diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3fb3fd7e7f..30fa5f916e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -10,4 +10,4 @@ assignees: '' - + diff --git a/.github/ISSUE_TEMPLATE/issue_report.md b/.github/ISSUE_TEMPLATE/issue_report.md index 9095acc8f3..6972478776 100644 --- a/.github/ISSUE_TEMPLATE/issue_report.md +++ b/.github/ISSUE_TEMPLATE/issue_report.md @@ -11,6 +11,7 @@ assignees: '' + **Minecraft Version:** {Minecraft version} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5fdf3fe6d6..ea7d5307b8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Publish on: push: - branches: [ '1.21.11' ] + branches: [ '26.2' ] permissions: contents: read diff --git a/.github/workflows/pull_request_review.yml b/.github/workflows/pull_request_review.yml index 7f44cbdb09..0bb812509c 100644 --- a/.github/workflows/pull_request_review.yml +++ b/.github/workflows/pull_request_review.yml @@ -7,7 +7,7 @@ jobs: name: Upload payload runs-on: ubuntu-latest steps: - - uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable + - uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable with: name: payload path: ${{ github.event_path }} \ No newline at end of file diff --git a/.github/workflows/pull_request_review_comment.yml b/.github/workflows/pull_request_review_comment.yml index 2c3e5bc54b..74233a353d 100644 --- a/.github/workflows/pull_request_review_comment.yml +++ b/.github/workflows/pull_request_review_comment.yml @@ -7,7 +7,7 @@ jobs: name: Upload payload runs-on: ubuntu-latest steps: - - uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable + - uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable with: name: payload path: ${{ github.event_path }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4ae87a4951..c134175e62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +#forgedev dev if the folder exists in here +forgedev + #eclipse **/bin **/.settings @@ -22,10 +25,12 @@ /*/build /*/.gradle +# Minecraft +/run +/*.launch + # Projects repo, either ignore it, or ignore patches. -/projects/mcp/ -/projects/clean/ -/projects/forge/ +src/minecraft #occupational hazards /projects/**/build/ @@ -33,6 +38,7 @@ /projects/**/run/ /projects/**/*.launch /repo/ +/rejects-*/ src/*/generated/**/.cache/ # Generated by gradle every import @@ -46,3 +52,9 @@ src/*/generated/**/.cache/ /*/.gitignore /*/.factorypath /*/.apt_generated/ +/fmlcore/logs/ +/lib/ +/_actual/ +/runs/ +/forge.ipr +/forge.iws diff --git a/CREDITS.txt b/CREDITS.txt deleted file mode 100644 index 6ec8f004bd..0000000000 --- a/CREDITS.txt +++ /dev/null @@ -1,65 +0,0 @@ -Minecraft Forge: Credits/Thank You - -Forge is a set of tools and modifications to the Minecraft base game code to assist -mod developers in creating new and exciting content. It has been in development for -several years now, but I would like to take this time thank a few people who have -helped it along its way. - -First, the people who originally created the Forge projects way back in Minecraft -alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance -of me taking over the project, who knows what Minecraft modding would be today. - -Secondly, someone who has worked with me, and developed some of the core features -that allow modding to be as functional, and as simple as it is, cpw. For developing -FML, which stabilized the client and server modding ecosystem. As well as the base -loading system that allows us to modify Minecraft's code as elegently as possible. - -Mezz, who has stepped up as the issue and pull request manager. Helping to keep me -sane as well as guiding the community into creating better additions to Forge. - -Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which -I am a part}. For creating some of the core tools needed to make Minecraft modding -both possible, and as stable as can be. - On that note, here is some specific information of the MCP data we use: - * Minecraft Coder Pack (MCP) * - Forge Mod Loader and Minecraft Forge have permission to distribute and automatically - download components of MCP and distribute MCP data files. This permission is not - transitive and others wishing to redistribute the Minecraft Forge source independently - should seek permission of MCP or remove the MCP data files and request their users - to download MCP separately. - -And lastly, the countless community members who have spent time submitting bug reports, -pull requests, and just helping out the community in general. Thank you. - ---LexManos - -========================================================================= - -This is Forge Mod Loader. - -You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml - -This minecraft mod is a clean open source implementation of a mod loader for minecraft servers -and minecraft clients. - -The code is authored by cpw. - -It began by partially implementing an API defined by the client side ModLoader, authored by Risugami. -https://www.minecraftforum.net/topic/75440- -This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader. - -It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge. -https://minecraftforge.net/ - -Additionally, it contains an implementation of topological sort based on that -published at http://keithschwarz.com/interesting/code/?dir=topological-sort - -It also contains code from the Maven project for performing versioned dependency -resolution. http://maven.apache.org/ - -It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/ -with credit to it's authors. - -Forge Mod Loader downloads components from the Minecraft Coder Pack -(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team. - diff --git a/LICENSE.txt b/LICENSE.txt index 249debe26b..51c22dd7db 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -3,7 +3,7 @@ parts herein are licensed under the terms of the LGPL 2.1 found here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and copied below. -Homepage: http://minecraftforge.net/ +Homepage: https://minecraftforge.net/ https://github.com/MinecraftForge/MinecraftForge diff --git a/build.gradle b/build.gradle index a49df84377..76f7de0ad6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,54 +1,795 @@ -import net.minecraftforge.forge.tasks.* -import net.minecraftforge.gradleutils.PomUtils +import org.apache.tools.ant.filters.ReplaceTokens plugins { - id 'net.minecraftforge.licenser' version '1.0.1' - id 'com.github.ben-manes.versions' version '0.46.0' - id 'net.minecraftforge.gradleutils' version '[2.6.4,2.7)' + id 'java-library' + id 'idea' id 'eclipse' - id 'de.undercouch.download' version '5.4.0' - id 'net.minecraftforge.gradle.patcher' version '[6.0.46,6.2)' apply false - id 'net.minecraftforge.gradle.mcp' version '[6.0.46,6.2)' apply false - id 'net.minecraftforge.gradlejarsigner' version '1.0.4' - id 'org.barfuin.gradle.taskinfo' version '2.1.0' + id 'maven-publish' + alias libs.plugins.licenser + alias libs.plugins.versions + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + alias libs.plugins.jarsigner + id 'net.minecraftforge.forgedev' + id 'net.minecraftforge.forge.build.convention' } -Util.init() //Init all our extension methods! +gradleutils.displayName = 'Forge' +group = 'net.minecraftforge' +description = 'Modifications to Minecraft to enable mod developers.' -ext { - VERSION = gitversion.getMCTagOffsetBranch(MC_VERSION) - FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1) +// NOTE: See settings.gradle for all the referenceable version variables. +// All subprojects (that apply 'net.minecraftforge.forge.build.convention') will have these available. +println "Version: $version" + +java.toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) + +jarSigner.autoDetect('forge') + +// We have to tell ForgeDev to use the exact versions of tools we ship in the installer +fdtools { + configure('binpatcher') { + version = buildLibs.binarypatcher.get().version + } + configure('installertools') { + version = buildLibs.installertools.get().version + } + configure('jarcompatibilitychecker') { + javaLauncher = javaToolchains.launcherFor(java.toolchain) + } } -changelog { - from '47.999' +/* This is used for debugging, comparing all published artifacts against actual production +forgedev.validatePublish { + task { + baseBranch = 'upstream/26.1.2' + versionPrefix = minecraftVersion + } +} +*/ + +final minecraftFiles = forgedev.minecraftFiles(minecraftVersion) + +final mcpBase = forgedev.mcpBase { + mcpVersion = "${minecraftVersion}-${project.ext.mcpVersion}" + accessTransformers.from file('src/main/resources/META-INF/accesstransformer.cfg') + sideAnnotationStrippers.from file('src/main/resources/forge.sas') +} + +forgedev.patches { + base = mcpBase + patches = file('patches/minecraft') + patched = file('src/minecraft/java') + sourceSets.main.java.srcDir patched } tasks.register('setup') { - dependsOn ':forge:extractMapped' - if (findProject(':clean')) - dependsOn ':clean:extractMapped' + dependsOn forgedev.patches.apply } -tasks.register('doChecks') { - dependsOn ':forge:checkJarCompatibility' - dependsOn ':forge:publish' -} - -project(':mcp') { - apply plugin: 'net.minecraftforge.gradle.mcp' - mcp { - config MC_VERSION + '-' + MCP_VERSION - pipeline = 'joined' +sourceSets { + named('main') { + resources.srcDir 'src/main/generated' + } + named('test') { + resources.srcDir 'src/test/generated' } } -if (System.env.TEAMCITY_VERSION) { - //Only setup the CI environment if and only if the environment variables are set. - tasks.named('configureTeamCity').configure { - doLast { - println "##teamcity[buildNumber '${project(':forge').version}']" - println "##teamcity[setParameter name='env.PUBLISHED_JAVA_ARTIFACT_VERSION' value='${project(':forge').version}']" +license { + header = file('LICENSE-header.txt') + + include 'net/minecraftforge/' + exclude 'net/minecraftforge/common/LenientUnboundedMapCodec.java' + + tasks.tap { + register('main') { + files.from files('src/main/java') + } + + register('test') { + files.from files('src/test/java') } } } + +changelog { + from changelogBase + publishAll = false +} + +// TODO [ForgeDev] Support compileOnlyApi, runtimeOnly, and a consumable annotation processor configuration +configurations { + // Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it. + register('bootstrap') { + transitive = false + canBeDeclared = true + canBeResolved = true + } + + register('installer') { + transitive = false + canBeDeclared = true + canBeResolved = true + extendsFrom(bootstrap) + } + + named('api') { + extendsFrom(installer) + } + + named('implementation') { + // Inherit vanilla Minecraft's dependencies + extendsFrom(mcpBase.dependencyConfiguration) + } +} + +dependencies { + // These need to actually be on the classpath at the start. This is only used for the server shim jar. + // And this is only needed because custom file systems are REQUIRED to be on the boot classloader. + // This has ASM/BootStrap/Unsafe all because I haven't gotten around to moving UnionFileSystem out to its own project. + bootstrap libs.jarjar.fs // JarInJar file system + bootstrap libs.roimfs // JarInJar File System - FileSystems need to be on boot loader. + bootstrap libs.bundles.jimfs // In memory file system used for ForgeDev launches + bootstrap libs.securemodules // Has Union file system in it + bootstrap libs.unsafe // Needed by securemodules + bootstrap libs.bundles.asm // Needed by securemodules + + implementation libs.jopt.simple + + installer libs.bootstrap + installer libs.bootstrap.api // Needed by securemodules + installer libs.accesstransformers + installer libs.eventbus + installer libs.jspecify // Dep of EventBus + installer libs.forgespi + installer libs.coremods.api + installer libs.modlauncher + installer libs.mergetool.api + installer libs.bundles.night.config + installer libs.maven.artifact + installer libs.bundles.terminalconsoleappender + installer libs.mixin + installer libs.mixinextras.forge + installer libs.bundles.jarjar + installer libs.roimfs + + installer projects.fmlcore + installer projects.fmlloader + installer projects.fmlearlydisplay + installer projects.javafmllanguage + installer projects.lowcodelanguage + installer projects.mclanguage + installer projects.forgeTransformers + + runtimeOnly files(mcpBase.extra) + + runtimeOnly libs.bootstrap + runtimeOnly libs.bootstrap.dev + + annotationProcessor libs.eventbus.validator +} + +final EXTRA_TXTS = [ + file('LICENSE.txt'), + changelog.task.flatMap(task -> task.outputFile) +] +forgedev.runs { + configureEach { + options { + workingDir = layout.projectDirectory.dir("runs/$name") + + mainClass = 'net.minecraftforge.bootstrap.ForgeBootstrap' + args '--gameDir', '.' + jvmArgs '-Djava.net.preferIPv6Addresses=system', '-XX:+UseCompactObjectHeaders' + + systemProperty 'bsl.debug', 'true' + systemProperty 'terminal.jline', 'true' + with(sourceSets.test) { + systemProperty 'forge.enableGameTest', 'true' + systemProperty 'forgedev.enableTestMods', 'true' + } + } + } + + create('client') { + options { + systemProperty 'eventbus.api.strictRuntimeChecks', 'true' + systemProperty 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll' + + args '--launchTarget', 'forge_dev_client', + '--username', 'Dev', + '--version', project.name, + '--accessToken', '0', + '--userType', 'mojang', + '--versionType', 'release', + '--assetsDir', '{assets_root}', + '--assetIndex', '{asset_index}' + } + } + + create('server') { + options { + args '--launchTarget', 'forge_dev_server' + } + } + + create('gameTestServer') { + options { + args '--launchTarget', 'forge_dev_server_gametest' + args '--uniqueWorld' // Unique world is used so that the world regenerates, as well as the world config isn't influenced by other runs + } + } + + create('data') { + options { + args '--launchTarget', 'forge_dev_data', + '--all', + '--existing', sourceSets.main.resources.srcDirs[0], + '--assetsDir', '{assets_root}', + '--assetIndex', '{asset_index}' + + with(sourceSets.main) { + args '--mod', 'forge', + '--output', rootProject.file('src/main/generated/') + } + + with(sourceSets.test) { + args '--mod', '.+', + '--existing', sourceSets.test.resources.srcDirs[0], + '--output', rootProject.file('src/test/generated/') + } + } + } + + create('clientData') { + options { + args '--all', + '--existing', sourceSets.main.resources.srcDirs[0], + '--assetsDir', '{assets_root}', + '--assetIndex', '{asset_index}' + + with(sourceSets.main) { + args '--launchTarget', 'forge_dev_client_data', + '--mod', 'forge', + '--output', rootProject.file('src/main/generated/'), + '--mod', 'forge' + } + + with(sourceSets.test) { + args '--launchTarget', 'forge_dev', + '--launchEntry', 'minecraft/net.minecraft.client.data.Main', + '--launchData', + '--mod', '.+', + '--existing', sourceSets.test.resources.srcDirs[0], + '--output', rootProject.file('src/test/generated/') + } + } + } +} +tasks.register('genAllData') { + dependsOn forgedev.runs.data.run, forgedev.runs.data.runTest, forgedev.runs.clientData.run, forgedev.runs.clientData.runTest +} + +final serverShim = forgedev.shim { + config { + mainClass = 'net.minecraftforge.bootstrap.ForgeBootstrap' + args = ['--launchTarget', 'forge_server'] + } + classpath { + libraries configurations.installer + library tasks.named('universalJar', Jar) + library forgedev.binaryPatches('server').apply, 'server' + serverBundle.fileProvider(minecraftFiles.server) + } + bootstrapClasspath(configurations.bootstrap) + jar { + jarSigner.sign(it) + } +} + +final finalizeSpawn = forgedev.methodCallFinder('findFinalizeSpawnTargets') { + jar.fileProvider(mcpBase.classes) + output = rootProject.file('forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json') + blacklist 'net/minecraft/world/level/BaseSpawner' // Ignore this class as we special case it. + invokeVirtual('finalizeSpawn', '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;') +} + +forgedev.validateDeprecations(tasks.named('jar', Jar)) { + mcVersion = minecraftVersion +} + +forgedev.checks() { + base = mcpBase + ats {} + sas {} + execs {} + + patches { + dependsOn forgedev.patches.make + patchDir = forgedev.patches.patches + patchesWithS2SArtifact = [ + 'minecraft/net/minecraft/client/renderer/ViewArea.java.patch', + 'minecraft/net/minecraft/data/models/blockstates/Variant.java.patch', + ] + } + + fix { + dependsOn finalizeSpawn + } + + forgedev.patches.make.configure { + finalizedBy forgedev.checks.patches.fix + } +} + +final crowdin = forgedev.crowdin // Create the crowdin tasks +tasks.named('jar', Jar) { + from(EXTRA_TXTS) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + exclude '.cache' + + from(zipTree(crowdin.flatMap { it.output } )) { + include 'assets/forge/lang/*.json' + } + + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.forge' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : gradleutils.vendor.get(), + 'Specification-Version' : gitversion.info.tag, + 'Implementation-Title' : project.group, + 'Implementation-Vendor' : gradleutils.vendor.get(), + 'Implementation-Version': forgeVersion + ], 'net/minecraftforge/versions/forge/') + attributes([ + 'Specification-Title' : 'Minecraft', + 'Specification-Vendor' : gradleutils.vendor.get(), + 'Specification-Version' : minecraftVersion, + 'Implementation-Title' : 'MCP', + 'Implementation-Vendor' : gradleutils.vendor.get(), + 'Implementation-Version': mcpVersion + ], 'net/minecraftforge/versions/mcp/') + } + jarSigner.sign(it) +} + +final universalJar = tasks.register('universalJar', Jar) { + from (zipTree(tasks.named('jar', Jar).flatMap { it.archiveFile } )) { + exclude(forgedev.filterVanilla(mcpBase.classes)) + } + manifest = tasks.named('jar', Jar).get().manifest + archiveClassifier = 'universal' + jarSigner.sign(it) +} + +final sourcesJarAll = tasks.register('sourcesJarAll', Jar) { + archiveClassifier = 'sources-all' + from(sourceSets.main.allJava.srcDirs) +} + +// Our sources, plus the patches we do to Vanilla Minecraft +final sourcesJar = tasks.register('sourcesJar', Jar) { + archiveClassifier = 'sources' + from(sourceSets.main.allJava.srcDirs - forgedev.patches.patched.asFile.get()) + mustRunAfter(forgedev.patches.make) + from(forgedev.patches.patches) { + into 'patches/' + } +} + +forgedev.userDev { + base(mcpBase) + + config { + universal universalJar + sources sourcesJar + addLibraries(configurations.installer) + // TODO [ForgeDev][UserDev] Split API/Runtime elements in userdev config + // so we don't gotta keep making exceptions for MixinExtras + addCompileDependency(libs.mixinextras.common) + addAnnotationProcessorDependency(libs.mixinextras.common) + + // TODO [ForgeDev] Consolidate Patcher + UserDev Config runs in a sane way + runs { + configureEach { + parents = [] + main = 'net.minecraftforge.bootstrap.ForgeBootstrap' + args '--gameDir', '.' + jvmArgs '-Djava.net.preferIPv6Addresses=system', '-XX:+UseCompactObjectHeaders' + client = it.name.containsIgnoreCase('client') + environment 'MCP_MAPPINGS', '{mcp_mappings}' + } + + register('clientData') { + args '--launchTarget', "forge_userdev_client_data" + args '--assetIndex', '{asset_index}' + args '--assetsDir', '{assets_root}' + } + + register('client') { + property 'forge.enableGameTest', 'true' + args '--launchTarget', "forge_userdev_client" + args '--version', 'MOD_DEV' + args '--assetIndex', '{asset_index}' + args '--assetsDir', '{assets_root}' + } + + register('server') { + property 'forge.enableGameTest', 'true' + args '--launchTarget', "forge_userdev_server" + } + + register('gameTestServer') { + args '--launchTarget', "forge_userdev_server_gametest" + } + + register('data') { + args '--launchTarget', "forge_userdev_data" + args '--assetIndex', '{asset_index}' + args '--assetsDir', '{assets_root}' + } + } + } + patches { + modified.setFrom(sourcesJarAll.flatMap { it.archiveFile }) + } + binaryPatches { + mustRunAfter(forgedev.patches.make) + patches.setFrom(forgedev.patches.patches) + dirty.setFrom(tasks.named('jar', Jar).flatMap { it.archiveFile }) + } +} + +forgedev.userdevCompatibility(minecraftVersion) { + clean = mcpBase.classes + dirty = tasks.named('jar', Jar) +} + +// region Installer tasks, Not needed when we simplify the installer/remove obf +final clientBinPatches = forgedev.binaryPatches('client') { + clean = minecraftFiles.client + // Workaround for 3rd party launcher issues, marker needed to locate MC, store needed to fix zlib-ng issues + apply { + store = true + marker = '.forge_patched_minecraft' + } +} +final serverBinPatches = forgedev.binaryPatches('server') { + clean = minecraftFiles.serverExtracted + apply { store = true } +} +// endregion + +forgedev.installer { + dev = !forgedev.ci + offline = false + baseVersion = buildLibs.installer.get().version.toString() + + // Add extra libraries + pack serverShim.jar // The Server executable jar IS needed to be packed, as the installer would need a spec bump in order to download it + pack universalJar // I don't think this is strictly needed to be packed anymore, will need to double check later + + launcherLibrary universalJar + // We configure the launcher here to keep the order for easier diff, after publishing, move this to the LauncherJson configuration below + launcherJson { + // We create this during install, so it's not downloadable + generated(clientBinPatches.apply, 'client') + } + + launcherLibraries configurations.installer + + final launcherId = "${minecraftVersion}-${project.name}-${forgeVersion}" + final installertools = tool(buildLibs.installertools) + final binarypatcher = tool(buildLibs.binarypatcher) + + jar { + from(EXTRA_TXTS) + from(rootProject.file('/forge_installer_logo.png')) { + rename { 'big_logo.png' } + } + from(clientBinPatches.create.flatMap { t -> t.output }) { + rename { 'data/client.lzma' } + } + from(serverBinPatches.create.flatMap { t -> t.output }) { + rename { 'data/server.lzma' } + } + + final argsFile = rootProject.file('server_files/args.txt') + final tokens = [tokens: [ + SHIM_JAR_FILE: serverShim.jar.get().archiveFileName.get(), + MAVEN_PATH: forgedev.mavenArtifact.directory + ]] + from(argsFile) { + filter(tokens, ReplaceTokens) + into 'data' + rename { 'unix_args.txt' } + } + from(argsFile) { + filter(tokens, ReplaceTokens) + into 'data' + rename { 'win_args.txt' } + } + + from(rootProject.file('server_files')) { + filter(tokens, ReplaceTokens) + into 'data' + exclude 'args.txt' + } + + jarSigner.sign(it) + } + json { + icon = rootProject.file('icon.ico') + executable serverShim.jar + minecraft = minecraftVersion + profileVersion = launcherId + + final projectArtifact = "${project.group}:${project.name}:${project.version}" + + data 'MC_UNPACKED', "[net.minecraft:client:${minecraftVersion}]", "[net.minecraft:server:${minecraftVersion}:unpacked]" + data 'MC_UNPACKED_SHA', minecraftFiles.client, minecraftFiles.serverExtracted + + data 'BINPATCH', '/data/client.lzma', '/data/server.lzma' + data 'PATCHED', "[$projectArtifact:client]", "[$projectArtifact:server]" + data 'PATCHED_SHA', clientBinPatches.apply.flatMap { it.output }, serverBinPatches.apply.flatMap { it.output } + + steps = [ + extract(installertools) { + side = 'server' + archive '{INSTALLER}' + extract 'data/README.txt', '{ROOT}/README.txt' + extract 'data/run.sh', '{ROOT}/run.sh' + executable '{ROOT}/run.sh' + extract 'data/run.bat', '{ROOT}/run.bat' + optional 'data/user_jvm_args.txt', '{ROOT}/user_jvm_args.txt' + extract 'data/unix_args.txt', "{ROOT}/libraries/${forgedev.mavenArtifact.directory}/unix_args.txt" + extract 'data/win_args.txt', "{ROOT}/libraries/${forgedev.mavenArtifact.directory}/win_args.txt" + }, + extractBundle(installertools) { + side = 'server' + libraries() + }, + extractBundle(installertools) { + side = 'server' + jar '{MINECRAFT_JAR}', '{MC_UNPACKED}' + cache '{MC_UNPACKED}', '{MC_UNPACKED_SHA}' + }, + step(binarypatcher) { + side = 'server' + args = [ + '--clean', '{MC_UNPACKED}', + '--output', '{PATCHED}', + '--apply', '{BINPATCH}', + '--data', '--unpatched', + '--store' + ] + cache '{PATCHED}', '{PATCHED_SHA}' + }, + step(binarypatcher) { + side = 'client' + args = [ + '--clean', '{MINECRAFT_JAR}', + '--output', '{PATCHED}', + '--apply', '{BINPATCH}', + '--data', '--unpatched', + '--store', + '--marker', '.forge_patched_minecraft' + ] + cache '{PATCHED}', '{PATCHED_SHA}' + } + ] + } + + launcherJson { + // These are flags to preserve glitchy old behavior to make diffing easier, removing when migrating to production is recommended + sortLibraries = false // Don't sort, makes things non-deterministic, but easier to diff old versions + duplicateLibraries = true // Our 'bootstrap' layer go added twice + librariesLast = false // Makes libraries be added before args + + id = launcherId + inheritsFrom = minecraftVersion + mainClass = 'net.minecraftforge.bootstrap.ForgeBootstrap' + gameArgs = [ '--launchTarget', 'forge_client' ] + jvmArgs = [ '-Djava.net.preferIPv6Addresses=system', '-XX:+UseCompactObjectHeaders' ] + } +} + +final mdkGradleWrapper = tasks.register('mdkGradleWrapper', Wrapper) { + gradleVersion = '9.5.0' + scriptFile = layout.buildDirectory.dir("wrapper/" + gradleVersion + "/gradlew") + jarFile = layout.buildDirectory.dir("wrapper/" + gradleVersion + "/gradle/wrapper/gradle-wrapper.jar") +} + +final mdkZip = tasks.register('mdkZip', Zip) { + dependsOn mdkGradleWrapper + + archiveBaseName = project.name + archiveClassifier = 'mdk' + archiveVersion = project.version + destinationDirectory = file('build/libs') + from(EXTRA_TXTS) + + from mdkGradleWrapper.map(Wrapper.&getScriptFile) + from mdkGradleWrapper.map(Wrapper.&getBatchScript) + into('gradle/wrapper/') { + from mdkGradleWrapper.map(Wrapper.&getJarFile) + from mdkGradleWrapper.map(Wrapper.&getPropertiesFile) + } + from(rootProject.file('mdk/')){ + rootProject.file('mdk/gitignore.txt').eachLine { + if (!it.trim().isEmpty() && !it.trim().startsWith('#')) + exclude it + } + filter(ReplaceTokens, tokens: [ + FORGE_VERSION: forgeVersion, + FORGE_GROUP: project.group, + FORGE_NAME: project.name, + MC_VERSION: minecraftVersion, + FORGE_SPEC_VERSION: gitversion.info.tag.split("\\.")[0], + MC_NEXT_VERSION: minecraftNextVersion, + EVENTBUS_VERSION: libs.versions.eventbus.get() + ]) + rename 'gitignore\\.txt', '.gitignore' + rename 'gitattributes\\.txt', '.gitattributes' + } + from(rootProject.file('src/test/java/com/example/examplemod/')) { + into('src/main/java/com/example/examplemod/') + } + from(rootProject.file('src/test/generated/mdk_datagen/')) { + into('src/main/resources/') + exclude '**/.cache/' + } +} + +/* +tasks.named('javadoc', Javadoc) { + description = 'Generates the combined javadocs for the FML projects and the main Forge project' + var includedProjects = [ ':fmlcore', ':fmlloader', ':javafmllanguage', ':mclanguage', ':forge-transformers' ] + source includedProjects.collect { project(it).sourceSets.main.allJava } + classpath = classpath + files(includedProjects.collect { project(it).sourceSets.main.compileClasspath }) + + var docsDir = rootProject.file('src/docs/') + inputs.dir(docsDir) + .withPropertyName('docs resources directory') + .withPathSensitivity(PathSensitivity.RELATIVE) + .optional() + + failOnError = false + + // Exclude the Minecraft classes if not enabled + if (!project.hasProperty('generateAllDocumentation')) { + exclude 'net/minecraft/**' + exclude 'com/mojang/**' + } + exclude 'mcp/**' + + options { + stylesheetFile = new File(docsDir, 'stylesheet.css') + + tags = [ + 'apiNote:a:API Note:', + 'implSpec:a:Implementation Requirements:', + 'implNote:a:Implementation Note:' + ] + + groups = [ + 'Forge Mod Loader': [ + 'net.minecraftforge.fml.common.asm*', + 'net.minecraftforge.fml.loading*', + 'net.minecraftforge.fml.server*' + ], + 'FML Core': [ + 'net.minecraftforge.fml', + 'net.minecraftforge.fml.config*', + 'net.minecraftforge.fml.event*', + 'net.minecraftforge.fml.util*' + ], + 'FML Common': [ + 'net.minecraftforge.fml.core', + 'net.minecraftforge.fml.event.config', + 'net.minecraftforge.fml.event.lifecycle' + ], + 'FML Java/MC Language Providers': [ + 'net.minecraftforge.fml.common', + 'net.minecraftforge.fml.javafmlmod', + 'net.minecraftforge.fml.mclanguageprovider' + ], + 'Minecraft Forge API': [ + 'net.minecraftforge*' + ] + ] + + author = false + noSince = true + noHelp = true + + bottom = "Minecraft Forge is an open source modding API for Minecraft: Java Edition, licensed under the Lesser GNU General Public License, version 2.1." + windowTitle = "Minecraft Forge API ${version}" + docTitle = "Minecraft Forge API - ${forgeVersion} for Minecraft ${minecraftVersion}" + header = "
${forgeVersion} for Minecraft ${minecraftVersion}
" + } + + doLast { + project.copy { + from docsDir + exclude '/stylesheet.css' + into destinationDir + } + } +} +*/ + +publishing { + repositories { + maven gradleutils.publishingForgeMaven + } + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + artifact universalJar + artifact forgedev.installer.jar + artifact mdkZip + artifact forgedev.userDev.jar + artifact sourcesJar + artifact serverShim.jar + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } +} + + +/* +// These are debugging tasks that are only used when developing ForgeDevPlugin, to bulk test task's config/caching +// region ForgeDev Tests +def all = tasks.register('all') {} +afterEvaluate { + if (gradle.startParameter.taskNames.contains('all')) { + tasks.forEach { task -> // This forces everything to be realized, which is why we have the startParameter check + if (!gradle.startParameter.isTaskGraph() && task.name.startsWith('run')) return + if (task.name in [all.name, 'dependencyInsight', 'dependencies', 'dependencyUpdates', 'init', 'buildEnvironment', 'idea', + 'eclipse', 'javaToolchains', 'outgoingVariants', 'projects', 'properties', 'resolvableConfigurations', 'tasks', 'updateDaemonJvm', + 'generateActionsWorkflow' + ]) return + if (task.name.startsWith('clean')) return + if (task.name == 'checkJarCompatibility') return // This doesn't work in FG6 dev, I think it's cuz we check vs srg names. Will need to look at later + all.configure { dependsOn(task) } + } + } +} +*/ +// endregion +// We dont have any unit tests, so disable this error +tasks.withType(AbstractTestTask).configureEach { + failOnNoDiscoveredTests = false +} +// This shouldn't be needed according to the Gradle devs, as we never run these commands together. +// But in another case of Gradle being gradle, here we are +[ 'makePatches', 'compileJava', 'checkLicenseMain', 'updateLicenseMain', 'sourcesJar', 'sourcesJarAll' ] + .each{ tasks.named(it).configure{ mustRunAfter forgedev.patches.apply }} +forgedev.runs.configureEach { + run.configure { dependsOn finalizeSpawn} + runTest.configure { dependsOn finalizeSpawn} +} +// run gradlew dependencyUpdates --no-parallel +//noinspection UnnecessaryQualifiedReference +tasks.named('dependencyUpdates', com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask) { + resolutionStrategy { + mcpBase.dependencies.get().forEach {dep -> force(dep) } // Force all vanilla dependencies to their correct versions + force(earlyDisplayLibs.slf4j.jdk14) // Force slf4j implementation, its tied to the api from the manifest + } +} \ No newline at end of file diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore deleted file mode 100644 index 2979d33310..0000000000 --- a/buildSrc/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/.gradle/ -/build/ -/out/ diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 0f87c9c66b..0000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -repositories { - maven { url = 'https://maven.minecraftforge.net/' } - mavenCentral() -} - -dependencies { - implementation 'org.ow2.asm:asm:9.8' - implementation 'org.ow2.asm:asm-tree:9.8' - implementation 'net.minecraftforge:srgutils:0.5.10' - implementation 'net.minecraftforge:JarJarMetadata:0.3.27' - implementation 'commons-io:commons-io:2.13.0' - implementation 'com.google.code.gson:gson:2.10.1' - implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r' -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BundleList.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BundleList.groovy deleted file mode 100644 index 427efb330b..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BundleList.groovy +++ /dev/null @@ -1,72 +0,0 @@ -package net.minecraftforge.forge.tasks - -import org.gradle.api.tasks.* -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.bundling.AbstractArchiveTask - -import java.util.zip.ZipFile - -abstract class BundleList extends DefaultTask { - @InputFiles abstract ConfigurableFileCollection getConfig() - @InputFiles abstract ConfigurableFileCollection getConfigExtra() - @InputFile abstract RegularFileProperty getServerBundle() - @OutputFile abstract RegularFileProperty getOutput() - - BundleList() { - config.setFrom(project.configurations.installer) - configExtra.setFrom(project.configurations.installerextra) - output.convention(project.layout.buildDirectory.file("$name/output.list")) - configure { - dependsOn(project.tasks.universalJar) - inputs.file(project.tasks.universalJar.archiveFile) - dependsOn(project.tasks.applyServerBinPatches) - inputs.file(project.tasks.applyServerBinPatches.output) - } - } - - @TaskAction - void run() { - def entries = [:] as TreeMap - def resolved = project.configurations.installer.resolvedConfiguration.resolvedArtifacts - for (def dep : resolved) { - def info = Util.getMavenInfoFromDep(dep) - //println("$dep.file.sha1\t$info.name\t$info.path") - entries.put("$info.art.group:$info.art.name", "$dep.file.sha256\t$info.name\t$info.path") - } - - resolved = project.configurations.installerextra.resolvedConfiguration.resolvedArtifacts - for (def dep : resolved) { - def info = Util.getMavenInfoFromDep(dep) - //println("$dep.file.sha1\t$info.name\t$info.path") - entries.put("$info.art.group:$info.art.name", "$dep.file.sha256\t$info.name\t$info.path") - } - - var packed = (AbstractArchiveTask) project.tasks.universalJar - var info = Util.getMavenInfoFromTask(packed) - def file = packed.archiveFile.get().asFile - entries.put("$info.art.group:$info.art.name:$info.art.classifier", "$file.sha256\t$info.name\t$info.path") - - var classifier = 'server' - var genned = project.tasks.applyServerBinPatches - info = Util.getMavenInfoFromTask(genned, classifier) - file = genned.output.get().asFile - entries.put("$info.art.group:$info.art.name:$info.art.classifier", "$file.sha256\t$info.name\t$info.path") - - try (def zip = new ZipFile(serverBundle.get().asFile)) { - def entry = zip.getEntry('META-INF/libraries.list') - def data = zip.getInputStream(entry).text.split('\n') - for (def line : data) { - def (sha, artifact, path) = line.split('\t') - def (group, name, other) = artifact.split(':', 3) - //println("Group: $group Name: $name") - def key = "$group:$name" - if (!entries.containsKey(key)) - entries.put(key, line) - } - } - - output.get().asFile.text = entries.values().join('\n') - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy deleted file mode 100644 index 8f8271f490..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy +++ /dev/null @@ -1,52 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.json.JsonBuilder -import groovy.transform.CompileStatic -import org.gradle.api.DefaultTask -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.Internal -import org.gradle.api.tasks.TaskAction -import org.objectweb.asm.tree.ClassNode -import org.objectweb.asm.tree.FieldNode -import org.objectweb.asm.tree.MethodNode - -@CompileStatic -abstract class BytecodeFinder extends DefaultTask { - @InputFile abstract RegularFileProperty getJar() - // 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") }) - } - - @TaskAction - protected void exec() { - Util.init() - - var outputFile = output.get().asFile - if (outputFile.exists()) - outputFile.delete() - - pre() - - Util.processClassNodes(jar.get().asFile, this.&process) - - post() - outputFile.text = new JsonBuilder(getData()).toPrettyString() - } - - - protected process(ClassNode node) { - if (node.fields !== null) node.fields.each { process(node, it) } - if (node.methods !== null) node.methods.each { process(node, it) } - } - - protected pre() {} - protected process(ClassNode parent, FieldNode node) {} - protected process(ClassNode parent, MethodNode node) {} - protected post() {} - protected abstract Object getData() -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodePredicateFinder.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodePredicateFinder.groovy deleted file mode 100644 index b0efa482cc..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodePredicateFinder.groovy +++ /dev/null @@ -1,48 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.CompileStatic -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Internal -import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.ClassNode -import org.objectweb.asm.tree.MethodNode - -@CompileStatic -abstract class BytecodePredicateFinder extends BytecodeFinder { - - @Internal - abstract Property> getPredicate() - - private final Map> matches = new TreeMap<>(Comparator.naturalOrder()) - - @Override - protected process(ClassNode parent, MethodNode node) { - for (final current : node.instructions) { - if (predicate.get().call(parent, node, current)) { - var methods = matches.compute(parent.name, { k, v -> v ?: new ArrayList<>() }) - - // only add non-synthetic methods - if ((node.access & Opcodes.ACC_SYNTHETIC) == 0) { - methods.add(node.name + node.desc) - } - - return - } - } - } - - @Internal - @Override - protected Object getData() { - var array = new ArrayList() - matches.forEach { c, m -> - { - array.add( - 'class': c, - 'methods': m - ) - } - } - return array ?: { throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.') }() - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/CleanProperties.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/CleanProperties.groovy deleted file mode 100644 index 676ac30300..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/CleanProperties.groovy +++ /dev/null @@ -1,97 +0,0 @@ -package net.minecraftforge.forge.tasks; - -import groovy.transform.CompileDynamic; -import groovy.transform.CompileStatic; - -import java.util.Properties; -import java.util.Enumeration; -import java.util.Map; -import java.util.TreeSet; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.Reader; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Set; - -/** - * Eclipse config files are literally just java properties, with the header cleaned up. - * https://github.com/eclipse/buildship/blob/5b2c7fca7fa86cd74d71b3c099c7b1559eba038e/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/configuration/PreferenceStore.java#L238 - * - * This does the same thing, as well as sorting alphabetically. - * It also ignores all comments. We can add them latter if someone cares. - */ -@CompileStatic -public class CleanProperties extends Properties { - private static final long serialVersionUID = 1L; - private static final String LINE_SEP = System.getProperty("line.separator"); - private static final String UNIX_LINE_SEP = "\n"; - private static final Charset ENCODING = StandardCharsets.UTF_8; - - public CleanProperties load(File input) throws IOException { - if (input.exists()) { - try (Reader is = new InputStreamReader(new FileInputStream(input), ENCODING)) { - super.load(is); - } - } - return this; - } - - public void store(File out) throws IOException { - if (!out.getParentFile().exists()) - out.getParentFile().mkdirs(); - - try (OutputStream os = new FileOutputStream(out)) { - store(os, null); - } - } - - @Override - public synchronized Enumeration keys() { - Set ret = new TreeSet<>(); - for (Enumeration e = super.keys(); e.hasMoreElements();) - ret.add(e.nextElement()); - return Collections.enumeration(ret); - } - - @CompileDynamic - @Override - public Set> entrySet() { - Set> ret = new TreeSet<>((l, r) -> ((String)l.getKey()).compareTo((String)r.getKey())); - ret.addAll(super.entrySet()); - return ret; - } - - @Override - public void store(OutputStream out, String comments) throws IOException { - out.write(clean().getBytes(ENCODING)); - out.flush(); - } - - @Override - public void store(Writer out, String comments) throws IOException { - out.write(clean()); - out.flush(); - } - - private String clean() throws IOException { - ByteArrayOutputStream tmp = new ByteArrayOutputStream(); - try { - super.store(tmp, null); - } finally { - tmp.close(); - } - - String ret = tmp.toString(ENCODING).replace(LINE_SEP, UNIX_LINE_SEP); - ret = ret.substring(ret.indexOf(UNIX_LINE_SEP) + 1); - return ret; - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ClosureHelper.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ClosureHelper.groovy deleted file mode 100644 index 348ca2cfe2..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ClosureHelper.groovy +++ /dev/null @@ -1,33 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.stc.FirstParam - -import java.util.function.BiConsumer - -public class ClosureHelper { - BiConsumer callback - - public ClosureHelper(Closure cl, BiConsumer callback) { - this.callback = callback - apply(this, cl) - } - - - def methodMissing(String name, Object args) { - if (!args.class.isArray()) return - Object[] aargs = (Object[])args - - if (aargs.length == 1 && aargs[0] instanceof Closure) { - this.callback.accept(name, (Closure)aargs[0]) - } else { - throw new IllegalArgumentException('Unknown method: "' + name + '" with arguments ' + args + ' for ' + this) - } - } - - static T apply(T obj, @DelegatesTo(value = FirstParam, strategy = Closure.DELEGATE_FIRST) Closure cl) { - cl.delegate = obj - cl.resolveStrategy = Closure.DELEGATE_FIRST - cl() - return obj - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DownloadLibraries.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DownloadLibraries.groovy deleted file mode 100644 index c3f98258ff..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DownloadLibraries.groovy +++ /dev/null @@ -1,54 +0,0 @@ -package net.minecraftforge.forge.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.Internal -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.OutputFiles -import org.gradle.api.tasks.TaskAction -import org.gradle.api.tasks.OutputDirectory - -import java.nio.file.Files - -abstract class DownloadLibraries extends DefaultTask { - @InputFile abstract RegularFileProperty getInput() - @OutputDirectory abstract DirectoryProperty getOutput() - @OutputFile abstract RegularFileProperty getLibrariesOutput() - - DownloadLibraries() { - output.convention(project.layout.buildDirectory.dir(name)) - librariesOutput.convention(project.layout.buildDirectory.dir(name).map(d -> d.file('libraries.txt'))) - } - - @TaskAction - def run() { - Util.init() - File outputDir = output.get().asFile - var libraries = new ArrayList() - - def json = input.get().asFile.json().libraries.each { lib -> - //TODO: Thread? - def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values() - artifacts.each{ art -> - def target = new File(outputDir, art.path) - libraries.add(target.absolutePath) - if (!target.exists() || art.sha1 != target.sha1()) { - project.logger.lifecycle("Downloading ${art.url}") - if (!target.parentFile.exists()) { - target.parentFile.mkdirs() - } - new URL(art.url).withInputStream { i -> - target.withOutputStream { it << i } - } - if (art.sha1 != target.sha1()) { - throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch") - } - } - } - } - Files.write(librariesOutput.get().asFile.toPath(), libraries) - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ExtractFile.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ExtractFile.groovy deleted file mode 100644 index 727c3258e0..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ExtractFile.groovy +++ /dev/null @@ -1,28 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.CompileStatic -import org.gradle.api.DefaultTask -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.* - -import java.util.zip.ZipFile - -@CompileStatic -abstract class ExtractFile extends DefaultTask { - @InputFile abstract RegularFileProperty getInput() - @Input abstract Property getTarget() - @OutputFile abstract RegularFileProperty getOutput() - - @TaskAction - protected void exec() { - var zip = new ZipFile(input.get().asFile); - var entry = zip.getEntry(target.get()) - if (entry == null) - throw new IllegalStateException(input.get().asFile.absolutePath + " does not contain " + target.get()) - var stream = zip.getInputStream(entry) - output.get().asFile.withOutputStream { out -> - stream.transferTo(out) - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FieldCompareFinder.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FieldCompareFinder.groovy deleted file mode 100644 index ec0deac865..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FieldCompareFinder.groovy +++ /dev/null @@ -1,101 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.CompileStatic -import groovy.transform.EqualsAndHashCode - -import org.gradle.api.tasks.* -import org.objectweb.asm.tree.AbstractInsnNode -import org.objectweb.asm.tree.ClassNode -import org.objectweb.asm.tree.MethodNode - -import static org.objectweb.asm.Opcodes.* - -abstract class FieldCompareFinder extends BytecodeFinder { - @Nested - Map fields = [:] as HashMap - @Internal - Map fieldsReverse = [:] as HashMap - @Internal - Map> targets = [:] as TreeMap - - @Override - protected pre() { - //fields.each{ k,v -> logger.lifecycle("Fields: " + k + ' ' + v) } - } - - @Override - protected process(ClassNode parent, MethodNode node) { - AbstractInsnNode last = null - def parentInstance = new ObjectTarget(owner: parent.name, name: '', desc: '') - for (int x = 0; x < node.instructions.size(); x++) { - def current = node.instructions.get(x) - if (current.opcode === IF_ACMPEQ || current.opcode === IF_ACMPNE) { - if (last !== null && (last.opcode === GETSTATIC || last.opcode === GETFIELD)) { - def target = new Search(cls: last.owner, name: last.name) - def wanted = fieldsReverse.get(target) - def original = fields.get(wanted) - def instance = new ObjectTarget(owner: parent.name, name: node.name, desc: node.desc) - if (wanted !== null && (original.blacklist === null || (!original.blacklist.contains(instance) && !original.blacklist.contains(parentInstance)))) { - targets.computeIfAbsent(wanted, { k -> new TreeSet() }).add(instance) - } - } - } - last = current - } - } - - @Internal - @Override - protected Object getData() { - def ret = [:] as HashMap - targets.forEach{ k, v -> - def e = fields.get(k) - ret[k] = [ - cls: e.cls, - name: e.name, - replacement: e.replacement, - targets: v - ] - } - return ret - } - - @CompileStatic - @EqualsAndHashCode(excludes = ['replacement', 'blacklist']) - static class Search { - @Input - String cls - - @Input - String name - - @Input - String replacement - - @Nested - @Optional - Set blacklist - - @Override - String toString() { - return cls + '.' + name - } - - def blacklist(String owner, String name, String desc) { - if (blacklist === null) - blacklist = new HashSet<>() - blacklist.add(new ObjectTarget(owner: owner, name: name, desc: desc)) - } - def blacklist(String owner) { - blacklist(owner, '', '') - } - } - - void fields(Closure cl) { - new ClosureHelper(cl, {name, ccl -> - def search = ClosureHelper.apply(new Search(), ccl) - this.fields.put(name, search) - this.fieldsReverse.put(search, name) - }) - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InheritanceData.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InheritanceData.groovy deleted file mode 100644 index 546aec2018..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InheritanceData.groovy +++ /dev/null @@ -1,49 +0,0 @@ -package net.minecraftforge.forge.tasks - -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import groovy.transform.CompileStatic -import groovy.transform.TupleConstructor - -@CompileStatic -@TupleConstructor -final class InheritanceData implements Annotatable { - String name - int access - String superName - List interfaces = [] - Map methods = [:] - Map fields = [:] - List annotations = [] - - @TupleConstructor - static final class Method implements Annotatable { - int access - String override - List annotations = [] - } - - @TupleConstructor - static final class Field implements Annotatable { - int access - String desc - List annotations = [] - } - - @TupleConstructor - static final class Annotation { - String desc - } - - private static final Gson GSON = new Gson() - static Map parse(File file) { - try (final reader = file.newReader()) { - return GSON.fromJson(reader, new TypeToken>() {}) - } - } -} - -@CompileStatic -interface Annotatable { - List getAnnotations() -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJar.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJar.groovy deleted file mode 100644 index f0918baace..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJar.groovy +++ /dev/null @@ -1,158 +0,0 @@ -package net.minecraftforge.forge.tasks - -import org.gradle.api.file.DuplicatesStrategy -import org.gradle.api.tasks.bundling.AbstractArchiveTask -import org.gradle.api.tasks.bundling.Zip -import org.gradle.api.tasks.* -import org.gradle.api.DefaultTask -import org.gradle.api.provider.Property -import groovy.json.JsonSlurper - -abstract class InstallerJar extends Zip { - @Input @Optional abstract Property getFat() - @Input @Optional abstract Property getOffline() - - InstallerJar() { - archiveClassifier.set('installer') - archiveExtension.set('jar') // Needs to be Zip task to not override Manifest, so set extension - destinationDirectory.set(project.layout.buildDirectory.dir('libs')) - fat.convention(false) - offline.convention(false) - - def installerJson = project.tasks.installerJson - def launcherJson = project.tasks.launcherJson - def downloadInstaller = project.tasks.downloadInstaller - - dependsOn(installerJson, launcherJson, downloadInstaller, project.configurations.installer) - from(installerJson, launcherJson) - - from(project.rootProject.file('/src/main/resources/url.png')) - project.afterEvaluate { - from(project.zipTree(downloadInstaller.output)) { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } - - if (fat.get() || offline.get()) { - def cfg = project.tasks.register(name + "Config", Configure) - cfg.get().configure { - parent = this - dependsOn(project.tasks.installerJson, project.tasks.launcherJson) - } - dependsOn(cfg) - } else { - // Things we ALWAYS bundle, this just the server shim jar, because the installer spec only says to extract the file. - // I should make it allow downloads but thats a spec break, and this is just a ~14KB jar - [ - project.tasks.serverShimJar // Server bootstrap executable jar - ].forEach { AbstractArchiveTask packed -> - def path = Util.getMavenInfoFromTask(packed).path - from(packed) { - rename { "maven/$path" } - } - } - } - } - } - - static abstract class Configure extends DefaultTask { - public Zip parent - private int count = 0; - - @TaskAction - protected void exec() { - def deps = [:] as java.util.TreeMap - - // Gather all things that need downloading - [ - project.tasks.installerJson, - project.tasks.launcherJson - ].each { task -> - def json = task.output.get().asFile.json - json.libraries.each { lib -> - if (lib.downloads?.artifact?.url !== null && !lib.downloads.artifact.url.isEmpty()) - deps.put(lib.name, lib.downloads.artifact) - } - } - - // First find things we build in this project. - [ - project.tasks.universalJar, // Forge runtime code - project.tasks.serverShimJar // Shim jar for dedicated server - ].forEach { AbstractArchiveTask packed -> - def name = Util.getMavenInfoFromTask(packed).name - def info = deps.remove(name) - if (info !== null) { - println("Adding: $packed.path $name") - parent.from(packed) { - rename { "maven/$info.path" } - } - } - } - - // Find any artifacts from the 'installer' config - // This config specifies the runtime files we intend for the interaller to have. - // And are typically what we would be developing and testing alongside Forge. - // So we may have local modified versions - def cfg = project.configurations.installer - while (cfg != null) { - //println('') - def resolved = cfg.resolvedConfiguration.resolvedArtifacts - int found = 0 - for (def dep : resolved) { - def name = Util.getMavenInfoFromDep(dep).name - def info = deps.remove(name) - if (info == null) { - //println("Skipping: $name") - continue - } - //println("-$name") - found++ - addFile(dep.file, info) - } - - if (deps.isEmpty()) { - cfg = null - continue - } - - // Prevent infinite loops if something fucky happens - if (found == 0) - throw new IllegalStateException("Failed to find any installer dependencies") - - def seen = [] as Set - cfg = project.configurations.detachedConfiguration() - cfg.transitive = false - for (def key : deps.keySet()) { - def (group, artifact, other) = key.split(':', 3) - // Only resolve unique group:artifact so we don't get version overrides - if (seen.add(group + ':' + artifact)) { - //println("+$key") - cfg.dependencies.add(project.dependencies.create(key)) - } - } - } - } - - void addFile(file, info) { - boolean pack = parent.offline.get() || info.url.isEmpty() - - // If it's a offline jar just always pack - if (!pack) { - try { - var remote = new URL("${info.url}.sha1").getText('UTF-8') - pack = info.sha1 != remote - } catch (FileNotFoundException e) { - pack = !info.url.startsWith('https://libraries.minecraft.net/') - // Oh noes its not there! - } - } - - if (pack) { - println("Adding: $file.absolutePath") - parent.from(file) { - rename { "maven/$info.path" } - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJson.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJson.groovy deleted file mode 100644 index 1076b7552b..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/InstallerJson.groovy +++ /dev/null @@ -1,73 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.json.JsonBuilder -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.provider.SetProperty -import org.gradle.api.tasks.* -import org.gradle.api.tasks.bundling.AbstractArchiveTask - -import java.nio.file.Files - -abstract class InstallerJson extends DefaultTask { - @OutputFile abstract RegularFileProperty getOutput() - @InputFiles abstract ConfigurableFileCollection getInput() - @Input @Optional final Map libraries = new LinkedHashMap<>() - @Input Map json = new LinkedHashMap<>() - @InputFile abstract RegularFileProperty getIcon() - @Input abstract Property getLauncherJsonName() - @Input abstract Property getLogo() - @Input abstract Property getMirrors() - @Input abstract Property getWelcome() - - InstallerJson() { - launcherJsonName.convention('/version.json') - logo.convention('/big_logo.png') - mirrors.convention('https://files.minecraftforge.net/mirrors-2.0.json') - welcome.convention("Welcome to the ${project.name.capitalize()} installer.") - output.convention(project.layout.buildDirectory.file('libs/install_profile.json')) - - project.afterEvaluate { - [ - project.tasks.universalJar, - project.tasks.serverShimJar - ].forEach { packed -> - dependsOn(packed) - input.from packed.archiveFile - } - } - } - - @TaskAction - protected void exec() { - def libs = libraries - [ - project.tasks.universalJar, - project.tasks.serverShimJar - ].forEach { AbstractArchiveTask packed -> - def info = Util.getMavenInfoFromTask(packed) - libs.put(info.name, [ - name: info.name, - downloads: [ - artifact: [ - path: info.path, - url: "https://maven.minecraftforge.net/$info.path", - sha1: packed.archiveFile.get().asFile.sha1(), - size: packed.archiveFile.get().asFile.length() - ] - ] - ]) - } - json.libraries = libs.values().sort{a,b -> a.name.compareTo(b.name)} - json.icon = "data:image/png;base64," + new String(Base64.getEncoder().encode(Files.readAllBytes(icon.get().asFile.toPath()))) - json.json = launcherJsonName.get() - json.logo = logo.get() - if (!mirrors.get().isEmpty()) - json.mirrorList = mirrors.get() - json.welcome = welcome.get() - - Files.writeString(output.get().getAsFile().toPath(), new JsonBuilder(json).toPrettyString()) - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/JarJarMetadataOptions.java b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/JarJarMetadataOptions.java deleted file mode 100644 index 8837a29032..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/JarJarMetadataOptions.java +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.tasks; - -import com.google.common.reflect.TypeToken; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import net.minecraftforge.jarjar.metadata.ContainedJarIdentifier; -import net.minecraftforge.jarjar.metadata.ContainedJarMetadata; -import net.minecraftforge.jarjar.metadata.ContainedVersion; -import net.minecraftforge.jarjar.metadata.Metadata; -import net.minecraftforge.jarjar.metadata.MetadataIOHandler; -import net.minecraftforge.jarjar.metadata.json.ArtifactVersionSerializer; -import net.minecraftforge.jarjar.metadata.json.ContainedJarIdentifierSerializer; -import net.minecraftforge.jarjar.metadata.json.ContainedJarMetadataSerializer; -import net.minecraftforge.jarjar.metadata.json.ContainedVersionSerializer; -import net.minecraftforge.jarjar.metadata.json.MetadataSerializer; -import net.minecraftforge.jarjar.metadata.json.VersionRangeSerializer; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.groovy.runtime.InvokerHelper; -import org.gradle.api.Action; -import org.gradle.api.DefaultTask; -import org.gradle.api.artifacts.ConfigurationContainer; -import org.gradle.api.artifacts.Dependency; -import org.gradle.api.artifacts.ExternalModuleDependency; -import org.gradle.api.artifacts.FileCollectionDependency; -import org.gradle.api.artifacts.MinimalExternalModuleDependency; -import org.gradle.api.artifacts.ModuleDependency; -import org.gradle.api.artifacts.ModuleIdentifier; -import org.gradle.api.artifacts.ModuleVersionIdentifier; -import org.gradle.api.artifacts.ResolvedArtifact; -import org.gradle.api.file.ProjectLayout; -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.provider.Provider; -import org.gradle.api.provider.SetProperty; -import org.gradle.api.tasks.Input; -import org.gradle.api.tasks.OutputFile; -import org.gradle.api.tasks.TaskAction; - -import javax.inject.Inject; -import java.io.File; -import java.io.IOException; -import java.io.Serial; -import java.io.Serializable; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.zip.ZipFile; - -// TODO SUPER SUPER SUPER UGLY, CLEAN UP IN FORGEDEV 7 -@Deprecated(forRemoval = true) // Will be moved to JarJar plugin in ForgeDev 7 -public abstract class JarJarMetadataOptions extends DefaultTask { - private static final Gson GSON = new GsonBuilder() - .registerTypeAdapter(VersionRange.class, new VersionRangeSerializer()) - .registerTypeAdapter(ArtifactVersion.class, new ArtifactVersionSerializer()) - .registerTypeAdapter(DefaultArtifactVersion.class, new ArtifactVersionSerializer()) - .registerTypeAdapter(ContainedJarIdentifier.class, new ContainedJarIdentifierSerializer()) - .registerTypeAdapter(ContainedJarMetadata.class, new ContainedJarMetadataSerializer()) - .registerTypeAdapter(ContainedVersion.class, new ContainedVersionSerializer()) - .registerTypeAdapter(Metadata.class, new MetadataSerializer()) - .setPrettyPrinting() - .create(); - - protected abstract @Input SetProperty getResolvedDependencies(); - - protected abstract @OutputFile RegularFileProperty getMetadataFile(); - - protected abstract @Inject ProjectLayout getLayout(); - - // NOTE: I'm not adding a non-provider version. please just use the version catalog entries for now. - public void add(Provider dependency, Action action) { - this.getResolvedDependencies().add(dependency.map(d -> { - var ret = ResolvedDependencyInfoImpl.from(this.getProject().getConfigurations(), d); - action.execute(ret); - return ret; - })); - } - - @Inject - public JarJarMetadataOptions() { - this.getMetadataFile().convention(this.getLayout().getBuildDirectory().file(this.getName() + "/options.json")); - } - - @TaskAction - protected void exec() { - record ForgeLocaterOptions(String resource, String layer, String id, List deps, ContainedJarMetadata meta, boolean nested) { } - - var resolved = this.getResolvedDependencies().get(); - var jars = new ArrayList(resolved.size()); - for (var dependency : resolved) { - var deps = new ArrayList(); - try (var zip = new ZipFile(dependency.artifact)) { - var entry = zip.getEntry("META-INF/jarjar/metadata.json"); - if (entry != null) { - try (var stream = zip.getInputStream(entry)) { - var meta = MetadataIOHandler.fromStream(stream).orElse(null); - if (meta == null) - throw new IllegalStateException("Corrupt metadata.json in " + dependency.artifact.getAbsolutePath()); - for (var dep : meta.jars()) - deps.add(new ContainedJarMetadata(dep.identifier(), dep.version(), "", dep.isObfuscated())); - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } - jars.add(new ForgeLocaterOptions( - dependency.resource, - dependency.layer, - dependency.identifier, - deps, - new ContainedJarMetadata( - new ContainedJarIdentifier(validateGroup(dependency), dependency.module.getName()), - new ContainedVersion(null, parseVersion(dependency)), - Objects.requireNonNull(dependency.path, "Dependency path is unspecified: " + dependency.asString), - false - ), - dependency.nested - )); - } - - try { - record Meta(List options){} - - Files.writeString( - this.getMetadataFile().getAsFile().get().toPath(), - GSON.toJson(new Meta(jars), Meta.class) - ); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private String validateGroup(ResolvedDependencyInfoImpl dependency) { - try { - return Objects.requireNonNull(dependency.module.getGroup()); - } catch (NullPointerException e) { - throw new IllegalArgumentException("Module dependency has no group: " + dependency.asString, e); - } - } - - private ArtifactVersion parseVersion(ResolvedDependencyInfoImpl resolved) { - try { - return VersionRange.createFromVersionSpec(Objects.requireNonNull(resolved.version)).getRecommendedVersion(); - } catch (InvalidVersionSpecificationException e) { - throw new IllegalArgumentException("Version is invalid for: " + resolved.asString, e); - } catch (NullPointerException e) { - throw new IllegalArgumentException("Version is unspecified for: " + resolved.asString, e); - } - } - - private VersionRange parseVersionRange(ResolvedDependencyInfoImpl dependency) { - if (dependency.hasManuallySpecifiedRange) { - try { - return VersionRange.createFromVersionSpec(dependency.versionRange); - } catch (InvalidVersionSpecificationException e) { - throw new IllegalArgumentException("Version is invalid for: " + dependency.asString, e); - } - } else { - try { - return VersionRange.createFromVersionSpec("[%s,)".formatted(Objects.requireNonNull(dependency.versionRange))); - } catch (InvalidVersionSpecificationException e) { - throw new IllegalArgumentException("Version range is invalid for: " + dependency.asString, e); - } catch (NullPointerException e) { - throw new IllegalArgumentException("Version is unspecified for: " + dependency.asString, e); - } - } - } - - public interface ResolvedDependencyInfo { - void containedJarMetadata(Action action); - - void setResource(String resource); - - void setLayer(String layer); - - void setId(String identifier); - - void setNested(boolean nested); - - interface ContainedJarMetadataInfo { - void setGroup(String group); - - void setName(String name); - - void setPath(String version); - } - } - - static final class ResolvedDependencyInfoImpl implements ResolvedDependencyInfo, ResolvedDependencyInfo.ContainedJarMetadataInfo, Serializable { - private static final @Serial long serialVersionUID = -7577318115877822993L; - - final MinimalModuleVersionIdentifier module; - final String version; - String versionRange; - boolean hasManuallySpecifiedRange; - boolean nested; - final File artifact; - String path; - String resource; - String layer; - String identifier; - final String asString; - - public ResolvedDependencyInfoImpl(MinimalModuleVersionIdentifier module, String version, File artifact, String asString) { - this.module = module; - this.version = version; - this.artifact = artifact; - this.asString = asString; - } - - @Override - public void containedJarMetadata(Action action) { - action.execute(this); - } - - @Override - public void setGroup(String group) { - this.module.group = group; - } - - @Override - public void setName(String name) { - this.module.name = name; - } - - @Override - public void setPath(String path) { - this.path = path; - } - - @Override - public void setResource(String resource) { - this.resource = resource; - } - - @Override - public void setLayer(String layer) { - this.layer = layer; - } - - @Override - public void setId(String identifier) { - this.identifier = identifier; - } - - @Override - public void setNested(boolean nested) { - this.nested = nested; - } - - static Set getFiles(Set resolvedDependencies) { - var ret = new HashSet(resolvedDependencies.size()); - for (var dependency : resolvedDependencies) { - ret.add(dependency.artifact); - } - return ret; - } - - static ResolvedDependencyInfoImpl from(ConfigurationContainer configurations, Dependency dependency) { - var group = dependency.getGroup(); - var name = dependency.getName(); - var version = dependency.getVersion(); - - if (dependency instanceof FileCollectionDependency filesDependency) { - File artifact; - try { - artifact = filesDependency.getFiles().getSingleFile(); - } catch (IllegalStateException e) { - // TODO fileCollectionDependencyIsNotSingleFile - throw e; - } - - return new ResolvedDependencyInfoImpl( - new MinimalModuleVersionIdentifier(group, name, version), - version, - artifact, - filesDependency.toString() - ); - } else if (dependency instanceof ModuleDependency moduleDependency) { - moduleDependency = moduleDependency.copy(); - if (moduleDependency instanceof ExternalModuleDependency externalModuleDependency) { - externalModuleDependency.version(v -> v.strictly(version.toString())); - } - - var detachedConfiguration = configurations.detachedConfiguration(moduleDependency); - detachedConfiguration.setTransitive(false); - - ResolvedDependencyInfoImpl ret = null; - for (var artifact : detachedConfiguration.getResolvedConfiguration().getFirstLevelModuleDependencies().iterator().next().getModuleArtifacts()) { - var fileName = getFileName(artifact); - if (!fileName.endsWith(".jar")) - continue; - - if (ret != null) - throw new IllegalArgumentException("Module dependency has too many Jar artifacts: " + moduleDependency); - - ret = new ResolvedDependencyInfoImpl( - new MinimalModuleVersionIdentifier(group, name, artifact.getModuleVersion().getId().getVersion()), - version, - artifact.getFile(), - moduleDependency.toString() - ); - } - if (ret == null) - throw new IllegalArgumentException("Module dependency has no Jar artifacts: " + moduleDependency); - - return ret; - } else { - throw new IllegalArgumentException("Unsupported dependency type: " + dependency.getClass().getName() + " -- " + dependency); - } - } - - private static String getFileName(ResolvedArtifact artifact) { - try { - return InvokerHelper.getProperty(artifact.getId(), "fileName").toString(); - } catch (Throwable e) { - // NOTE: Why not just use this to begin with? - // ComponentArtifactIdentifier can have a getFileName() method, which doesn't necessarily resolve the file itself. - // This allows us to get the name of the file to be used without asking Gradle to download the file. - // So, if a file is not a JAR file, we can check the name without actually downloading it. - return artifact.getFile().getName(); - } - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (ResolvedDependencyInfoImpl) obj; - return Objects.equals(this.module, that.module) && - Objects.equals(this.version, that.version) && - Objects.equals(this.versionRange, that.versionRange) && - Objects.equals(this.artifact, that.artifact); - } - - @Override - public int hashCode() { - return Objects.hash(module, version, versionRange, artifact); - } - - @Override - public String toString() { - return "ResolvedDependencyInfo[" + - "module=" + module + ", " + - "fixedVersion=" + version + ", " + - "versionRange=" + versionRange + ", " + - "artifact=" + artifact + ']'; - } - - static final class MinimalModuleVersionIdentifier implements ModuleIdentifier, ModuleVersionIdentifier { - private static final @Serial long serialVersionUID = -955346236759069739L; - - private String group; - private String name; - private final String version; - - @Inject - public MinimalModuleVersionIdentifier(String group, String name, String version) { - this.group = group; - this.name = name; - this.version = version; - } - - @Override - public ModuleIdentifier getModule() { - return this; - } - - @Override - public String getGroup() { - return this.group; - } - - @Override - public String getName() { - return this.name; - } - - @Override - public String getVersion() { - return this.version; - } - - @Override - public boolean equals(Object obj) { - return this == obj || obj instanceof MinimalModuleVersionIdentifier o - && Objects.equals(this.group, o.group) - && Objects.equals(this.name, o.name) - && Objects.equals(this.version, o.version); - } - - @Override - public int hashCode() { - return Objects.hash(group, name, version); - } - - @Override - public String toString() { - return "MinimalModuleVersionIdentifier[" + - "group=" + group + ", " + - "name=" + name + ", " + - "version=" + version + ']'; - } - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/LauncherJson.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/LauncherJson.groovy deleted file mode 100644 index fe6f810398..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/LauncherJson.groovy +++ /dev/null @@ -1,96 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.json.JsonBuilder -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.SetProperty -import org.gradle.api.tasks.* -import org.gradle.api.tasks.bundling.AbstractArchiveTask - -import java.nio.file.Files - -import static net.minecraftforge.forge.tasks.Util.getArtifacts -import static net.minecraftforge.forge.tasks.Util.iso8601Now - -abstract class LauncherJson extends DefaultTask { - @OutputFile abstract RegularFileProperty getOutput() - @InputFiles abstract ConfigurableFileCollection getInput() - @Input Map json = new LinkedHashMap<>() - - LauncherJson() { - output.convention(project.layout.buildDirectory.file('libs/version.json')) - - dependsOn(project.tasks.universalJar) - input.from(project.tasks.universalJar.archiveFile) - input.from(project.configurations.installer) - input.from(project.configurations.installerextra) - configure { - def mc = project.rootProject.ext.MC_VERSION - def forge = project.rootProject.ext.FORGE_VERSION - def timestamp = iso8601Now() - json.putAll([ - _comment: [ - "Please do not automate the download and installation of Forge.", - "Our efforts are supported by ads from the download page.", - "If you MUST automate this, please consider supporting the project through https://www.patreon.com/LexManos/" - ], - id: "$mc-$project.name-$forge", - time: timestamp, - releaseTime: timestamp, - inheritsFrom: mc, - type: 'release', - logging: [:], - mainClass: '', - libraries: [] - ] as LinkedHashMap) - - [ - project.tasks.universalJar - ].forEach { packed -> - dependsOn(packed) - input.from packed.archiveFile - } - - def patched = project.tasks.applyClientBinPatches - dependsOn(patched) - input.from patched.output - } - } - - @TaskAction - protected void exec() { - var packed = (AbstractArchiveTask) project.tasks.universalJar - def info = Util.getMavenInfoFromTask(packed) - json.libraries.add([ - name: info.name, - downloads: [ - artifact: [ - path: info.path, - url: "https://maven.minecraftforge.net/$info.path", - sha1: packed.archiveFile.get().asFile.sha1(), - size: packed.archiveFile.get().asFile.length() - ] - ] - ]) - - var classifier = 'client' - var genned = project.tasks.applyClientBinPatches - info = Util.getMavenInfoFromTask(genned, classifier) - json.libraries.add([ - name: info.name, - downloads: [ - artifact: [ - path: info.path, - url: "", - sha1: genned.output.get().asFile.sha1(), - size: genned.output.get().asFile.length() - ] - ] - ]) - - json.libraries.addAll(getArtifacts(project.configurations.installerextra).values()) - json.libraries.addAll(getArtifacts(project.configurations.installer).values()) - Files.writeString(output.get().asFile.toPath(), new JsonBuilder(json).toPrettyString()) - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/MergeJars.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/MergeJars.groovy deleted file mode 100644 index 0f95d42f36..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/MergeJars.groovy +++ /dev/null @@ -1,46 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.CompileStatic -import org.apache.commons.io.IOUtils -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFiles -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction - -import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream -import java.util.zip.ZipOutputStream - -@CompileStatic -abstract class MergeJars extends DefaultTask { - MergeJars() { - output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') }) - } - - @TaskAction - void run() { - def jars = inputJars.files - - try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) { - for (def jar : jars) { - try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) { - ZipEntry entry - while ((entry = zin.getNextEntry()) !== null) { - ZipEntry _new = new ZipEntry(entry.getName()) - _new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you! - zout.putNextEntry(_new) - IOUtils.copy(zin, zout) - } - } - } - } - } - - @InputFiles - abstract ConfigurableFileCollection getInputJars() - - @OutputFile - abstract RegularFileProperty getOutput() -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ObjectTarget.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ObjectTarget.groovy deleted file mode 100644 index 00f64e18fa..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ObjectTarget.groovy +++ /dev/null @@ -1,32 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.transform.EqualsAndHashCode - -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.Nested -import org.gradle.api.tasks.Optional - -@EqualsAndHashCode -public class ObjectTarget implements Comparable { - @Input - String owner - - @Input - String name - - @Input - @Optional - String desc - - @Override - String toString() { - if (desc == null) - return owner + '.' + name - return owner + '.' + name + desc - } - - @Override - int compareTo(ObjectTarget o) { - return toString() <=> o.toString() - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/SetupCheckJarCompatibility.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/SetupCheckJarCompatibility.groovy deleted file mode 100644 index a583d6b5e6..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/SetupCheckJarCompatibility.groovy +++ /dev/null @@ -1,47 +0,0 @@ -package net.minecraftforge.forge.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.artifacts.Dependency -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.Optional -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction - -import java.nio.file.Files -import java.nio.file.StandardCopyOption - -abstract class SetupCheckJarCompatibility extends DefaultTask { - SetupCheckJarCompatibility() { - group = 'jar compatibility' - onlyIf { - inputVersion.getOrNull() !== null - } - outputs.upToDateWhen { false } // Never up to date, because this setup task should always run - - baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') }) - } - - @TaskAction - void run() { - def inputVersion = inputVersion.get() - - def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile - project.rootProject.extensions.download.run { - src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar" - dest baseForgeUserdev - } - - def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile - - Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING) - } - - @Input - @Optional - abstract Property getInputVersion() - - @OutputFile - abstract RegularFileProperty getBaseBinPatchesOutput() -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/TeamcityRequests.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/TeamcityRequests.groovy deleted file mode 100644 index bccebbaffa..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/TeamcityRequests.groovy +++ /dev/null @@ -1,74 +0,0 @@ -package net.minecraftforge.forge.tasks - -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import groovy.transform.CompileStatic -import org.eclipse.jgit.api.Git - -import javax.annotation.Nullable -import java.util.stream.Collectors - -@CompileStatic -class TeamcityRequests { - public static final Gson GSON = new Gson() - - @Nullable - static T jsonRequest(TypeToken clazz, String url) throws Exception { - final HttpURLConnection conn = (HttpURLConnection) URI.create(url).toURL().openConnection() - conn.setRequestProperty('Accept', 'application/json') - conn.setReadTimeout(5 * 1000) - conn.setConnectTimeout(5 * 1000) - conn.connect() - - if (conn.responseCode !== 200) { - return null - } - - try (final InputStream is = conn.getInputStream()) { - GSON.fromJson(new InputStreamReader(is), clazz.getType()) - } - } - - @Nullable - static Map buildsByCommit() throws IOException { - final Map builds = [:] - jsonRequest(new TypeToken() {}, 'https://teamcity.minecraftforge.net/guestAuth/app/rest/builds?fields=build:(revisions,number)&locator=buildType:(id:MinecraftForge_MinecraftForge_MinecraftForge_MinecraftForge__Build),defaultFilter:false,count:300,status:SUCCESS') - ?.build?.forEach { - it.revisions.revision.each { rev -> builds[rev.version] = it } - } - return builds - } - - @Nullable - static String attemptFindBase(File gitPath) { - try (final git = Git.open(gitPath)) { - final Map buildByCommit = buildsByCommit() - for (final commit in git.log().setMaxCount(100).call()) { - // Find the first commit which was built on CI - final build = buildByCommit[commit.id.name] - if (build) { - return build.number - } - } - } catch (Exception ignored) {} - return null - } - - static final class Builds { - public List build - } - - static final class Build { - public String number - public Revisions revisions - } - - static final class Revisions { - public int count - public List revision - } - - static final class Revision { - public String version - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy deleted file mode 100644 index c15e595952..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy +++ /dev/null @@ -1,230 +0,0 @@ -package net.minecraftforge.forge.tasks - -import groovy.json.JsonBuilder -import groovy.json.JsonSlurper -import groovy.transform.CompileStatic -import groovy.transform.stc.ClosureParams -import groovy.transform.stc.SimpleType -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.ResolvedArtifact -import org.gradle.api.tasks.bundling.AbstractArchiveTask -import org.objectweb.asm.ClassReader -import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.ClassNode - -import java.net.http.HttpClient -import java.net.http.HttpRequest -import java.net.http.HttpResponse -import java.security.MessageDigest -import java.text.SimpleDateFormat -import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.Semaphore -import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream - -final class Util { - public static final int ASM_LEVEL = Opcodes.ASM9 - private static final HttpClient HTTP = HttpClient.newBuilder().build() - - static void init() { - File.metaClass.sha1 = { -> - MessageDigest md = MessageDigest.getInstance('SHA-1') - delegate.eachByte(4096) { byte[] bytes, int size -> - md.update(bytes, 0, size) - } - return md.digest().collect(this.&toHex).join('') - } - File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() } - File.metaClass.sha256 = { -> - MessageDigest md = MessageDigest.getInstance('SHA-256') - delegate.eachByte(4096) { byte[] bytes, int size -> - md.update(bytes, 0, size) - } - return md.digest().collect(this.&toHex).join('') - } - File.metaClass.getSha256 = { !delegate.exists() ? null : delegate.sha256() } - - File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) } - File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] } - File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() } - - Date.metaClass.iso8601 = { -> - var format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") - var result = format.format(delegate) - return result[0..21] + ':' + result[22..-1] - } - - String.metaClass.rsplit = { String del, int limit = -1 -> - var lst = new ArrayList() - int x = 0 - int idx - String tmp = delegate - while ((idx = tmp.lastIndexOf(del)) != -1 && (limit === -1 || x++ < limit)) { - lst.add(0, tmp.substring(idx + del.length(), tmp.length())) - tmp = tmp.substring(0, idx) - } - lst.add(0, tmp) - return lst - } - } - - static String[] getClasspath(Project project, Map libs, String artifact) { - def ret = [] - artifactTree(project, artifact).each { key, lib -> - libs[lib.name] = lib - if (lib.name != artifact) - ret.add(lib.name) - } - return ret - } - - @CompileStatic - static Map getArtifacts(Configuration config) { - var ret = [:] - var semaphore = new Semaphore(1, true) - config.resolvedConfiguration.resolvedArtifacts.parallelStream().forEachOrdered(dep -> { - var info = getMavenInfoFromDep(dep) - var domain = 'libraries.minecraft.net' - var url = "https://$domain/$info.path" - if (!checkExists(url)) - url.values[0] = 'maven.minecraftforge.net' - - var sha1 = sha1(dep.file) - - semaphore.acquire() - ret[info.key] = [ - name: info.name, - downloads: [ - artifact: [ - path: info.path, - url: url.toString(), - sha1: sha1, - size: dep.file.length() - ] - ] - ] - semaphore.release() - }) - return ret - } - - @CompileStatic - static Map getMavenInfoFromDep(ResolvedArtifact dep) { - return getMavenInfoFromMap([ - group: dep.moduleVersion.id.group, - name: dep.moduleVersion.id.name, - version: dep.moduleVersion.id.version, - classifier: dep.classifier, - extension: dep.extension - ]) - } - - @CompileStatic - static Map getMavenInfoFromTask(AbstractArchiveTask task) { - return getMavenInfoFromMap([ - group: task.project.group.toString(), - name: task.project.name, - version: task.project.version.toString(), - classifier: task.archiveClassifier.get(), - extension: task.archiveExtension.get() - ]) - } - - @CompileStatic - static Map getMavenInfoFromTask(Task task, String classifier) { - return getMavenInfoFromMap([ - group: task.project.group.toString(), - name: task.project.name, - version: task.project.version.toString(), - classifier: classifier, - extension: 'jar' - ]) - } - - @CompileStatic - private static Map getMavenInfoFromMap(Map art) { - var key = "$art.group:$art.name" - var name = "$art.group:$art.name:$art.version" - var path = "${art.group.replace('.', '/')}/$art.name/$art.version/$art.name-$art.version" - if (art.classifier !== null) { - name += ":$art.classifier" - path += "-$art.classifier" - } - if ('jar' != art.extension) { - name += "@$art.extension" - path += ".$art.extension" - } else { - path += ".jar" - } - return [ - key: key.toString(), - name: name.toString(), - path: path.toString(), - art: art - ] - } - - static String iso8601Now() { new Date().iso8601() } - - @CompileStatic - static String sha1(File file) { - MessageDigest md = MessageDigest.getInstance('SHA-1') - file.eachByte(4096) { byte[] bytes, int size -> - md.update(bytes, 0, size) - } - return md.digest().collect(this.&toHex).join('') - } - - @CompileStatic - private static String toHex(byte bite) { - return String.format('%02x', bite) - } - - private static Map artifactTree(Project project, String artifact, boolean transitive = true) { - if (!project.ext.has('tree_resolver')) - project.ext.tree_resolver = 1 - def cfg = project.configurations.create('tree_resolver_' + project.ext.tree_resolver++) - cfg.transitive = transitive - def dep = project.dependencies.create(artifact) - cfg.dependencies.add(dep) - def files = cfg.resolve() - return getArtifacts(cfg) - } - - @CompileStatic - static boolean checkExists(String url) { - try { - return HTTP.send(HttpRequest.newBuilder(new URI(url)) - .method('HEAD', HttpRequest.BodyPublishers.noBody()).build(), HttpResponse.BodyHandlers.discarding() - ).statusCode() === 200 - } catch (Exception e) { - if (e.toString().contains('unable to find valid certification path to requested target')) - throw new RuntimeException("Failed to connect to $url: Missing certificate root authority, try updating Java") - throw e - } - } - - static String getLatestForgeVersion(String mcVersion) { - final json = new JsonSlurper().parseText(new URL('https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json').getText('UTF-8')) - final ver = json.promos["$mcVersion-latest"] - ver === null ? null : (mcVersion + '-' + ver) - } - - @CompileStatic - static void processClassNodes(File file, @ClosureParams(value = SimpleType, options = 'org.objectweb.asm.tree.ClassNode') Closure process) { - file.withInputStream { i -> - new ZipInputStream(i).withCloseable { zin -> - ZipEntry zein - while ((zein = zin.nextEntry) !== null) { - if (zein.name.endsWith('.class')) { - var node = new ClassNode(ASM_LEVEL) - new ClassReader(zin).accept(node, 0) - process(node) - } - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ValidateDeprecations.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ValidateDeprecations.groovy deleted file mode 100644 index 14018ddd8a..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/ValidateDeprecations.groovy +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.tasks - -import groovy.transform.CompileStatic -import net.minecraftforge.srgutils.MinecraftVersion -import org.gradle.api.DefaultTask -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.TaskAction -import org.objectweb.asm.tree.AnnotationNode -import org.objectweb.asm.tree.ClassNode - -abstract class ValidateDeprecations extends DefaultTask { - @InputFile - abstract RegularFileProperty getInput() - - @Input - abstract Property getMcVersion() - - ValidateDeprecations() { - this.onlyIf { !System.env.TEAMCITY_VERSION } - } - - @TaskAction - protected void exec() { - var mcVer = MinecraftVersion.from(mcVersion.get()) - List errors = [] - - Util.processClassNodes(input.get().asFile) { - processNode(mcVer, errors, it) - } - - if (!errors.isEmpty()) { - errors.forEach { - this.logger.error("Deprecated ${it[0]} is marked for removal in ${it[1]} but is not yet removed") - } - throw new IllegalStateException("Found deprecated members marked for removal but not yet removed in ${mcVer}; see log for details") - } - } - - protected processNode(MinecraftVersion mcVer, List errors, ClassNode node) { - node.visibleAnnotations?.each { annotation -> - ValidateDeprecations.processAnnotations(annotation, mcVer, errors) { - "class ${node.name}" - } - } - node.fields?.each { field -> - field.visibleAnnotations?.each { annotation -> - ValidateDeprecations.processAnnotations(annotation, mcVer, errors) { - "field ${node.name}#${field.name}" - } - } - } - node.methods?.each { method -> - method.visibleAnnotations?.each { annotation -> - ValidateDeprecations.processAnnotations(annotation, mcVer, errors) { - "method ${node.name}#${method.name}${method.desc}" - } - } - } - } - - private static void processAnnotations(AnnotationNode annotation, MinecraftVersion mcVer, List errors, Closure context) { - def values = annotation.values - if (values === null) - return - int forRemoval = values.indexOf('forRemoval') - int since = values.indexOf('since') - if (annotation.desc == 'Ljava/lang/Deprecated;' && forRemoval !== -1 && since !== -1 && values.size() >= 4 && values[forRemoval + 1] === true) { - def oldVersion = MinecraftVersion.from(values[since + 1]) - int[] split = ValidateDeprecations.splitDots(oldVersion.toString()) - if (split.length < 2) - return - def removeVersion = MinecraftVersion.from("${split[0]}.${split[1] + 1}") - if (removeVersion <= mcVer) - errors.add([context(), removeVersion]) - } - } - - @CompileStatic - private static int[] splitDots(String version) { - String[] pts = version.split('\\.') - int[] values = new int[pts.length] - for (int x = 0; x < pts.length; x++) - values[x] = Integer.parseInt(pts[x]) - return values - } -} 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 deleted file mode 100644 index 1eacac6daa..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy +++ /dev/null @@ -1,310 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import groovy.transform.CompileStatic -import groovy.transform.TupleConstructor -import net.minecraftforge.forge.tasks.InheritanceData -import net.minecraftforge.srgutils.IMappingFile -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFile -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.InputFiles -import org.gradle.api.tasks.Optional -import org.objectweb.asm.Opcodes - -@CompileStatic -abstract class CheckATs extends CheckTask { - - @InputFile abstract RegularFileProperty getInheritance() - @InputFiles abstract ConfigurableFileCollection getAts() - @InputFile @Optional abstract RegularFileProperty getMappings() - - @Override - void check(Reporter reporter, boolean fix) { - final IMappingFile mappings = mappings.map { RegularFile it -> IMappingFile.load(it.asFile) }.getOrNull() - final inheritance = InheritanceData.parse(this.inheritance.get().asFile) - - ats.each { - final lines = process(it, reporter, inheritance) - if (fix) { - it.text = joinBack(lines, inheritance, mappings).join('\n') - } - } - } - - private static TreeMap process(File file, Reporter reporter, Map inheritance) { - final TreeMap lines = ATParser.parse(file.readLines(), reporter) - final Map constructorGroups = [:] - - final itr = lines.entrySet().iterator() - final toRemove = [] - while (itr.hasNext()) { - final next = itr.next() - String key = next.key - final entry = next.value - if (entry === null) continue - - final binaryName = entry.cls.replaceAll('\\.', '/') - - // Process Groups, this will remove any entries outside the group that is covered by the group - if (entry.group) { - final jcls = inheritance[binaryName] - if (jcls === null) { - itr.remove() - reporter.report("Invalid group: $key") - } else if ('*' == entry.desc) { - if (!jcls.fields) { - itr.remove() - reporter.report("Invalid group, class has no fields: $key") - } else { - jcls.fields.each { field, value -> - final fkey = entry.cls + ' ' + field - if (accessLevel(value.access) < accessStr(entry.modifier)) { - if (lines.containsKey(fkey)) { - toRemove.add(fkey) - } else if (!entry.existing.contains(fkey)) { - reporter.report("Missing group entry: $fkey") - } - entry.children.add(fkey) - } else if (lines.containsKey(fkey)) { - toRemove.add(fkey) - reporter.report("Found invalid group entry: $fkey") - } - } - entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) } - } - } else if ('*()' == entry.desc) { - if (!jcls.methods) { - itr.remove() - reporter.report("Invalid group, class has no methods: $key") - } else { - jcls.methods.each { mtd, value -> - if (mtd.startsWith('') || mtd.startsWith('lambda$')) return - key = entry.cls + ' ' + mtd.replace(' ', '') - if (accessLevel(value.access) < accessStr(entry.modifier)) { - if (lines.containsKey(key)) { - toRemove.add(key) - } else if (!entry.existing.contains(key)) { - reporter.report("Missing group entry: $key") - } - entry.children.add(key) - } else if (lines.containsKey(key)) { - toRemove.add(key) - reporter.report("Found invalid group entry: $key") - } - } - entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) } - } - } else if ('' == entry.desc) { //Make all public non-abstract subclasses - constructorGroups.put(binaryName, entry) - } - } - - // Process normal lines, remove invalid and remove narrowing - else { - def jcls = inheritance.get(binaryName) - if (jcls === null) { - itr.remove() - reporter.report("Invalid: $key") - } else if (entry.desc == '') { - if (accessLevel(jcls.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) { - itr.remove() - reporter.report("Invalid Narrowing: $key") - } - } else if (!entry.desc.contains('(')) { - if (!jcls.fields || !jcls.fields.containsKey(entry.desc)) { - itr.remove() - reporter.report("Invalid: $key") - } else { - final value = jcls.fields[entry.desc] - if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) { - itr.remove() - reporter.report("Invalid Narrowing: $key - ${entry.comment}") - } - } - } else { - final jdesc = entry.desc.replace('(', ' (') - if (!jcls.methods || !jcls.methods.containsKey(jdesc)) { - itr.remove() - reporter.report("Invalid: $key") - } else { - final value = jcls.methods[jdesc] - if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) { - itr.remove() - reporter.report("Invalid Narrowing: $key") - } - } - } - } - } - - inheritance.each { tcls, value -> - if (!value.methods || ((value.access & Opcodes.ACC_ABSTRACT) !== 0)) return - String parent = tcls - while (parent !== null) { - constructorGroups[parent]?.tap { entry -> - value.methods.each { mtd, v -> - if (mtd.startsWith('')) { - final child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '') - if (accessLevel(v.access) < 3) { - if (lines.containsKey(child)) { - toRemove.add(child) - } else if (child !in entry.existing) { - reporter.report("Missing group entry: $child") - } - entry.children.add(child) - } else if (lines.containsKey(child)) { - toRemove.add(child) - reporter.report("Found invalid group entry: $child") - } - } - } - } - parent = inheritance[parent]?.superName - } - } - constructorGroups.values().each { entry -> entry.existing.findAll { it !in entry.children }.each{ reporter.report("Found invalid group entry: $it") } } - - toRemove.each(lines.&remove) - - return lines - } - - private static List joinBack(TreeMap lines, Map inheritance, IMappingFile mappings) { - final data = [] as List - final remapComment = { ATParser.Entry entry -> - if (!mappings || !entry || !entry.desc) return null - final comment = entry.comment?.substring(1)?.trim() - final jsonCls = inheritance.get(entry.cls.replaceAll('\\.', '/')) - final mappingsClass = mappings?.getClass(jsonCls.name) - if (mappingsClass === null) return entry.comment - final idx = entry.desc.indexOf('(') - - String mappedName = idx == -1 - ? mappingsClass.remapField(entry.desc) - : mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx)) - if (!mappedName) return entry.comment - if (mappedName == '') - mappedName = 'constructor' - - if (comment?.startsWith(mappedName)) - return '# ' + comment - if (comment && comment.indexOf(' ') !== -1) { - def split = comment.split(' - ').toList() - if (split[0].indexOf(' ') !== -1) - // The first string is more than one word, so append before it - return "# ${mappedName} - ${comment}" - split.remove(0) - return "# ${mappedName} - ${String.join(' - ', split)}" - } - return '# ' + mappedName - } - lines.each { key, value -> - if (!value.group) { - def comment = remapComment.call(value) - data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : '')) - } else { - data.add(('#group ' + value.modifier + ' ' + key + ' ' + (value.comment ?: '')).trim()) - value.children.each { - final line = value.modifier + ' ' + it - final entry = ATParser.parseEntry(line) - final comment = remapComment(entry) - data.add(line + (comment ? ' ' + comment : '')) - } - data.add('#endgroup') - } - } - return data - } - - static int accessStr(String access) { - if (access.endsWith('-f') || access.endsWith('+f')) return 4 - switch (access.toLowerCase()) { - case 'public': return 3 - case 'protected': return 2 - case 'default': return 1 - case 'private': return 0 - default: return -1 - } - } - - static int accessLevel(int access) { - if ((access & Opcodes.ACC_PUBLIC) !== 0) return 3 - if ((access & Opcodes.ACC_PROTECTED) !== 0) return 2 - if ((access & Opcodes.ACC_PRIVATE) !== 0) return 0 - return 1 - } -} - -@CompileStatic -class ATParser { - static TreeMap parse(List lines, CheckTask.Reporter reporter) { - TreeMap outLines = new TreeMap<>() - Entry group = null - for (final line : lines) { - if (line.isEmpty()) continue - if (line.startsWith('#group ')) { - final entry = parseEntry(line.substring(7)) - - if (entry.desc != '*' && entry.desc != '*()' && entry.desc != '') { - reporter.report("Invalid group: $line", false) - } - - entry.group = true - entry.children = [] - entry.existing = [] - - group = entry - - if (outLines.containsKey(entry.key)) { - reporter.report("Duplicate group: $line", false) - } - - outLines[entry.key] = group - } else if (group !== null) { - if (line.startsWith('#endgroup')) { - group = null - } else { - final key = parseEntry(line).key - group.existing.add(key) - } - } else if (line.startsWith('#endgroup')) { - reporter.report("Invalid group ending: $line", false) - } else if (line.startsWith('#')) { - //Nom - } else { - final entry = parseEntry(line) - if (outLines.containsKey(entry.key)) { - reporter.report("Found duplicate: $line") - continue - } - outLines[entry.key] = entry - } - } - return outLines - } - - static Entry parseEntry(String line) { - final idx = line.indexOf('#') - final String comment = idx === -1 ? null : line.substring(idx) - if (idx !== -1) line = line.substring(0, idx - 1) - final data = (line.trim() + ' ').split(' ', -1) - new Entry(data[0], data[1], data[2], comment) - } - - @TupleConstructor - static final class Entry { - String modifier, cls, desc, comment - - Set existing - TreeSet children - boolean group = false - - @Lazy - String key = {cls + (desc.isEmpty() ? '' : ' ' + desc)}() - - Object getAt(String key) { - return getProperty(key) - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckExcs.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckExcs.groovy deleted file mode 100644 index 8925657539..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckExcs.groovy +++ /dev/null @@ -1,95 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import net.minecraftforge.forge.tasks.Util -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.InputFiles -import org.objectweb.asm.ClassReader -import org.objectweb.asm.ClassVisitor -import org.objectweb.asm.MethodVisitor -import org.objectweb.asm.Type - -import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream - -abstract class CheckExcs extends CheckTask { - - @InputFile abstract RegularFileProperty getBinary() - @InputFiles abstract ConfigurableFileCollection getExcs() - - @Override - void check(Reporter reporter, boolean fix) { - final Set known = [] - collectKnown(known) - - excs.each { f -> - final lines = [] - f.eachLine { line -> - int idx = line.indexOf('#') - if (idx === 0 || line.isEmpty()) { - return - } - - if (idx !== -1) line = line.substring(0, idx - 1) - - if (!line.contains('=')) { - reporter.report("Invalid: $line") - return - } - - def (String key, String value) = line.split('=', 2) - if (!known.contains(key)) { - reporter.report("Unknown: $line") - return - } - - String desc = key.split('\\.', 2)[1] - if (!desc.contains('(')) { - reporter.report("Invalid: $line") - return - } - desc = '(' + desc.split('\\(', 2)[1] - - def (exceptions, String args) = value.contains('|') ? value.split('|', 2) : [value, ''] - - if (args.split(',').length !== Type.getArgumentTypes(desc).length) { - reporter.report("Invalid: $line") - return - } - lines.add(line) - - return - } - - if (fix) f.text = lines.sort().join('\n') - } - } - - private void collectKnown(Collection known) { - binary.get().asFile.withInputStream { i -> - new ZipInputStream(i).withCloseable { zin -> - final visitor = new ClassVisitor(Util.ASM_LEVEL) { - private String cls - @Override - void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - this.cls = name - } - - @Override - MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - known.add(this.cls + '.' + name + descriptor) - super.visitMethod(access, name, descriptor, signature, exceptions) - } - } - ZipEntry zein - while ((zein = zin.nextEntry) !== null) { - if (zein.name.endsWith('.class')) { - ClassReader reader = new ClassReader(zin) - reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) - } - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckMode.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckMode.groovy deleted file mode 100644 index 8580aa64e4..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckMode.groovy +++ /dev/null @@ -1,11 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import groovy.transform.CompileStatic - -@CompileStatic -enum CheckMode { - CHECK, - FIX - - CheckMode() {} -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckPatches.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckPatches.groovy deleted file mode 100644 index 89192dff55..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckPatches.groovy +++ /dev/null @@ -1,182 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import groovy.transform.CompileStatic -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.provider.ListProperty -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputDirectory -import org.gradle.api.tasks.Optional - -import java.nio.file.Files -import java.nio.file.Path -import java.util.regex.Pattern - -@CompileStatic -abstract class CheckPatches extends CheckTask { - - private static final Pattern HUNK_START_PATTERN = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$') - private static final Pattern WHITESPACE_PATTERN = Pattern.compile('^[+\\-]\\s*$') - private static final Pattern IMPORT_PATTERN = Pattern.compile('^[+\\-]\\s*import.*') - private static final Pattern FIELD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$') - private static final Pattern METHOD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$') - private static final Pattern CLASS_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$') - private static final Map ACCESS_MAP = [private: 0, protected: 2, public: 3].tap { it.put(null, 1) } - - @InputDirectory abstract DirectoryProperty getPatchDir() - @Input @Optional abstract ListProperty getPatchesWithS2SArtifact() - - @Override - void check(Reporter reporter, boolean fix) { - final patchDir = getPatchDir().get().asFile.toPath() - Files.walk(patchDir).withCloseable { - it.filter(Files.&isRegularFile).forEach { path -> - final String relativeName = patchDir.relativize(path).toString() - verifyPatch(path, reporter, fix, relativeName, patchesWithS2SArtifact.get().contains(relativeName.replace('\\', '/'))) - } - } - } - - static boolean accessChange(String previous, String current) { - //return ACCESS_MAP[previous] < ACCESS_MAP[current] - return previous != current - } - - void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) { - int oldFixedErrors = reporter.fixed.size() - - final lines = Files.readAllLines(patch) - - int hunksStart = 0 - boolean onlyWhiteSpace = false - - final List newLines = [] - - // First two lines are file name ++/-- and we do not care - newLines.add(lines[0] + '\n') - newLines.add(lines[1] + '\n') - - int i - for (i = 2; i < lines.size(); ++i) { - def line = lines[i] - newLines.add(line + '\n') - - if (HUNK_START_PATTERN.matcher(line).find()) { - if (onlyWhiteSpace) { - if (!hasS2SArtifact) - reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath") - int toRemove = i - hunksStart - while (toRemove-- > 0) - newLines.remove(newLines.size() - 1) - } - hunksStart = i - onlyWhiteSpace = true - continue - } - - if (line.startsWithAny('+','-')) { - def prefixChange = false - def prevLine = lines[i - 1] - - if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') { - def prevTrim = prevLine.substring(1).replaceAll("\\s", "") - def currTrim = line.substring(1).replaceAll("\\s", "") - - if (prevTrim == currTrim) { - prefixChange = true - } - - def pMatcher = FIELD_PATTERN.matcher(prevLine) - def cMatcher = FIELD_PATTERN.matcher(line) - - if (pMatcher.find() && cMatcher.find() && - pMatcher.group(6) == cMatcher.group(6) && // = ... - pMatcher.group(5) == cMatcher.group(5) && // field name - pMatcher.group(3) == cMatcher.group(3) && // static - (accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) { - reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false) - } - - pMatcher = METHOD_PATTERN.matcher(prevLine) - cMatcher = METHOD_PATTERN.matcher(line) - - if (pMatcher.find() && cMatcher.find() && - pMatcher.group(6) == cMatcher.group(6) && // params - pMatcher.group(5) == cMatcher.group(5) && // void name - pMatcher.group(3) == cMatcher.group(3) && // static - (accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) { - reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false) - } - - pMatcher = CLASS_PATTERN.matcher(prevLine) - cMatcher = CLASS_PATTERN.matcher(line) - - if (pMatcher.find() && cMatcher.find() && - pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ... - pMatcher.group(5) == cMatcher.group(5) && // class | interface - pMatcher.group(3) == cMatcher.group(3) && // static - (accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) { - reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false) - } - } - - if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) { - final nextLine = lines[i + 1] - if (nextLine.charAt(0) == (char)'+') { - final nextTrim = nextLine.substring(1).replaceAll("\\s", "") - final currTrim = line.substring(1).replaceAll("\\s", "") - - if (nextTrim == currTrim) { - prefixChange = true - } - } - } - - final isWhiteSpaceChange = WHITESPACE_PATTERN.matcher(line).find() - - if (!prefixChange && !isWhiteSpaceChange) { - onlyWhiteSpace = hasS2SArtifact && IMPORT_PATTERN.matcher(line).find() - } else if (isWhiteSpaceChange) { - final prevLineChange = prevLine.startsWithAny('+','-') - final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-') - - if (!prevLineChange && !nextLineChange) { - reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath \n$prevLine\n$line\n${lines[i+1]}", false) - } - } - - if (line.contains('\t')) { - reporter.report("Patch contains tabs on line ${i + 1}, file: $patchPath") - line = line.replaceAll('\t', ' ') - newLines.remove(newLines.size() - 1) - newLines.add(line + '\n') - } - - if (IMPORT_PATTERN.matcher(line).find() && !hasS2SArtifact) { - reporter.report("Patch contains import change on line ${i + 1}, file: $patchPath", false) - } - } - } - - if (onlyWhiteSpace) { - if (!hasS2SArtifact) - reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath") - def toRemove = i - hunksStart; - while (toRemove-- > 0) - newLines.remove(newLines.size() - 1) - } - - if ((reporter.fixed.size() > oldFixedErrors && fix) || hasS2SArtifact) { - if (newLines.size() <= 2) { - logger.lifecycle("Patch is now empty removing, file: {}", patchPath) - Files.delete(patch) - } - else { - if (!hasS2SArtifact) - logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***") - Files.newBufferedWriter(patch).withCloseable { - newLines.each { l -> it.write(l) } - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckSAS.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckSAS.groovy deleted file mode 100644 index bc93cf05ba..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckSAS.groovy +++ /dev/null @@ -1,110 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import groovy.transform.CompileStatic -import net.minecraftforge.forge.tasks.Annotatable -import net.minecraftforge.forge.tasks.InheritanceData -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.InputFiles - -@CompileStatic -abstract class CheckSAS extends CheckTask { - - @InputFile abstract RegularFileProperty getInheritance() - @InputFiles abstract ConfigurableFileCollection getSass() - - @Override - void check(Reporter reporter, boolean fix) { - final inheritance = InheritanceData.parse(this.inheritance.get().asFile) - - sass.each { f -> - final lines = [] - f.eachLine { line -> - if (line[0] == '\t') return // Skip any tabbed lines, those are ones we add - final idx = line.indexOf('#') - if (idx == 0 || line.isEmpty()) { - lines.add(line) - return - } - def comment = idx == -1 ? null : line.substring(idx) - if (idx != -1) line = line.substring(0, idx - 1) - final spl = (line.trim().replace('(', ' (') + ' ').split(' ', -1) - def (String cls, String name, String desc) = [spl[0], spl[1], spl[2]] - cls = cls.replaceAll('\\.', '/') - - if (inheritance[cls] === null) { - reporter.report("Invalid: $line") - } else if (name.isEmpty()) { //Class SAS - final toAdd = [] - final clsSided = isSided(inheritance[cls]) - boolean sided = clsSided - - /* TODO: MergeTool doesn't do fields - if (json[cls]['fields'] != null) { - for (entry in json[cls]['fields']) { - if (isSided(entry.value)) { - sided = true - toAdd.add('\t' + cls + ' ' + entry.key) - } - } - } */ - - final clsInh = inheritance[cls] - if (clsInh.methods) { - for (entry in clsInh.methods) { - if (isSided(entry.value)) { - sided = true - toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', '')) - findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) } - findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) } - } else if (clsSided) { - findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) } - findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) } - } - } - } - - if (sided) { - lines.add(cls + (comment == null ? '' : ' ' + comment)) - lines.addAll(toAdd.sort()) - } else { - reporter.report("Invalid: $line") - } - - } else if (desc.isEmpty()) { // Fields - /* TODO: MergeTool doesn't do fields - if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name])) - lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment)) - else */ - reporter.report("Invalid: $line") - } else { // Methods - final clsInh = inheritance[cls] - if (clsInh.methods === null || !isSided(clsInh.methods[name + ' ' + desc])) - reporter.report("Invalid: $line") - else { - lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment)) - findChildMethods(inheritance, cls, name + ' ' + desc).each { println(line + ' -- ' + it) } - findChildMethods(inheritance, cls, name + ' ' + desc).each { lines.add('\t' + it) } - } - } - } - - if (fix) f.text = lines.join('\n') - } - } - - protected static boolean isSided(Annotatable annotatable) { - if (annotatable === null) return false - for (ann in annotatable.annotations) { - if ('Lnet/minecraftforge/api/distmarker/OnlyIn;' == ann.desc) - return true - } - return false - } - - protected static findChildMethods(Map json, String cls, String desc) { - return json.values().findAll{ it.methods !== null && it.methods[desc] !== null && it.methods[desc].override == cls && isSided(it.methods[desc]) } - .collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet - } -} 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 deleted file mode 100644 index 62b50abdbf..0000000000 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckTask.groovy +++ /dev/null @@ -1,114 +0,0 @@ -package net.minecraftforge.forge.tasks.checks - -import groovy.transform.CompileStatic -import groovy.transform.stc.ClosureParams -import groovy.transform.stc.ThirdParam -import net.minecraftforge.forge.tasks.Util -import org.gradle.api.Action -import org.gradle.api.DefaultTask -import org.gradle.api.logging.LogLevel -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction -import org.gradle.api.tasks.TaskContainer -import org.gradle.api.tasks.VerificationTask - -@CompileStatic -abstract class CheckTask extends DefaultTask implements VerificationTask { - @Input - abstract Property getMode() - - private boolean ignoreFailures = false - - @Input - @Override - boolean getIgnoreFailures() { - return ignoreFailures - } - - @Override - void setIgnoreFailures(boolean ignoreFailures) { - this.ignoreFailures = ignoreFailures - } - - @TaskAction - void run() { - Util.init() - - boolean 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')) - if (!ignoreFailures) { - throw new IllegalArgumentException("${reporter.messages.size()} errors were found!") - } - } else { - if (logger.isEnabled(LogLevel.DEBUG)) { - logger.warn("Check task '{}' found {} errors and fixed {}:\n{}", name, reporter.messages.size(), reporter.fixed.size(), reporter.fixed.join('\n')) - } else { - logger.warn("Check task '{}' found {} errors and fixed {}.", name, reporter.messages.size(), reporter.fixed.size()) - } - - if (reporter.notFixed) { - logger.error('{} errors could not be fixed:\n{}', reporter.notFixed.size(), reporter.notFixed.join('\n')) - if (!ignoreFailures) { - throw new IllegalArgumentException("${reporter.notFixed.size()} errors which cannot be fixed were found!") - } - } - } - } - } - - abstract void check(Reporter reporter, boolean fix) - - @CompileStatic - static final class Reporter { - final boolean trackFixed - Reporter(boolean trackFixed) { - this.trackFixed = trackFixed - } - - public final List messages = [] - - public final List fixed = [] - public final List notFixed = [] - - void report(String message, boolean canBeFixed = true) { - messages.add(message) - - if (trackFixed) { - if (canBeFixed) { - fixed.add(message) - } else { - notFixed.add(message) - } - } - } - } - - static void registerTask(TaskContainer tasks, String taskName, @DelegatesTo.Target('type') Class clazz, - @DelegatesTo(genericTypeIndex = 0, target = 'type') - @ClosureParams(ThirdParam.FirstGenericType) Closure configuration) { - taskName = taskName.capitalize() - tasks.register("check$taskName", clazz) { CheckTask task -> - 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 -> - 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/build_clean.gradle b/build_clean.gradle deleted file mode 100644 index 21471fcc6c..0000000000 --- a/build_clean.gradle +++ /dev/null @@ -1,73 +0,0 @@ -plugins { - id 'java-library' - id 'net.minecraftforge.gradle.patcher' -} - -evaluationDependsOn(':mcp') - -repositories { - mavenCentral() - maven gradleutils.forgeMaven - maven gradleutils.minecraftLibsMaven -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) - -dependencies { - implementation(libs.forgespi) -} - -patcher { - parent = project(':mcp') - mcVersion = MC_VERSION - patchedSrc = file('src/main/java') - - mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION - - runs { - clean_client { - client true - taskName 'clean_client' - ideaModule "${rootProject.name}.${project.name}.main" - - main 'net.minecraft.client.main.Main' - workingDirectory project.file('run/client') - - args '--gameDir', '.' - args '--version', MC_VERSION - args '--assetsDir', downloadAssets.output - args '--assetIndex', '{asset_index}' - args '--accessToken', '0' - } - - clean_server { - client false - taskName 'clean_server' - ideaModule "${rootProject.name}.${project.name}.main" - - main 'net.minecraft.server.Main' - workingDirectory project.file('run/server') - } - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation - options.warnings = false // Shutup deprecated for removal warnings -} - -eclipse.classpath.file.whenMerged { - // Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase - def src = entries.find { it.path == 'src/main/java' } - if (src == null) throw new IllegalStateException("You must run `setup` task before importing") - src.entryAttributes['ignore_optional_problems'] = 'true' -} - -tasks.named('genPatches').configure { - onlyIf { false } -} - -tasks.named('extractRangeMap').configure { - onlyIf { false } - tool = 'net.minecraftforge:Srg2Source:8.1.0:fatjar' -} \ No newline at end of file diff --git a/build_forge.gradle b/build_forge.gradle deleted file mode 100644 index 268facc2f3..0000000000 --- a/build_forge.gradle +++ /dev/null @@ -1,1111 +0,0 @@ -import de.undercouch.gradle.tasks.download.Download -import net.minecraftforge.forge.tasks.checks.CheckATs -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 java.nio.file.Files -import net.minecraftforge.forge.tasks.* -import static net.minecraftforge.forge.tasks.Util.* -import net.minecraftforge.gradle.common.tasks.ApplyBinPatches -import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility -import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact -import net.minecraftforge.gradle.common.tasks.ExtractInheritance -import net.minecraftforge.gradle.patcher.tasks.FilterNewJar -import net.minecraftforge.gradle.patcher.tasks.GeneratePatches -import net.minecraftforge.gradle.userdev.tasks.RenameJar -import org.apache.tools.ant.filters.ReplaceTokens -import org.objectweb.asm.Opcodes - -plugins { - id 'idea' - id 'eclipse' - id 'java-library' - id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'de.undercouch.download' - id 'net.minecraftforge.gradleutils' - id 'net.minecraftforge.gradle.patcher' - id 'net.minecraftforge.gradlejarsigner' -} - -Util.init() //Init all our extension methods! - -// We depend on all other projects so that we can know their versions for userdev config -rootProject.subprojects.each { sib -> if (sib != project) evaluationDependsOn(sib.path) } - -apply from: rootProject.file('build_shared.gradle') - -java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) - withSourcesJar() -} - -jarSigner.autoDetect('forge') - -applyPatches { - level 'WARNING' - failOnError = UPDATING != 'true' - rejects = rootProject.layout.projectDirectory.dir('rejects').asFile -} - -sourceSets { - main { - java { - srcDir "$rootDir/src/main/java" - } - resources { - srcDir "$rootDir/src/main/resources" - srcDir "$rootDir/src/main/generated" - } - } - test { - java { - srcDir "$rootDir/src/test/java" - } - resources { - srcDir "$rootDir/src/test/resources" - srcDir "$rootDir/src/test/generated" - } - } -} - -final String SPEC_VERSION = gitversion.info.tag - -// The new versioning sceme is -.. -// ForgeMC is a unique identifier for every MC version we have supported. -// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique. -final def MCP_ARTIFACT = project(':mcp').mcp.config.get() - -final List EXTRA_TXTS = [ - rootProject.file('CREDITS.txt'), - rootProject.file('LICENSE.txt'), - rootProject.tasks.createChangelog.outputFile -] - -ext { - MAVEN_PATH = "${group.toString().replace('.', '/')}/${project.name}/${VERSION}".toString() -} -final String MAVEN_PATH = ext.MAVEN_PATH - -final String BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.2.0:fatjar' -final String INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.3' -final String FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.6' -final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.1.1:fatjar' - -configurations { - // Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it. - bootstrap { transitive = false } - installer { - extendsFrom(bootstrap) - transitive = false - } - installerextra { - extendsFrom(bootstrap) - transitive = false - } - api.extendsFrom(installer) -} - -dependencies { - // These need to actually be on the classpath at the start. This is only used for the server shim jar. - // And this is only needed because custom file systems are REQUIRED to be on the boot classloader. - // This has ASM/BootStrap/Unsafe all because I haven't gotten around to moving UnionFileSystem out to its own project. - bootstrap(libs.jarjar.fs) // JarInJar file system - bootstrap(libs.roimfs) // JarInJar File System - FileSystems need to be on boot loader. - bootstrap(libs.bundles.jimfs) // In memory file system used for ForgeDev launches - bootstrap(libs.securemodules) // Has Union file system in it - bootstrap(libs.unsafe) // Needed by securemodules - bootstrap(libs.bundles.asm) // Needed by securemodules - - implementation(libs.jopt.simple) - - installer(libs.bootstrap) - installer(libs.bootstrap.api) // Needed by securemodules - installer(libs.accesstransformers) - installer(libs.eventbus) - installer(libs.jspecify) // Dep of EventBus - installer(libs.forgespi) - installer(libs.coremods) - installer(libs.nashorn) // Dep of Coremods - installer(libs.modlauncher) - installer(libs.mergetool.api) - installer(libs.bundles.night.config) - installer(libs.maven.artifact) - installer(libs.bundles.terminalconsoleappender) - installer(libs.mixin) - installer(libs.mixinextras.forge) - installer(libs.bundles.jarjar) - installer(libs.roimfs) - - installer(project(':fmlcore')) - installer(project(':fmlloader')) - installer(project(':fmlearlydisplay')) - installer(project(':javafmllanguage')) - installer(project(':lowcodelanguage')) - installer(project(':mclanguage')) - installer(project(':forge-transformers')) - - installerextra("${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:srg2off") - - runtimeOnly(libs.bootstrap) - runtimeOnly(libs.bootstrap.dev) - - annotationProcessor(libs.eventbus.validator) -} - -tasks.named('extractRangeMap').configure { - tool = S2S_TOOL -} - -patcher { - excs.from file("$rootDir/src/main/resources/forge.exc") - parent = project(':mcp') - mcVersion = MC_VERSION - mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION - patches = file("$rootDir/patches/minecraft") - patchedSrc = file('src/main/java') - srgPatches = false - accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg") - sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas") - - runs { - forge_client { - property 'eventbus.api.strictRuntimeChecks', 'true' - property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll' - - args '--launchTarget', 'forge_dev_client', - '--username', 'Dev', - '--version', project.name, - '--accessToken', '0', - '--userType', 'mojang', - '--versionType', 'release', - '--assetsDir', downloadAssets.output, - '--assetIndex', "{asset_index}" - } - - forge_client_test { - parent runs.forge_client - source sourceSets.test - } - - forge_server { - args '--launchTarget', 'forge_dev_server' - } - - forge_server_test { - parent runs.forge_server - source sourceSets.test - } - - forge_server_gametest { - args '--launchTarget', 'forge_dev_server_gametest' - args '--uniqueWorld' // Unique world is used so that the world regenerates, as well as the world config isn't influenced by other runs - } - - forge_server_gametest_test { - parent runs.forge_server_gametest - source sourceSets.test - } - - forge_data { - args '--launchTarget', 'forge_dev_data', - '--mod', 'forge', - '--all', - '--validate', - '--output', rootProject.file('src/main/generated/'), - '--existing', sourceSets.main.resources.srcDirs[0], - '--assetsDir', downloadAssets.output, - '--assetIndex', "{asset_index}" - } - - forge_data_test { - source sourceSets.test - args '--launchTarget', 'forge_dev_data', - '--mod', '.+', - '--all', - '--validate', - '--output', rootProject.file('src/test/generated/'), - '--existing', sourceSets.main.resources.srcDirs[0], - '--existing', sourceSets.test.resources.srcDirs[0], - '--assetsDir', downloadAssets.output, - '--assetIndex', "{asset_index}" - } - - forge_client_data { - args '--launchTarget', 'forge_dev_client_data', - '--mod', 'forge', - '--all', - '--output', rootProject.file('src/main/generated/'), - '--existing', sourceSets.main.resources.srcDirs[0], - '--assetsDir', downloadAssets.output, - '--assetIndex', "{asset_index}" - } - - forge_client_data_test { - source sourceSets.test - args '--launchTarget', 'forge_dev', - '--launchEntry', 'minecraft/net.minecraft.client.data.Main', - '--launchData', - '--mod', '.+', - '--all', - '--output', rootProject.file('src/test/generated/'), - '--existing', sourceSets.main.resources.srcDirs[0], - '--existing', sourceSets.test.resources.srcDirs[0], - '--assetsDir', downloadAssets.output, - '--assetIndex', "{asset_index}" - } - } -} - -afterEvaluate { - if (!patcher.srgPatches) { - srg2mcpClean { - dependsOn = [] - input = project(':mcp').setupMCP.output - } - userdevJar { - onlyIf = { t -> true } - } - def patches = project.file('build/genPatchesForUserdev/output/') - patches.mkdirs() - def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){ - base = project(':mcp').setupMCP.output - modified = applyRangeMapBase.output - originalPrefix = genPatches.originalPrefix - modifiedPrefix = genPatches.modifiedPrefix - output = patches - autoHeader true - lineEnding = '\n' - } - bakePatches { - dependsOn = [] - input = genPatchesForUserdev.get().output - } - } -} - -tasks.register('downloadCrowdin', Download) { - src 'https://files.minecraftforge.net/crowdin.zip' - dest file('build/crowdin.zip') - useETag 'all' - onlyIfModified true - quiet true -} - -tasks.userdevConfig.configure { - configurations.installer.allDependencies.forEach { - def dep = it.toString() - if (it instanceof ProjectDependency) - dep = "net.minecraftforge:$it.dependencyProject.name:$it.dependencyProject.version" - libraries.add(dep) - } - - // TODO [ForgeDev][UserDev] Split API/Runtime elements in userdev config - // so we don't gotta keep making exceptions for MixinExtras - addCompileDependency(libs.mixinextras.common) - addAnnotationProcessorDependency(libs.mixinextras.common) - - inject = '' // We don't have a userdev sourceset anymore. Empty as a gradle workaround... - runs { - client { - environment 'MCP_MAPPINGS', '{mcp_mappings}' - property 'forge.enableGameTest', 'true' - args '--launchTarget', "forge_userdev_client" - args '--version', 'MOD_DEV' - args '--assetIndex', '{asset_index}' - args '--assetsDir', '{assets_root}' - } - - clientData { - environment 'MCP_MAPPINGS', '{mcp_mappings}' - args '--launchTarget', "forge_userdev_client_data" - args '--assetIndex', '{asset_index}' - args '--assetsDir', '{assets_root}' - } - - server { - environment 'MCP_MAPPINGS', '{mcp_mappings}' - property 'forge.enableGameTest', 'true' - args '--launchTarget', "forge_userdev_server" - } - - gameTestServer { - environment 'MCP_MAPPINGS', '{mcp_mappings}' - args '--launchTarget', "forge_userdev_server_gametest" - } - - data { - environment 'MCP_MAPPINGS', '{mcp_mappings}' - args '--launchTarget', "forge_userdev_data" - args '--assetIndex', '{asset_index}' - args '--assetsDir', '{assets_root}' - } - } -} - -for (def run in patcher.runs + tasks.userdevConfig.runs) { - if (run.parents) continue // We already added this to the parent run config - //run.property 'bsl.debug', 'true' - run.args '--gameDir', '.' - run.jvmArgs '-Djava.net.preferIPv6Addresses=system' - run.client run.name.contains('client') - run.main 'net.minecraftforge.bootstrap.ForgeBootstrap' -} - -for (def run : patcher.runs) { - def isTest = run.name.endsWith('_test') - run.taskName = run.name - run.workingDirectory file('run/' + run.name) - run.ideaModule rootProject.name + '.' + project.name + '.' + (isTest ? 'test' : 'main') - run.property 'bsl.debug', 'true' - run.property 'terminal.jline', 'true' - if (isTest) { - run.property 'forge.enableGameTest', 'true' - run.property 'forgedev.enableTestMods', 'true' - } -} - -tasks.register('downloadVersionManifest', Download) { - src 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json' - dest file('build/versions/version_manifest.json') - useETag 'all' - onlyIfModified true - quiet true -} -tasks.register('downloadJson', Download) { - dependsOn downloadVersionManifest - inputs.file downloadVersionManifest.dest - src { downloadVersionManifest.dest.json.versions.find { it.id == MC_VERSION }.url } - dest file("build/versions/$MC_VERSION/version.json") - useETag 'all' - onlyIfModified true - quiet true -} -tasks.register('downloadClientRaw', Download) { - dependsOn downloadJson - inputs.file downloadJson.dest - src { downloadJson.dest.json.downloads.client.url } - dest file("build/versions/$MC_VERSION/client.jar") - useETag 'all' - onlyIfModified true - quiet true -} -tasks.register('downloadServerRaw', Download) { - dependsOn downloadJson - inputs.file downloadJson.dest - src { downloadJson.dest.json.downloads.server.url } - dest file("build/versions/$MC_VERSION/server-bundled.jar") - useETag 'all' - onlyIfModified true - quiet true -} -tasks.register('extractServer', ExtractFile) { - dependsOn downloadServerRaw - input = downloadServerRaw.dest - target = "META-INF/versions/$MC_VERSION/server-${MC_VERSION}.jar" - output = file("build/versions/$MC_VERSION/server.jar") -} -tasks.register('downloadLibraries', DownloadLibraries) { - dependsOn downloadJson - input = downloadJson.dest - output = rootProject.file('build/libraries/') -} -tasks.register('extractInheritance', ExtractInheritance) { - dependsOn downloadLibraries - tool = INSTALLER_TOOLS + ':fatjar' - args.add '--annotations' - input = genJoinedBinPatches.cleanJar - libraries.addAll downloadLibraries.librariesOutput.map { rf -> - Files.readAllLines(rf.asFile.toPath()).stream().map(File::new).toList() - } -} -tasks.register("findFinalizeSpawnTargets", BytecodePredicateFinder) { - jar = createClientOfficial.output - output = rootProject.file('forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json') - predicate = { - parent, node, insn -> - return 'net/minecraft/world/level/BaseSpawner' != parent.name // Ignore this class as we special case it. - && insn.getOpcode().equals(Opcodes.INVOKEVIRTUAL) - && insn.name == 'finalizeSpawn' - && insn.desc == '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;'; - } -} -tasks.register('validateDeprecations', ValidateDeprecations) { - input = tasks.jar.archiveFile - mcVersion = MC_VERSION -} -tasks.named('jar', Jar).configure { - finalizedBy 'validateDeprecations' -} -tasks.register("downloadInstaller", DownloadMavenArtifact) { - artifact = "net.minecraftforge:installer:2.2.+:fatjar" - changing = true -} -tasks.register("downloadServerShim", DownloadMavenArtifact) { - artifact = libs.bootstrap.shim.get().toString() - changing = true -} -tasks.register('downloadClientMappings', net.minecraftforge.gradle.common.tasks.JarExec) { - ext.output = file('build/client_mappings.tsrg') - tool = INSTALLER_TOOLS + ':fatjar' - args = ['--task', 'DOWNLOAD_MOJMAPS', '--sanitize', '--version', MC_VERSION, '--side', 'client', '--output', output.absolutePath] - outputs.file(output) -} -tasks.register('downloadServerMappings', net.minecraftforge.gradle.common.tasks.JarExec) { - ext.output = file('build/server_mappings.tsrg') - tool = INSTALLER_TOOLS + ':fatjar' - args = ['--task', 'DOWNLOAD_MOJMAPS', '--sanitize', '--version', MC_VERSION, '--side', 'server', '--output', output.absolutePath] - outputs.file(output) -} -tasks.register("createJoinedSRG", DownloadMavenArtifact) { - artifact = "net.minecraft:joined:${MC_VERSION}-${MCP_VERSION}:srg" -} -tasks.register("createClientOfficial", RenameJar) { - tool = FART + ':all' - args = ['--input', '{input}', '--output', '{output}', '--names', '{mappings}', '--ann-fix', '--ids-fix', '--src-fix', '--record-fix', '--strip-sigs', '--reverse'] - mappings = downloadClientMappings.output - dependsOn(downloadClientRaw, downloadClientMappings) - input = downloadClientRaw.dest - output = file("build/createClientOfficial/output.jar") -} -tasks.register("createServerOfficial", RenameJar) { - tool = FART + ':all' - args = ['--input', '{input}', '--output', '{output}', '--names', '{mappings}', '--ann-fix', '--ids-fix', '--src-fix', '--record-fix', '--strip-sigs', '--reverse'] - mappings = downloadServerMappings.output - dependsOn(downloadServerMappings) - input = extractServer.output - output = file("build/createServerOfficial/output.jar") -} -tasks.named('genClientBinPatches').configure { - tool = BINPATCH_TOOL - cleanJar = createClientOfficial.output - dirtyJar = jar.archiveFile -} -tasks.named('genServerBinPatches').configure { - tool = BINPATCH_TOOL - cleanJar = createServerOfficial.output - dirtyJar = jar.archiveFile -} -tasks.named('genJoinedBinPatches').configure { - tool = BINPATCH_TOOL - cleanJar = createJoinedSRG.output -} -tasks.register('applyClientBinPatches', ApplyBinPatches) { - tool = BINPATCH_TOOL - clean = createClientOfficial.output - patch = genClientBinPatches.output - args.addAll(['--data', '--unpatched']) -} -tasks.register('applyServerBinPatches', ApplyBinPatches) { - tool = BINPATCH_TOOL - clean = createServerOfficial.output - patch = genServerBinPatches.output - args.addAll(['--data', '--unpatched']) -} -tasks.register('applyJoinedBinPatches', ApplyBinPatches) { - tool = BINPATCH_TOOL - clean = genJoinedBinPatches.cleanJar - patch = genJoinedBinPatches.output -} -tasks.register('createServerShimClasspath', BundleList) { - dependsOn(downloadServerRaw) - serverBundle = downloadServerRaw.dest -} -tasks.register('createServerShimConfig') { - ext.output = file('build/libs/bootstrap-shim.properties') - doLast { - var cfg = new CleanProperties() - cfg['Main-Class'] = 'net.minecraftforge.bootstrap.ForgeBootstrap' - cfg['Java-Version'] = '21' - cfg['Arguments'] = '--launchTarget forge_server' - cfg.store(output) - } -} -tasks.register('serverShimJar', Jar) { - dependsOn(createServerShimConfig) - from (createServerShimConfig.output) - from (createServerShimClasspath.output) { - rename { 'bootstrap-shim.list' } - } - from (zipTree(downloadServerShim.output)) - manifest { - from { - zipTree(downloadServerShim.output).find { it.name == 'MANIFEST.MF' } - } - - attributes('Class-Path': configurations.bootstrap.resolvedConfiguration.resolvedArtifacts.collect { "libraries/${Util.getMavenInfoFromDep(it).path}" }.join(' ')) - } - archiveClassifier = 'shim' - jarSigner.sign(it) -} -tasks.register('checkAll') { - dependsOn 'checkLicenses' - group = 'checks' -} -tasks.register('checkAllAndFix') { - dependsOn 'findFinalizeSpawnTargets', 'checkLicenses' - group = 'checks' -} - -CheckTask.registerTask(tasks, 'ATs', CheckATs) { - dependsOn extractInheritance, createSrg2Mcp - ats.from patcher.accessTransformers - inheritance = extractInheritance.output - mappings = createSrg2Mcp.output -} - -CheckTask.registerTask(tasks, 'SAS', CheckSAS) { - dependsOn extractInheritance - sass.from patcher.sideAnnotationStrippers - inheritance = extractInheritance.output -} - -CheckTask.registerTask(tasks, 'Excs', CheckExcs) { - dependsOn jar - binary = jar.archiveFile.get().asFile - excs.from patcher.excs -} - -CheckTask.registerTask(tasks, 'Patches', CheckPatches) { - dependsOn 'genPatches' - patchDir = file("$rootDir/patches") - patchesWithS2SArtifact = [ - 'minecraft/net/minecraft/client/renderer/ViewArea.java.patch', - 'minecraft/net/minecraft/data/models/blockstates/Variant.java.patch', - ] -} - -tasks.named('genPatches', GeneratePatches).configure { - finalizedBy checkAndFixPatches - autoHeader true - lineEnding = '\n' -} - -def baseForgeVersionProperty = project.objects.property(String) -baseForgeVersionProperty.set(project.provider { TeamcityRequests.attemptFindBase(rootDir) ?: getLatestForgeVersion(MC_VERSION) }) -baseForgeVersionProperty.finalizeValueOnRead() -final jarCompatibilityTaskSetup = { Task task -> - task.group = 'jar compatibility' - task.onlyIf { - baseForgeVersionProperty.getOrNull() !== null - } -} - -tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) { - inputVersion = baseForgeVersionProperty -} - -tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) { - jarCompatibilityTaskSetup(it) - - clean = project.tasks.createJoinedSRG.output - patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput } - output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') } -} - -tasks.register('mergeBaseForgeJar', MergeJars) { - jarCompatibilityTaskSetup(it) - - inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output }) - inputJars.from(baseForgeVersionProperty.map { inputVersion -> - def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile - project.rootProject.extensions.download.run { - src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar" - dest output - } - return output - }) -} - -tasks.register('checkJarCompatibility', CheckJarCompatibility) { - jarCompatibilityTaskSetup(it) - dependsOn 'setupCheckJarCompatibility' - - baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output } - baseLibraries.from(project.tasks.named('createJoinedSRG').flatMap { it.output }) - - inputJar = project.tasks.named('reobfJar').flatMap { it.output } - - commonLibraries.from(project.configurations.minecraftImplementation) - commonLibraries.from(project.configurations.installer) -} - -tasks.register('launcherJson', LauncherJson).configure { - json.putAll([ - mainClass: 'net.minecraftforge.bootstrap.ForgeBootstrap', - arguments: [ - game: [ - '--launchTarget', 'forge_client' - ], - jvm: [ - '-Djava.net.preferIPv6Addresses=system' - ] - ] - ] as LinkedHashMap) -} - -tasks.register('installerJson', InstallerJson) { - icon = rootProject.file('icon.ico') - - // Json to install into the client's launcher - dependsOn(launcherJson) - input.from(launcherJson.output) - - // Download Official Mappings - dependsOn(downloadClientMappings, downloadServerMappings) - input.from(downloadClientMappings.output, downloadServerMappings.output) - // Get 'base' MC jar, Client is straight download, server is extracted from the bundle - dependsOn(downloadClientRaw, extractServer) - input.from(downloadClientRaw.dest, extractServer.output) - // Rename MC Jar - dependsOn(createClientOfficial, createServerOfficial) - input.from(createClientOfficial.output, createServerOfficial.output) - // Apply Binary patches to vanilla jar - dependsOn(applyClientBinPatches, applyServerBinPatches) - input.from(applyClientBinPatches.output, applyServerBinPatches.output, genClientBinPatches.toolJar) - - doFirst { - var libs = libraries - String[] INSTALLER_TOOLS_CLASSPATH = getClasspath(project, libs, INSTALLER_TOOLS) - json.putAll([ - _comment: launcherJson.json._comment, - hideExtract: true, - spec: 1, - profile: project.name, - version: launcherJson.json.id, - path: Util.getMavenInfoFromTask(tasks.serverShimJar).name, - minecraft: MC_VERSION, - serverJarPath: '{LIBRARY_DIR}/net/minecraft/server/{MINECRAFT_VERSION}/server-{MINECRAFT_VERSION}-bundled.jar', - data: [ - MOJMAPS: [ - client: "[net.minecraft:client:${MC_VERSION}:mappings@tsrg]", - server: "[net.minecraft:server:${MC_VERSION}:mappings@tsrg]" - ], - MOJMAPS_SHA: [ - client: "'${downloadClientMappings.output.sha1}'", - server: "'${downloadServerMappings.output.sha1}'" - ], - MC_UNPACKED: [ - client: "[net.minecraft:client:${MC_VERSION}]", - server: "[net.minecraft:server:${MC_VERSION}:unpacked]" - ], - MC_UNPACKED_SHA: [ - client: "'${downloadClientRaw.dest.sha1}'", - server: "'${extractServer.output.get().asFile.sha1}'" - ], - MC_OFF: [ - client: "[net.minecraft:client:${MC_VERSION}:official]", - server: "[net.minecraft:server:${MC_VERSION}:official]" - ], - MC_OFF_SHA: [ - client: "'${createClientOfficial.output.get().asFile.sha1}'", - server: "'${createServerOfficial.output.get().asFile.sha1}'" - ], - BINPATCH: [ - client: '/data/client.lzma', - server: '/data/server.lzma' - ], - PATCHED: [ - client: "[${project.group}:${project.name}:${project.version}:client]", - server: "[${project.group}:${project.name}:${project.version}:server]" - ], - PATCHED_SHA: [ - client: "'${applyClientBinPatches.output.get().asFile.sha1}'", - server: "'${applyServerBinPatches.output.get().asFile.sha1}'" - ] - ], - processors: [ - [ - sides: ['server'], - jar: INSTALLER_TOOLS, - classpath: INSTALLER_TOOLS_CLASSPATH, - args: [ - '--task', 'EXTRACT_FILES', - '--archive', '{INSTALLER}', - - '--from', 'data/README.txt', - '--to', '{ROOT}/README.txt', - - '--from', 'data/run.sh', - '--to', '{ROOT}/run.sh', - '--exec', '{ROOT}/run.sh', - - '--from', 'data/run.bat', - '--to', '{ROOT}/run.bat', - - '--from', 'data/user_jvm_args.txt', - '--to', '{ROOT}/user_jvm_args.txt', - '--optional', '{ROOT}/user_jvm_args.txt', - - '--from', 'data/unix_args.txt', - '--to', "{ROOT}/libraries/${MAVEN_PATH}/unix_args.txt", - - '--from', 'data/win_args.txt', - '--to', "{ROOT}/libraries/${MAVEN_PATH}/win_args.txt" - ] - ], [ - sides: ['server'], - jar: INSTALLER_TOOLS, - classpath: INSTALLER_TOOLS_CLASSPATH, - args: [ - '--task', 'BUNDLER_EXTRACT', - '--input', '{MINECRAFT_JAR}', - '--output', '{ROOT}/libraries/', - '--libraries' - ] - ], [ - sides: ['server'], - jar: INSTALLER_TOOLS, - classpath: INSTALLER_TOOLS_CLASSPATH, - args: [ - '--task', 'BUNDLER_EXTRACT', - '--input', '{MINECRAFT_JAR}', - '--output', '{MC_UNPACKED}', - '--jar-only' - ], - outputs: [ - '{MC_UNPACKED}': '{MC_UNPACKED_SHA}' - ] - ], [ - jar: INSTALLER_TOOLS, - classpath: INSTALLER_TOOLS_CLASSPATH, - args: [ - '--task', 'DOWNLOAD_MOJMAPS', - '--sanitize', - '--version', MC_VERSION, - '--side', '{SIDE}', - '--output', '{MOJMAPS}' - ], - outputs: [ - '{MOJMAPS}': '{MOJMAPS_SHA}' - ] - ], [ - sides: ['server'], - jar: FART, - classpath: getClasspath(project, libs, FART), - args: [ - '--input', '{MC_UNPACKED}', - '--output', '{MC_OFF}', - '--names', '{MOJMAPS}', - '--ann-fix', '--ids-fix', '--src-fix', '--record-fix', '--strip-sigs', '--reverse' - ], - outputs: [ - '{MC_OFF}': '{MC_OFF_SHA}' - ] - ], [ - sides: ['client'], - jar: FART, - classpath: getClasspath(project, libs, FART), - args: [ - '--input', '{MINECRAFT_JAR}', - '--output', '{MC_OFF}', - '--names', '{MOJMAPS}', - '--ann-fix', '--ids-fix', '--src-fix', '--record-fix', '--strip-sigs', '--reverse' - ], - outputs: [ - '{MC_OFF}': '{MC_OFF_SHA}' - ] - ], [ - jar: BINPATCH_TOOL.rsplit(':', 1)[0], // remove :fatjar - classpath: getClasspath(project, libs, BINPATCH_TOOL.rsplit(':', 1)[0]), - args: [ - '--clean', '{MC_OFF}', - '--output', '{PATCHED}', - '--apply', '{BINPATCH}', - '--data', '--unpatched' - ], - outputs: [ - '{PATCHED}': '{PATCHED_SHA}' - ] - ] - ] - ] as LinkedHashMap) - getClasspath(project, libs, MCP_ARTIFACT.descriptor) //Tell it to download mcp_config - } -} - -tasks.register('officialClassesOnly', Zip).configure { - dependsOn(jar) - destinationDirectory = file('build/libs') - archiveClassifier = 'official-classes' - from zipTree(jar.archiveFile).matching { - include '**/*.class' - exclude 'mcp/**' - } -} - -tasks.named('filterJarNew').configure { - dependsOn('officialClassesOnly') - input = officialClassesOnly.archiveFile -} - -tasks.register('filterJarNewSRG', FilterNewJar).configure { - input = reobfJar.output - srg = filterJarNew.srg - blacklist = filterJarNew.blacklist -} - -tasks.named('universalJar').configure { - dependsOn downloadCrowdin - from zipTree(downloadCrowdin.dest).matching { - include 'assets/forge/lang/*.json' - } - - from(EXTRA_TXTS) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - exclude '.cache' - - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.forge' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'Forge', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': SPEC_VERSION, - 'Implementation-Title': project.group, - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': FORGE_VERSION - ] as LinkedHashMap, 'net/minecraftforge/versions/forge/') - attributes([ - 'Specification-Title': 'Minecraft', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': MC_VERSION, - 'Implementation-Title': 'MCP', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': MCP_VERSION - ] as LinkedHashMap, 'net/minecraftforge/versions/mcp/') - } - jarSigner.sign(it) -} - -tasks.register('universalJarSrg', Jar).configure { - from zipTree(filterJarNewSRG.output) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from zipTree(universalJar.archiveFile) - destinationDirectory = file('build/libs') - archiveClassifier = 'universal-srg' - manifest.from(universalJar.manifest) - jarSigner.sign(it) -} - -tasks.named('userdevConfig').configure { - universal = "$project.group:$project.name:$project.version:universal-srg@jar" -} - -tasks.register('installerJar', InstallerJar) { - fat = !System.env.TEAMCITY_VERSION - //offline = true - from(EXTRA_TXTS) - from(rootProject.file('/forge_installer_logo.png')) { - rename { 'big_logo.png' } - } - from(genClientBinPatches.output) { - rename { 'data/client.lzma' } - } - from(genServerBinPatches.output) { - rename { 'data/server.lzma' } - } - - final var argsFile = rootProject.file('server_files/args.txt') - final Map> tokens = [tokens: [ - SHIM_JAR_FILE: serverShimJar.archiveFileName.get(), - MAVEN_PATH: MAVEN_PATH - ]] - from(argsFile) { - filter(tokens, ReplaceTokens) - into 'data' - rename { 'unix_args.txt' } - } - from(argsFile) { - filter(tokens, ReplaceTokens) - into 'data' - rename { 'win_args.txt' } - } - - from(rootProject.file('server_files')) { - filter(tokens, ReplaceTokens) - into 'data' - exclude 'args.txt' - } - - jarSigner.sign(it) -} - -tasks.register('mdkZip', Zip) { - archiveBaseName = project.name - archiveClassifier = 'mdk' - archiveVersion = project.version - destinationDirectory = file('build/libs') - - from rootProject.file('gradlew') - from rootProject.file('gradlew.bat') - from(EXTRA_TXTS) - from(rootProject.file('gradle/')){ - into('gradle/') - } - from(rootProject.file('mdk/')){ - rootProject.file('mdk/gitignore.txt').eachLine{ - if (!it.trim().isEmpty() && !it.trim().startsWith('#')) - exclude it - } - filter(ReplaceTokens, tokens: [ - FORGE_VERSION: FORGE_VERSION, - FORGE_GROUP: project.group, - FORGE_NAME: project.name, - MC_VERSION: MC_VERSION, - MAPPING_CHANNEL: MAPPING_CHANNEL, - MAPPING_VERSION: MAPPING_VERSION, - FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0], - MC_NEXT_VERSION: MC_NEXT_VERSION - ]) - rename 'gitignore\\.txt', '.gitignore' - rename 'gitattributes\\.txt', '.gitattributes' - } - from(rootProject.file('src/test/java/com/example/examplemod/')) { - into('src/main/java/com/example/examplemod/') - } - from(rootProject.file('src/test/generated/mdk_datagen/')) { - into('src/main/resources/') - exclude '**/.cache/' - } -} - -license { - header = file("$rootDir/LICENSE-header.txt") - - include 'net/minecraftforge/' - exclude 'net/minecraftforge/common/LenientUnboundedMapCodec.java' - - tasks { - main { - files.from files("$rootDir/src/main/java") - } - test { - files.from files("$rootDir/src/test/java") - } - } -} - -tasks.register('genAllData') { - dependsOn 'forge_data', 'forge_test_data' -} - -if (project.hasProperty('UPDATE_MAPPINGS')) { - extractRangeMap { - sources.from sourceSets.test.java.srcDirs - addDependencies compileTestJava.classpath - } - applyRangeMap { - sources.from sourceSets.test.java.srcDirs - } - sourceSets.test.java.srcDirs.each { extractMappedNew.addTarget it } -} - -tasks.named('javadoc', Javadoc).configure { - description 'Generates the combined javadocs for the FML projects and the main Forge project' - var includedProjects = [ ':fmlcore', ':fmlloader', ':javafmllanguage', ':mclanguage', ':forge-transformers' ] - source includedProjects.collect { project(it).sourceSets.main.allJava } - classpath = classpath + files(includedProjects.collect { project(it).sourceSets.main.compileClasspath }) - - var docsDir = rootProject.file('src/docs/') - inputs.dir(docsDir) - .withPropertyName('docs resources directory') - .withPathSensitivity(PathSensitivity.RELATIVE) - .optional() - - failOnError = false - - // Exclude the Minecraft classes if not enabled - if (!project.hasProperty('generateAllDocumentation')) { - exclude 'net/minecraft/**' - exclude 'com/mojang/**' - } - exclude 'mcp/**' - - options.addStringOption('Xdoclint:all,-missing', '-public') - options { - stylesheetFile = new File(docsDir, 'stylesheet.css') - - tags = [ - 'apiNote:a:API Note:', - 'implSpec:a:Implementation Requirements:', - 'implNote:a:Implementation Note:' - ] - - groups = [ - 'Forge Mod Loader': [ - 'net.minecraftforge.fml.common.asm*', - 'net.minecraftforge.fml.loading*', - 'net.minecraftforge.fml.server*' - ], - 'FML Core': [ - 'net.minecraftforge.fml', - 'net.minecraftforge.fml.config*', - 'net.minecraftforge.fml.event*', - 'net.minecraftforge.fml.util*' - ], - 'FML Common': [ - 'net.minecraftforge.fml.core', - 'net.minecraftforge.fml.event.config', - 'net.minecraftforge.fml.event.lifecycle' - ], - 'FML Java/MC Language Providers': [ - 'net.minecraftforge.fml.common', - 'net.minecraftforge.fml.javafmlmod', - 'net.minecraftforge.fml.mclanguageprovider' - ], - 'Minecraft Forge API': [ - 'net.minecraftforge*' - ] - ] - - author = false - noSince = true - noHelp = true - - bottom = "Minecraft Forge is an open source modding API for Minecraft: Java Edition, licensed under the Lesser GNU General Public License, version 2.1." - windowTitle = "Minecraft Forge API ${VERSION}" - docTitle = "Minecraft Forge API - ${FORGE_VERSION} for Minecraft ${MC_VERSION}" - header = "
${FORGE_VERSION} for Minecraft ${MC_VERSION}
" - } - - doLast { - project.copy { - from docsDir - exclude '/stylesheet.css' - into destinationDir - } - } -} - -publishing { - publications.register('mavenJava', MavenPublication).configure { - artifact universalJar - artifact universalJarSrg - artifact installerJar - artifact mdkZip - artifact userdevJar - artifact sourcesJar - artifact serverShimJar - - artifactId = project.name - pom { - name = project.name - description = 'Modifactions to Minecraft to enable mod developers.' - url = 'https://github.com/MinecraftForge/MinecraftForge' - gradleutils.pom.setGitHubDetails(pom, 'MinecraftForge') - license gradleutils.pom.Licenses.LGPLv2_1 - } - } - - repositories { - maven gradleutils.publishingForgeMaven - } -} - -// Make sure we run bin compat checking during local testing. -if ((!System.env.MAVEN_USER || !System.env.MAVEN_PASSWORD) && CHECK_COMPATIBILITY == "true") - tasks.named('publish').configure { dependsOn(':forge:checkJarCompatibility') } diff --git a/build_shared.gradle b/build_shared.gradle deleted file mode 100644 index b988510649..0000000000 --- a/build_shared.gradle +++ /dev/null @@ -1,89 +0,0 @@ -import net.minecraftforge.forge.tasks.CleanProperties - -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'net.minecraftforge.gradleutils' - -group = 'net.minecraftforge' -version = VERSION -println("Version: $version") - -repositories { - mavenCentral() - maven gradleutils.forgeMaven - maven gradleutils.minecraftLibsMaven - //mavenLocal() -} - -tasks.withType(Javadoc).configureEach { - options.tags = [ - 'apiNote:a:API Note:', - 'implSpec:a:Implementation Requirements:', - 'implNote:a:Implementation Note:' - ] - options.addStringOption('Xdoclint:all,-missing', '-public') -} - -// We need to write the manifest to the binary file so we have properly versioned packaged at dev time. -tasks.register('writeManifest') { - doLast { - if (plugins.findPlugin('net.minecraftforge.gradle.patcher')) // Forge project - universalJar.manifest.writeTo(rootProject.file('src/main/resources/META-INF/MANIFEST.MF')) - else - jar.manifest.writeTo(project.file('src/main/resources/META-INF/MANIFEST.MF')) - } -} - -tasks.register('generateResources') { - dependsOn('writeManifest') -} - -tasks.named('processResources') { - dependsOn(generateResources) -} - -// Make sure out manifests get written before compiling the code, IDEA calls this task if you tell it to use the gradle build. -tasks.withType(JavaCompile).configureEach { - dependsOn 'generateResources' - dependsOn 'processResources' // Needed because we merge the output of this with the output of the compile task. And gradle detects downstream tasks using the output without a hard dep - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation - options.warnings = false // Shutup deprecated for removal warnings - options.forkOptions.jvmArgs += '-Xmx6G' // Needed to make compiling faster, and not run out of heap space in some cases. -} - -// Merge the resources and classes into the same directory. We'll need to split them at runtime because -// Minecraft and Forge are in the same sourceSet as they are inter dependent.. for now.. -sourceSets.each { - def dir = layout.buildDirectory.dir("classes/java/$it.name") - it.output.resourcesDir = dir - it.java.destinationDirectory = dir -} - -tasks.register('copyEclipseSettings') { - doLast { - rootProject.fileTree('ide/eclipse/template/.settings/').matching { include '**/*.prefs' }.each { file -> - def target = project.file('.settings/' + file.name) - def temp = new CleanProperties().load(file) - def exst = new CleanProperties().load(target) - exst.put('eclipse.preferences.version', '1') - exst.putAll(temp) - exst.store(target) - } - } -} - -// TODO: [Gradle][IntelliJ] Auto trigger these tasks on import. -eclipse { - // Run everytime eclipse builds the code - //autoBuildTasks writeManifest - // Run when importing the project - synchronizationTasks generateResources, copyEclipseSettings, eclipseClasspath, eclipseProject -} - -idea { - module { - // IntelliJ IDEA does not do this by itself anymore... - downloadJavadoc = true - downloadSources = true - } -} diff --git a/docs/README.md b/docs/README.md index 6a1fb3a120..e4082e7eac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,8 +2,8 @@ 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.21.10-&query=$.promos["1.21.10-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.21.10-&query=$.promos["1.21.10-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo= +[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=26.2-&query=$.promos["26.2-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=26.2-&query=$.promos["26.2-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! @@ -34,12 +34,13 @@ For support and questions, visit [the Support Forum][Support-Forum] or [the Forg We require the version of Java that Minecraft requires, which is currently: -| Minecraft | Java | -|---------------|-------------------| -| 1.20.6+ | [21][Adoptium-21] | -| 1.18 - 1.20.4 | [17][Adoptium-17] | -| 1.17.1 | [16][Adoptium-16] | -| 1.16.5- | [8][Adoptium-8] | +| Minecraft | Java | +|------------------|-------------------| +| 26.1+ | [25][Adoptium-25] | +| 1.20.6 - 1.21.11 | [21][Adoptium-21] | +| 1.18 - 1.20.4 | [17][Adoptium-17] | +| 1.17.1 | [16][Adoptium-16] | +| 1.16.5- | [8][Adoptium-8] | **If you are on Windows and have difficulty using Java to launch JAR files, consider using [Jarfix by Johann Löfflmann][Jarfix].** @@ -80,6 +81,7 @@ YourKit for providing us accesss to their [YourKit Java Profiler] which helps id [Download]: https://files.minecraftforge.net/ +[Adoptium-25]: https://adoptium.net/temurin/releases/?version=25 [Adoptium-21]: https://adoptium.net/temurin/releases/?version=21 [Adoptium-17]: https://adoptium.net/temurin/releases/?version=17 [Adoptium-16]: https://adoptium.net/temurin/releases/?version=16 diff --git a/dump.sh b/dump.sh new file mode 100644 index 0000000000..196298dd02 --- /dev/null +++ b/dump.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +for file in $(find repo | grep --invert-match -e md5 -e sha | grep -e .jar -e .zip); do + file_path=$(realpath $file) + file_name=$(basename $file) + + echo "$file_name" + files=$(unzip -l $file | awk '{print $4}') + for f in $files; do + out="_actual/$file_name/$f" + parent=$(dirname "$out") + echo $out + + if [ ! -d "$parent" ]; then + mkdir -p "$parent" + fi + + if [[ $f == *.class ]]; then + javap -v -p jar:file://$file_path!/$f | tail -n +4 >$out.txt + elif [[ $f != */ && $f != "Name" && $f != "----" ]]; then + unzip -o -q $file $f -d _actual/$file_name + fi + done +done \ No newline at end of file diff --git a/fmlcore/build.gradle b/fmlcore/build.gradle index 2c1153c9c9..d6adcbbea8 100644 --- a/fmlcore/build.gradle +++ b/fmlcore/build.gradle @@ -1,68 +1,78 @@ -import net.minecraftforge.gradleutils.PomUtils - plugins { id 'java-library' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') +gradleutils.displayName = 'FML' +final vendor = 'Forge Development LLC' +description = 'Modifications to Minecraft to enable mod developers.' dependencies { - compileOnly(libs.jetbrains.annotations) + compileOnly libs.jetbrains.annotations - api(libs.eventbus) - annotationProcessor(libs.eventbus.validator) + api libs.eventbus - implementation(project(':fmlloader')) - implementation(libs.commons.io) + implementation projects.fmlloader + implementation libs.commons.io } java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.fmlcore', - 'FMLModType': 'LIBRARY' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'FML', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'FML', - 'Implementation-Version': '1.0', - 'Implementation-Vendor': 'Forge Development LLC' - ] as LinkedHashMap, 'net/minecraftforge/fml/') - } +license { + header = rootProject.file('LICENSE-header.txt') +} +changelog { + from changelogBase } tasks.withType(JavaCompile).configureEach { options.compilerArgs << '-Xlint:-unchecked' } -license { - header = rootProject.file('LICENSE-header.txt') +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.fmlcore', + 'FMLModType' : 'LIBRARY' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Version': '1.0', + 'Implementation-Vendor' : vendor + ], 'net/minecraftforge/fml/') + } } publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'fmlcore' - pom { - name = project.name - description = 'Modifactions to Minecraft to enable mod developers.' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } - } - repositories { maven gradleutils.publishingForgeMaven } + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java b/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java index 18bc69f54f..d17eaedb7b 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java @@ -14,16 +14,14 @@ import java.util.List; import java.util.function.BooleanSupplier; import java.util.function.Supplier; -public class CrashReportCallables -{ +public class CrashReportCallables { private static final Logger LOGGER = LogUtils.getLogger(); private static final List crashCallables = Collections.synchronizedList(new ArrayList<>()); /** * Register a custom {@link ISystemReportExtender} */ - public static void registerCrashCallable(ISystemReportExtender callable) - { + public static void registerCrashCallable(ISystemReportExtender callable) { crashCallables.add(callable); } @@ -33,19 +31,15 @@ public class CrashReportCallables * @param headerName The name of the system report entry * @param reportGenerator The report generator to be called when a crash report is built */ - public static void registerCrashCallable(String headerName, Supplier reportGenerator) - { - registerCrashCallable(new ISystemReportExtender() - { + public static void registerCrashCallable(String headerName, Supplier reportGenerator) { + registerCrashCallable(new ISystemReportExtender() { @Override - public String getLabel() - { + public String getLabel() { return headerName; } @Override - public String get() - { + public String get() { return reportGenerator.get(); } }); @@ -58,31 +52,23 @@ public class CrashReportCallables * @param reportGenerator The report generator to be called when a crash report is built * @param active The supplier of the flag to be checked when a crash report is built */ - public static void registerCrashCallable(String headerName, Supplier reportGenerator, BooleanSupplier active) - { - registerCrashCallable(new ISystemReportExtender() - { + public static void registerCrashCallable(String headerName, Supplier reportGenerator, BooleanSupplier active) { + registerCrashCallable(new ISystemReportExtender() { @Override - public String getLabel() - { + public String getLabel() { return headerName; } @Override - public String get() - { + public String get() { return reportGenerator.get(); } @Override - public boolean isActive() - { - try - { + public boolean isActive() { + try { return active.getAsBoolean(); - } - catch (Throwable t) - { + } catch (Throwable t) { LOGGER.warn("CrashCallable '{}' threw an exception while checking the active flag, disabling", headerName, t); return false; } @@ -90,8 +76,7 @@ public class CrashReportCallables }); } - public static List allCrashCallables() - { + public static List allCrashCallables() { return List.copyOf(crashCallables); } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/DistExecutor.java b/fmlcore/src/main/java/net/minecraftforge/fml/DistExecutor.java deleted file mode 100644 index 0367576e5e..0000000000 --- a/fmlcore/src/main/java/net/minecraftforge/fml/DistExecutor.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.fml; - -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.fml.loading.FMLEnvironment; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.Serializable; -import java.lang.invoke.SerializedLambda; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Objects; -import java.util.concurrent.Callable; -import java.util.function.Supplier; - -/** - * Use to execute code conditionally based on sidedness. - *
    - *
  • When you want to call something on one side and return a result {@link #safeCallWhenOn(Dist, Supplier)}
  • - *
  • When you want to call one thing on one side, another thing on the other and return a result {@link #safeRunForDist(Supplier, Supplier)}
  • - *
  • When you want to run something on one side {@link #safeRunWhenOn(Dist, Supplier)}
  • - *
- * - * @deprecated Historically, this allowed for safe execution of code on the correct side by exploiting a low-level - * detail in Java 8, but in newer versions a simple if check is enough. - *
- * For example: - *
{@code
- * if (FMLEnvironment.dist.isClient()) {
- *     // client code here
- * }
- * }
- */ -@Deprecated(since = "1.21.5", forRemoval = true) -public final class DistExecutor -{ - private static final Logger LOGGER = LogManager.getLogger(); - private DistExecutor() {} - - /** - * Run the callable in the supplier only on the specified {@link Dist}. - * This method is NOT sided-safe and special care needs to be taken in code using this method that implicit class - * loading is not triggered by the Callable. - * - * This method can cause unexpected ClassNotFound exceptions. - * - * Use {@link #safeCallWhenOn(Dist, Supplier)} where possible. - * - * @param dist The dist to run on - * @param toRun A supplier of the callable to run (Supplier wrapper to ensure classloading only on the appropriate dist) - * @param The return type from the callable - * @return The callable's result - * @deprecated use {@link #safeCallWhenOn(Dist, Supplier)} instead. This remains for advanced use cases. - */ - @Deprecated - public static T callWhenOn(Dist dist, Supplier> toRun) { - return unsafeCallWhenOn(dist, toRun); - } - - public static T unsafeCallWhenOn(Dist dist, Supplier> toRun) { - if (dist == FMLEnvironment.dist) { - try - { - return toRun.get().call(); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - return null; - } - - /** - * Call the SafeCallable when on the correct {@link Dist}. - * - * The lambda supplied here is required to be a method reference to a method defined in - * another class, otherwise an invalid SafeReferent error will be thrown - * @param dist the dist which this will run on - * @param toRun the SafeCallable to run and return the result from - * @param The type of the SafeCallable - * @return the result of the SafeCallable or null if on the wrong side - */ - public static T safeCallWhenOn(Dist dist, Supplier> toRun) { - validateSafeReferent(toRun); - return callWhenOn(dist, toRun::get); - } - - /** - * Runs the supplied Runnable on the speicified side. Same warnings apply as {@link #callWhenOn(Dist, Supplier)}. - * - * This method can cause unexpected ClassNotFound exceptions. - * - * @see #callWhenOn(Dist, Supplier) - * @param dist Dist to run this code on - * @param toRun The code to run - * @deprecated use {@link #safeRunWhenOn(Dist, Supplier)} where possible. Advanced uses only. - */ - @Deprecated - public static void runWhenOn(Dist dist, Supplier toRun) { - unsafeRunWhenOn(dist, toRun); - } - /** - * Runs the supplied Runnable on the speicified side. Same warnings apply as {@link #unsafeCallWhenOn(Dist, Supplier)}. - * - * This method can cause unexpected ClassNotFoundException problems in common scenarios. Understand the pitfalls of - * the way the class verifier works to load classes before using this. - * - * Use {@link #safeRunWhenOn(Dist, Supplier)} if you can. - * - * @see #unsafeCallWhenOn(Dist, Supplier) - * @param dist Dist to run this code on - * @param toRun The code to run - */ - public static void unsafeRunWhenOn(Dist dist, Supplier toRun) { - if (dist == FMLEnvironment.dist) { - toRun.get().run(); - } - } - - /** - * Call the supplied SafeRunnable when on the correct Dist. - * @param dist The dist to run on - * @param toRun The code to run - */ - public static void safeRunWhenOn(Dist dist, Supplier toRun) { - validateSafeReferent(toRun); - if (dist == FMLEnvironment.dist) { - toRun.get().run(); - } - } - /** - * Executes one of the two suppliers, based on which side is active. - * - *

- * Example (replacement for old SidedProxy):
- * {@code Proxy p = DistExecutor.runForDist(()->ClientProxy::new, ()->ServerProxy::new);} - * - * NOTE: the double supplier is required to avoid classloading the secondary target. - * - * @param clientTarget The supplier supplier to run when on the {@link Dist#CLIENT} - * @param serverTarget The supplier supplier to run when on the {@link Dist#DEDICATED_SERVER} - * @param The common type to return - * @return The returned instance - * @deprecated Use {@link #safeRunForDist(Supplier, Supplier)} - */ - @Deprecated - public static T runForDist(Supplier> clientTarget, Supplier> serverTarget) { - return unsafeRunForDist(clientTarget, serverTarget); - } - - /** - * Unsafe version of {@link #safeRunForDist(Supplier, Supplier)}. Use only when you know what you're doing - * and understand why the verifier can cause unexpected ClassNotFoundException crashes even when code is apparently - * not sided. Ensure you test both sides fully to be confident in using this. - * - * @param clientTarget The supplier supplier to run when on the {@link Dist#CLIENT} - * @param serverTarget The supplier supplier to run when on the {@link Dist#DEDICATED_SERVER} - * @param The common type to return - * @return The returned instance - */ - public static T unsafeRunForDist(Supplier> clientTarget, Supplier> serverTarget) { - switch (FMLEnvironment.dist) - { - case CLIENT: - return clientTarget.get().get(); - case DEDICATED_SERVER: - return serverTarget.get().get(); - default: - throw new IllegalArgumentException("UNSIDED?"); - } - } - /** - * Executes one of the two suppliers, based on which side is active. - * - *

- * Example (replacement for old SidedProxy):
- * {@code Proxy p = DistExecutor.safeRunForDist(()->ClientProxy::new, ()->ServerProxy::new);} - * - * NOTE: the double supplier is required to avoid classloading the secondary target. - * - * @param clientTarget The supplier supplier to run when on the {@link Dist#CLIENT} - * @param serverTarget The supplier supplier to run when on the {@link Dist#DEDICATED_SERVER} - * @param The common type to return - * @return The returned instance - */ - public static T safeRunForDist(Supplier> clientTarget, Supplier> serverTarget) { - validateSafeReferent(clientTarget); - validateSafeReferent(serverTarget); - switch (FMLEnvironment.dist) - { - case CLIENT: - return clientTarget.get().get(); - case DEDICATED_SERVER: - return serverTarget.get().get(); - default: - throw new IllegalArgumentException("UNSIDED?"); - } - } - - /** - * A safe referent. This will assert that it is being called via a separated class method reference. This will - * avoid the common pitfalls of {@link #callWhenOn(Dist, Supplier)} above. - * - * SafeReferents assert that they are defined as a separate method outside the scope of the calling class. - * - * Implementations need to be defined in a separate class to the referring site, with appropriate - * visibility to be accessible at the callsite (generally, avoid private methods). - * - *

- * Valid:
- * - * {@code DistExecutor.safeCallWhenOn(Dist.CLIENT, ()->AnotherClass::clientOnlyMethod);} - * - *

- * Invalid:
- * - * {@code DistExecutor.safeCallWhenOn(Dist.CLIENT, ()->()->Minecraft.getInstance().world);} - */ - public interface SafeReferent {} - - /** - * SafeCallable version of {@link SafeReferent}. - * @see SafeReferent - * @param The return type of the Callable - */ - public interface SafeCallable extends SafeReferent, Callable, Serializable {} - - /** - * SafeSupplier version of {@link SafeReferent} - * @param The return type of the Supplier - */ - public interface SafeSupplier extends SafeReferent, Supplier, Serializable {} - - /** - * SafeRunnable version of {@link SafeReferent} - */ - public interface SafeRunnable extends SafeReferent, Runnable, Serializable {} - - private static final void validateSafeReferent(Supplier safeReferentSupplier) { - if (FMLEnvironment.production) return; - final SafeReferent setter; - try { - setter = safeReferentSupplier.get(); - } catch (Exception e) { - // Typically a class cast exception, just return out, expected. - return; - } - - for (Class cl = setter.getClass(); cl != null; cl = cl.getSuperclass()) { - try { - Method m = cl.getDeclaredMethod("writeReplace"); - m.setAccessible(true); - Object replacement = m.invoke(setter); - if (!(replacement instanceof SerializedLambda)) - break;// custom interface implementation - SerializedLambda l = (SerializedLambda) replacement; - if (Objects.equals(l.getCapturingClass(), l.getImplClass())) { - LOGGER.fatal("Detected unsafe referent usage, please view the code at {}",Thread.currentThread().getStackTrace()[3]); - throw new RuntimeException("Unsafe Referent usage found in safe referent method"); - } - } catch (NoSuchMethodException e) { - } catch (IllegalAccessException | InvocationTargetException e) { - break; - } - } - } -} diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java b/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java index df2ea454e0..0d48ff0c5c 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java @@ -6,13 +6,14 @@ package net.minecraftforge.fml; import net.minecraftforge.fml.loading.progress.ProgressMeter; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import java.util.function.Consumer; import java.util.function.Function; -import java.util.function.ToIntFunction; +import java.util.function.IntSupplier; +import java.util.function.Supplier; /** * A mod loading state. During mod loading, the mod loader transitions between states in a defined sorted list of states, @@ -20,6 +21,7 @@ import java.util.function.ToIntFunction; * * @see IModStateProvider */ +@NullMarked public interface IModLoadingState { /** * {@return the name of this state} @@ -42,19 +44,21 @@ public interface IModLoadingState { /** * {@return a function returning a human-friendly message for this state} */ - Function message(); + Supplier message(); /** * @return a function that computes the size of this transition based on the size of the modlist. * Used to compute progress. */ - ToIntFunction size(); + default IntSupplier size() { + return ModList::size; + } /** * {@return an optional runnable, which runs before starting the transition from this state to the next} * @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function) */ - Optional> inlineRunnable(); + @Nullable Runnable inlineRunnable(); /** * Builds the transition task for this state with a blank pre-sync and post-sync task. @@ -65,14 +69,14 @@ public interface IModLoadingState { * @return a transition task for this state * @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function) */ - default Optional> buildTransition( + default @Nullable CompletableFuture buildTransition( final Executor syncExecutor, final Executor parallelExecutor, final ProgressMeter progressBar ) { return buildTransition(syncExecutor, parallelExecutor, progressBar, - e -> CompletableFuture.completedFuture(null), - e -> CompletableFuture.completedFuture(null) + _ -> CompletableFuture.completedFuture(null), + _ -> CompletableFuture.completedFuture(null) ); } @@ -87,7 +91,7 @@ public interface IModLoadingState { * @param postSyncTask a function which returns a task to run after event post-dispatch hook * @return a transition task for this state */ - Optional> buildTransition(final Executor syncExecutor, + @Nullable CompletableFuture buildTransition(final Executor syncExecutor, final Executor parallelExecutor, final ProgressMeter progressBar, final Function> preSyncTask, diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java index c1c57db993..9eb9e25d48 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java @@ -6,21 +6,16 @@ package net.minecraftforge.fml; import net.minecraftforge.fml.event.IModBusEvent; -import net.minecraftforge.fml.loading.progress.ProgressMeter; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.BiFunction; import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Stream; +import net.minecraftforge.fml.loading.progress.ProgressMeter; import org.jetbrains.annotations.Nullable; public interface IModStateTransition { - /** Magic value to allow me to optimize the futures list by ignoring the default value without making old methods nullable. */ - BiFunction, CompletableFuture> NULL_HOOK = (e, g) -> CompletableFuture.completedFuture(null); - static IModStateTransition buildNoopTransition() { return ModStateTransitionHelper.NOOP; } @@ -40,15 +35,6 @@ public interface IModStateTransition { return ModLoadingStage::nextState; } - /** - * This used to allow you to fire multiple events during the transition. However, in doing so it would cause issues with the default - * ModContainer's event handlers causing issues such as mod classes being constructed multiple times. - */ - @Deprecated(since = "1.21.3", forRemoval = true) - default Supplier>> eventFunctionStream() { - return () -> Stream.ofNullable(eventFunction()); - } - @Nullable default EventGenerator eventFunction() { return null; @@ -57,25 +43,9 @@ public interface IModStateTransition { ThreadSelector threadSelector(); BiFunction, CompletableFuture> finalActivityGenerator(); - /** - * I think this was meant as a way to do some things for each mod container beforge/after the transition had been sent to the container. - * However, the Future returned by this was never linked to the main transition future in any way. Which means that it was run - * in parallel and couldn't guarantee the state of the ModContainer. - *

- * Plus all existing code that I could find returned a completedFuture, so I don't think anyone ever used this. - *

- * If I were to add this back it would be a CompletableFuture wrap(ModContainer, CompletableFuture) - *

- * Added magic value NULL_HOOK to allow me to optimize the futures list by ignoring the default value without making this method nullable. - */ - @Deprecated(since = "1.21.3", forRemoval = true) - default BiFunction, CompletableFuture> preDispatchHook() { return NULL_HOOK; } - @Deprecated(since = "1.21.3", forRemoval = true) - default BiFunction, CompletableFuture> postDispatchHook() { return NULL_HOOK; } - interface EventGenerator extends Function { static EventGenerator fromFunction(Function fn) { return fn::apply; } } -} \ No newline at end of file +} diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java b/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java index e533be752b..e39d9d069e 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java @@ -7,12 +7,10 @@ package net.minecraftforge.fml; import java.util.function.Supplier; -public interface ISystemReportExtender extends Supplier -{ +public interface ISystemReportExtender extends Supplier { String getLabel(); - default boolean isActive() - { + default boolean isActive() { return true; } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/InterModComms.java b/fmlcore/src/main/java/net/minecraftforge/fml/InterModComms.java index 92b31df72f..28cf6eab29 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/InterModComms.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/InterModComms.java @@ -5,63 +5,20 @@ package net.minecraftforge.fml; - import java.util.Iterator; import java.util.Spliterator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ConcurrentMap; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Stream; import java.util.stream.StreamSupport; -public class InterModComms -{ - public record IMCMessage(String senderModId, String modId, String method, Supplier messageSupplier) { +public final class InterModComms { + public record IMCMessage(String senderModId, String modId, String method, Supplier messageSupplier) {} - /** - * Deprecated: use {@link #senderModId()} - * @return The modid of the sender. This is supplied by the caller, or by the active mod container context. - * Consider it unreliable. - */ - @Deprecated - public final String getSenderModId() { - return this.senderModId; - } - - /** - * Deprecated: use {@link #modId()} - * @return The modid being sent to. - */ - @Deprecated - public final String getModId() { - return this.modId; - } - - /** - * Deprecated: use {@link #method()} - * @return The method being sent to. - */ - @Deprecated - public final String getMethod() { - return this.method; - } - - /** - * @param The type of the message. - * @return A {@link Supplier} of the message. - * Use {@link #messageSupplier()} - */ - @SuppressWarnings("unchecked") - @Deprecated - public final Supplier getMessageSupplier() { - return (Supplier) this.messageSupplier; - } - } - - private static final ConcurrentMap> containerQueues = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap> containerQueues = new ConcurrentHashMap<>(); /** * Send IMC to remote. Sender will default to the active modcontainer, or minecraft if not. @@ -72,8 +29,9 @@ public class InterModComms * @return true if the message was enqueued for sending (the target modid is loaded) */ public static boolean sendTo(final String modId, final String method, final Supplier thing) { - if (!ModList.get().isLoaded(modId)) return false; - containerQueues.computeIfAbsent(modId, k->new ConcurrentLinkedQueue<>()).add(new IMCMessage(ModLoadingContext.get().getActiveContainer().getModId(), modId, method, thing)); + if (!ModList.isLoaded(modId)) return false; + containerQueues.computeIfAbsent(modId, _ -> new ConcurrentLinkedQueue<>()) + .add(new IMCMessage(ModLoadingContext.get().getContainer().getModId(), modId, method, thing)); return true; } @@ -87,8 +45,9 @@ public class InterModComms * @return true if the message was enqueued for sending (the target modid is loaded) */ public static boolean sendTo(final String senderModId, final String modId, final String method, final Supplier thing) { - if (!ModList.get().isLoaded(modId)) return false; - containerQueues.computeIfAbsent(modId, k->new ConcurrentLinkedQueue<>()).add(new IMCMessage(senderModId, modId, method, thing)); + if (!ModList.isLoaded(modId)) return false; + containerQueues.computeIfAbsent(modId, _ -> new ConcurrentLinkedQueue<>()) + .add(new IMCMessage(senderModId, modId, method, thing)); return true; } @@ -112,7 +71,7 @@ public class InterModComms * @return All messages */ public static Stream getMessages(final String modId) { - return getMessages(modId, s->Boolean.TRUE); + return getMessages(modId, _ -> true); } private record QueueFilteringSpliterator( @@ -136,13 +95,10 @@ public class InterModComms } @Override - public boolean tryAdvance(final Consumer action) - { + public boolean tryAdvance(final Consumer action) { IMCMessage next; - do - { - if (!iterator.hasNext()) - { + do { + if (!iterator.hasNext()) { return false; } next = this.iterator.next(); @@ -157,6 +113,5 @@ public class InterModComms public Spliterator trySplit() { return null; } - } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java index cf6a35a3af..8c453fda1c 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java @@ -19,7 +19,6 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.function.BiPredicate; -import java.util.function.Consumer; import java.util.function.Supplier; /** @@ -41,11 +40,6 @@ public abstract class ModContainer { protected final Map>, Supplier> extensionPoints = new IdentityHashMap<>(); protected final EnumMap configs = new EnumMap<>(ModConfig.Type.class); final Set dependencies = new HashSet<>(); - /** - * If you want to handle the event, override {@link #dispatchConfigEvent(IConfigEvent)} - */ - @Deprecated(since = "1.21.3", forRemoval = true) - protected Optional> configHandler = Optional.empty(); public ModContainer(IModInfo info) { this.modId = info.getModId(); @@ -59,7 +53,7 @@ public abstract class ModContainer { Supplier displayTestSupplier = switch (displayTestString) { case "MATCH_VERSION" -> // default displaytest checks for version string match () -> new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(), - (incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString())); + (incoming, _) -> Objects.equals(incoming, this.modInfo.getVersion().toString())); case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods IExtensionPoint.DisplayTest.IGNORE_SERVER_VERSION; case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information @@ -138,12 +132,7 @@ public abstract class ModContainer { configs.put(modConfig.getType(), modConfig); } - public void dispatchConfigEvent(IConfigEvent event) { - var handler = configHandler.orElse(null); - if (handler != null) { - handler.accept(event); - } - } + public void dispatchConfigEvent(IConfigEvent event) {} /** * Does this mod match the supplied mod? diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java index 7bbfcb0ede..438609e6b6 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java @@ -5,14 +5,14 @@ package net.minecraftforge.fml; +import net.minecraftforge.fml.loading.LoadingModList; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.ModFileScanData; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; -import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.forgespi.locating.IModFile; -import java.util.Collections; + import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -30,33 +30,36 @@ import java.util.stream.Stream; * Master list of all mods - game-side version. This is classloaded in the game scope and * can dispatch game level events as a result. */ -public class ModList { - private static ModList INSTANCE; - private final List modFiles; - private final List sortedList; - private final Map fileById; - private List mods; - private Map indexedMods; - private List modFileScanData; - private List sortedContainers; +public final class ModList { + private ModList() {} - private ModList(final List modFiles, final List sortedList) { - var modFileInfos = this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).toList(); - this.sortedList = sortedList.stream().map(IModInfo.class::cast).toList(); + private static final List MOD_FILES; + private static final List SORTED_LIST; + private static final Map FILE_BY_ID; + private static List mods; + private static Map indexedMods; + private static List sortedContainers; + + static { + var loadingModFiles = LoadingModList.getModFiles().stream().map(ModFileInfo::getFile).toList(); + var loadingSortedList = LoadingModList.getMods(); + + var modFileInfos = MOD_FILES = loadingModFiles.stream().map(ModFile::getModFileInfo).toList(); + SORTED_LIST = loadingSortedList.stream().map(IModInfo.class::cast).toList(); var byId = new HashMap(); for (var file : modFileInfos) { for (var mod : file.getMods()) byId.put(mod.getModId(), mod.getOwningFile()); } - this.fileById = Map.copyOf(byId); - CrashReportCallables.registerCrashCallable("Mod List", this::crashReport); + FILE_BY_ID = Map.copyOf(byId); + CrashReportCallables.registerCrashCallable("Mod List", ModList::crashReport); } - private String getModContainerState(String modId) { + private static String getModContainerState(String modId) { return getModContainerById(modId).map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE"); } - private String fileToLine(IModFile mf) { + private static String fileToLine(IModFile mf) { var mainMod = mf.getModInfos().getFirst(); return String.format(Locale.ENGLISH, "%-50.50s|%-30.30s|%-30.30s|%-20.20s|%-10.10s|Manifest: %s", mf.getFileName(), mainMod.getDisplayName(), @@ -66,92 +69,92 @@ public class ModList { ((ModFileInfo)mf.getModFileInfo()).getCodeSigningFingerprint().orElse("NOSIGNATURE")); } - private String crashReport() { - return "\n" + applyForEachModFile(this::fileToLine).collect(Collectors.joining("\n\t\t", "\t\t", "")); + private static String crashReport() { + return "\n" + applyForEachModFile(ModList::fileToLine).collect(Collectors.joining("\n\t\t", "\t\t", "")); } - public static ModList of(List modFiles, List sortedList) { - INSTANCE = new ModList(modFiles, sortedList); - return INSTANCE; + public static void init() {} + + public static List getModFiles() { + return MOD_FILES; } - public static ModList get() { - return INSTANCE; + public static IModFileInfo getModFileById(String modid) { + return FILE_BY_ID.get(modid); } - public List getModFiles() { - return modFiles; + static void setLoadedMods(final List modContainers) { + mods = modContainers; + sortedContainers = modContainers.stream().sorted(Comparator.comparingInt(c -> SORTED_LIST.indexOf(c.getModInfo()))).toList(); + indexedMods = modContainers.stream().collect(Collectors.toUnmodifiableMap(ModContainer::getModId, Function.identity())); } - public IModFileInfo getModFileById(String modid) { - return this.fileById.get(modid); - } - - void setLoadedMods(final List modContainers) { - this.mods = modContainers; - this.sortedContainers = modContainers.stream().sorted(Comparator.comparingInt(c -> sortedList.indexOf(c.getModInfo()))).toList(); - this.indexedMods = modContainers.stream().collect(Collectors.toMap(ModContainer::getModId, Function.identity())); + static void clearLoadedMods() { + mods = List.of(); + indexedMods = Map.of(); + sortedContainers = List.of(); } @SuppressWarnings("unchecked") - public Optional getModObjectById(String modId) { + public static Optional getModObjectById(String modId) { return getModContainerById(modId).map(ModContainer::getMod).map(o -> (T) o); } - public Optional getModContainerById(String modId) { - return Optional.ofNullable(this.indexedMods.get(modId)); + public static Optional getModContainerById(String modId) { + return Optional.ofNullable(indexedMods.get(modId)); } - public Optional getModContainerByObject(Object obj) { + public static Optional getModContainerByObject(Object obj) { return mods.stream().filter(mc -> mc.getMod() == obj).findFirst(); } - public List getMods() { - return this.sortedList; + public static List getMods() { + return SORTED_LIST; } - public boolean isLoaded(String modTarget) { - return this.indexedMods.containsKey(modTarget); + public static boolean isLoaded(String modTarget) { + return indexedMods.containsKey(modTarget); } - public int size() { + public static int size() { return mods.size(); } - public List getAllScanData() { - if (modFileScanData == null) { - modFileScanData = this.sortedList.stream(). - map(IModInfo::getOwningFile). - filter(Objects::nonNull). - map(IModFileInfo::getFile). - distinct(). - map(IModFile::getScanResult). - toList(); + public static List getAllScanData() { + final class LazyInit { + private LazyInit() {} + private static final List MOD_FILE_SCAN_DATA = SORTED_LIST.stream() + .map(IModInfo::getOwningFile) + .filter(Objects::nonNull) + .map(IModFileInfo::getFile) + .distinct() + .map(IModFile::getScanResult) + .toList(); } - return modFileScanData; + return LazyInit.MOD_FILE_SCAN_DATA; } - public void forEachModFile(Consumer fileConsumer) { - modFiles.stream().map(IModFileInfo::getFile).forEach(fileConsumer); + public static void forEachModFile(Consumer fileConsumer) { + MOD_FILES.stream().map(IModFileInfo::getFile).forEach(fileConsumer); } - public Stream applyForEachModFile(Function function) { - return modFiles.stream().map(IModFileInfo::getFile).map(function); + public static Stream applyForEachModFile(Function function) { + return MOD_FILES.stream().map(IModFileInfo::getFile).map(function); } - public void forEachModContainer(BiConsumer modContainerConsumer) { + public static void forEachModContainer(BiConsumer modContainerConsumer) { indexedMods.forEach(modContainerConsumer); } - public void forEachModInOrder(Consumer containerConsumer) { - this.sortedContainers.forEach(containerConsumer); + public static void forEachModInOrder(Consumer containerConsumer) { + sortedContainers.forEach(containerConsumer); } - public List getLoadedMods() { - return this.sortedContainers; + public static List getLoadedMods() { + return sortedContainers; } - public Stream applyForEachModContainer(Function function) { + public static Stream applyForEachModContainer(Function function) { return indexedMods.values().stream().map(function); } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java index b43a761f47..f6be23d2d1 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -5,16 +5,11 @@ package net.minecraftforge.fml; -import com.google.common.collect.ImmutableList; import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.fml.event.IModBusEvent; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.fml.loading.FMLLoader; -import net.minecraftforge.fml.loading.ImmediateWindowHandler; -import net.minecraftforge.fml.loading.LoadingModList; +import net.minecraftforge.fml.loading.*; import net.minecraftforge.fml.loading.moddiscovery.InvalidModIdentifier; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; -import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.progress.ProgressMeter; import net.minecraftforge.fml.loading.progress.StartupNotificationManager; import net.minecraftforge.forgespi.language.IModInfo; @@ -71,48 +66,18 @@ import static net.minecraftforge.fml.Logging.LOADING; * and completes the mod loading sequence. * */ -public class ModLoader { +public final class ModLoader { + private ModLoader() {} + private static final Logger LOGGER = LogManager.getLogger(); - private final LoadingModList loadingModList; - - private final List loadingExceptions; - private final Set erroredModInfos; - private final List loadingWarnings; - private final ModStateManager stateManager; + private static final ArrayList LOADING_EXCEPTIONS = new ArrayList<>(); + private static final ArrayList LOADING_WARNINGS = new ArrayList<>(); + private static final Consumer STATUS_CONSUMER = StartupNotificationManager.modLoaderConsumer().orElse(_ -> {}); + private static final HashSet COMPLETED_STATES = new HashSet<>(); private static boolean loadingStateValid; - private final Consumer statusConsumer = StartupNotificationManager.modLoaderConsumer().orElse(msg -> {}); - private final Set completedStates = new HashSet<>(); - private ModList modList; - - private ModLoader() { - var loadingModList = this.loadingModList = FMLLoader.getLoadingModList(); - var loadingExceptions = this.loadingExceptions = loadingModList.getErrors().stream() - .flatMap(ModLoadingException::fromEarlyException) - .collect(Collectors.toList()); - this.loadingWarnings = loadingModList.getBrokenFiles().stream() - .map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName())) - .collect(Collectors.toList()); - if (loadingExceptions.isEmpty()) { - this.erroredModInfos = Collections.emptySet(); - } else { - this.erroredModInfos = Collections.newSetFromMap(new IdentityHashMap<>()); - this.erroredModInfos.addAll(loadingExceptions.stream().map(ModLoadingException::getModInfo).toList()); - } - loadingModList.getModFiles().stream() - .filter(ModFileInfo::missingLicense) - .filter(modFileInfo -> modFileInfo.getMods().stream().noneMatch(this.erroredModInfos::contains)) //Ignore files where any other mod already encountered an error - .map(modFileInfo -> new ModLoadingException(null, ModLoadingStage.VALIDATE, "fml.modloading.missinglicense", null, modFileInfo.getFile())) - .forEach(this.loadingExceptions::add); - this.stateManager = new ModStateManager(); - CrashReportCallables.registerCrashCallable("ModLauncher", FMLLoader::getLauncherInfo); - CrashReportCallables.registerCrashCallable("ModLauncher launch target", FMLLoader::launcherHandlerName); - CrashReportCallables.registerCrashCallable("ModLauncher naming", FMLLoader::getNaming); - CrashReportCallables.registerCrashCallable("ModLauncher services", ModLoader::computeModLauncherServiceList); - CrashReportCallables.registerCrashCallable("FML Language Providers", ModLoader::computeLanguageList); - } private static String computeLanguageList() { - return "\n" + FMLLoader.getLanguageLoadingProvider() + return "\n" + LanguageLoadingProvider .applyForEach(lp -> lp.name() + '@' + lp.getClass().getPackage().getImplementationVersion()) .collect(Collectors.joining("\n\t\t", "\t\t", "")); } @@ -126,37 +91,51 @@ public class ModLoader { collect(Collectors.joining("\n\t\t","\t\t","")); } - public static ModLoader get() { - return LazyInit.INSTANCE; - } - - private static final class LazyInit { - private static final ModLoader INSTANCE = new ModLoader(); - private LazyInit() {} - } - /** * Run on the primary starting thread by ClientModLoader and ServerModLoader * @param syncExecutor An executor to run tasks on the main thread * @param parallelExecutor An executor to run tasks on a parallel loading thread pool * @param periodicTask Optional periodic task to perform on the main thread while other activities run */ - public void gatherAndInitializeMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { + public static void gatherAndInitializeMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { + var loadingExceptions = LoadingModList.getErrors().stream() + .flatMap(ModLoadingException::fromEarlyException) + .toList(); + ModLoader.LOADING_EXCEPTIONS.addAll(loadingExceptions); + LOADING_WARNINGS.addAll(LoadingModList.getBrokenFiles().stream() + .map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName())) + .toList()); + Set erroredModInfos; + if (loadingExceptions.isEmpty()) { + erroredModInfos = Collections.emptySet(); + } else { + erroredModInfos = Collections.newSetFromMap(new IdentityHashMap<>()); + erroredModInfos.addAll(loadingExceptions.stream().map(ModLoadingException::getModInfo).toList()); + } + LoadingModList.getModFiles().stream() + .filter(ModFileInfo::missingLicense) + .filter(modFileInfo -> modFileInfo.getMods().stream().noneMatch(erroredModInfos::contains)) //Ignore files where any other mod already encountered an error + .map(modFileInfo -> new ModLoadingException(null, ModLoadingStage.VALIDATE, "fml.modloading.missinglicense", null, modFileInfo.getFile())) + .forEach(LOADING_EXCEPTIONS::add); + CrashReportCallables.registerCrashCallable("ModLauncher", FMLLoader::getLauncherInfo); + CrashReportCallables.registerCrashCallable("ModLauncher launch target", FMLLoader::launcherHandlerName); + CrashReportCallables.registerCrashCallable("ModLauncher naming", FMLLoader::getNaming); + CrashReportCallables.registerCrashCallable("ModLauncher services", ModLoader::computeModLauncherServiceList); + CrashReportCallables.registerCrashCallable("FML Language Providers", ModLoader::computeLanguageList); + ForgeFeature.registerFeature("javaVersion", ForgeFeature.VersionFeatureTest.forVersionString(IModInfo.DependencySide.BOTH, System.getProperty("java.version"))); ForgeFeature.registerFeature("openGLVersion", ForgeFeature.VersionFeatureTest.forVersionString(IModInfo.DependencySide.CLIENT, ImmediateWindowHandler.getGLVersion())); loadingStateValid = true; FMLLoader.backgroundScanHandler.waitForScanToComplete(periodicTask); - final ModList modList = ModList.of(loadingModList.getModFiles().stream().map(ModFileInfo::getFile).toList(), - loadingModList.getMods()); - if (!this.loadingExceptions.isEmpty()) { - LOGGER.fatal(CORE, "Error during pre-loading phase", loadingExceptions.getFirst()); - statusConsumer.accept("ERROR DURING MOD LOADING"); - modList.setLoadedMods(Collections.emptyList()); + if (!LOADING_EXCEPTIONS.isEmpty()) { + LOGGER.fatal(CORE, "Error during pre-loading phase", LOADING_EXCEPTIONS.getFirst()); + STATUS_CONSUMER.accept("ERROR DURING MOD LOADING"); + ModList.clearLoadedMods(); loadingStateValid = false; - throw new LoadingFailedException(loadingExceptions); + throw new LoadingFailedException(LOADING_EXCEPTIONS); } var failedBounds = new ArrayList(); - for (var mod : loadingModList.getMods()) { + for (var mod : LoadingModList.getMods()) { for (var feature : mod.getForgeFeatures()) { if (!ForgeFeature.testFeature(FMLEnvironment.dist, feature)) failedBounds.add(feature); @@ -165,8 +144,8 @@ public class ModLoader { if (!failedBounds.isEmpty()) { LOGGER.fatal(CORE, "Failed to validate feature bounds for mods: {}", failedBounds); - statusConsumer.accept("ERROR DURING MOD LOADING"); - modList.setLoadedMods(Collections.emptyList()); + STATUS_CONSUMER.accept("ERROR DURING MOD LOADING"); + ModList.clearLoadedMods(); loadingStateValid = false; throw new LoadingFailedException(failedBounds.stream() .map(fb -> new ModLoadingException(fb.modInfo(), ModLoadingStage.CONSTRUCT, "fml.modloading.feature.missing", null, fb, ForgeFeature.featureValue(fb))) @@ -174,18 +153,18 @@ public class ModLoader { } final var modContainers = new HashMap(); - for (var file : loadingModList.getModFiles()) { - var containers = this.buildMods(file.getFile()); + for (var file : LoadingModList.getModFiles()) { + var containers = buildMods(file.getFile()); for (var container : containers) modContainers.put(container.getModId(), container); } - if (!loadingExceptions.isEmpty()) { - LOGGER.fatal(CORE, "Failed to initialize mod containers", loadingExceptions.getFirst()); - statusConsumer.accept("ERROR DURING MOD LOADING"); - modList.setLoadedMods(Collections.emptyList()); + if (!LOADING_EXCEPTIONS.isEmpty()) { + LOGGER.fatal(CORE, "Failed to initialize mod containers", LOADING_EXCEPTIONS.getFirst()); + STATUS_CONSUMER.accept("ERROR DURING MOD LOADING"); + ModList.clearLoadedMods(); loadingStateValid = false; - throw new LoadingFailedException(loadingExceptions); + throw new LoadingFailedException(LOADING_EXCEPTIONS); } // Gather all dependencies, so we can make sure they have finished their transition events before we fire ours @@ -208,34 +187,33 @@ public class ModLoader { } } - modList.setLoadedMods(modContainers.values().stream().toList()); - this.modList = modList; - var stateList = stateManager.getStates(ModLoadingPhase.GATHER); - var progress = StartupMessageManager.addProgressBar("Mod Gather", stateList.stream().mapToInt(mls -> mls.size().applyAsInt(this.modList)).sum()); + ModList.setLoadedMods(modContainers.values().stream().toList()); + var stateList = ModStateManager.getStates(ModLoadingPhase.GATHER); + var progress = StartupMessageManager.addProgressBar("Mod Gather", stateList.stream().mapToInt(mls -> mls.size().getAsInt()).sum()); for (IModLoadingState mls : stateList) { dispatchAndHandleError(mls, syncExecutor, parallelExecutor, periodicTask, progress); } progress.complete(); } - public void loadMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { - var stateList = stateManager.getStates(ModLoadingPhase.LOAD); - var progress = StartupMessageManager.addProgressBar("Mod Loading", stateList.stream().mapToInt(mls -> mls.size().applyAsInt(modList)).sum()); + public static void loadMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { + var stateList = ModStateManager.getStates(ModLoadingPhase.LOAD); + var progress = StartupMessageManager.addProgressBar("Mod Loading", stateList.stream().mapToInt(mls -> mls.size().getAsInt()).sum()); for (IModLoadingState mls : stateList) { dispatchAndHandleError(mls, syncExecutor, parallelExecutor, periodicTask, progress); } progress.complete(); } - public void finishMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { - var stateList = stateManager.getStates(ModLoadingPhase.COMPLETE); - var progress = StartupMessageManager.addProgressBar("Mod Complete", stateList.stream().mapToInt(mls -> mls.size().applyAsInt(modList)).sum()); + public static void finishMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) { + var stateList = ModStateManager.getStates(ModLoadingPhase.COMPLETE); + var progress = StartupMessageManager.addProgressBar("Mod Complete", stateList.stream().mapToInt(mls -> mls.size().getAsInt()).sum()); for (IModLoadingState mls : stateList) { dispatchAndHandleError(mls, syncExecutor, parallelExecutor, periodicTask, progress); } var modBusGroups = Set.of( - modList.getLoadedMods().stream() + ModList.getLoadedMods().stream() .map(ModContainer::getModBusGroup) .filter(Objects::nonNull) .toArray(BusGroup[]::new) @@ -245,11 +223,11 @@ public class ModLoader { } parallelExecutor.execute(BusGroup.DEFAULT::trim); - statusConsumer.accept("Mod loading complete - %d mods loaded".formatted(this.modList.size())); + STATUS_CONSUMER.accept("Mod loading complete - %d mods loaded".formatted(ModList.size())); progress.complete(); } - private void dispatchAndHandleError(IModLoadingState state, ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor, final Runnable ticker, final ProgressMeter progressBar) { + private static void dispatchAndHandleError(IModLoadingState state, ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor, final Runnable ticker, final ProgressMeter progressBar) { if (!isLoadingStateValid()) { LOGGER.error("Cowardly refusing to process mod state change request from {}", state); return; @@ -257,25 +235,25 @@ public class ModLoader { progressBar.label(progressBar.name() + " working"); syncExecutor.drive(ticker); - var inlineRunnable = state.inlineRunnable().orElse(null); + var inlineRunnable = state.inlineRunnable(); if (inlineRunnable != null) handleInlineTransition(inlineRunnable, state, syncExecutor, ticker); - var transition = state.buildTransition(syncExecutor, parallelExecutor, progressBar).orElse(null); + var transition = state.buildTransition(syncExecutor, parallelExecutor, progressBar); if (transition != null) waitForTransition(state, syncExecutor, ticker, transition); - completedStates.add(state); + COMPLETED_STATES.add(state); } - private void handleInlineTransition(final Consumer transition, final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker) { + private static void handleInlineTransition(final Runnable transition, final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker) { var pb = StartupMessageManager.addProgressBar("State transition " + state.name() + " running", 0); syncExecutor.drive(ticker); - transition.accept(this.modList); + transition.run(); syncExecutor.drive(ticker); pb.complete(); syncExecutor.drive(ticker); } - private void waitForTransition(final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker, final CompletableFuture transition) { + private static void waitForTransition(final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker, final CompletableFuture transition) { while (!transition.isDone()) { syncExecutor.drive(ticker); } @@ -289,7 +267,7 @@ public class ModLoader { .anyMatch(obj -> !(obj instanceof ModLoadingException)); if (hasNotModLoadingEx) { LOGGER.fatal("Encountered non-modloading exceptions!", e); - statusConsumer.accept("ERROR DURING MOD LOADING"); + STATUS_CONSUMER.accept("ERROR DURING MOD LOADING"); throw e; } @@ -298,12 +276,12 @@ public class ModLoader { .map(ModLoadingException.class::cast) .toList(); LOGGER.fatal(LOADING,"Failed to complete lifecycle event {}, {} errors found", state.name(), modLoadingExceptions.size()); - statusConsumer.accept("ERROR DURING MOD LOADING"); + STATUS_CONSUMER.accept("ERROR DURING MOD LOADING"); throw new LoadingFailedException(modLoadingExceptions); } } - private List buildMods(final IModFile modFile) { + private static List buildMods(final IModFile modFile) { final Map modInfoMap = new HashMap<>(); for (var mod : modFile.getModFileInfo().getMods()) modInfoMap.put(mod.getModId(), mod); @@ -333,14 +311,14 @@ public class ModLoader { missingMods.removeAll(modIds); LOGGER.fatal(LOADING, "The following mods are missing, but have classes in the jar: {}", missingMods); - loadingExceptions.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath())); + LOADING_EXCEPTIONS.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath())); } // remove errored mod containers return containers.stream().filter(mc -> mc.modLoadingStage != ModLoadingStage.ERROR).toList(); } - private ModContainer buildModContainerFromTOML(final IModFile modFile, final Map modInfoMap, + private static ModContainer buildModContainerFromTOML(final IModFile modFile, final Map modInfoMap, final String modId, final IModLanguageProvider.IModLanguageLoader languageLoader ) { try { @@ -352,7 +330,7 @@ public class ModLoader { return languageLoader.loadMod(info, modFile.getScanResult(), FMLLoader.getGameLayer()); } catch (ModLoadingException mle) { // exceptions are caught and added to the error list for later handling - loadingExceptions.add(mle); + LOADING_EXCEPTIONS.add(mle); // return an errored container instance here, because we tried and failed building a container. return new ErroredModContainer(); } @@ -366,15 +344,8 @@ public class ModLoader { return loadingStateValid; } - /** @deprecated Use {@link #hasCompletedState(IModLoadingState)} instead */ - @Deprecated(forRemoval = true) - public boolean hasCompletedState(final String stateName) { - IModLoadingState state = stateManager.findState(stateName); - return completedStates.contains(state); - } - - public boolean hasCompletedState(IModLoadingState state) { - return completedStates.contains(state); + public static boolean hasCompletedState(IModLoadingState state) { + return COMPLETED_STATES.contains(state); } public static void runEventGenerator(Function generator) { @@ -382,7 +353,7 @@ public class ModLoader { LOGGER.error("Cowardly refusing to send event generator to a broken mod state"); return; } - for (var mod : ModList.get().getLoadedMods()) + for (var mod : ModList.getLoadedMods()) mod.acceptEvent(generator.apply(mod)); } @@ -391,7 +362,7 @@ public class ModLoader { LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName()); return; } - for (var mod : ModList.get().getLoadedMods()) + for (var mod : ModList.getLoadedMods()) mod.acceptEvent(e); } @@ -400,7 +371,7 @@ public class ModLoader { LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName()); return e; } - for (var mod : ModList.get().getLoadedMods()) + for (var mod : ModList.getLoadedMods()) mod.acceptEvent(e); return e; } @@ -408,8 +379,8 @@ public class ModLoader { @SuppressWarnings("removal") public static void postEventWrapContainerInModOrder(T event) { postEventWithWrapInModOrder(event, - (mc, e) -> ModLoadingContext.get().setActiveContainer(mc), - (mc, e) -> ModLoadingContext.get().setActiveContainer(null) + (mc, _) -> ModLoadingContext.get().setActiveContainer(mc), + (_, _) -> ModLoadingContext.get().setActiveContainer(null) ); } @@ -418,19 +389,19 @@ public class ModLoader { LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName()); return; } - for (var mod : ModList.get().getLoadedMods()) { + for (var mod : ModList.getLoadedMods()) { pre.accept(mod, e); mod.acceptEvent(e); post.accept(mod, e); } } - public List getWarnings() { - return ImmutableList.copyOf(this.loadingWarnings); + public static List getWarnings() { + return List.copyOf(LOADING_WARNINGS); } - public void addWarning(ModLoadingWarning warning) { - this.loadingWarnings.add(warning); + public static void addWarning(ModLoadingWarning warning) { + LOADING_WARNINGS.add(warning); } private static boolean runningDataGen = false; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingContext.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingContext.java index 32d2ed044a..48090d9bee 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingContext.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingContext.java @@ -32,24 +32,11 @@ public class ModLoadingContext { return context.get(); } - /** - * @deprecated Going to be moved to ForgeHooks for Internal use. - */ - @Deprecated(forRemoval = true, since="1.21.1") - public void setActiveContainer(final ModContainer container) { + void setActiveContainer(final ModContainer container) { this.activeContainer = container; this.languageExtension = container == null ? null : container.contextExtension.get(); } - /** - * Going to be moved to ForgeHooks for Internal use. - * @deprecated Override/Use {@link ModLoadingContext#getContainer()} - */ - @Deprecated(forRemoval = true, since="1.21.1") - public ModContainer getActiveContainer() { - return activeContainer == null ? ModList.get().getModContainerById("minecraft").orElseThrow(()->new RuntimeException("Where is minecraft???!")) : activeContainer; - } - /** * @deprecated Going to be moved to ForgeHooks for Internal use. */ @@ -58,11 +45,10 @@ public class ModLoadingContext { return activeContainer == null ? "minecraft" : activeContainer.getNamespace(); } - /** - * @return {@link ModLoadingContext#getActiveContainer()} by default. - */ public ModContainer getContainer() { - return getActiveContainer(); + return activeContainer == null + ? ModList.getModContainerById("minecraft").orElseThrow(()->new RuntimeException("Where is minecraft???!")) + : activeContainer; } /** @@ -114,8 +100,7 @@ public class ModLoadingContext { } public void registerConfig(ModConfig.Type type, IConfigSpec spec) { - if (spec.isEmpty()) - { + if (spec.isEmpty()) { // This handles the case where a mod tries to register a config, without any options configured inside it. LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getContainer().getModId()); return; @@ -125,8 +110,7 @@ public class ModLoadingContext { } public void registerConfig(ModConfig.Type type, IConfigSpec spec, String fileName) { - if (spec.isEmpty()) - { + if (spec.isEmpty()) { // This handles the case where a mod tries to register a config, without any options configured inside it. LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getContainer().getModId(), fileName); return; @@ -135,7 +119,6 @@ public class ModLoadingContext { getContainer().addConfig(new ModConfig(type, spec, getContainer(), fileName)); } - @SuppressWarnings("unchecked") public T extension() { return (T)languageExtension; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java index 7a2ab79a3d..bba28748b7 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java @@ -6,14 +6,14 @@ package net.minecraftforge.fml; import net.minecraftforge.fml.loading.progress.ProgressMeter; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; -import java.util.Objects; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import java.util.function.Consumer; import java.util.function.Function; -import java.util.function.ToIntFunction; +import java.util.function.IntSupplier; +import java.util.function.Supplier; /** * Implementation of the {@link IModLoadingState} interface. @@ -25,27 +25,26 @@ import java.util.function.ToIntFunction; * @param inlineRunnable an optional runnable, which runs before starting the transition from this state to the next * @param transition optional state transition information */ +@NullMarked public record ModLoadingState( String name, String previous, - Function message, - ToIntFunction size, + Supplier message, + IntSupplier size, ModLoadingPhase phase, - Optional> inlineRunnable, - Optional transition + @Nullable Runnable inlineRunnable, + @Nullable IModStateTransition transition ) implements IModLoadingState { @Override - public Optional> buildTransition( + public @Nullable CompletableFuture buildTransition( final Executor syncExecutor, final Executor parallelExecutor, final ProgressMeter progressBar, final Function> preSyncTask, final Function> postSyncTask ) { - var transition = this.transition.orElse(null); - return transition == null - ? Optional.empty() - : Optional.ofNullable(transition.build(name, syncExecutor, parallelExecutor, progressBar, preSyncTask, postSyncTask)); + if (transition == null) return null; + return transition.build(name, syncExecutor, parallelExecutor, progressBar, preSyncTask, postSyncTask); } /** @@ -60,7 +59,7 @@ public record ModLoadingState( */ @Deprecated(since = "1.21.3", forRemoval = true) public static ModLoadingState empty(final String name, final String previous, final ModLoadingPhase phase) { - return new ModLoadingState(name, previous, ml -> "", ml -> 0, phase, Optional.empty(), Optional.empty()); + return new ModLoadingState(name, previous, () -> "", () -> 0, phase, null, null); } /** @@ -94,7 +93,7 @@ public record ModLoadingState( */ @Deprecated(since = "1.21.3", forRemoval = true) public static ModLoadingState withTransition(final String name, final String previous, - final Function message, final ModLoadingPhase phase, + final Supplier message, final ModLoadingPhase phase, final IModStateTransition transition) { return of(name, phase).after(previous).message(message).withTransition(transition); } @@ -113,7 +112,7 @@ public record ModLoadingState( */ @Deprecated(since = "1.21.3", forRemoval = true) public static ModLoadingState withInline(final String name, final String previous, final ModLoadingPhase phase, - final Consumer inline) { + final Runnable inline) { return of(name, phase).after(previous).withInline(inline); } @@ -126,23 +125,23 @@ public record ModLoadingState( return o instanceof ModLoadingState that && this.phase == that.phase && this.name.equals(that.name) - && Objects.equals(this.previous, that.previous); + && this.previous.equals(that.previous); } @Override public int hashCode() { int result = phase.hashCode(); result = 31 * result + name.hashCode(); - result = 31 * result + Objects.hashCode(previous); + result = 31 * result + previous.hashCode(); return result; } - public static class Builder { + public static final class Builder { private final String name; private final ModLoadingPhase phase; - private String after; - private Function message = null; - private ToIntFunction size = null; + private String after = ""; + private @Nullable Supplier message = null; + private @Nullable IntSupplier size = null; private Builder(final String name, final ModLoadingPhase phase) { this.name = name; @@ -155,28 +154,28 @@ public record ModLoadingState( return this; } - public Builder message(final String value) { return message(ml -> value); } - public Builder message(final Function value) { + public Builder message(final String value) { return message(() -> value); } + public Builder message(final Supplier value) { this.message = value; return this; } - public Builder size(final int value) { return size(ml -> value); } - public Builder size(final ToIntFunction value) { + public Builder size(final int value) { return size(() -> value); } + public Builder size(final IntSupplier value) { this.size = value; return this; } public ModLoadingState empty() { - return new ModLoadingState(name, after, message != null ? message : ml -> "", size != null ? size : ml -> 0, phase, Optional.empty(), Optional.empty()); + return new ModLoadingState(name, after, message != null ? message : () -> "", size != null ? size : () -> 0, phase, null, null); } public ModLoadingState withTransition(final IModStateTransition transition) { - return new ModLoadingState(name, after, message != null ? message : ml -> "Processing transition " + name, size != null ? size : ModList::size, phase, Optional.empty(), Optional.of(transition)); + return new ModLoadingState(name, after, message != null ? message : () -> "Processing transition " + name, size != null ? size : ModList::size, phase, null, transition); } - public ModLoadingState withInline(final Consumer inline) { - return new ModLoadingState(name, after, message != null ? message : ml -> "Processing work " + name, size != null ? size : ml -> 0, phase, Optional.of(inline), Optional.empty()); + public ModLoadingState withInline(final Runnable inline) { + return new ModLoadingState(name, after, message != null ? message : () -> "Processing work " + name, size != null ? size : () -> 0, phase, inline, null); } } -} \ No newline at end of file +} diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingWarning.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingWarning.java index 27fe31da27..4877e4d92c 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingWarning.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingWarning.java @@ -5,41 +5,27 @@ package net.minecraftforge.fml; -import com.google.common.collect.Streams; import net.minecraftforge.forgespi.language.IModInfo; -import java.util.Arrays; import java.util.List; import java.util.stream.Stream; -public class ModLoadingWarning { - /** - * Mod Info for mod with warning - */ - private final IModInfo modInfo; - /** - * The stage where this warning was encountered - */ - private final ModLoadingStage warningStage; - - /** - * I18N message to use for display - */ - private final String i18nMessage; - - /** - * Context for message display - */ - private final List context; - +/** + * @param modInfo Mod info for mod with warning + * @param warningStage The stage where this warning was encountered + * @param i18nMessage I18N message to use for display + * @param context Context for message display + */ +public record ModLoadingWarning(IModInfo modInfo, ModLoadingStage warningStage, String i18nMessage, List context) { public ModLoadingWarning(final IModInfo modInfo, final ModLoadingStage warningStage, final String i18nMessage, Object... context) { - this.modInfo = modInfo; - this.warningStage = warningStage; - this.i18nMessage = i18nMessage; - this.context = Arrays.asList(context); + this(modInfo, warningStage, i18nMessage, List.of(context)); + } + + public ModLoadingWarning { + context = List.copyOf(context); } public String formatToString() { - return Bindings.getMessageParser().get().parseMessage(i18nMessage, Streams.concat(Stream.of(modInfo, warningStage), context.stream()).toArray()); + return Bindings.getMessageParser().get().parseMessage(i18nMessage, Stream.concat(Stream.of(modInfo, warningStage), context.stream()).toArray()); } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateManager.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateManager.java index 266a8874b0..a260652266 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateManager.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateManager.java @@ -15,18 +15,19 @@ import java.util.function.Function; import java.util.stream.Collectors; @SuppressWarnings("UnstableApiUsage") -public class ModStateManager { - private final EnumMap> stateMap; +public final class ModStateManager { + private ModStateManager() {} + private static final EnumMap> stateMap; - public ModStateManager() { + static { final var sp = ServiceLoader.load(FMLLoader.getGameLayer(), IModStateProvider.class); - this.stateMap = ServiceLoaderUtils.streamWithErrorHandling(sp, sce->{}) + stateMap = ServiceLoaderUtils.streamWithErrorHandling(sp, _ -> {}) .map(IModStateProvider::getAllStates) .flatMap(List::stream) - .collect(Collectors.groupingBy(IModLoadingState::phase, ()->new EnumMap<>(ModLoadingPhase.class), Collectors.toUnmodifiableList())); + .collect(Collectors.groupingBy(IModLoadingState::phase, () -> new EnumMap<>(ModLoadingPhase.class), Collectors.toUnmodifiableList())); } - public List getStates(final ModLoadingPhase phase) { + public static List getStates(final ModLoadingPhase phase) { var nodes = stateMap.get(phase); var lookup = nodes.stream().collect(Collectors.toMap(IModLoadingState::name, Function.identity())); @@ -40,7 +41,7 @@ public class ModStateManager { return TopologicalSort.topologicalSort(graph, Comparator.comparingInt(nodes::indexOf)).stream().filter(st->st!=dummy).toList(); } - public IModLoadingState findState(final String stateName) { + public static IModLoadingState findState(final String stateName) { var result = stateMap.values() .stream() .flatMap(List::stream) diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java index baea870f26..683b5d92ba 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java @@ -24,7 +24,7 @@ import net.minecraftforge.fml.event.IModBusEvent; import net.minecraftforge.fml.loading.progress.ProgressMeter; @ApiStatus.Internal -class ModStateTransitionHelper { +final class ModStateTransitionHelper { static final IModStateTransition NOOP = new NoopTransition(); record NoopTransition() implements IModStateTransition { @Override @@ -62,7 +62,30 @@ class ModStateTransitionHelper { } } - record FutureResult(V value, Throwable exception){} + /// Same as [#completableFutureFromExceptionList(List)] but specialised for a single future + static CompletionStage completableFutureFromException(FutureResult t) { + if (t.exception() == null) { + return CompletableFuture.completedFuture(null); + } else { + var exception = t.exception(); + CompletableFuture cf = new CompletableFuture<>(); + RuntimeException accumulator = new RuntimeException(); + cf.completeExceptionally(accumulator); + if (exception instanceof CompletionException) { + exception = exception.getCause(); + } + if (exception.getSuppressed().length != 0) { + for (Throwable throwable : exception.getSuppressed()) { + accumulator.addSuppressed(throwable); + } + } else { + accumulator.addSuppressed(exception); + } + return cf; + } + } + + record FutureResult(V value, Throwable exception) {} static CompletableFuture>> gather(Collection> futures) { var list = new ArrayList>(futures.size()); @@ -76,25 +99,17 @@ class ModStateTransitionHelper { results[i] = raw.whenComplete((result, exception) -> list.set(i, new FutureResult<>(result, exception))); } - return CompletableFuture.allOf(results).handle((r, th)->null).thenApply(res -> list); + return CompletableFuture.allOf(results).handle((_, _)->null).thenApply(_ -> list); } - private static void addCompletableFutureTaskForModDispatch( - final IModStateTransition transition, + private static CompletableFuture addCompletableFutureTaskForModDispatch( final Executor executor, - final List> completableFutures, final ProgressMeter progressBar, final EventGenerator eventGenerator, final BiFunction nextState ) { - - @SuppressWarnings("removal") - var preDispatchHook = getHook(transition.preDispatchHook(), executor, eventGenerator); - if (preDispatchHook != null) - completableFutures.add(preDispatchHook); - var modFutures = new LinkedHashMap>(); - for (var mod : ModList.get().getLoadedMods()) { + for (var mod : ModList.getLoadedMods()) { CompletableFuture parent = null; if (mod.dependencies.isEmpty()) { @@ -120,7 +135,7 @@ class ModStateTransitionHelper { handler.run(); mod.acceptEvent(eventGenerator.apply(mod)); }, executor) - .whenComplete((mc, exception) -> { + .whenComplete((_, exception) -> { mod.modLoadingStage = nextState.apply(mod.modLoadingStage, exception); progressBar.increment(); ModLoadingContext.get().setActiveContainer(null); @@ -129,20 +144,7 @@ class ModStateTransitionHelper { modFutures.put(mod.getModId(), dispatch); } - var dispatch = gather(modFutures.values()).thenComposeAsync(ModStateTransitionHelper::completableFutureFromExceptionList, executor); - completableFutures.add(dispatch); - - @SuppressWarnings("removal") - var postDispatchHook = getHook(transition.preDispatchHook(), executor, eventGenerator); - if (postDispatchHook != null) - completableFutures.add(postDispatchHook); - } - - private static CompletableFuture getHook(BiFunction, CompletableFuture> hook, Executor executor, EventGenerator eventGenerator) { - if (hook == null || hook == IModStateTransition.NULL_HOOK) return null; - @SuppressWarnings("unchecked") - var hookTyped = (BiFunction, CompletableFuture>)hook; - return hookTyped.apply(executor, eventGenerator); + return gather(modFutures.values()).thenComposeAsync(ModStateTransitionHelper::completableFutureFromExceptionList, executor); } static CompletableFuture build( @@ -154,31 +156,25 @@ class ModStateTransitionHelper { final Function> preSyncTask, final Function> postSyncTask ) { - List> futures = new ArrayList<>(); + CompletableFuture future; final var executor = transition.threadSelector().apply(syncExecutor, parallelExecutor); - @SuppressWarnings({ "removal", "unchecked" }) - var events = transition.eventFunctionStream().get().map(f -> (EventGenerator)f).toList(); - for (int x = 0; x < events.size(); x++) { - var gen = events.get(x); - BiFunction state = x == events.size() - 1 - ? transition.nextModLoadingStage() - : ModLoadingStage::currentState; - addCompletableFutureTaskForModDispatch(transition, executor, futures, progressBar, gen, state); + final CompletableFuture preSyncTaskCF = preSyncTask.apply(syncExecutor); + CompletableFuture postEventDispatchCF = preSyncTaskCF + .thenRunAsync(() -> progressBar.label(progressBar.name() + ": dispatching " + name), parallelExecutor); + + var eventGenerator = transition.eventFunction(); + if (eventGenerator != null) { + BiFunction state = transition.nextModLoadingStage(); + future = addCompletableFutureTaskForModDispatch(executor, progressBar, eventGenerator, state); + + final CompletableFuture eventDispatchCF = future.handle(FutureResult::new) + .thenCompose(ModStateTransitionHelper::completableFutureFromException); + postEventDispatchCF = postEventDispatchCF.thenComposeAsync(_ -> eventDispatchCF, parallelExecutor); } - final CompletableFuture preSyncTaskCF = preSyncTask.apply(syncExecutor); - final CompletableFuture eventDispatchCF = gather(futures).thenCompose(ModStateTransitionHelper::completableFutureFromExceptionList); - final CompletableFuture postEventDispatchCF = preSyncTaskCF - .thenApplyAsync(n -> { - progressBar.label(progressBar.name() + ": dispatching " + name); - return null; - }, parallelExecutor) - .thenComposeAsync(n -> eventDispatchCF, parallelExecutor) - .thenApply(r -> { - postSyncTask.apply(syncExecutor); - return null; - }); + postEventDispatchCF = postEventDispatchCF.thenRun(() -> postSyncTask.apply(syncExecutor)); + return transition.finalActivityGenerator().apply(syncExecutor, postEventDispatchCF); } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModWorkManager.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModWorkManager.java index cf37948b42..90789aafd6 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModWorkManager.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModWorkManager.java @@ -14,25 +14,12 @@ import java.util.concurrent.locks.LockSupport; import static net.minecraftforge.fml.Logging.LOADING; -public class ModWorkManager { +public final class ModWorkManager { private static final Logger LOGGER = LogManager.getLogger(); private static final long PARK_TIME = TimeUnit.MILLISECONDS.toNanos(1); - public interface DrivenExecutor extends Executor { - boolean selfDriven(); - boolean driveOne(); - - default void drive(Runnable ticker) { - if (!selfDriven()) { - ticker.run(); - while (true) { - if (!driveOne()) break; - } - } else { - // park for a bit so other threads can schedule - LockSupport.parkNanos(PARK_TIME); - } - } + public sealed interface DrivenExecutor extends Executor { + void drive(Runnable ticker); } private record SyncExecutor(ConcurrentLinkedDeque tasks) implements DrivenExecutor { @@ -40,8 +27,7 @@ public class ModWorkManager { this(new ConcurrentLinkedDeque<>()); } - @Override - public boolean driveOne() { + private boolean driveOne() { final Runnable task = tasks.pollFirst(); if (task != null) { task.run(); @@ -50,31 +36,30 @@ public class ModWorkManager { } @Override - public boolean selfDriven() { - return false; + public void execute(final Runnable command) { + tasks.addLast(command); } @Override - public void execute(final Runnable command) { - tasks.addLast(command); + public void drive(Runnable ticker) { + ticker.run(); + while (true) { + if (!driveOne()) break; + } } } private record WrappingExecutor(Executor wrapped) implements DrivenExecutor { - @Override - public boolean selfDriven() { - return true; - } - - @Override - public boolean driveOne() { - return false; - } - @Override public void execute(final Runnable command) { wrapped.execute(command); } + + @Override + public void drive(Runnable ticker) { + // Park for a bit so other threads can schedule + LockSupport.parkNanos(PARK_TIME); + } } private static final SyncExecutor syncExecutor = new SyncExecutor(); diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/OptionalMod.java b/fmlcore/src/main/java/net/minecraftforge/fml/OptionalMod.java index 31a686f3b4..2683b37988 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/OptionalMod.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/OptionalMod.java @@ -43,7 +43,7 @@ public final class OptionalMod private T getValue() { if (!searched) { - this.value = ModList.get().getModObjectById(this.modId).orElse(null); + this.value = ModList.getModObjectById(this.modId).orElse(null); searched = true; } return this.value; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java b/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java index fe03dcc582..8a3c9a7347 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java @@ -9,8 +9,8 @@ import java.util.concurrent.Executor; import java.util.function.BinaryOperator; public enum ThreadSelector implements BinaryOperator { - SYNC((sync, parallel) -> sync), - PARALLEL((sync, parallel) -> parallel); + SYNC((sync, _) -> sync), + PARALLEL((_, parallel) -> parallel); private final BinaryOperator selector; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/VersionChecker.java b/fmlcore/src/main/java/net/minecraftforge/fml/VersionChecker.java index 783ee8909b..88423d2955 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/VersionChecker.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/VersionChecker.java @@ -93,8 +93,8 @@ public class VersionChecker { return; } - var mc = ModList.get().getModContainerById("minecraft"); - var forge = ModList.get().getModContainerById("forge"); + var mc = ModList.getModContainerById("minecraft"); + var forge = ModList.getModContainerById("forge"); this.mcVersion = mc.get().getModInfo().getVersion().toString(); this.agent = "Java-http-client/" + System.getProperty("java.version") @@ -223,7 +223,7 @@ public class VersionChecker { // Gather a list of mods that have opted in to this update system by providing a URL. private static List gatherMods() { List ret = new LinkedList<>(); - for (IModInfo info : ModList.get().getMods()) { + for (IModInfo info : ModList.getMods()) { if (info.getUpdateURL().isPresent()) ret.add(info); } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java index fd33c85d43..a7a63db614 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java @@ -8,8 +8,7 @@ package net.minecraftforge.fml.config; import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.mojang.logging.LogUtils; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLPaths; import org.slf4j.Logger; import org.slf4j.Marker; @@ -19,57 +18,54 @@ import java.nio.file.Path; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -public class ConfigTracker { +public final class ConfigTracker { + private ConfigTracker() {} + private static final Logger LOGGER = LogUtils.getLogger(); static final Marker CONFIG = MarkerFactory.getMarker("CONFIG"); - public static final ConfigTracker INSTANCE = new ConfigTracker(); - private final ConcurrentHashMap fileMap; - private final EnumMap> configSets; - private final ConcurrentHashMap> configsByMod; + private static final ConcurrentHashMap FILE_MAP = new ConcurrentHashMap<>(); + private static final Map> CONFIG_SETS = Map.of( + ModConfig.Type.CLIENT, Collections.synchronizedSet(new LinkedHashSet<>()), + ModConfig.Type.COMMON, Collections.synchronizedSet(new LinkedHashSet<>()), + ModConfig.Type.SERVER, Collections.synchronizedSet(new LinkedHashSet<>()) + ); + private static final ConcurrentHashMap> CONFIGS_BY_MOD = new ConcurrentHashMap<>(); - private ConfigTracker() { - this.fileMap = new ConcurrentHashMap<>(); - this.configSets = new EnumMap<>(ModConfig.Type.class); - this.configsByMod = new ConcurrentHashMap<>(); - this.configSets.put(ModConfig.Type.CLIENT, Collections.synchronizedSet(new LinkedHashSet<>())); - this.configSets.put(ModConfig.Type.COMMON, Collections.synchronizedSet(new LinkedHashSet<>())); -// this.configSets.put(ModConfig.Type.PLAYER, new ConcurrentSkipListSet<>()); - this.configSets.put(ModConfig.Type.SERVER, Collections.synchronizedSet(new LinkedHashSet<>())); - } - - void trackConfig(final ModConfig config) { - if (this.fileMap.containsKey(config.getFileName())) { - LOGGER.error(CONFIG,"Detected config file conflict {} between {} and {}", config.getFileName(), this.fileMap.get(config.getFileName()).getModId(), config.getModId()); + static void trackConfig(final ModConfig config) { + if (FILE_MAP.containsKey(config.getFileName())) { + LOGGER.error(CONFIG,"Detected config file conflict {} between {} and {}", config.getFileName(), FILE_MAP.get(config.getFileName()).getModId(), config.getModId()); throw new RuntimeException("Config conflict detected!"); } - this.fileMap.put(config.getFileName(), config); - this.configSets.get(config.getType()).add(config); - this.configsByMod.computeIfAbsent(config.getModId(), (k)->new EnumMap<>(ModConfig.Type.class)).put(config.getType(), config); + FILE_MAP.put(config.getFileName(), config); + CONFIG_SETS.get(config.getType()).add(config); + CONFIGS_BY_MOD.computeIfAbsent(config.getModId(), _ -> new EnumMap<>(ModConfig.Type.class)).put(config.getType(), config); LOGGER.debug(CONFIG, "Config file {} for {} tracking", config.getFileName(), config.getModId()); } - public void loadConfigs(ModConfig.Type type, Path configBasePath) { + public static void loadConfigs(ModConfig.Type type, Path configBasePath) { LOGGER.debug(CONFIG, "Loading configs type {}", type); - for (ModConfig config : this.configSets.get(type)) { + for (ModConfig config : CONFIG_SETS.get(type)) { openConfig(config, configBasePath); } } // TODO: [FML] This is only called for the server (outside of forceUnload) // rethink config implementation for eventual FML rewrite - public void unloadConfigs(ModConfig.Type type, Path configBasePath) { + public static void unloadConfigs(ModConfig.Type type, Path configBasePath) { LOGGER.debug(CONFIG, "Unloading configs type {}", type); - for (ModConfig config : this.configSets.get(type)) { + for (ModConfig config : CONFIG_SETS.get(type)) { closeConfig(config, configBasePath); } ConfigFileTypeHandler.get(type).stopWatcher(); } // If there is a better way to do this, please tell me. Because this is FUCKED - public void forceUnload() { + public static void forceUnload() { // This is how ModStateProvider handles loading configs. So we're doing the same but with unloadConfigs instead - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.unloadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get())); - this.unloadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); + if (FMLEnvironment.dist.isClient()) + unloadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()); + + unloadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); // just in case server watcher is still alive somehow... ConfigFileTypeHandler.get(ModConfig.Type.SERVER).stopWatcher(); @@ -96,8 +92,8 @@ public class ConfigTracker { } } - public void loadDefaultServerConfigs() { - configSets.get(ModConfig.Type.SERVER).forEach(modConfig -> { + public static void loadDefaultServerConfigs() { + CONFIG_SETS.get(ModConfig.Type.SERVER).forEach(modConfig -> { final CommentedConfig commentedConfig = CommentedConfig.inMemory(); modConfig.getSpec().correct(commentedConfig); modConfig.setConfigData(commentedConfig); @@ -105,16 +101,16 @@ public class ConfigTracker { }); } - public String getConfigFileName(String modId, ModConfig.Type type) { - return Optional.ofNullable(configsByMod.getOrDefault(modId, Collections.emptyMap()).getOrDefault(type, null)). + public static String getConfigFileName(String modId, ModConfig.Type type) { + return Optional.ofNullable(CONFIGS_BY_MOD.getOrDefault(modId, Collections.emptyMap()).getOrDefault(type, null)). map(ModConfig::getFullPath).map(Object::toString).orElse(null); } - public Map> configSets() { - return configSets; + public static Map> configSets() { + return CONFIG_SETS; } - public ConcurrentHashMap fileMap() { - return fileMap; + public static ConcurrentHashMap fileMap() { + return FILE_MAP; } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/IConfigEvent.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/IConfigEvent.java index 21e2060416..5db712359c 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/IConfigEvent.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/IConfigEvent.java @@ -13,6 +13,7 @@ import java.util.function.Function; import org.jetbrains.annotations.Nullable; public interface IConfigEvent { + // TODO: [FML] Get rid of this indirection somehow record ConfigConfig(Function loading, Function reloading, @Nullable Function unloading) {} ConfigConfig CONFIGCONFIG = Bindings.getConfigConfiguration().get(); diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java index 7179e41120..bb2f2f5670 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java @@ -13,8 +13,6 @@ import net.minecraftforge.fml.loading.StringUtils; import java.io.ByteArrayInputStream; import java.nio.file.Path; -import java.util.Locale; -import java.util.concurrent.Callable; public class ModConfig { @@ -31,7 +29,7 @@ public class ModConfig this.fileName = fileName; this.container = container; this.configHandler = ConfigFileTypeHandler.get(type); - ConfigTracker.INSTANCE.trackConfig(this); + ConfigTracker.trackConfig(this); } public ModConfig(final Type type, final IConfigSpec spec, final ModContainer activeContainer) { @@ -40,8 +38,9 @@ public class ModConfig private static String defaultConfigName(Type type, String modId) { // config file name would be "forge-client.toml" and "forge-server.toml" - return String.format(Locale.ROOT, "%s-%s.toml", modId, type.extension()); + return modId + '-' + type.extension() + ".toml"; } + public Type getType() { return type; } diff --git a/fmlearlydisplay/build.gradle b/fmlearlydisplay/build.gradle index 78e8905e8f..b3316d0262 100644 --- a/fmlearlydisplay/build.gradle +++ b/fmlearlydisplay/build.gradle @@ -1,67 +1,74 @@ -import net.minecraftforge.gradleutils.PomUtils +import org.gradle.api.plugins.jvm.JvmTestSuite +import org.gradle.internal.os.OperatingSystem plugins { id 'java-library' + id 'jvm-test-suite' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') - -import org.gradle.internal.os.OperatingSystem switch (OperatingSystem.current()) { - case OperatingSystem.LINUX: - project.ext.lwjglNatives = "natives-linux" - break - case OperatingSystem.MAC_OS: - project.ext.lwjglNatives = "natives-macos" - break - case OperatingSystem.WINDOWS: - project.ext.lwjglNatives = "natives-windows" - break + case OperatingSystem.LINUX: + project.ext.lwjglNatives = "natives-linux" + break + case OperatingSystem.MAC_OS: + project.ext.lwjglNatives = "natives-macos" + break + case OperatingSystem.WINDOWS: + project.ext.lwjglNatives = "natives-windows" + break } +gradleutils.displayName = 'FML Early Display' +final vendor = 'Forge Development LLC' +description = 'A pretty looking, but prone to erroring screen displayed during Forge loading.' + java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } +license { + header = rootProject.file('LICENSE-header.txt') +} + +changelog { + from changelogBase +} + dependencies { - compileOnly(libs.jetbrains.annotations) - implementation(project(':fmlloader')) - implementation(project(':fmlcore')) - implementation(libs.bundles.lwjgl) - implementation('org.slf4j:slf4j-api:1.8.0-beta4') - implementation(libs.jopt.simple) - testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.2') - testImplementation('org.powermock:powermock-core:2.0.9') - testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.2') - testRuntimeOnly('org.slf4j:slf4j-jdk14:1.8.0-beta4') - testRuntimeOnly("org.lwjgl:lwjgl::$lwjglNatives") - testRuntimeOnly("org.lwjgl:lwjgl-glfw::$lwjglNatives") - testRuntimeOnly("org.lwjgl:lwjgl-opengl::$lwjglNatives") - testRuntimeOnly("org.lwjgl:lwjgl-stb::$lwjglNatives") + compileOnly libs.jetbrains.annotations + + implementation projects.fmlloader + implementation projects.fmlcore + implementation libs.bundles.lwjgl + implementation earlyDisplayLibs.slf4j.api + implementation libs.jopt.simple } -tasks.named('test', Test).configure { - useJUnitPlatform() +// See gradle/gradle#35070 (https://github.com/gradle/gradle/issues/35070) +// We are making the list of providers first BEFORE mapping them to a provider of the resolved objects so that they can be finalized after configuration. +var lwjglTestLibs = [ + dependencies.variantOf(earlyDisplayTestLibs.lwjgl) { classifier lwjglNatives }, + dependencies.variantOf(earlyDisplayTestLibs.lwjgl.glfw) { classifier lwjglNatives }, + dependencies.variantOf(earlyDisplayTestLibs.lwjgl.opengl) { classifier lwjglNatives }, + dependencies.variantOf(earlyDisplayTestLibs.lwjgl.stb) { classifier lwjglNatives } +].with { list -> + provider { list.collect { it.get() } } } -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.earlydisplay', - 'Forge-Module-Layer': 'boot' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'FML Early Display', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'FML Early Display', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': '1.0' - ] as LinkedHashMap, 'net/minecraftforge/fml/earlydisplay/') +testing.suites.named('test', JvmTestSuite) { + useJUnitJupiter('5.8.2') + + dependencies { + implementation earlyDisplayTestLibs.powermock.core + runtimeOnly earlyDisplayLibs.slf4j.jdk14 + runtimeOnly.bundle lwjglTestLibs } } @@ -69,24 +76,42 @@ tasks.withType(JavaCompile).configureEach { options.compilerArgs << '-Xlint:unchecked' } -license { - header = rootProject.file('LICENSE-header.txt') +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.earlydisplay', + 'Forge-Module-Layer' : 'boot' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Vendor' : vendor, + 'Implementation-Version': '1.0' + ], 'net/minecraftforge/fml/earlydisplay/') + } } publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'fmlearlydisplay' - pom { - name = project.name - description = 'A pretty looking, but prone to erroring screen displayed during Forge loading.' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } - } - repositories { maven gradleutils.publishingForgeMaven } -} + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } +} \ No newline at end of file diff --git a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/DisplayWindow.java b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/DisplayWindow.java index a79300826b..df45aadd56 100644 --- a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/DisplayWindow.java +++ b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/DisplayWindow.java @@ -46,8 +46,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; import java.util.function.Supplier; import java.util.stream.Collector; import java.util.stream.Collectors; @@ -70,7 +68,7 @@ import static org.lwjgl.opengl.GL32C.*; * Based on the prior ClientVisualization, with some personal touches. */ public class DisplayWindow implements ImmediateWindowProvider { - private static final int[][] GL_VERSIONS = new int[][] {{4,6}, {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0}, {3,3}, {3,2}}; + private static final int[][] GL_VERSIONS = new int[][] {{4,6}, {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0}, {3,3}}; private static final Logger LOGGER = LoggerFactory.getLogger("EARLYDISPLAY"); private final AtomicBoolean animationTimerTrigger = new AtomicBoolean(true); @@ -115,6 +113,14 @@ public class DisplayWindow implements ImmediateWindowProvider { return "fmlearlywindow"; } + @Override + public ImmediateWindowProvider selectBackend(String backend) { + // We only support opengl + if ("default".equals(backend) || "opengl".equals(backend)) + return this; + return ImmediateWindowProvider.getFallbackHandler(); + } + @Override public Runnable initialize(String[] arguments) { String mcVersion = FMLLoader.versionInfo().mcVersion(); @@ -139,7 +145,7 @@ public class DisplayWindow implements ImmediateWindowProvider { this.colourScheme = ColourScheme.BLACK; } else { try { - // check the options file for the colour scheme + // check the options file for the color scheme var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt"))); var keyName = "darkMojangStudiosBackground:"; for (String line : optionLines) { @@ -314,17 +320,18 @@ public class DisplayWindow implements ImmediateWindowProvider { LOGGER.error("ERROR DISPLAY\n"+msgBuilder); // we show the display on a new dedicated thread Executors.newSingleThreadExecutor().submit(()-> { - var res = TinyFileDialogs.tinyfd_messageBox("Minecraft: Forge", msgBuilder.toString(), "yesno", "error", false); - if (res) { + var res = TinyFileDialogs.tinyfd_messageBox("Minecraft: Forge", msgBuilder.toString(), "yesno", "error", 0); + if (res != 0) { try { Desktop.getDesktop().browse(URI.create(ERROR_URL)); } catch (IOException ioe) { - TinyFileDialogs.tinyfd_messageBox("Minecraft: Forge", "Sadly, we couldn't open your browser.\nVisit " + ERROR_URL, "ok", "error", false); + TinyFileDialogs.tinyfd_messageBox("Minecraft: Forge", "Sadly, we couldn't open your browser.\nVisit " + ERROR_URL, "ok", "error", 0); } } System.exit(1); }); } + /** * Called to initialize the window when preparing for the Render Thread. * @@ -460,7 +467,9 @@ public class DisplayWindow implements ImmediateWindowProvider { this.winWidth = x[0]; this.winHeight = y[0]; + // Setting the window position isn't supported on wayland, so check the error here glfwSetWindowPos(window, (vidmode.width() - this.winWidth) / 2 + monitorX, (vidmode.height() - this.winHeight) / 2 + monitorY); + handleLastGLFWError(); // Attempt setting the icon // int[] channels = new int[1]; @@ -483,7 +492,10 @@ public class DisplayWindow implements ImmediateWindowProvider { // Show the window glfwShowWindow(window); + // Getting the window position isn't supported on wayland, so check the error here glfwGetWindowPos(window, x, y); + handleLastGLFWError(); + this.winX = x[0]; this.winY = y[0]; glfwGetFramebufferSize(window, x, y); @@ -492,6 +504,18 @@ public class DisplayWindow implements ImmediateWindowProvider { glfwPollEvents(); } + private static void handleLastGLFWError() { + handleLastGLFWError((error, description) -> { + if (error == GLFW_FEATURE_UNAVAILABLE) { + // suppress window pos errors for unsupported platforms (wayland) + LOGGER.debug(String.format("Suppressing GLFW error: [0x%X]%s", error, description)); + return; + } + + throw new IllegalStateException(String.format("GLFW error: [0x%X]%s", error, description)); + }); + } + private void winResize(long window, int width, int height) { if (window == this.window && width != 0 && height != 0) { this.winWidth = width; @@ -529,7 +553,7 @@ public class DisplayWindow implements ImmediateWindowProvider { * * @return the Window we own. */ - public long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier title, final LongSupplier monitorSupplier) { + public long setupMinecraftWindow(final int width, final int height, final String title, final long monitorSupplier, final Supplier backend) { // wait for the window to actually be initialized try { this.initializationFuture.get(30, TimeUnit.SECONDS); @@ -549,11 +573,11 @@ public class DisplayWindow implements ImmediateWindowProvider { var renderlockticket = false; do { try { - renderlockticket = renderLock.tryAcquire(100, TimeUnit.MILLISECONDS); - if (++tries > 9) { - Thread.dumpStack(); - crashElegantly("We seem to be having trouble handing off the window, tried for 1 second"); - } + renderlockticket = renderLock.tryAcquire(100, TimeUnit.MILLISECONDS); + if (++tries > 9) { + Thread.dumpStack(); + crashElegantly("We seem to be having trouble handing off the window, tried for 1 second"); + } } catch (InterruptedException e) { Thread.interrupted(); } @@ -563,7 +587,7 @@ public class DisplayWindow implements ImmediateWindowProvider { glfwMakeContextCurrent(window); // Set the title to what the game wants - glfwSetWindowTitle(window, title.get()); + glfwSetWindowTitle(window, title); glfwSwapInterval(0); // Clean up our hooks glfwSetFramebufferSizeCallback(window, null).free(); @@ -649,4 +673,4 @@ public class DisplayWindow implements ImmediateWindowProvider { this.context.elementShader().close(); SimpleBufferBuilder.destroy(); } -} \ No newline at end of file +} diff --git a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java index 68895f3298..e0cd43e72c 100644 --- a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java +++ b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java @@ -116,7 +116,7 @@ public class RenderElement { } public static RenderElement forgeVersionOverlay(SimpleFont font, String version) { - return new RenderElement(RenderElement.initializeText(font, (bb, fnt, ctx)-> + return new RenderElement(RenderElement.initializeText(font, (bb, _, ctx)-> font.generateVerticesForTexts(ctx.scaledWidth() - font.stringWidth(version) - 10, ctx.scaledHeight() - font.lineSpacing() + font.descent() - 10, bb, new SimpleFont.DisplayText(version, ctx.colourScheme.foreground().packedint(RenderElement.globalAlpha))))); @@ -178,11 +178,11 @@ public class RenderElement { var colour = (alpha << 24) | 0xFFFFFF; Renderer bar; if (pm.steps() == 0) { - bar = progressBar(ctx->new int[] {(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, f->colour, frame -> indeterminateBar(frame, cnt == 0)); + bar = progressBar(ctx->new int[] {(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, _->colour, frame -> indeterminateBar(frame, cnt == 0)); } else { - bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, f -> colour, f -> new float[]{0f, pm.progress()}); + bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, _ -> colour, _ -> new float[]{0f, pm.progress()}); } - Renderer label = (bb, ctx, frame) -> renderText(font, text((ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, pm.label().getText(), colour), bb, ctx); + Renderer label = (bb, ctx, _) -> renderText(font, text((ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, pm.label().getText(), colour), bb, ctx); return bar.then(label); } private static float[] indeterminateBar(int frame, boolean isActive) { @@ -198,9 +198,9 @@ public class RenderElement { var y = 10 * context.scale(); PerformanceInfo pi = context.performance(); final int colour = hsvToRGB((1.0f - (float)Math.pow(pi.memory(), 1.5f)) / 3f, 1.0f, 0.5f); - var bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, BAR_WIDTH * ctx.scale()}, f -> colour, f -> new float[]{0f, pi.memory()}); + var bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, BAR_WIDTH * ctx.scale()}, _ -> colour, _ -> new float[]{0f, pi.memory()}); var width = font.stringWidth(pi.text()); - Renderer label = (bb, ctx, frame) -> renderText(font, text(ctx.scaledWidth() / 2 - width / 2, y + 18, pi.text(), context.colourScheme.foreground().packedint(globalAlpha)), bb, ctx); + Renderer label = (bb, ctx, _) -> renderText(font, text(ctx.scaledWidth() / 2 - width / 2, y + 18, pi.text(), context.colourScheme.foreground().packedint(globalAlpha)), bb, ctx); bar.then(label).accept(buffer, context, frameNumber); } @@ -250,7 +250,7 @@ public class RenderElement { } private static Renderer initializeText(SimpleFont font, TextGenerator textGenerator) { - return (bb, context, frame) -> renderText(font, textGenerator, bb, context); + return (bb, context, _) -> renderText(font, textGenerator, bb, context); } private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) { @@ -262,7 +262,7 @@ public class RenderElement { } private static TextGenerator text(int x, int y, String text, int colour) { - return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour)); + return (bb, font, _) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour)); } private static Renderer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) { diff --git a/fmlloader/build.gradle b/fmlloader/build.gradle index 70cae8a9d0..21a9112b80 100644 --- a/fmlloader/build.gradle +++ b/fmlloader/build.gradle @@ -1,70 +1,75 @@ -import net.minecraftforge.gradleutils.PomUtils +import groovy.transform.CompileDynamic +import groovy.transform.CompileStatic +import groovy.transform.PackageScope +import net.minecraftforge.forgedev.legacy.tasks.JarJarMetadataOptions +import org.gradle.api.plugins.jvm.JvmTestSuite + +import javax.inject.Inject plugins { id 'java-library' + id 'jvm-test-suite' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' - alias(libs.plugins.apt) + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + alias libs.plugins.apt + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') - -configurations.forEach{ it.transitive = false } - -dependencies { - compileOnly(libs.jetbrains.annotations) - - api(libs.bundles.asm) // Needed by all the black magic - api(libs.forgespi) - api(libs.mergetool.api) - api(libs.log4j.api) - api(libs.slf4j.api) - api(libs.guava) - api(libs.gson) - api(libs.maven.artifact) - api(libs.apache.commons) - api(libs.bundles.night.config) - api(libs.modlauncher) - api(libs.coremods) - api(libs.mojang.logging) - api(libs.jarjar.selector) - api(libs.jarjar.meta) - - implementation(libs.jopt.simple) - implementation(libs.securemodules) - implementation(libs.accesstransformers) - implementation(libs.terminalconsoleappender) - implementation(libs.jimfs) - implementation(libs.roimfs) - - // Needed because we have a custom log4j plugin, and they removed package scanning and require a data file to be generated - implementation(libs.log4j.core) - annotationProcessor(libs.bundles.log4j) - - testCompileOnly(libs.jetbrains.annotations) - testRuntimeOnly(libs.bootstrap) -} +gradleutils.displayName = 'FMLLoader' +final vendor = 'Forge Development LLC' +description = 'Modifications to Minecraft to enable mod developers.' java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.fmlloader', - 'Forge-Module-Layer': 'boot' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'FMLLoader', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'FMLLoader', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': FORGE_VERSION - ] as LinkedHashMap, 'net/minecraftforge/fml/loading/') +license { + header = rootProject.file('LICENSE-header.txt') +} + +changelog { + from changelogBase +} + +dependencies { + compileOnly libs.jetbrains.annotations + + // TODO [FMLLoader] Figure out a better way to lock transitive dependencies to the explicit versions shipped by the isntaller + api(libs.bundles.asm ){ transitive = false } // Needed by all the black magic + api(libs.forgespi ){ transitive = false } + api(libs.mergetool.api ){ transitive = false } + api(libs.log4j.api ){ transitive = false } + api(libs.slf4j.api ){ transitive = false } + api(libs.guava ){ transitive = false } + api(libs.gson ){ transitive = false } + api(libs.maven.artifact ){ transitive = false } + api(libs.apache.commons ){ transitive = false } + api(libs.bundles.night.config){ transitive = false } + api(libs.modlauncher ){ transitive = false } + api(libs.mojang.logging ){ transitive = false } + api(libs.jarjar.selector ){ transitive = false } + api(libs.jarjar.meta ){ transitive = false } + + implementation(libs.jopt.simple ){ transitive = false } + implementation(libs.securemodules ){ transitive = false } + implementation(libs.accesstransformers ){ transitive = false } + implementation(libs.terminalconsoleappender){ transitive = false } + implementation(libs.jimfs ){ transitive = false } + implementation(libs.roimfs ){ transitive = false } + + // Needed because we have a custom log4j plugin, and they removed package scanning and require a data file to be generated + implementation(libs.log4j.core ){ transitive = false } + annotationProcessor(libs.bundles.log4j){ transitive = false } +} + +testing.suites.named('test', JvmTestSuite) { + dependencies { + compileOnly libs.jetbrains.annotations + runtimeOnly libs.bootstrap } } @@ -72,39 +77,81 @@ tasks.withType(JavaCompile).configureEach { options.compilerArgs << '-Xlint:unchecked' } -license { - header = rootProject.file('LICENSE-header.txt') +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.fmlloader', + 'Forge-Module-Layer' : 'boot' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Vendor' : vendor, + 'Implementation-Version': forgeVersion + ], 'net/minecraftforge/fml/loading/') + } } publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'fmlloader' - pom { - name = project.name - description = 'Modifactions to Minecraft to enable mod developers.' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } - } - repositories { maven gradleutils.publishingForgeMaven } -} -tasks.register('writeForgeVersionJson') { - doLast { - file('src/main/resources/forge_version.json').json = [ - forge: FORGE_VERSION, - mc: MC_VERSION, - mcp: MCP_VERSION - ] + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } } } -tasks.register('jarJarOptionsJson', net.minecraftforge.forge.tasks.JarJarMetadataOptions) { +// A simple task to write JSON to a file. Using Task#doLast to output files is no longer supported. +// This code may seem verbose, but it's better this way. If more projects need this, we can move it to buildSrc. +@CompileStatic +@PackageScope abstract class WriteForgeVersionJson extends DefaultTask { + abstract @Input Property getForgeVersion() + abstract @Input Property getMinecraftVersion() + abstract @Input Property getMcpVersion() + + abstract @OutputFile RegularFileProperty getOutputFile() + + @Inject + WriteForgeVersionJson() {} + + @TaskAction + @CompileDynamic + void exec() { + var json = new groovy.json.JsonBuilder() + json { + forge this.forgeVersion.get() + mc this.minecraftVersion.get() + mcp this.mcpVersion.get() + } + this.outputFile.asFile.get().text = json.toPrettyString() + } +} + +tasks.register('writeForgeVersionJson', WriteForgeVersionJson) { + forgeVersion = project.forgeVersion + minecraftVersion = project.minecraftVersion + mcpVersion = project.mcpVersion + + outputFile = file('src/main/resources/forge_version.json') +} + +tasks.register('jarJarOptionsJson', JarJarMetadataOptions) { metadataFile = project.file('src/main/resources/jarjar_options.json') // This is resolved too early by cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(DiscoveryData) But eventually... //add(libs.mixin, 'org/spongepowered/asm/mixin/Mixin.class') @@ -119,29 +166,25 @@ tasks.register('jarJarOptionsJson', net.minecraftforge.forge.tasks.JarJarMetadat } } -tasks.named('generateResources').configure { - dependsOn('eclipseJdt') - dependsOn('eclipseJdtApt') - dependsOn('eclipseFactorypath') - dependsOn('writeForgeVersionJson') - dependsOn('jarJarOptionsJson') +tasks.named('generateResources') { + dependsOn( + tasks.named('eclipseJdt'), + tasks.named('eclipseJdtApt'), + tasks.named('eclipseFactorypath'), + tasks.named('writeForgeVersionJson', WriteForgeVersionJson), + tasks.named('jarJarOptionsJson') + ) } -tasks.named('sourcesJar') { - dependsOn('jarJarOptionsJson') -} - -eclipse { - classpath { - // We need to set the default output directory for the log4j annotation processor - // Ideally we'd just set the value, but the eclipse plugin deduplicates the output directories - // So we have to do a hacky whenMerged - //defaultOutputDir = file('bin/main') - file.whenMerged { - entries.each { entry -> - if (entry.kind == 'output' && entry.hasProperty('path')) - entry.path = 'bin/main' - } - } +eclipse.classpath { + // We need to set the default output directory for the log4j annotation processor + // Ideally we'd just set the value, but the eclipse plugin deduplicates the output directories + // So we have to do a hacky whenMerged + //defaultOutputDir = file('bin/main') + file.whenMerged { + entries.each { entry -> + if (entry.kind == 'output' && entry.hasProperty('path')) + entry.path = 'bin/main' + } } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java index 78e0d15df2..e861ed43f2 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java @@ -49,7 +49,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService { private static final class LazyInit { private LazyInit() {} - private static final boolean ANY_MODS = LoadingModList.get().getMods().size() > 2; // 2: forge, minecraft + private static final boolean ANY_MODS = LoadingModList.getMods().size() > 2; // 2: forge, minecraft } @Override diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java index 1530f6b575..414dee68e3 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java @@ -109,7 +109,7 @@ public class FMLConfig } if (!configSpec.isCorrect(configData)) { LOGGER.warn(CORE, "Configuration file {} is not correct. Correcting", configFile); - configSpec.correct(configData, (action, path, incorrectValue, correctedValue) -> + configSpec.correct(configData, (_, path, incorrectValue, correctedValue) -> LOGGER.info(CORE, "Incorrect key {} was corrected from {} to {}", path, incorrectValue, correctedValue)); } configData.putAllComments(configComments); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java index 4f72460375..327279e890 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java @@ -20,8 +20,8 @@ public class FMLEnvironment public static final boolean secureJarsEnabled = FMLLoader.isSecureJarEnabled(); static void setupInteropEnvironment(IEnvironment environment) { - environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming); - environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist); + environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), _->naming); + environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), _->dist); } public static class Keys { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java index e210ecdf68..69fad86619 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java @@ -16,7 +16,6 @@ import net.minecraftforge.accesstransformer.service.AccessTransformerService; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.loading.targets.CommonLaunchHandler; import net.minecraftforge.forgespi.Environment; -import net.minecraftforge.forgespi.coremod.ICoreModProvider; import org.slf4j.Logger; import java.nio.file.Path; @@ -31,14 +30,11 @@ import java.util.function.BiFunction; import static net.minecraftforge.fml.loading.LogMarkers.CORE; import static net.minecraftforge.fml.loading.LogMarkers.SCAN; -public class FMLLoader { +public final class FMLLoader { private static final Logger LOGGER = LogUtils.getLogger(); private static AccessTransformerService accessTransformer; - private static ICoreModProvider coreModProvider; - private static LanguageLoadingProvider languageLoadingProvider; private static Dist dist; private static String naming; - private static LoadingModList loadingModList; private static RuntimeDistCleaner runtimeDistCleaner; private static Path gamePath; private static final VersionInfo versionInfo = VersionInfo.detect(); @@ -57,8 +53,6 @@ public class FMLLoader { checkPackage(ITransformationService.class, "4.0", "ModLauncher"); accessTransformer = getPlugin(env, "accesstransformer", "1.0", "AccessTransformer"); runtimeDistCleaner = getPlugin(env, "runtimedistcleaner", "1.0", "RuntimeDistCleaner"); - coreModProvider = getSingleService(ICoreModProvider.class, "CoreMod"); - LOGGER.debug(CORE, "FML found CoreMod version : {}", JarVersionLookupHandler.getInfo(coreModProvider.getClass()).impl().version().orElse("MISSING")); checkPackage(Environment.class, "2.0", "ForgeSPI"); try { @@ -96,6 +90,7 @@ public class FMLLoader { } } + @SuppressWarnings("unused") private static T getSingleService(Class clazz, String name) throws IncompatibleEnvironmentException { var providers = new ArrayList(); for (var itr = ServiceLoader.load(FMLLoader.class.getModule().getLayer(), clazz).iterator(); itr.hasNext(); ) { @@ -154,26 +149,17 @@ public class FMLLoader { public static List completeScan(IModuleLayerManager layerManager) { moduleLayerManager = layerManager; - languageLoadingProvider = new LanguageLoadingProvider(); + LanguageLoadingProvider.reload(); backgroundScanHandler = modValidator.stage2Validation(); - loadingModList = backgroundScanHandler.getLoadingModList(); return List.of(modValidator.getModResources()); } - public static ICoreModProvider getCoreModProvider() { - return coreModProvider; - } - - public static LanguageLoadingProvider getLanguageLoadingProvider() { - return languageLoadingProvider; - } - public static CommonLaunchHandler getLaunchHandler() { return commonLaunchHandler; } public static void addAccessTransformer(Path atPath, ModFile modName) { - LOGGER.debug(SCAN, "Adding Access Transformer in {}", modName.getFilePath()); + LOGGER.debug(SCAN, "Adding Access Transformer {} in {}", atPath, modName.getFilePath()); accessTransformer.offerResource(atPath, modName.getFileName()); } @@ -187,10 +173,6 @@ public class FMLLoader { progressWindowTick.run(); } - public static LoadingModList getLoadingModList() { - return loadingModList; - } - public static Path getGamePath() { return gamePath; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java index 6f2dca80e3..fd74cf0698 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java @@ -12,7 +12,6 @@ import net.minecraftforge.forgespi.Environment; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -42,7 +41,7 @@ public class FMLServiceProvider implements ITransformationService { LOGGER.debug(CORE, "Loading configuration"); FMLConfig.load(); LOGGER.debug(CORE, "Preparing ModFile"); - environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile::new); + environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), _->ModFile::new); LOGGER.debug(CORE, "Preparing launch handler"); FMLLoader.setupLaunchHandler(environment, arguments); FMLEnvironment.setupInteropEnvironment(environment); @@ -68,7 +67,6 @@ public class FMLServiceProvider implements ITransformationService { @SuppressWarnings("rawtypes") @Override public @NotNull List transformers() { - LOGGER.debug(CORE, "Loading coremod transformers"); - return new ArrayList<>(FMLLoader.getCoreModProvider().getCoreModTransformers()); + return List.of(); } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowHandler.java index 15cf3a3617..c704a3fd7d 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowHandler.java @@ -10,8 +10,13 @@ import net.minecraftforge.fml.loading.progress.StartupNotificationManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import joptsimple.OptionParser; + +import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.util.function.*; import java.util.stream.Collectors; @@ -41,18 +46,64 @@ public class ImmediateWindowHandler { if (provider == null) { LOGGER.info("Failed to find ImmediateWindowProvider {}, disabling", providername); provider = new DummyProvider(); + } else { + var backend = findBackend(arguments); + var newProvider = provider.selectBackend(backend); + if (provider != newProvider) { + if (newProvider == null) + newProvider = new DummyProvider(); + + LOGGER.info("ImmediateWindowProvider {} does not support {}, switching to {}", provider.name(), backend, newProvider.name()); + provider = newProvider; + } } } + // Only update config if the provider isn't the dummy provider if (!Objects.equals(provider.name(), "dummyprovider")) FMLConfig.updateConfig(FMLConfig.ConfigValue.EARLY_WINDOW_PROVIDER, provider.name()); + FMLLoader.progressWindowTick = provider.initialize(arguments); earlyProgress = StartupNotificationManager.addProgressBar("EARLY", 0); earlyProgress.label("Bootstrapping Minecraft"); } - public static long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier title, final LongSupplier monitor) { - return provider.setupMinecraftWindow(width, height, title, monitor); + private static String findBackend(String[] arguments) { + // Try and parse from the command line arguments + var parser = new OptionParser(); + var backendOption = parser.accepts("graphicsBackend").withRequiredArg(); + parser.allowsUnrecognizedOptions(); + var parsed = parser.parse(arguments); + + if (parsed.has(backendOption)) + return parsed.valueOf(backendOption).toLowerCase(Locale.ENGLISH); + + + // Read the options.txt if it exists. + var optionsFile = FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt")); + if (!Files.exists(optionsFile)) // Default is OpenGL first + return "default"; + + List lines = null; + try { + lines = Files.readAllLines(optionsFile); + } catch (IOException e) { + return "default"; // We failed to read for some reason, assume we're using the default. + } + + final String key = "preferredGraphicsBackend:"; + for (var line : lines) { + if (line.startsWith(key)) { + var backend = line.substring(key.length() + 1, line.length() - 1); + return backend.toLowerCase(Locale.ENGLISH); + } + } + + return "default"; + } + + public static long setupMinecraftWindow(final int width, final int height, final String title, final long monitor, final Supplier backend) { + return provider.setupMinecraftWindow(width, height, title, monitor, backend); } public static boolean positionWindow(Optional monitor,IntConsumer widthSetter, IntConsumer heightSetter, IntConsumer xSetter, IntConsumer ySetter) { @@ -83,7 +134,7 @@ public class ImmediateWindowHandler { earlyProgress.label(message); } - private record DummyProvider() implements ImmediateWindowProvider { + record DummyProvider() implements ImmediateWindowProvider { private static Method NV_HANDOFF; private static Method NV_POSITION; private static Method NV_OVERLAY; @@ -104,9 +155,9 @@ public class ImmediateWindowHandler { } @Override - public long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier title, final LongSupplier monitor) { + public long setupMinecraftWindow(final int width, final int height, final String title, final long monitor, final Supplier backend) { try { - var longsupplier = (LongSupplier)NV_HANDOFF.invoke(null, width, height, title, monitor); + var longsupplier = (LongSupplier)NV_HANDOFF.invoke(null, width, height, title, monitor, backend); return longsupplier.getAsLong(); } catch (Throwable e) { throw new IllegalStateException("How did you get here?", e); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowProvider.java index d1b8c74058..d15c3629da 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ImmediateWindowProvider.java @@ -8,8 +8,6 @@ package net.minecraftforge.fml.loading; import java.util.Optional; import java.util.function.Consumer; import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; import java.util.function.Supplier; /** @@ -26,11 +24,36 @@ import java.util.function.Supplier; * No doubt many more things can be said here. */ public interface ImmediateWindowProvider { + /** + * Returns a new instance of ImmediateWindowProvider which just bounces to the vanilla code. + * This can be useful when you want to disable your provider and defer to vanilla behavior for some reason. + */ + public static ImmediateWindowProvider getFallbackHandler() { + return new ImmediateWindowHandler.DummyProvider(); + } + /** * @return The name of this window provider. Do NOT use fmlearlywindow. */ String name(); + /** + * This is called before initialize, but after reading the preferred graphics backend config value from the user's + * options.txt or command line. + * + * If you do not support the requested backend, you can return a new ImmediateWindowProvider that does. + * {@link #getFallbackHandler()} can be used to get an instance that falls back to Vanilla's code effectively + * disabling the early loading screen. + * + * @param backend - The backend the user has selected, known values: "default", "opengl", and "vulkan". However this + * is read from the config file, or command line arguments so could be anything. + * Default and OpenGL are treated the same, attempting to load OpenGL first, then Vulkan. + * Vulkan attempts to load Vulkan first then OpenGL + */ + default ImmediateWindowProvider selectBackend(String backend) { + return this; + } + /** * This is called very early on to initialize ourselves. Use this to initialize the window and other GL core resources. * @@ -66,7 +89,7 @@ public interface ImmediateWindowProvider { * @param monitor This is the monitor it should appear on. * @return The window id */ - long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier title, final LongSupplier monitor); + long setupMinecraftWindow(final int width, final int height, final String title, final long monitor, final Supplier backend); /** * This is called after window handoff to allow us to tell Mojang about our window's position. This might give a diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java index 6ec18db624..92b17454a5 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java @@ -18,7 +18,6 @@ import org.slf4j.Logger; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; import java.util.function.Consumer; @@ -28,43 +27,36 @@ import java.util.stream.Stream; import static net.minecraftforge.fml.loading.LogMarkers.CORE; import static net.minecraftforge.fml.loading.LogMarkers.LOADING; -public class LanguageLoadingProvider { - public void forEach(Consumer consumer) { +public final class LanguageLoadingProvider { + public static void forEach(Consumer consumer) { providers.forEach(consumer); } - public Stream applyForEach(Function function) { + public static Stream applyForEach(Function function) { return providers.stream().map(function); } - public void reload() { + public static void reload() { loadLanguageProviders(); } - /** This doesn't actually do anything with the argument, so just call reload(). Not sure when cpw broke that. */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void addAdditionalLanguages(List modFiles) { - reload(); - } - /*==========================================================================* - * INTERNAL SHIT * + * INTERNAL * *==========================================================================*/ private static final Logger LOGGER = LogUtils.getLogger(); - private final ServiceLoader serviceLoader; - private final List providers = new ArrayList<>(); - private final Map providersByName = new HashMap<>(); + private static final ServiceLoader serviceLoader; + private static final ArrayList providers = new ArrayList<>(); + private static final HashMap providersByName = new HashMap<>(); private static final DefaultArtifactVersion IN_DEV = new DefaultArtifactVersion("0.0-dev"); private record Wrapper(ArtifactVersion version, IModLanguageProvider service) {} - LanguageLoadingProvider() { + static { var sl = Launcher.INSTANCE.environment().findModuleLayerManager().flatMap(lm -> lm.getLayer(Layer.PLUGIN)).orElseThrow(); serviceLoader = ServiceLoader.load(sl, IModLanguageProvider.class); - loadLanguageProviders(); } - private void loadLanguageProviders() { + private static void loadLanguageProviders() { providers.clear(); providersByName.clear(); @@ -97,7 +89,7 @@ public class LanguageLoadingProvider { } } - public IModLanguageProvider findLanguage(ModFile mod, String language, VersionRange versionRange) { + public static IModLanguageProvider findLanguage(ModFile mod, String language, VersionRange versionRange) { var consumer = mod.getFileName(); var wrapper = providersByName.get(language); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModList.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModList.java index 7b7947821e..c0ac46d0b7 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModList.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModList.java @@ -5,111 +5,46 @@ package net.minecraftforge.fml.loading; -import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler; -import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.forgespi.locating.IModFile; +import org.jetbrains.annotations.Nullable; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -/** - * Master list of all mods in the loading context. This class cannot refer outside the - * loading package - */ -public class LoadingModList { - private static LoadingModList INSTANCE; - private final List modFiles; - private final List sortedList; - private final Map fileById; - private final List preLoadErrors; - private List brokenFiles; - - private LoadingModList(final List modFiles, final List sortedList) { - this.modFiles = modFiles.stream() - .map(ModFile::getModFileInfo) - .map(ModFileInfo.class::cast) - .toList(); - this.sortedList = sortedList.stream().toList(); - this.fileById = this.modFiles.stream() - .map(ModFileInfo::getMods) - .flatMap(Collection::stream) - .map(ModInfo.class::cast) - .collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile)); - this.preLoadErrors = new ArrayList<>(); +/// Master list of all mods in the loading context +public sealed interface LoadingModList permits LoadingModListImpl { + static ModFileInfo getModFileById(String modId) { + return get().fileById().get(modId); } - public static LoadingModList of(List modFiles, List sortedList, final EarlyLoadingException earlyLoadingException) { - INSTANCE = new LoadingModList(modFiles, sortedList); - if (earlyLoadingException != null) - INSTANCE.preLoadErrors.add(earlyLoadingException); - return INSTANCE; + static List getModFiles() { + return get().getModFiles(); } - public static LoadingModList get() { - return INSTANCE; + static List getMods() { + return get().getMods(); } - public void addCoreMods() { - modFiles.stream() - .map(ModFileInfo::getFile) - .map(ModFile::getCoreMods) - .flatMap(List::stream) - .forEach(FMLLoader.getCoreModProvider()::addCoreMod); - } - - public void addAccessTransformers() { - for (ModFileInfo modFile : modFiles) { - ModFile mod = modFile.getFile(); - var at = mod.getAccessTransformer().orElse(null); - if (at != null) { - FMLLoader.addAccessTransformer(at, mod); - } - } - } - - public void addForScanning(BackgroundScanHandler backgroundScanHandler) { - backgroundScanHandler.setLoadingModList(this); - modFiles.stream() - .map(ModFileInfo::getFile) - .forEach(backgroundScanHandler::submitForScanning); - } - - public List getModFiles() { - return modFiles; - } - - public Path findResource(final String className) { - for (ModFileInfo mf : modFiles) { - final Path resource = mf.getFile().findResource(className); + static @Nullable Path findResource(String className) { + for (ModFileInfo modFileInfo : get().getModFiles()) { + Path resource = modFileInfo.getFile().findResource(className); if (Files.exists(resource)) return resource; } return null; } - public ModFileInfo getModFileById(String modid) { - return this.fileById.get(modid); + static List getErrors() { + return get().getErrors(); } - public List getMods() { - return this.sortedList; + static List getBrokenFiles() { + return get().getBrokenFiles(); } - public List getErrors() { - return preLoadErrors; - } - - public void setBrokenFiles(final List brokenFiles) { - this.brokenFiles = brokenFiles; - } - - public List getBrokenFiles() { - return this.brokenFiles; + private static LoadingModListImpl get() { + return LoadingModListImpl.get(); } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModListImpl.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModListImpl.java new file mode 100644 index 0000000000..f7473ee15e --- /dev/null +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LoadingModListImpl.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.fml.loading; + +import net.minecraftforge.fml.loading.EarlyLoadingException.ExceptionData; +import net.minecraftforge.fml.loading.moddiscovery.ModFile; +import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; +import net.minecraftforge.fml.loading.moddiscovery.ModInfo; +import net.minecraftforge.forgespi.locating.IModFile; + +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.slf4j.Logger; + +import com.mojang.logging.LogUtils; + +/** + * Master list of all mods in the loading context. This class cannot refer outside the + * loading package + */ +record LoadingModListImpl( + List getModFiles, + List getMods, + Map fileById, + ArrayList getErrors, + ArrayList getBrokenFiles +) implements LoadingModList { + private static final Logger LOGGER = LogUtils.getLogger(); + private static ModSorter.State temp; + + LoadingModListImpl(List modFiles, List sortedList) { + var modFileInfos = modFiles.stream() + .map(ModFile::getModFileInfo) + .map(ModFileInfo.class::cast) + .toList(); + sortedList = sortedList.stream().toList(); + var fileById = modFileInfos.stream() + .map(ModFileInfo::getMods) + .flatMap(Collection::stream) + .map(ModInfo.class::cast) + .collect(Collectors.toUnmodifiableMap(ModInfo::getModId, ModInfo::getOwningFile)); + this(modFileInfos, sortedList, fileById, new ArrayList<>(), new ArrayList<>()); + } + + static LoadingModListImpl init(ModSorter.State modSorterState, EarlyLoadingException earlyLoadingException) { + temp = modSorterState; + var instance = get(); + if (earlyLoadingException != null) + instance.getErrors.add(earlyLoadingException); + temp = null; + instance.addAccessTransformers(); + return instance; + } + + static LoadingModListImpl get() { + final class LazyInit { + private LazyInit() {} + private static final LoadingModListImpl INSTANCE + = new LoadingModListImpl(LoadingModListImpl.temp.files(), LoadingModListImpl.temp.mods()); + } + return LazyInit.INSTANCE; + } + + private void addAccessTransformers() { + var errors = new ArrayList(); + + for (ModFileInfo modFile : getModFiles) { + ModFile mod = modFile.getFile(); + for (var at : mod.getAccessTransformers()) { + if (!Files.exists(at)) { + var message = "Invalid mod file: " + modFile.getFile().getFileName() + ". Missing Access Transformer: " + at; + errors.add(new ExceptionData(message)); + LOGGER.error(message); + } else + FMLLoader.addAccessTransformer(at, mod); + } + } + + if (!errors.isEmpty()) + getErrors.add(new EarlyLoadingException("Invalid Access Transformers", null, errors)); + } +} diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java index ca908d0470..201aca6de4 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java @@ -7,7 +7,6 @@ package net.minecraftforge.fml.loading; import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.INameMappingService; -import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import java.io.BufferedReader; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java index fe3e595b06..d0d90d22cb 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java @@ -6,7 +6,6 @@ package net.minecraftforge.fml.loading; import java.nio.file.Path; -import java.nio.file.Paths; /** * Convert a maven coordinate into a Path. diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java index 3b2cbd6cb4..697978d18d 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java @@ -33,10 +33,10 @@ import java.util.stream.Stream; import static net.minecraftforge.fml.loading.LogMarkers.LOADING; -public class ModSorter { +public final class ModSorter { private static final Logger LOGGER = LogUtils.getLogger(); - private record State(List files, List mods) {} + record State(List files, List mods) {} private ModSorter() {} @@ -52,7 +52,7 @@ public class ModSorter { // Note this will never actually throw an error because the duplicate checks are done in ModDiscovererer before we get to this phase // So all this is really doing is wasting time. // But i'm leaving it here until I rewrite all of cpw's mod loading code because its such a clusterfuck. - return LoadingModList.of(systemMods.files(), systemMods.mods(), e); + return LoadingModListImpl.init(systemMods, e); } var named = new HashMap(); @@ -66,15 +66,15 @@ public class ModSorter { // if we miss one or the other, we abort now if (!failedList.isEmpty()) { - return LoadingModList.of(systemMods.files(), systemMods.mods(), new EarlyLoadingException("failure to validate mod list", null, failedList)); + return LoadingModListImpl.init(systemMods, new EarlyLoadingException("failure to validate mod list", null, failedList)); } else { // Otherwise, lets try and sort the modlist and proceed try { var sorted = sort(modFiles, named); - return LoadingModList.of(sorted.files(), sorted.mods(), null); + return LoadingModListImpl.init(sorted, null); } catch (EarlyLoadingException e) { // The only exception that can happen here is a cyclic exception, but fall back to system mods so we can display the nice screen. - return LoadingModList.of(systemMods.files(), systemMods.mods(), e); + return LoadingModListImpl.init(systemMods, e); } } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java index 005c071a69..947fa45b93 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java @@ -33,7 +33,6 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { private static String DIST; private static final String ONLYIN = Type.getDescriptor(OnlyIn.class); private static final String ONLYINS = Type.getDescriptor(OnlyIns.class); - private static final String MOD = "Lnet/minecraftforge/fml/common/Mod;"; @Override public String name() { @@ -49,14 +48,21 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { return NAY; String internalName = classType.getInternalName(); + + // Only apply to MC classes when on a dedicated server in a production environment + if (FMLEnvironment.production) + return FMLEnvironment.dist.isDedicatedServer() && isMinecraftClass(internalName) ? YAY : NAY; + + // For dev time it's a bit trickier so that we can throw exceptions when someone uses @OnlyIn in their mod code, + // so that it's more obvious that the behaviour they're expecting won't work in production anymore if (internalName.startsWith("net/minecraftforge/")) return NAY; // No Vanilla classes use @OnlyIn(Dist.SERVER), so we can skip them entirely when we're running on a client - if (FMLEnvironment.dist.isClient() && (internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/"))) + if (FMLEnvironment.dist.isClient() && isMinecraftClass(internalName)) return NAY; - return YAY; + return YAY; // mod classes might have @OnlyIn, so parse them in dev to find out and throw if they do } @Override @@ -64,16 +70,15 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { var changed = false; var annotations = unpack(classNode.visibleAnnotations); + var isNonMinecraftClass = !isMinecraftClass(classNode.name); if (remove(annotations, DIST)) { LOGGER.error(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST); - throw new RuntimeException("Attempted to load class "+ classNode.name + " for invalid dist "+ DIST); + throw new RuntimeException("Attempted to load class " + classNode.name + " for invalid dist " + DIST); } - if (!FMLEnvironment.production && !annotations.isEmpty() && hasModAnnotation(classNode.visibleAnnotations)) { - LOGGER.error(DISTXFORM, "Attempted to load class {} with @Mod and @OnlyIn/@OnlyIns annotations", classNode.name); - throw new RuntimeException("Found @OnlyIn on @Mod class "+ classNode.name + " - this is not allowed as it causes crashes. Remove the OnlyIn and consider setting clientSideOnly=true in the root of your mods.toml instead"); - } + if (isNonMinecraftClass && !annotations.isEmpty()) + throw new UnsupportedOperationException("Mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times"); if (classNode.interfaces != null && !classNode.interfaces.isEmpty()) { for (var ann : annotations) { @@ -81,7 +86,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { continue; if (classNode.interfaces.remove(ann.intf)) { - LOGGER.debug(DISTXFORM,"Removing Interface: {} implements {}", classNode.name, ann.intf); + LOGGER.debug(DISTXFORM, "Removing Interface: {} implements {}", classNode.name, ann.intf); changed = true; } } @@ -105,6 +110,9 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { LOGGER.debug(DISTXFORM, "Removing field: {}.{}", classNode.name, field.name); itr.remove(); changed = true; + + if (isNonMinecraftClass) + throw new UnsupportedOperationException("Field " + field.name + " in mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times"); } } @@ -116,6 +124,9 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { itr.remove(); lambdaGatherer.accept(method); changed = true; + + if (isNonMinecraftClass) + throw new UnsupportedOperationException("Method " + method.name + " in mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times"); } } @@ -142,7 +153,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { return changed ? ComputeFlags.SIMPLE_REWRITE : ComputeFlags.NO_REWRITE; } - private static record Target(String side, String intf) { + private record Target(String side, String intf) { static Target from(final AnnotationNode node) { var idx = node.values.indexOf("value"); var value = (String[])node.values.get(idx + 1); // Enums are stored as [Type, Value] @@ -196,16 +207,8 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { return false; } - private static boolean hasModAnnotation(final List anns) { - if (anns == null || anns.isEmpty()) - return false; - - for (var ann : anns) { - if (ann.desc.equals(MOD)) - return true; - } - - return false; + private static boolean isMinecraftClass(final String internalName) { + return internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/"); } @SuppressWarnings("unchecked") @@ -217,7 +220,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService { }; } - private static class LambdaGatherer extends MethodVisitor { + private static final class LambdaGatherer extends MethodVisitor { private static final Handle META_FACTORY = new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;", diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringSubstitutor.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringSubstitutor.java index 21c3e625f8..ba6a549bda 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringSubstitutor.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringSubstitutor.java @@ -12,6 +12,7 @@ import java.util.Map; import org.apache.commons.lang3.text.StrLookup; import org.apache.commons.lang3.text.StrSubstitutor; +// TODO: [FML] Remove this @SuppressWarnings("deprecation") public class StringSubstitutor { private static final Map GLOBALS = Map.of( diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java index 195719ee5b..bf40fc6492 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java @@ -26,6 +26,7 @@ public class StringUtils { return java.util.stream.Stream.of(endings).anyMatch(lowerSearch::endsWith); } + @SuppressWarnings("deprecation") public static URL toURL(final String string) { if (string == null || string.trim().isEmpty() || string.contains("myurl.me") || string.contains("example.invalid")) return null; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/UniqueModListBuilder.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/UniqueModListBuilder.java index 3e15d68bd7..dfd08a7e27 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/UniqueModListBuilder.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/UniqueModListBuilder.java @@ -115,19 +115,22 @@ public final class UniqueModListBuilder { } private static ArtifactVersion getVersion(final ModFile mf) { - if (mf.getModFileInfo() == null || mf.getModInfos() == null || mf.getModInfos().isEmpty()) { + List modInfos; + if (mf.getModFileInfo() == null || (modInfos = mf.getModInfos()) == null || modInfos.isEmpty()) { return mf.getJarVersion(); } - return mf.getModInfos().getFirst().getVersion(); + return modInfos.getFirst().getVersion(); } private static String getModId(ModFile modFile) { - if (modFile.getModFileInfo() == null || modFile.getModFileInfo().getMods().isEmpty()) { + var modFileInfo = modFile.getModFileInfo(); + List mods; + if (modFileInfo == null || (mods = modFileInfo.getMods()).isEmpty()) { return modFile.getSecureJar().name(); } - return modFile.getModFileInfo().getMods().getFirst().getModId(); + return mods.getFirst().getModId(); } public record UniqueModListData(List modFiles, Map> modFilesByFirstId) {} diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java index d13935a811..da25929206 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java @@ -13,7 +13,6 @@ import org.jetbrains.annotations.ApiStatus; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.function.BiPredicate; @ApiStatus.Internal // since 1.21.1, will be made non-public in a later MC version public class VersionSupportMatrix { @@ -32,15 +31,6 @@ public class VersionSupportMatrix { } } - /** - * @deprecated Use {@link #testVersionSupportMatrix(VersionRange, String, String)} instead, unwrapping your BiPredicate. - */ - @Deprecated(forRemoval = true, since = "1.21.1") - public static boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type, BiPredicate standardLookup) { - if (standardLookup.test(lookupId, declaredRange)) return true; - return testVersionSupportMatrix(declaredRange, lookupId, type); - } - public static boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type) { if (OVERRIDE_VERSIONS.isEmpty()) return false; List custom = OVERRIDE_VERSIONS.get(type + "." + lookupId); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java index a42a501904..faed16a26c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java @@ -7,7 +7,6 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.ImmediateWindowHandler; -import net.minecraftforge.fml.loading.LoadingModList; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.ModFileScanData; import org.slf4j.Logger; @@ -17,8 +16,7 @@ import java.time.Instant; import java.util.List; import java.util.concurrent.*; -public class BackgroundScanHandler -{ +public final class BackgroundScanHandler { private enum ScanStatus { NOT_STARTED, RUNNING, @@ -33,7 +31,6 @@ public class BackgroundScanHandler private final ExecutorService modContentScanner; private final List modFiles; private ScanStatus status; - private LoadingModList loadingModList; public BackgroundScanHandler(final List modFiles) { this.modFiles = modFiles; @@ -58,7 +55,7 @@ public class BackgroundScanHandler ImmediateWindowHandler.updateProgress("Scanning mod candidates"); CompletableFuture future = CompletableFuture.supplyAsync(file::compileContent, modContentScanner) .whenComplete(file::setScanResult); - if (DEBUG) future = future.whenComplete((r, t) -> addCompletedFile(file, t)); + if (DEBUG) future = future.whenComplete((_, t) -> addCompletedFile(file, t)); file.setFutureScanResult(future); } @@ -69,16 +66,6 @@ public class BackgroundScanHandler } } - public void setLoadingModList(LoadingModList loadingModList) - { - this.loadingModList = loadingModList; - } - - public LoadingModList getLoadingModList() - { - return loadingModList; - } - public void waitForScanToComplete(final Runnable ticker) { boolean timeoutActive = System.getProperty("fml.disableScanTimeout") == null; Instant deadline = Instant.now().plus(Duration.ofMinutes(10)); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java index cba72c99e7..e3e352c8d1 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java @@ -45,7 +45,7 @@ public final class ClasspathLocator extends AbstractModProvider implements IModL // Find 'minecraft' during dev time this is also Forge. So skip it. // Can return null for dedicated server as Minecraft isn't on the classpath // On the client it doesn't matter as it's the vanilla jar so wouldnt have mods.toml in it. - var minecraft = getPathFromResource(cl, "net/minecraft/obfuscate/DontObfuscate.class"); + var minecraft = getPathFromResource(cl, "net/minecraft/world/item/Item.class"); var claimed = new HashSet(); var tomls = getUrls(cl, MODS_TOML); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java deleted file mode 100644 index f6328221d2..0000000000 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.fml.loading.moddiscovery; - -import net.minecraftforge.forgespi.coremod.ICoreModFile; - -import java.io.IOException; -import java.io.Reader; -import java.nio.file.Files; -import java.nio.file.Path; - -import org.jetbrains.annotations.ApiStatus; - -@ApiStatus.Internal -public final class CoreModFile implements ICoreModFile { - private final Path internalPath; - private final ModFile file; - private final String name; - - CoreModFile(final String name, final Path path, final ModFile file) { - this.name = name; - this.internalPath = path; - this.file = file; - } - - @Override - public Reader readCoreMod() throws IOException { - return Files.newBufferedReader(this.internalPath); - } - - @Override - public Path getPath() { - return this.internalPath; - } - - @Override - public Reader getAdditionalFile(final String fileName) throws IOException { - return Files.newBufferedReader(file.findResource(fileName)); - } - - @Override - public String getOwnerId() { - return this.file.getModInfos().get(0).getModId(); - } - - @Override - public String toString() { - return "{Name: " + name + ", Owner: " + getOwnerId() + " @ " + getPath() + "}"; - } -} diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java index 8d6cd490da..7e84195398 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java @@ -24,7 +24,7 @@ public enum InvalidModIdentifier { LITELOADER(filePresent("litemod.json")), OPTIFINE(filePresent("optifine/Installer.class")), BUKKIT(filePresent("plugin.yml")), - INVALIDZIP((f,zf) -> zf.isEmpty()); // note: only this one INVALIDZIP check is ran until the todo on this class is fixed + INVALIDZIP((_,zf) -> zf.isEmpty()); // note: only this one INVALIDZIP check is ran until the todo on this class is fixed private final BiPredicate> ident; @@ -51,7 +51,7 @@ public enum InvalidModIdentifier { private static BiPredicate> filePresent(String filename) { - return (f, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false); + return (_, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false); } private static Optional optionalFromException(Supplier_WithExceptions supp) diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java index c2e497621e..38e5b0c083 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java @@ -145,7 +145,7 @@ public class JarInJarDependencyLocator extends AbstractModProvider implements ID var ids = new TreeMap>(); for (var entry : selector.entries.values()) { if (entry != FAILED && entry.coord != null) - ids.computeIfAbsent(entry.coord, id -> new ArrayList<>()).add(entry); + ids.computeIfAbsent(entry.coord, _ -> new ArrayList<>()).add(entry); } for (var entry : ids.entrySet()) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java index 5b983946ea..b2ffbfd22c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java @@ -14,6 +14,7 @@ import net.minecraftforge.forgespi.locating.IModLocator; import net.minecraftforge.forgespi.locating.ModFileFactory; import java.nio.file.Path; import java.util.List; +import java.util.function.Consumer; import org.jetbrains.annotations.ApiStatus; @@ -26,7 +27,7 @@ public final class MinecraftLocator extends AbstractModProvider implements IModL // Minecraft itself. var meta = new ModJarMetadata(); - var mcjar = SecureJar.from(jar -> meta, paths); + var mcjar = SecureJar.from(_ -> meta, paths); var mc = ModFileFactory.FACTORY.build(mcjar, this, MinecraftLocator::buildMinecraftTOML); meta.setModFile(mc); @@ -57,4 +58,9 @@ public final class MinecraftLocator extends AbstractModProvider implements IModL public String name() { return "minecraft"; } + + @Override + public void scanFile(IModFile file, Consumer pathConsumer) { + // skip annotation scanning for MC itself + } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java index a1ece7438e..348172d1e7 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java @@ -19,7 +19,7 @@ import org.objectweb.asm.Type; import com.google.common.base.MoreObjects; @ApiStatus.Internal -class ModAnnotation { +final class ModAnnotation { public static ModFileScanData.AnnotationData fromModAnnotation(Type clazz, ModAnnotation annotation) { return new ModFileScanData.AnnotationData(annotation.asmType, annotation.type, clazz, annotation.member, annotation.values); } @@ -84,6 +84,7 @@ class ModAnnotation { } public void endArray() { + arrayList.trimToSize(); values.put(arrayName, arrayList); arrayList = null; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java index bdc09297df..049e9a1fc3 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java @@ -22,7 +22,47 @@ import java.util.stream.Collectors; import java.util.stream.Stream; @ApiStatus.Internal -class ModClassVisitor extends ClassVisitor { +final class ModClassVisitor extends ClassVisitor { + private static final Set ANNOTATION_BLACKLIST; + + private static final Type OBJECT_TYPE = Type.getObjectType("java/lang/Object"); + private static final Type RECORD_TYPE = Type.getObjectType("java/lang/Record"); + + static { + var customBlacklist = System.getProperty("forge.annotationScanningBlacklist"); + if (customBlacklist != null) { + ANNOTATION_BLACKLIST = Set.of(customBlacklist.split(",")); + } else { + ANNOTATION_BLACKLIST = Set.of( + "Ljava/lang/Deprecated;", + "Ljava/lang/FunctionalInterface;", + "Ljava/lang/SafeVarargs;", + + "Ljava/lang/annotation/Retention;", + "Ljava/lang/annotation/Target;", + + "Ljavax/annotation/Nullable;", + + "Lorg/jspecify/nullness/NonNull;", + "Lorg/jspecify/nullness/Nullable;", + "Lorg/jspecify/annotations/NullMarked;", + "Lorg/jspecify/annotations/NullUnmarked;", + + "Lorg/jetbrains/annotations/ApiStatus$Internal;", + "Lorg/jetbrains/annotations/Contract;", + "Lorg/jetbrains/annotations/Nullable;", + "Lorg/jetbrains/annotations/NotNull;", + "Lorg/jetbrains/annotations/VisibleForTesting;", + + "Lcom/google/common/annotations/VisibleForTesting;", + + "Lnet/minecraftforge/api/distmarker/OnlyIn", // should not be used by mods + // @Mod.EventBusSubscriber doesn't use scan data for finding @SubscribeEvent annotated methods + "Lnet/minecraftforge/eventbus/api/listener/SubscribeEvent;" + ); + } + } + private Type asmType; private Type asmSuperType; private Set interfaces; @@ -35,12 +75,17 @@ class ModClassVisitor extends ClassVisitor { @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.asmType = Type.getObjectType(name); - this.asmSuperType = superName != null && !superName.isEmpty() ? Type.getObjectType(superName) : null; + this.asmSuperType = superName != null && !superName.isEmpty() ? switch (superName) { + case "java/lang/Object" -> OBJECT_TYPE; + case "java/lang/Record" -> RECORD_TYPE; + default -> Type.getObjectType(superName); + } : null; this.interfaces = Stream.of(interfaces).map(Type::getObjectType).collect(Collectors.toSet()); } @Override public AnnotationVisitor visitAnnotation(final String annotationName, final boolean runtimeVisible) { + if (ANNOTATION_BLACKLIST.contains(annotationName)) return null; var ann = new ModAnnotation(ElementType.TYPE, Type.getType(annotationName), this.asmType.getClassName()); annotations.addFirst(ann); return new ModAnnotationVisitor(ann); @@ -51,6 +96,7 @@ class ModClassVisitor extends ClassVisitor { return new FieldVisitor(Opcodes.ASM9) { @Override public AnnotationVisitor visitAnnotation(String annotationName, boolean runtimeVisible) { + if (ANNOTATION_BLACKLIST.contains(annotationName)) return null; var ann = new ModAnnotation(ElementType.FIELD, Type.getType(annotationName), name); annotations.addFirst(ann); return new ModAnnotationVisitor(ann); @@ -63,6 +109,7 @@ class ModClassVisitor extends ClassVisitor { return new MethodVisitor(Opcodes.ASM9) { @Override public AnnotationVisitor visitAnnotation(String annotationName, boolean runtimeVisible) { + if (ANNOTATION_BLACKLIST.contains(annotationName)) return null; ModAnnotation ann = new ModAnnotation(ElementType.METHOD, Type.getType(annotationName), name + desc); annotations.addFirst(ann); return new ModAnnotationVisitor(ann); @@ -78,7 +125,7 @@ class ModClassVisitor extends ClassVisitor { } } - private class ModAnnotationVisitor extends AnnotationVisitor { + private final class ModAnnotationVisitor extends AnnotationVisitor { private final ModAnnotation annotation; private boolean array; private boolean isSubAnnotation; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java index 27227b053b..6d720e8140 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java @@ -41,9 +41,10 @@ public final class ModDiscoverer { @SuppressWarnings("removal") public static ModValidator discoverMods(Map arguments) { - Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.MODDIRECTORYFACTORY.get(), v->ModsFolderLocator::new); - Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.PROGRESSMESSAGE.get(), v-> StartupNotificationManager.locatorConsumer().orElseGet(()-> s->{})); - final var moduleLayerManager = Launcher.INSTANCE.environment().findModuleLayerManager().orElseThrow(); + var env = Launcher.INSTANCE.environment(); + env.computePropertyIfAbsent(Environment.Keys.MODDIRECTORYFACTORY.get(), _ -> ModsFolderLocator::new); + env.computePropertyIfAbsent(Environment.Keys.PROGRESSMESSAGE.get(), _ -> StartupNotificationManager.locatorConsumer().orElse(_ -> {})); + final var moduleLayerManager = env.findModuleLayerManager().orElseThrow(); ServiceLoader modLocators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IModLocator.class); ServiceLoader dependencyLocators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IDependencyLocator.class); List modLocatorList = ServiceLoaderUtils.streamWithErrorHandling(modLocators, sce -> LOGGER.error("Failed to load mod locator list", sce)).toList(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java index 3c033d878b..5008e0d80b 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java @@ -8,7 +8,7 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.google.common.collect.ImmutableMap; import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.SecureJar; -import net.minecraftforge.fml.loading.FMLLoader; +import net.minecraftforge.fml.loading.LanguageLoadingProvider; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.language.IModInfo; @@ -25,7 +25,6 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -48,8 +47,7 @@ public class ModFile implements IModFile { private final IModFileInfo modFileInfo; private ModFileScanData fileModFileScanData; private CompletableFuture futureScanResult; - private List coreMods; - private Path accessTransformer; + private List accessTransformers = List.of(); static final Attributes.Name TYPE = new Attributes.Name("FMLModType"); private SecureJar.Status securityStatus; @@ -92,24 +90,30 @@ public class ModFile implements IModFile { return modFileInfo.getMods(); } - public Optional getAccessTransformer() { - return Optional.ofNullable(Files.exists(accessTransformer) ? accessTransformer : null); + public List getAccessTransformers() { + return this.accessTransformers; } public boolean identifyMods() { if (this.modFileInfo == null) return this.getType() != Type.MOD; LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFileName(), this.modFileInfo.requiredLanguageLoaders()); - this.coreMods = ModFileParser.getCoreMods(this); - if (!this.coreMods.isEmpty()) - LOGGER.warn("Mod file {} contains javascript coremods! JS CoreMods are deprecated and will be removed in a future release. Consider using Mixin or ModLauncher transformers.", this.getFileName()); - for (var mi : this.coreMods) - LOGGER.debug(LogMarkers.LOADING, "Found coremod {}", mi.getPath()); - this.accessTransformer = findResource("META-INF", "accesstransformer.cfg"); - return true; - } + var cfg = this.modFileInfo.getConfig() + .>getConfigElement("accessTransformers") + .orElse(null); - public List getCoreMods() { - return coreMods; + if (cfg == null) { + var path = findResource("META-INF", "accesstransformer.cfg"); + if (Files.exists(path)) { + this.accessTransformers = List.of(path); + } + } else if (!cfg.isEmpty()) { + var paths = new ArrayList(cfg.size()); + for (var path : cfg) + paths.add(getSecureJar().getPath(path.replace('\\', '/'))); + this.accessTransformers = List.copyOf(paths); + } + + return true; } /** @@ -169,12 +173,11 @@ public class ModFile implements IModFile { public void identifyLanguage() { var lst = new ArrayList(this.modFileInfo.requiredLanguageLoaders().size()); - var services = FMLLoader.getLanguageLoadingProvider(); for (var spec : this.modFileInfo.requiredLanguageLoaders()) { - var service = services.findLanguage(this, spec.languageName(), spec.acceptedVersions()); + var service = LanguageLoadingProvider.findLanguage(this, spec.languageName(), spec.acceptedVersions()); lst.add(service); } - this.loaders = Collections.unmodifiableList(lst); + this.loaders = List.copyOf(lst); } @Override diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java index 1d3c0dada3..4074429850 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java @@ -6,23 +6,18 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.electronwill.nightconfig.core.file.FileConfig; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; +import com.electronwill.nightconfig.core.io.ParsingException; import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.ModFileFactory; +import net.minecraftforge.forgespi.locating.ModFileLoadingException; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -import java.io.IOException; -import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collections; -import java.util.List; -import java.util.Map; public class ModFileParser { private static final Logger LOGGER = LogUtils.getLogger(); @@ -31,6 +26,7 @@ public class ModFileParser { return parser.build(modFile); } + // Note: Although @Nullable, several other places in FML assume ModFileInfo is not null. Keep this in mind public static @Nullable IModFileInfo modsTomlParser(final IModFile imodFile) { ModFile modFile = (ModFile) imodFile; LOGGER.debug(LogMarkers.LOADING,"Considering mod file candidate {}", modFile.getFilePath()); @@ -39,32 +35,19 @@ public class ModFileParser { LOGGER.warn(LogMarkers.LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath()); return null; } - - final FileConfig fileConfig = FileConfig.builder(modsjson).build(); - fileConfig.load(); - fileConfig.close(); - final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig); - return new ModFileInfo(modFile, configWrapper, configWrapper::setFile); - } - - protected static List getCoreMods(final ModFile modFile) { - Map coreModPaths; try { - final Path coremodsjson = modFile.findResource("META-INF", "coremods.json"); - if (!Files.exists(coremodsjson)) { - return Collections.emptyList(); - } - final Type type = new TypeToken>() {}.getType(); - final Gson gson = new Gson(); - coreModPaths = gson.fromJson(Files.newBufferedReader(coremodsjson), type); - } catch (IOException e) { - LOGGER.debug(LogMarkers.LOADING,"Failed to read coremod list coremods.json", e); - return Collections.emptyList(); + final FileConfig fileConfig = FileConfig.builder(modsjson).build(); + fileConfig.load(); + fileConfig.close(); + final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig); + return new ModFileInfo(modFile, configWrapper, configWrapper::setFile); + } catch (ParsingException e) { // Handle landmine toml errors, e.g. incorrectly ported mods. + LOGGER.error("Mod candidate {} contains a corrupt or misconfigured toml.", modFile.getFileName()); + throw new ModFileLoadingException("Mod candidate " + modFile.getFileName() + " contains a corrupt or misconfigured toml."); + } catch (Exception other) { // Otherwise this is just someone who (probably) forgot a comma or something. + LOGGER.error("Mod candidate {}'s toml .", modFile.getFileName()); + throw new ModFileLoadingException("Mod candidate " + modFile.getFileName() + " contains broken toml, likely due to a typo."); } - return coreModPaths.entrySet().stream() - .peek(e-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue())) - .map(e -> new CoreModFile(e.getKey(), modFile.findResource(e.getValue()),modFile)) - .toList(); } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java index b182043d08..dd616250b8 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java @@ -31,7 +31,6 @@ public class ModValidator { private final List candidatePlugins; private final List candidateMods; private final List gameLibraries; - private LoadingModList loadingModList; private final List brokenFiles = new ArrayList<>(); private final List discoveryErrorData; @@ -87,7 +86,7 @@ public class ModValidator { // If any detectable error happens during the sorting process {missing deps, duplicates, // This helps prevent coremods/mixins from screwing up us displaying the error screens that the sorting/validation is trying to display. // This won't fix them all as they are still loaded and will still apply but it might help - for (var info : this.loadingModList.getModFiles()) + for (var info : LoadingModList.getModFiles()) mods.add(info.getFile().getSecureJar()); // Add any game libraries, this *may* be duplicates, depending on the state of the sorting. But until I get around to re-writing @@ -124,12 +123,12 @@ public class ModValidator { var allErrors = new ArrayList<>(errors); allErrors.addAll(this.discoveryErrorData); - loadingModList = ModSorter.sort(candidateMods, allErrors); - loadingModList.addCoreMods(); - loadingModList.addAccessTransformers(); - loadingModList.setBrokenFiles(brokenFiles); - BackgroundScanHandler backgroundScanHandler = new BackgroundScanHandler(candidateMods); - loadingModList.addForScanning(backgroundScanHandler); + ModSorter.sort(candidateMods, allErrors); + LoadingModList.getBrokenFiles().addAll(brokenFiles); + var backgroundScanHandler = new BackgroundScanHandler(candidateMods); + LoadingModList.getModFiles().stream() + .map(ModFileInfo::getFile) + .forEach(backgroundScanHandler::submitForScanning); return backgroundScanHandler; } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java index 2e714d5ed1..6bd30c47db 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java @@ -56,7 +56,7 @@ public class StartupNotificationManager { private synchronized static void addMessage(Message.MessageType type, String message, int maxSize) { EnumMap> newMessages = new EnumMap<>(messages); - newMessages.compute(type, (key, existingList) -> { + newMessages.compute(type, (_, existingList) -> { List newList = new ArrayList<>(); if (existingList != null) { 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 4298506f1b..b9dc6ef946 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 @@ -141,7 +141,7 @@ abstract class CommonDevLaunchHandler extends CommonLaunchHandler { protected static Path getForgeOnly(Path forge) { var packages = getPackages(); // Pulled out so it is passed to the lambda as value // We need to separate out our resources/code so that we can show up as a different data pack. - var modJar = SecureJar.from((path, base) -> { + var modJar = SecureJar.from((path, _) -> { if (!path.endsWith(".class")) return true; for (var pkg : packages) if (path.startsWith(pkg)) return true; @@ -156,7 +156,6 @@ abstract class CommonDevLaunchHandler extends CommonLaunchHandler { return new String[] { "net/minecraftforge/", "META-INF/services/", - "META-INF/coremods.json", "META-INF/mods.toml" }; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java index 1ab63857e5..7b9d067940 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java @@ -112,7 +112,7 @@ public final class ForgeDevLocator extends AbstractModProvider implements IModLo // We want just the class files from the root of the input paths. So make a new union with a filter. var classes = UnionHelper.newFileSystem( - (name, base) -> { + (name, _) -> { if (name.endsWith("/")) { if (name.startsWith("/")) name = name.substring(1); @@ -164,7 +164,7 @@ public final class ForgeDevLocator extends AbstractModProvider implements IModLo if ("value".equals(key)) { int idx = clsName.lastIndexOf('/'); var pkg = clsName.substring(0, idx); - mods.computeIfAbsent(pkg, k -> new HashSet<>()).add((String)value); + mods.computeIfAbsent(pkg, _ -> new HashSet<>()).add((String)value); idx = pkg.lastIndexOf('/'); while (idx != -1) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeProdLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeProdLaunchHandler.java index 1488be3a7a..ee622db88a 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeProdLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeProdLaunchHandler.java @@ -25,7 +25,9 @@ sealed abstract class ForgeProdLaunchHandler extends CommonLaunchHandler { @Override public List getMinecraftPaths() { - return List.of(getPathFromResource("net/minecraft/client/Minecraft.class")); + // We use a marker because 3rd party launcher don't build their class paths correctly + // https://github.com/MinecraftForge/MinecraftForge/issues/10797 + return List.of(getPathFromResource(".forge_patched_minecraft")); } } diff --git a/fmlloader/src/main/resources/jarjar_options.json b/fmlloader/src/main/resources/jarjar_options.json index e155268e8b..79a05c8ff7 100644 --- a/fmlloader/src/main/resources/jarjar_options.json +++ b/fmlloader/src/main/resources/jarjar_options.json @@ -11,8 +11,8 @@ "artifact": "MixinExtras" }, "version": { - "range": "[0.5.0,)", - "artifactVersion": "0.5.0" + "range": "[0.5.4,)", + "artifactVersion": "0.5.4" }, "path": "", "isObfuscated": false @@ -24,7 +24,7 @@ "artifact": "mixinextras-forge" }, "version": { - "artifactVersion": "0.5.0" + "artifactVersion": "0.5.4" }, "path": "", "isObfuscated": false diff --git a/forge-transformers/build.gradle b/forge-transformers/build.gradle index e48c65d900..145d9ed3e9 100644 --- a/forge-transformers/build.gradle +++ b/forge-transformers/build.gradle @@ -1,73 +1,78 @@ -import net.minecraftforge.gradleutils.PomUtils - plugins { id 'java-library' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' - alias(libs.plugins.apt) + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') - -configurations.forEach{ it.transitive = false } - -dependencies { - compileOnly(libs.jetbrains.annotations) - - implementation(libs.bundles.asm) // Needed by all the black magic - implementation(libs.log4j.api) - implementation(libs.gson) - implementation(libs.modlauncher) - implementation(libs.coremods) // Used for ASMAPI (for now) - - testCompileOnly(libs.jetbrains.annotations) -} +gradleutils.displayName = 'Forge Transformers' +final vendor = 'Forge Development LLC' +description = 'Forge-specific transformers unrelated to the FML project.' java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -tasks.named('jar', Jar) { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.forge.transformers', - 'Forge-Module-Layer': 'boot' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'Forge Transformers', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'Forge Transformers', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': FORGE_VERSION - ] as LinkedHashMap, 'net/minecraftforge/forge/transformers/') - } -} - -tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-Xlint:unchecked' -} - license { header = rootProject.file('LICENSE-header.txt') } -publishing { - publications.register('mavenJava', MavenPublication) { - from components.java - artifactId = 'forge-transformers' - pom { - name = project.name - description = 'Forge-specific transformers unrelated to the FML project.' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } - } +changelog { + from changelogBase +} +dependencies { + compileOnly(libs.jetbrains.annotations) + + implementation(libs.bundles.asm ){ transitive = false } // Needed by all the black magic + implementation(libs.log4j.api ){ transitive = false } + implementation(libs.gson ){ transitive = false } + implementation(libs.modlauncher ){ transitive = false } + implementation(libs.coremods.api){ transitive = false } + + testCompileOnly(libs.jetbrains.annotations) +} + +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.forge.transformers', + 'Forge-Module-Layer' : 'boot' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Vendor' : vendor, + 'Implementation-Version': forgeVersion + ], 'net/minecraftforge/forge/transformers/') + } +} + +publishing { repositories { maven gradleutils.publishingForgeMaven } + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { pom -> + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } } diff --git a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java index 3415744140..113dac1e5c 100644 --- a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java +++ b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java @@ -8,16 +8,27 @@ package net.minecraftforge.forge.transformers; import cpw.mods.modlauncher.api.ITransformer; import cpw.mods.modlauncher.api.ITransformerVotingContext; import cpw.mods.modlauncher.api.TransformerVoteResult; -import net.minecraftforge.coremod.api.ASMAPI; -import org.jetbrains.annotations.NotNull; -import org.objectweb.asm.tree.ClassNode; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldInsnNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; + +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; record FieldToMethodTransformer(String className, Map fields) implements ITransformer { + private static final Logger LOGGER = LogManager.getLogger(); + // TODO [Forge][Transformer] Make this properly data driven or configurable. // It was hard-coded like this before when using JS CoreMods, though. static final Map> TARGETS = Map.of( @@ -60,7 +71,7 @@ record FieldToMethodTransformer(String className, Map fields) im @Override public @NotNull ClassNode transform(ClassNode input, ITransformerVotingContext context) { for (var entry : this.fields.entrySet()) { - ASMAPI.redirectFieldToMethod(input, entry.getKey(), entry.getValue()); + redirectFieldToMethod(input, entry.getKey(), entry.getValue()); } return input; @@ -75,4 +86,73 @@ record FieldToMethodTransformer(String className, Map fields) im public @NotNull Set targets() { return Set.of(Target.targetClass(this.className)); } + + private static final @Nullable FieldNode findField(final ClassNode classNode, final String name) { + FieldNode ret = null; + for (var fieldNode : classNode.fields) { + if (name.equals(fieldNode.name)) { + if (ret != null) + throw new IllegalStateException("Found multiple fields with name " + name); + ret = fieldNode; + } + } + return ret; + } + + private static final @Nullable MethodNode findMethod(final ClassNode classNode, final String name, final String desc) { + for (var methodNode : classNode.methods) { + if (name.equals(methodNode.name) && desc.equals(methodNode.desc)) + return methodNode; + } + return null; + } + + /** + * Rewrites accesses to a specific field in the given class to a method-call. + *

+ * The field specified by fieldName must be private and non-static. The method-call the field-access is redirected + * to does not take any parameters and returns an object of the same type as the field. If no methodName is passed, + * any method matching the described signature will be used as callable method. + * + * @param classNode the class to rewrite the accesses in + * @param fieldName the field accesses should be redirected to + * @param methodName the name of the method to redirect accesses through + * @apiNote This method was written as a special use case for Forge. It is not recommended to use this method + * unless you know what you are doing. + */ + private static void redirectFieldToMethod(final ClassNode classNode, final String fieldName, final String methodName) { + var foundField = findField(classNode, fieldName); + if (foundField == null) + throw new IllegalStateException("No field with name " + fieldName + " found"); + + if (!Modifier.isPrivate(foundField.access) || Modifier.isStatic(foundField.access)) + throw new IllegalStateException("Field " + classNode.name + '.' + fieldName + " is not private and an instance field"); + + var methodSignature = "()" + foundField.desc; + var foundMethod = findMethod(classNode, methodName, methodSignature); + if (foundMethod == null) + throw new IllegalStateException("Unable to find method " + methodName + methodSignature); + + for (MethodNode methodNode : classNode.methods) { + // skip the found getter method + if (methodNode == foundMethod) continue; + + // Why is this filtered? UI twas added in the beginning but would it matter? + if (methodSignature.equals(foundMethod)) { + LOGGER.debug("FieldToMethodTransformer " + classNode.name + " skipping " + methodNode.name + methodNode.hashCode()); + continue; + } + + for (var insn : methodNode.instructions) { + if (insn.getOpcode() != Opcodes.GETFIELD) + continue; + + var fieldInsnNode = (FieldInsnNode)insn; + if (fieldName.equals(fieldInsnNode.name)) { + var replace = new MethodInsnNode(Opcodes.INVOKEVIRTUAL, classNode.name, foundMethod.name, foundMethod.desc, false); + methodNode.instructions.set(insn, replace); + } + } + } + } } diff --git a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java index 58f13fb406..c87b3f9dbb 100644 --- a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java +++ b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java @@ -10,14 +10,15 @@ import com.google.gson.annotations.SerializedName; import cpw.mods.modlauncher.api.ITransformer; import cpw.mods.modlauncher.api.ITransformerVotingContext; import cpw.mods.modlauncher.api.TransformerVoteResult; -import net.minecraftforge.coremod.api.ASMAPI; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodInsnNode; +import org.objectweb.asm.tree.MethodNode; import java.io.InputStreamReader; import java.util.ArrayList; @@ -36,15 +37,16 @@ record MethodRedirector() implements ITransformer { private static final Replacement[] REPLACEMENTS = { new Replacement( // finalizeSpawn redirection to ForgeEventFactory.onFinalizeSpawn - ASMAPI.MethodType.VIRTUAL, + Opcodes.INVOKEVIRTUAL, "finalizeSpawn", "(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;", GSON.fromJson(new InputStreamReader(sneak(() -> MethodRedirector.class.getModule().getResourceAsStream("coremods/finalize_spawn_targets.json"))), Target[].class), - insn -> ASMAPI.buildMethodCall( - ASMAPI.MethodType.STATIC, + _ -> new MethodInsnNode( + Opcodes.INVOKESTATIC, "net/minecraftforge/event/ForgeEventFactory", "onFinalizeSpawn", - "(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;" + "(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;", + false ) ) }; @@ -58,7 +60,7 @@ record MethodRedirector() implements ITransformer { } record Replacement( - ASMAPI.MethodType type, + int opcode, String name, String desc, Target[] targets, @@ -94,7 +96,7 @@ record MethodRedirector() implements ITransformer { var splitPos = methodString.indexOf('('); var methodName = methodString.substring(0, splitPos); var methodDesc = methodString.substring(splitPos); - var method = ASMAPI.findMethodNode(clazz, methodName, methodDesc); + var method = findMethodNode(clazz, methodName, methodDesc); if (method == null) { LOGGER.error("Failed to redirect method call for {}! Method {} not found in class {}! This is a Forge bug, and is likely due to a Minecraft update changing something.", replacement.name, methodString, clazz.name); @@ -107,7 +109,7 @@ record MethodRedirector() implements ITransformer { var methodInsn = (MethodInsnNode) insn; var redirection = replacement.factory.apply(methodInsn); LOGGER.debug("Redirecting method call {}{} to {}{} inside of {}.{}", methodInsn.name, methodInsn.desc, redirection.name, redirection.desc, clazz.name, method.name); - ASMAPI.insertInsn(method, methodInsn, redirection, ASMAPI.InsertMode.REMOVE_ORIGINAL); + method.instructions.set(insn, redirection); } } } @@ -115,8 +117,16 @@ record MethodRedirector() implements ITransformer { return clazz; } + private static @Nullable MethodNode findMethodNode(ClassNode clazz, String name, String desc) { + for (var method : clazz.methods) { + if (name.equals(method.name) && desc.equals(method.desc)) + return method; + } + return null; + } + private static boolean shouldReplace(AbstractInsnNode insn, Replacement replacement) { - return insn.getOpcode() == replacement.type.toOpcode() + return insn.getOpcode() == replacement.opcode && replacement.name.equals(((MethodInsnNode) insn).name) && replacement.desc.equals(((MethodInsnNode) insn).desc); } diff --git a/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json b/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json index 29d45372ac..555238cf0c 100644 --- a/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json +++ b/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json @@ -1,8 +1,8 @@ [ { - "class": "net/minecraft/gametest/framework/GameTestHelper", + "class": "net/minecraft/gametest/framework/GameTestEntityBuilder", "methods": [ - "spawn(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;" + "spawn()Lnet/minecraft/world/entity/Entity;" ] }, { @@ -20,7 +20,7 @@ { "class": "net/minecraft/world/entity/EntityType", "methods": [ - "create(Lnet/minecraft/server/level/ServerLevel;Ljava/util/function/Consumer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/EntitySpawnReason;ZZ)Lnet/minecraft/world/entity/Entity;" + "create(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/PostSpawnProcessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/EntitySpawnReason;ZZ)Lnet/minecraft/world/entity/Entity;" ] }, { @@ -42,12 +42,6 @@ "finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;" ] }, - { - "class": "net/minecraft/world/entity/animal/frog/Tadpole", - "methods": [ - - ] - }, { "class": "net/minecraft/world/entity/monster/Strider", "methods": [ @@ -85,24 +79,12 @@ "finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;" ] }, - { - "class": "net/minecraft/world/entity/monster/zombie/ZombieVillager", - "methods": [ - - ] - }, { "class": "net/minecraft/world/entity/npc/CatSpawner", "methods": [ "spawnCat(Lnet/minecraft/core/BlockPos;Lnet/minecraft/server/level/ServerLevel;Z)V" ] }, - { - "class": "net/minecraft/world/entity/npc/villager/Villager", - "methods": [ - "getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/npc/villager/Villager;" - ] - }, { "class": "net/minecraft/world/entity/raid/Raid", "methods": [ @@ -158,11 +140,5 @@ "methods": [ "handleDataMarker(Ljava/lang/String;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/structure/BoundingBox;)V" ] - }, - { - "class": "net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate", - "methods": [ - - ] } ] \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 5c339d84c2..636e21bfab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,29 @@ +# TODO Re-evaluate # 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=-Xmx6G -org.gradle.daemon=false + +org.gradle.warning.mode=all +org.gradle.caching=true org.gradle.parallel=true +org.gradle.configureondemand=true -JAVA_VERSION=21 -MC_VERSION=1.21.11 -MC_NEXT_VERSION=1.22 -MCP_VERSION=20251209.095502 -MAPPING_CHANNEL=official -MAPPING_VERSION=1.21.11 +# TODO [ForgeDev] Enable this once ForgeDev 7 tasks are fully migrated +org.gradle.configuration-cache=false +org.gradle.configuration-cache.parallel=false +#org.gradle.configuration-cache.problems=warn +#org.gradle.configuration-cache.integrity-check=true -# Set to true before the first build of a new MC version, so we don't do compatibility checks -CHECK_COMPATIBILITY=false -# Set to true to allow for fuzzy patching. Useful during updateing -UPDATING=false +net.minecraftforge.gradleutils.ide.automatic.sources=true +net.minecraftforge.gradleutils.compilation.defaults=true + +net.minecraftforge.gradle.merge-source-sets=true + +# Controls if the compatibility checks are auto-added to the 'check' task. +# The check tasks are still created and can be run, they just are not grouped with the normal 'check' task. +# Set to false for the first builds of a new Minecraft version. +net.minecraftforge.forge.build.check.compatibility=false +# Set to true to allow for fuzzy patching. Useful during updating. +net.minecraftforge.forge.build.updating=false +# Set to true to enable the 'validatePublish' task which is currently a work in progress +net.minecraftforge.forgedev.validate.publish=false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3..61285a659d 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 e18bc253b8..1a704683a0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4269..adff685a03 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -170,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -203,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 25da30dbde..c4bdd3ab8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -68,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/javafmllanguage/build.gradle b/javafmllanguage/build.gradle index e81fd2b59f..8f0b9b76c9 100644 --- a/javafmllanguage/build.gradle +++ b/javafmllanguage/build.gradle @@ -1,66 +1,79 @@ -import net.minecraftforge.gradleutils.PomUtils - plugins { id 'java-library' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') - -dependencies { - compileOnly(libs.jetbrains.annotations) - implementation(project(':fmlloader')) - implementation(project(':fmlcore')) - implementation(libs.unsafe) - implementation(libs.securemodules) -} +gradleutils.displayName = 'JavaFMLMod' +final vendor = 'Forge Development LLC' +description = 'Language provider for Minecraft Forge that provides basic Java mod functionality.' java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.javafmlmod', - 'FMLModType': 'LANGPROVIDER' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'JavaFMLMod', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'JavaFMLMod', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': FORGE_VERSION - ] as LinkedHashMap, 'net/minecraftforge/fml/javafmlmod/') - } -} - -tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-Xlint:unchecked' -} - license { header = rootProject.file('LICENSE-header.txt') } -publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'javafmllanguage' - pom { - name = project.name - description = 'Language provider for Minecraft Forge that provides basic java mod functionality' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } - } +changelog { + from changelogBase +} +dependencies { + compileOnly libs.jetbrains.annotations + + implementation projects.fmlloader + implementation projects.fmlcore + implementation libs.unsafe + implementation libs.securemodules +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << '-Xlint:unchecked' +} + +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.javafmlmod', + 'FMLModType' : 'LANGPROVIDER' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Vendor' : vendor, + 'Implementation-Version': forgeVersion + ], 'net/minecraftforge/fml/javafmlmod/') + } +} + +publishing { repositories { maven gradleutils.publishingForgeMaven } -} + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } +} \ No newline at end of file diff --git a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/AutomaticEventSubscriber.java b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/AutomaticEventSubscriber.java index 1e98c1acbb..5743a70a51 100644 --- a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/AutomaticEventSubscriber.java +++ b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/AutomaticEventSubscriber.java @@ -6,7 +6,6 @@ package net.minecraftforge.fml.javafmlmod; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.bus.EventBus; @@ -52,7 +51,6 @@ public final class AutomaticEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(); private static final Type AUTO_SUBSCRIBER = Type.getType(EventBusSubscriber.class); private static final Type MOD_TYPE = Type.getType(Mod.class); - private static final Type ONLY_IN_TYPE = Type.getType(OnlyIn.class); private static final List DEFAULT_SIDES = List.of(new EnumData(null, "CLIENT"), new EnumData(null, "DEDICATED_SERVER")); private static final EnumData DEFAULT_BUS = new EnumData(null, "BOTH"); @@ -64,20 +62,11 @@ public final class AutomaticEventSubscriber { .filter(data -> AUTO_SUBSCRIBER.equals(data.annotationType())) .toList(); - var onlyIns = FMLEnvironment.production ? Collections.emptySet() : scanData.getAnnotations().stream() - .filter(data -> ONLY_IN_TYPE.equals(data.annotationType())) - .map(data -> data.clazz().getClassName()) - .collect(Collectors.toSet()); - var modids = scanData.getAnnotations().stream() .filter(data -> MOD_TYPE.equals(data.annotationType())) .collect(Collectors.toMap(a -> a.clazz().getClassName(), a -> (String)a.annotationData().get("value"))); for (var data : targets) { - if (!FMLEnvironment.production && onlyIns.contains(data.clazz().getClassName())) { - throw new RuntimeException("Found @OnlyIn on @EventBusSubscriber class " + data.clazz().getClassName() + " - this is not allowed as it causes crashes. Remove the OnlyIn and set value=Dist.CLIENT in the EventBusSubscriber annotation instead"); - } - var modId = modids.getOrDefault(data.clazz().getClassName(), mod.getModId()); modId = value(data, "modid", modId); diff --git a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java index 49bbeb9d46..6bc2b2e139 100644 --- a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java +++ b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java @@ -81,7 +81,7 @@ public class FMLJavaModLanguageProvider implements IModLanguageProvider .filter(ad -> ad.annotationType().equals(MODANNOTATION)) .peek(ad -> LOGGER.debug(SCAN, "Found @Mod class {} with id {}", ad.clazz().getClassName(), ad.annotationData().get("value"))) .map(ad -> new FMLModTarget(ad.clazz().getClassName(), (String)ad.annotationData().get("value"))) - .collect(Collectors.toMap(FMLModTarget::modId, Function.identity(), (a,b)->a)); + .collect(Collectors.toMap(FMLModTarget::modId, Function.identity(), (a, _) -> a)); scanResult.addLanguageLoader(modTargetMap); }; } diff --git a/lowcodelanguage/build.gradle b/lowcodelanguage/build.gradle index f4e92d6233..5681135f79 100644 --- a/lowcodelanguage/build.gradle +++ b/lowcodelanguage/build.gradle @@ -1,65 +1,77 @@ -import net.minecraftforge.gradleutils.PomUtils - plugins { id 'java-library' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') +gradleutils.displayName = 'LowCodeMod' +final vendor = 'Forge Development LLC' +description = 'Language provider for Minecraft Forge that loads mods without a Java entrypoint.' java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -dependencies { - compileOnly(libs.jetbrains.annotations) - - implementation(project(':fmlloader')) - implementation(project(':fmlcore')) -} - -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.lowcodemod', - 'FMLModType': 'LANGPROVIDER' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'LowCodeMod', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1.0', - 'Implementation-Title': project.name, - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': FORGE_VERSION.split('\\.')[0] - ] as java.util.LinkedHashMap, 'net/minecraftforge/fml/lowcodemod/') - } -} - -tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-Xlint:unchecked' -} - license { header = rootProject.file('LICENSE-header.txt') } -publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'lowcodelanguage' - pom { - name = project.name - description = 'Language provider for Minecraft Forge that loads resource packs as mods' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } +changelog { + from changelogBase +} + +dependencies { + compileOnly libs.jetbrains.annotations + + implementation projects.fmlloader + implementation projects.fmlcore +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << '-Xlint:unchecked' +} + +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.lowcodemod', + 'FMLModType' : 'LANGPROVIDER' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1.0', + 'Implementation-Title' : project.name, + 'Implementation-Vendor' : vendor, + 'Implementation-Version': forgeVersion.split('\\.')[0] + ], 'net/minecraftforge/fml/lowcodemod/') } - +} + +publishing { repositories { maven gradleutils.publishingForgeMaven } + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } } diff --git a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java index 0f5dcb950f..f39666fd40 100644 --- a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java +++ b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java @@ -74,7 +74,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider .flatMap(fi->fi.getMods().stream()) .map(IModInfo::getModId) .map(LowCodeModTarget::new) - .collect(Collectors.toMap(LowCodeModTarget::modId, Function.identity(), (a, b)->a)); + .collect(Collectors.toMap(LowCodeModTarget::modId, Function.identity(), (a, _)->a)); scanResult.addLanguageLoader(modTargetMap); }; } diff --git a/mclanguage/build.gradle b/mclanguage/build.gradle index abf4e79ed2..7e4ed70a54 100644 --- a/mclanguage/build.gradle +++ b/mclanguage/build.gradle @@ -1,64 +1,77 @@ -import net.minecraftforge.gradleutils.PomUtils - plugins { id 'java-library' id 'maven-publish' - id 'net.minecraftforge.licenser' - id 'net.minecraftforge.gradleutils' + alias libs.plugins.licenser + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.changelog + id 'net.minecraftforge.forge.build.convention' } -apply from: rootProject.file('build_shared.gradle') - -dependencies { - compileOnly(libs.jetbrains.annotations) - implementation(project(':fmlloader')) - implementation(project(':fmlcore')) -} +gradleutils.displayName = 'MCLanguage' +final vendor = 'Forge Development LLC' +description = 'Language provider for Minecraft Forge that provides Minecraft Itself.' java { - toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) + toolchain.languageVersion = JavaLanguageVersion.of(javaVersion) withSourcesJar() } -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Automatic-Module-Name': 'net.minecraftforge.mclanguageprovider', - 'FMLModType': 'LANGPROVIDER' - ] as LinkedHashMap) - attributes([ - 'Specification-Title': 'MCLanguage', - 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'MCLanguage', - 'Implementation-Vendor': 'Forge Development LLC', - 'Implementation-Version': '1.0' - ] as LinkedHashMap, 'net/minecraftforge/fml/mclanguageprovider/') - } -} - -tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-Xlint:unchecked' -} - license { header = rootProject.file('LICENSE-header.txt') } -publishing { - publications.register('mavenJava', MavenPublication).configure { - from components.java - artifactId = 'mclanguage' - pom { - name = project.name - description = 'Language provider for Minecraft Forge that provides Minecraft Itself' - url = 'https://github.com/MinecraftForge/MinecraftForge' - PomUtils.setGitHubDetails(pom, 'MinecraftForge') - license PomUtils.Licenses.LGPLv2_1 - } +changelog { + from changelogBase +} + +dependencies { + compileOnly libs.jetbrains.annotations + + implementation projects.fmlloader + implementation projects.fmlcore +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << '-Xlint:unchecked' +} + +tasks.named('jar', Jar) { + manifest { + attributes([ + 'Automatic-Module-Name': 'net.minecraftforge.mclanguageprovider', + 'FMLModType' : 'LANGPROVIDER' + ]) + attributes([ + 'Specification-Title' : gradleutils.displayName.get(), + 'Specification-Vendor' : vendor, + 'Specification-Version' : '1', + 'Implementation-Title' : gradleutils.displayName.get(), + 'Implementation-Vendor' : vendor, + 'Implementation-Version': '1.0' + ], 'net/minecraftforge/fml/mclanguageprovider/') } - +} + +publishing { repositories { maven gradleutils.publishingForgeMaven } + + publications.register('mavenJava', MavenPublication) { + changelog.publish(it) + gradleutils.promote(it) + + from components.java + + pom { + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } + } + } } diff --git a/mdk/build.gradle b/mdk/build.gradle index 1c06cc2179..c13dfe3355 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -1,235 +1,62 @@ +// This is a minimal setup of a Forge mod workspace. +// For complex examples (including AccessTransformers, Jar-in-Jar, and Mixin), see our examples repository. +// https://github.com/MinecraftForge/MDKExamples + plugins { - id 'eclipse' + id 'java' id 'idea' - id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0.46,6.2)' + id 'eclipse' + id 'net.minecraftforge.gradle' version '[7.0.17,8)' } -version = mod_version -group = mod_group_id +version = '1.0.0' +group = 'com.example.examplemod' -base { - archivesName = mod_id -} +// Mojang ships Java 25 to end users in 26.1+, so your mod should target Java 25. +java.toolchain.languageVersion = JavaLanguageVersion.of(25) -// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21. -java.toolchain.languageVersion = JavaLanguageVersion.of(21) +// Include generated resources +sourceSets.main.resources { srcDir 'src/generated/resources' } -println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { - // The mappings can be changed at any time and must be in the following format. - // 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 - // - // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started - // - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: mapping_channel, version: mapping_version - - // Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG - reobf = false - - // When true, this property will have all Eclipse/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. - // enableEclipsePrepareRuns = true - // 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, 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. runs { - // applies to all the run configs below configureEach { - workingDirectory project.file('run') + workingDir = layout.projectDirectory.dir('run') - // Optional additional logging. The markers can be added/remove as needed, separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. -// property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - - // Recommended for development - enables more descriptive errors at the cost of slower startup and registration. - property 'eventbus.api.strictRuntimeChecks', 'true' - -// arg "-mixin.config=${mod_id}.mixins.json" + systemProperty 'eventbus.api.strictRuntimeChecks', 'true' + systemProperty 'forge.enabledGameTestNamespaces', 'examplemod' } - client { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - } + register('client') - server { - property 'forge.enabledGameTestNamespaces', mod_id + register('server') { args '--nogui' } - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - property 'forge.enabledGameTestNamespaces', mod_id - } + register('gameTestServer') - data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory project.file('run-data') + register('data') { + workingDir = layout.projectDirectory.dir('run-data') - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + args '--mod', 'examplemod', '--all', '--output', layout.projectDirectory.dir('src/generated/resources'), '--existing', layout.projectDirectory.dir('src/main/resources') } } } -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - repositories { - // Put repositories for dependencies here + minecraft.mavenizer(it) // In Kotlin, it = this + maven fg.forgeMaven + maven fg.minecraftLibsMaven mavenCentral() - maven { - name = 'Forge' - url = 'https://maven.minecraftforge.net' - } - maven { - name = 'Minecraft libraries' - url = 'https://libraries.minecraft.net' - } - exclusiveContent { - forRepository { - maven { - name = 'Sponge' - url = 'https://repo.spongepowered.org/repository/maven-public' - } - } - filter { - includeGroupAndSubgroups('org.spongepowered') - } - } - - // 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. - // 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}" - - // Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor - // to improve performance in production environments. This line is required to enable said compile-time validation - // in your development environment, helping you catch issues early. - annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.12' - - // Example mod dependency with JEI - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" - // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}" - // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}" - - // 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: - // 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 -tasks.named('processResources', ProcessResources) { - var 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, - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} - -// Example for how to get properties into the manifest for reading at runtime. -tasks.named('jar', Jar) { - manifest { - attributes([ - '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' : mod_authors - ]) -// attributes['MixinConfigs'] = "${mod_id}.mixins.json" - } -} - -// Example configuration to allow publishing using the maven-publish plugin -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact jar - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - } + implementation minecraft.dependency('net.minecraftforge:forge:@MC_VERSION@-@FORGE_VERSION@') + annotationProcessor 'net.minecraftforge:eventbus-validator:@EVENTBUS_VERSION@' } tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - -// IntelliJ no longer downloads javadocs and sources by default, this tells Gradle to force IntelliJ to do it. -idea.module { downloadJavadoc = downloadSources = true } - -eclipse { - // Run everytime eclipse builds the code - //autoBuildTasks genEclipseRuns - // Run when importing the project - synchronizationTasks 'genEclipseRuns' -} - -// Merge the resources and classes into the same directory, because Java expects modules to be in a single directory. -// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem -// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. -sourceSets.each { - def dir = layout.buildDirectory.dir("sourcesSets/$it.name") - it.output.resourcesDir = dir - it.java.destinationDirectory = dir + // Use the UTF-8 charset for Java compilation + // This is done by default in Java 18+, but this ensures it no matter the Java or Gradle version + options.encoding = 'UTF-8' } diff --git a/mdk/README.txt b/mdk/forge_README.txt similarity index 61% rename from mdk/README.txt rename to mdk/forge_README.txt index fd3a5d5fa4..31830fb359 100644 --- a/mdk/README.txt +++ b/mdk/forge_README.txt @@ -1,13 +1,11 @@ - Source installation information for modders ------------------------------------------- This code follows the Minecraft Forge installation methodology. It will apply -some small patches to the vanilla MCP source code, giving you and it access +some small patches to the vanilla MCP source code, giving you and it access to some of the data and functions you need to build a successful mod. -Note also that the patches are built against "un-renamed" MCP source code (aka -SRG Names) - this means that you will not be able to read them directly against -normal code. +Please note that this example MDK is a simple showcase for the most basic of mods. +To see more examples see our dedicated examples repository under the "Additional Resources" section. Setup Process: ============================== @@ -17,30 +15,22 @@ Step 1: Open your command-line and browse to the folder where you extracted the Step 2: You're left with a choice. If you prefer to use Eclipse: 1. Run the following command: `./gradlew genEclipseRuns` -2. Open Eclipse, Import > Existing Gradle Project > Select Folder +2. Open Eclipse, Import > Existing Gradle Project > Select Folder or run `gradlew eclipse` to generate the project. If you prefer to use IntelliJ: 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. -3. Run the following command: `./gradlew genIntellijRuns` -4. Refresh the Gradle Project in IDEA if required. +3. Use the run tasks located under the "Slime Launcher" Gradle task group. If at any point you are missing libraries in your IDE, or you've run into problems you can run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything (this does not affect your code) and then start the process again. -Mapping Names: -============================= -By default, the MDK is configured to use the official mapping names from Mojang for methods and fields -in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this -license, if you do not agree with it you can change your mapping names to other crowdsourced names in your -build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here: -https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - Additional Resources: ========================= Community Documentation: https://docs.minecraftforge.net/en/latest/gettingstarted/ +Additional Examples: https://github.com/MinecraftForge/MDKExamples LexManos' Install Video: https://youtu.be/8VEdtQLuLO0 Forge Forums: https://forums.minecraftforge.net/ Forge Discord: https://discord.minecraftforge.net/ diff --git a/mdk/gitignore.txt b/mdk/gitignore.txt index 12f864471f..c3a6e6d180 100644 --- a/mdk/gitignore.txt +++ b/mdk/gitignore.txt @@ -22,4 +22,5 @@ eclipse run # Files from Forge MDK +forge_README.txt forge*changelog.txt diff --git a/mdk/gradle.properties b/mdk/gradle.properties index 71808d8f31..3feceb603e 100644 --- a/mdk/gradle.properties +++ b/mdk/gradle.properties @@ -1,66 +1,9 @@ -# 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=-Xmx5G -org.gradle.daemon=false +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true -# In the case that Gradle needs to fork to recompile, this will set the memory for that process. -systemProp.net.minecraftforge.gradle.repo.recompile.fork=true -systemProp.net.minecraftforge.gradle.repo.recompile.fork.args=-Xmx5G +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn -# Opts-out of ForgeGradle automatically adding mavenCentral(), Forge's maven and MC libs maven to the repositories block -systemProp.net.minecraftforge.gradle.repo.attach=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 +net.minecraftforge.gradle.merge-source-sets=true diff --git a/mdk/settings.gradle b/mdk/settings.gradle index 1870480369..46f898f686 100644 --- a/mdk/settings.gradle +++ b/mdk/settings.gradle @@ -1,13 +1,5 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } - } +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' } -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0' -} +rootProject.name = 'examplemod' diff --git a/mdk/src/main/resources/META-INF/mods.toml b/mdk/src/main/resources/META-INF/mods.toml index 80795f1f53..904335467c 100644 --- a/mdk/src/main/resources/META-INF/mods.toml +++ b/mdk/src/main/resources/META-INF/mods.toml @@ -1,73 +1,37 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# 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="${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="${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 -# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN), -# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers. -#clientSideOnly=true #optional - defaults to false if absent -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -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 -# A text field displayed in the mod UI -#credits="" #optional -# A text field displayed in the mod UI -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. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional) +# See https://docs.minecraftforge.net/en/1.21.x/gettingstarted/modfiles/#modstoml +# There are lots of things you can do with the mods.toml, and not all fields are included with this MDK +# References: https://github.com/MinecraftForge/MDKExamples -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are 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_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 +modLoader="javafml" +loaderVersion="[@FORGE_SPEC_VERSION@,)" +license="All Rights Reserved" +#issueTrackerURL="https://github.com/MyOrganization/MyMod/" #optional +#clientSideOnly=true #optional, default=false + +[[mods]] +modId="examplemod" +version="1.0.0" +displayName="Example Mod" +#updateJSONURL="https://example.com/updates.json" #optional +#displayURL="https://example.com/" #optional +#logoFile="examplemod.png" #optional +#credits="" #optional +authors="YourNameHere, OtherNameHere" #optional +#displayTest="MATCH_VERSION" #optional, default=MATCH_VERSION when not clientSideOnly, else IGNORE_ALL_VERSION + +description='''Example mod description. +Newline characters can be used like this, and rendered on the mods screen properly.''' + +[[dependencies.examplemod]] #recommended + modId="forge" + mandatory=true + versionRange="[@FORGE_SPEC_VERSION@,)" ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT, or SERVER side="BOTH" -# Here's another dependency -[[dependencies.${mod_id}]] + +[[dependencies.examplemod]] #recommended 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="${minecraft_version_range}" + versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@,)" ordering="NONE" side="BOTH" - -# Features are specific properties of the game environment, that you may want to declare you require. This example declares -# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't -# stop your mod loading on the server for example. -#[features.${mod_id}] -#openGLVersion="[3.2,)" diff --git a/minecraft.versions.toml b/minecraft.versions.toml new file mode 100644 index 0000000000..a2a4d47b43 --- /dev/null +++ b/minecraft.versions.toml @@ -0,0 +1,6 @@ +[versions] +java = "25" +minecraft = "26.2" +minecraft-next = "26.3" +mcp = "20260616.103818" +changelog-base = "65.0" diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch index acb6d73e19..8ef6350531 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch @@ -1,12 +1,12 @@ --- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java +++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java -@@ -133,6 +_,9 @@ - GlStateManager._colorMask(true, true, true, true); - GlStateManager._clear(16384); - GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0); -+ // Forge: if using stencil, clear it as well (3553 = GlConst.GL_TEXTURE_2D) -+ if (p_394273_.isStencilEnabled()) -+ GlStateManager._glFramebufferTexture2D(GlConst.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, GlConst.GL_TEXTURE_2D, 0, 0); - GlStateManager._glBindFramebuffer(36160, 0); - } +@@ -201,6 +_,9 @@ + GlStateManager._colorMask(15); + GlStateManager._clear(16384); + GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0); ++ // Forge: if using stencil, clear it as well (3553 = GlConst.GL_TEXTURE_2D) ++ if (colorTexture.isStencilEnabled()) ++ GlStateManager._glFramebufferTexture2D(GlConst.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, GlConst.GL_TEXTURE_2D, 0, 0); + GlStateManager._glBindFramebuffer(36160, 0); } + diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch new file mode 100644 index 0000000000..19c0803e0c --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch @@ -0,0 +1,35 @@ +--- a/com/mojang/blaze3d/opengl/GlConst.java ++++ b/com/mojang/blaze3d/opengl/GlConst.java +@@ -239,6 +_,10 @@ + } + + public static int toGlInternalId(final GpuFormat gpuFormat) { ++ return toGlInternalId(gpuFormat, false); ++ } ++ public static int toGlInternalId(final GpuFormat gpuFormat, final boolean stencil) { ++ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8; + return switch (gpuFormat) { + case R8_UNORM -> 33321; + case R8_SNORM -> 36756; +@@ -291,6 +_,10 @@ + } + + public static int toGlExternalId(final GpuFormat gpuFormat) { ++ return toGlExternalId(gpuFormat, false); ++ } ++ public static int toGlExternalId(final GpuFormat gpuFormat, final boolean stencil) { ++ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL; + return switch (gpuFormat) { + case R8_UNORM, R8_SNORM, R16_UNORM, R16_SNORM, R16_FLOAT, R32_FLOAT -> 6403; + case RG8_UNORM, RG8_SNORM, RG16_UNORM, RG16_SNORM, RG16_FLOAT, RG32_FLOAT -> 33319; +@@ -308,6 +_,10 @@ + } + + public static int toGlType(final GpuFormat gpuFormat) { ++ return toGlType(gpuFormat, false); ++ } ++ public static int toGlType(final GpuFormat gpuFormat, boolean stencil) { ++ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV; + return switch (gpuFormat) { + case R8_UNORM, RG8_UNORM, RGB8_UNORM, RGBA8_UNORM, R8_UINT, RG8_UINT, RGBA8_UINT, S8_UINT, RGB8_UINT -> 5121; + case R8_SNORM, RG8_SNORM, RGB8_SNORM, RGBA8_SNORM, R8_SINT, RG8_SINT, RGBA8_SINT, RGB8_SINT -> 5120; diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch index 3b6b49a1d1..5f5f2a7781 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/opengl/GlDebug.java +++ b/com/mojang/blaze3d/opengl/GlDebug.java -@@ -24,6 +_,14 @@ +@@ -22,6 +_,14 @@ @OnlyIn(Dist.CLIENT) public class GlDebug { @@ -15,20 +15,30 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final int CIRCULAR_LOG_SIZE = 10; private final Queue MESSAGE_BUFFER = EvictingQueue.create(10); -@@ -105,6 +_,8 @@ +@@ -83,6 +_,8 @@ } - LOGGER.info("OpenGL debug message: {}", gldebug$logentry); + LOGGER.info("OpenGL debug message: {}", entry); + // TODO: [VEN] Trim the stack trace + if (PRINT_STACKTRACE_ON_ERROR) LOGGER.info("Trace: ", new Throwable("GlDebug")); } public List getLastOpenGlDebugMessages() { -@@ -120,6 +_,7 @@ - } +@@ -107,7 +_,7 @@ + GlDebug debug = new GlDebug(); + enabledExtensions.add("GL_KHR_debug"); + GL33C.glEnable(37600); +- if (debugSynchronousGlLogs) { ++ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) { + GL33C.glEnable(33346); + } + +@@ -121,7 +_,7 @@ + } else if (caps.GL_ARB_debug_output && GlDevice.USE_GL_ARB_debug_output) { + GlDebug debug = new GlDebug(); + enabledExtensions.add("GL_ARB_debug_output"); +- if (debugSynchronousGlLogs) { ++ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) { + GL33C.glEnable(33346); + } - public static @Nullable GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set p_393339_) { -+ p_393026_ |= PRINT_STACKTRACE_ON_ERROR; - if (p_394351_ <= 0) { - return null; - } else { diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch index 90fc76c760..6700394d6b 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch @@ -1,74 +1,50 @@ --- a/com/mojang/blaze3d/opengl/GlDevice.java +++ b/com/mojang/blaze3d/opengl/GlDevice.java -@@ -124,8 +_,15 @@ - int p_407582_, - int p_408928_ +@@ -150,7 +_,12 @@ + final int depthOrLayers, + final int mipLevels ) { -+ return createTexture(p_397830_, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, false); +- return this.createTexture(this.debugLabels.exists() && label != null ? label.get() : null, usage, format, width, height, depthOrLayers, mipLevels); ++ return this.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels, false); + } + + @Override -+ public GpuTexture createTexture( -+ @Nullable Supplier p_397830_, int p_394481_, TextureFormat p_394839_, int p_391831_, int p_395609_, int p_407582_, int p_408928_, boolean stencil -+ ) { - return this.createTexture( -- this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_ -+ this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, stencil - ); ++ public GpuTexture createTexture(final @Nullable Supplier label, @GpuTexture.Usage final int usage, final GpuFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, final boolean stencil) { ++ return this.createTexture(this.debugLabels.exists() && label != null ? label.get() : null, usage, format, width, height, depthOrLayers, mipLevels, stencil); } -@@ -133,6 +_,15 @@ - public GpuTexture createTexture( - @Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_ + @Override +@@ -163,6 +_,11 @@ + final int depthOrLayers, + final int mipLevels ) { -+ return createTexture(p_394142_, p_395535_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, false); ++ return this.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels, false); + } + + @Override -+ public GpuTexture createTexture( -+ @Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil -+ ) { -+ // Forge: stencil rendering is only for depth -+ stencil &= p_394951_.hasDepthAspect(); - if (p_406483_ < 1) { - throw new IllegalArgumentException("mipLevels must be at least 1"); - } else if (p_408015_ < 1) { -@@ -183,11 +_,14 @@ - GlStateManager._texImage2D( - k, - l, -+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 : - GlConst.toGlInternalId(p_394951_), - p_393944_ >> l, - p_392329_ >> l, - 0, -+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL : - GlConst.toGlExternalId(p_394951_), -+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV : - GlConst.toGlType(p_394951_), - null - ); -@@ -198,11 +_,14 @@ - GlStateManager._texImage2D( - j, - i1, -+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 : - GlConst.toGlInternalId(p_394951_), - p_393944_ >> i1, - p_392329_ >> i1, - 0, -+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL : - GlConst.toGlExternalId(p_394951_), -+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV : - GlConst.toGlType(p_394951_), - null - ); -@@ -215,7 +_,7 @@ - } else if (j1 != 0) { - throw new IllegalStateException("OpenGL error " + j1); - } else { -- GlTexture gltexture = new GlTexture(p_395535_, p_394142_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, i); -+ GlTexture gltexture = new GlTexture(p_395535_, p_394142_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, i, stencil); - this.debugLabels.applyLabel(gltexture); - return gltexture; ++ public GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, final GpuFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, boolean stencil) { + GlStateManager.clearGlErrors(); + int id = GlStateManager._genTexture(); + if (label == null) { +@@ -186,9 +_,9 @@ + GlStateManager._texParameter(target, 34892, 0); + } + +- int glInternalID = GlConst.toGlInternalId(format); +- int glExternalID = GlConst.toGlExternalId(format); +- int glType = GlConst.toGlType(format); ++ int glInternalID = GlConst.toGlInternalId(format, stencil); ++ int glExternalID = GlConst.toGlExternalId(format, stencil); ++ int glType = GlConst.toGlType(format, stencil); + if (glInternalID != 0 && glExternalID != 0 && glType != 0) { + if (isCubemap) { + for (int cubeTarget : GlConst.CUBEMAP_TARGETS) { +@@ -211,7 +_,7 @@ + throw new IllegalStateException("OpenGL error " + error); } + +- GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, this.frameBufferCache); ++ GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, this.frameBufferCache, stencil); + this.debugLabels.applyLabel(texture); + return texture; + } else { diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch index 68d6d7ed49..11e9b24586 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch @@ -1,18 +1,18 @@ --- a/com/mojang/blaze3d/opengl/GlStateManager.java +++ b/com/mojang/blaze3d/opengl/GlStateManager.java -@@ -86,6 +_,11 @@ +@@ -80,6 +_,11 @@ } } -+ public static boolean _isBlendEnabled() { ++ public static boolean _isBlendEnabled(int index) { + RenderSystem.assertOnRenderThread(); -+ return BLEND.mode.enabled; ++ return BLEND[index].mode.enabled; + } + - public static void _disableBlend() { + public static void _disableBlend(int index) { RenderSystem.assertOnRenderThread(); - BLEND.mode.disable(); -@@ -371,9 +_,17 @@ + BLEND[index].mode.disable(); +@@ -390,9 +_,17 @@ } } @@ -20,13 +20,13 @@ + public static float lastBrightnessX = 0.0f; + public static float lastBrightnessY = 0.0f; + - public static void _texParameter(int p_393876_, int p_397998_, int p_396741_) { + public static void _texParameter(final int target, final int name, final int value) { RenderSystem.assertOnRenderThread(); - GL11.glTexParameteri(p_393876_, p_397998_, p_396741_); -+ if (p_393876_ == GL13.GL_TEXTURE1) { -+ lastBrightnessX = p_397998_; -+ lastBrightnessY = p_396741_; + GL33C.glTexParameteri(target, name, value); ++ if (target == GL33C.GL_TEXTURE1) { ++ lastBrightnessX = name; ++ lastBrightnessY = value; + } } - public static int _getTexLevelParameter(int p_393352_, int p_397204_, int p_396319_) { + public static int _getTexLevelParameter(final int target, final int level, final int name) { diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch index 9e16177549..a46d2a3d47 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch @@ -1,20 +1,21 @@ --- a/com/mojang/blaze3d/opengl/GlTexture.java +++ b/com/mojang/blaze3d/opengl/GlTexture.java -@@ -21,8 +_,13 @@ - protected GlTexture( - @GpuTexture.Usage int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_ +@@ -27,9 +_,14 @@ + final int id, + final FrameBufferCache frameBufferCache ) { -+ this(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_, p_408889_, false); ++ this(usage, label, format, width, height, depthOrLayers, mipLevels, id, frameBufferCache, false); + } + -+ protected GlTexture(int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_, boolean stencil) { - super(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_); - this.id = p_408889_; ++ protected GlTexture(@GpuTexture.Usage int usage, String label, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, int id, FrameBufferCache frameBufferCache, boolean stencil) { + super(usage, label, format, width, height, depthOrLayers, mipLevels); + this.id = id; + this.frameBufferCache = frameBufferCache; + this.stencilEnabled = stencil; } @Override -@@ -89,5 +_,12 @@ +@@ -84,5 +_,12 @@ if (this.closed && this.views == 0) { this.destroyImmediately(); } diff --git a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 2e4484440d..0c3e099fc8 100644 --- a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -1,15 +1,15 @@ --- a/com/mojang/blaze3d/pipeline/RenderTarget.java +++ b/com/mojang/blaze3d/pipeline/RenderTarget.java -@@ -80,7 +_,7 @@ - this.width = p_83951_; - this.height = p_83952_; +@@ -83,7 +_,7 @@ + this.width = width; + this.height = height; if (this.useDepth) { -- this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1); -+ this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1, this.stencilEnabled); - this.depthTextureView = gpudevice.createTextureView(this.depthTexture); +- this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, GpuFormat.D32_FLOAT, width, height, 1, 1); ++ this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, GpuFormat.D32_FLOAT, width, height, 1, 1, this.stencilEnabled); + this.depthTextureView = device.createTextureView(this.depthTexture); } -@@ -126,5 +_,26 @@ +@@ -121,5 +_,26 @@ public @Nullable GpuTextureView getDepthTextureView() { return this.depthTextureView; diff --git a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch index 98e1d80871..e7a00bd35a 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch @@ -1,30 +1,31 @@ --- a/com/mojang/blaze3d/platform/Window.java +++ b/com/mojang/blaze3d/platform/Window.java -@@ -91,7 +_,8 @@ - GLFW.glfwWindowHint(139267, 3); - GLFW.glfwWindowHint(139272, 204801); - GLFW.glfwWindowHint(139270, 1); -- this.handle = GLFW.glfwCreateWindow(this.width, this.height, p_85376_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L); -+ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.width, ()->this.height, ()->p_85376_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L); -+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) { - if (monitor != null) { - VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty()); - this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2; -@@ -103,6 +_,7 @@ - this.windowedX = this.x = aint1[0]; - this.windowedY = this.y = aint[0]; +@@ -101,8 +_,9 @@ + Monitor initialMonitor = monitorManager.getMonitor(GLFW.glfwGetPrimaryMonitor()); + this.windowedWidth = this.width = allowedWindowMinSize(displayData.width()); + this.windowedHeight = this.height = allowedWindowMinSize(displayData.height()); +- this.handle = this.createWindow(backend, this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.monitor() : 0L); ++ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.monitor() : 0L, () -> backend); + this.backend = backend; ++ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(initialMonitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) { + if (initialMonitor != null) { + VideoMode mode = initialMonitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty()); + this.windowedX = this.x = initialMonitor.x() + mode.getWidth() / 2 - this.width / 2; +@@ -114,6 +_,7 @@ + this.windowedX = this.x = actualX[0]; + this.windowedY = this.y = actualY[0]; } + } this.setMode(); this.refreshFramebufferSize(); -@@ -269,6 +_,9 @@ - GLFW.glfwGetFramebufferSize(this.handle, aint, aint1); - this.framebufferWidth = aint[0] > 0 ? aint[0] : 1; - this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1; +@@ -306,6 +_,9 @@ + outHeight[0] = this.isSoftScreen() ? outHeight[0] - 1 : outHeight[0]; + this.framebufferWidth = outWidth[0] > 0 ? outWidth[0] : 1; + this.framebufferHeight = outHeight[0] > 0 ? outHeight[0] : 1; + if (this.framebufferHeight == 0 || this.framebufferWidth == 0) { + net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w -> this.framebufferWidth = w, h -> this.framebufferHeight = h); + } } - private void onResize(long p_85428_, int p_85429_, int p_85430_) { + private void onResize(final long handle, final int newWidth, final int newHeight) { diff --git a/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch b/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch index 8859c3ec32..056d0582eb 100644 --- a/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch @@ -1,22 +1,46 @@ --- a/com/mojang/blaze3d/systems/GpuDevice.java +++ b/com/mojang/blaze3d/systems/GpuDevice.java -@@ -36,9 +_,19 @@ - int p_407070_ - ); +@@ -73,6 +_,21 @@ + return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels); + } -+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */ -+ default GpuTexture createTexture(@Nullable Supplier p_394357_, int p_395623_, TextureFormat p_395807_, int p_395802_, int p_396157_, int p_408810_, int p_407070_, boolean stencil) { -+ return this.createTexture(p_394357_, p_395623_, p_395807_, p_395802_, p_396157_, p_408810_, p_407070_); ++ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */ ++ public GpuTexture createTexture( ++ final @Nullable Supplier label, ++ @GpuTexture.Usage final int usage, ++ final GpuFormat format, ++ final int width, ++ final int height, ++ final int depthOrLayers, ++ final int mipLevels, ++ final boolean stencil ++ ) { ++ this.verifyTextureCreationArgs(usage, width, height, depthOrLayers, mipLevels); ++ return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels, stencil); + } + - GpuTexture createTexture( - @Nullable String p_391798_, @GpuTexture.Usage int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_ - ); -+ -+ /** Forge: same as {@link #createTexture(String, int, TextureFormat, int, int, int)} but with stencil support */ -+ default GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_, boolean stencil) { -+ return this.createTexture(p_391798_, p_391800_, p_393333_, p_395600_, p_394065_, p_408732_, p_407125_); + public GpuTexture createTexture( + final @Nullable String label, + final @GpuTexture.Usage int usage, +@@ -84,6 +_,21 @@ + ) { + this.verifyTextureCreationArgs(usage, width, height, depthOrLayers, mipLevels); + return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels); + } ++ ++ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */ ++ public GpuTexture createTexture( ++ final @Nullable String label, ++ @GpuTexture.Usage final int usage, ++ final GpuFormat format, ++ final int width, ++ final int height, ++ final int depthOrLayers, ++ final int mipLevels, ++ final boolean stencil ++ ) { ++ this.verifyTextureCreationArgs(usage, width, height, depthOrLayers, mipLevels); ++ return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels, stencil); + } - GpuTextureView createTextureView(GpuTexture p_409045_); - + private void verifyTextureCreationArgs(final @GpuTexture.Usage int usage, final int width, final int height, final int depthOrLayers, final int mipLevels) { diff --git a/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch b/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch new file mode 100644 index 0000000000..d39e0b3864 --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch @@ -0,0 +1,20 @@ +--- a/com/mojang/blaze3d/systems/GpuDeviceBackend.java ++++ b/com/mojang/blaze3d/systems/GpuDeviceBackend.java +@@ -32,7 +_,17 @@ + @Nullable Supplier label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels + ); + ++ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */ ++ default GpuTexture createTexture(@Nullable Supplier label, @GpuTexture.Usage final int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) { ++ return createTexture(label, usage, format, width, height, depthOrLayers, mipLevels); ++ } ++ + GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels); ++ ++ /** Forge: same as {@link #createTexture(String, int, GpuFormat, int, int, int)} but with stencil support */ ++ default GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) { ++ return createTexture(label, usage, format, width, height, depthOrLayers, mipLevels); ++ } + + GpuTextureView createTextureView(GpuTexture texture); + diff --git a/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch b/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch index a53ef1fc42..e1acf98c71 100644 --- a/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch @@ -1,9 +1,9 @@ --- a/com/mojang/blaze3d/textures/GpuTexture.java +++ b/com/mojang/blaze3d/textures/GpuTexture.java -@@ -10,7 +_,7 @@ +@@ -9,7 +_,7 @@ + import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) - @DontObfuscate -public abstract class GpuTexture implements AutoCloseable { +public abstract class GpuTexture implements AutoCloseable, net.minecraftforge.client.extensions.IForgeGpuTexture { public static final int USAGE_COPY_DST = 1; diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/PoseStack.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/PoseStack.java.patch index bedbe42f21..b74e45535d 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/PoseStack.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/PoseStack.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/PoseStack.java +++ b/com/mojang/blaze3d/vertex/PoseStack.java -@@ -15,7 +_,7 @@ +@@ -16,7 +_,7 @@ import org.joml.Vector3fc; @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch deleted file mode 100644 index 36226d81e2..0000000000 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/com/mojang/blaze3d/vertex/VertexConsumer.java -+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java -@@ -14,7 +_,7 @@ - import org.joml.Vector3fc; - - @OnlyIn(Dist.CLIENT) --public interface VertexConsumer { -+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer { - VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_); - - VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_); diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch index 87f3add2da..d181b3f0bb 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch @@ -1,41 +1,31 @@ --- a/com/mojang/blaze3d/vertex/VertexFormat.java +++ b/com/mojang/blaze3d/vertex/VertexFormat.java -@@ -20,7 +_,7 @@ - - @OnlyIn(Dist.CLIENT) - @DontObfuscate --public class VertexFormat { -+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat { - public static final int UNKNOWN_ELEMENT = -1; - private final List elements; - private final List names; -@@ -29,6 +_,7 @@ - private final int[] offsetsByElement = new int[32]; - private @Nullable GpuBuffer immediateDrawVertexBuffer; - private @Nullable GpuBuffer immediateDrawIndexBuffer; +@@ -19,6 +_,7 @@ + private final int vertexSize; + private final int stepRate; + private final List elementValues; + private final com.google.common.collect.ImmutableMap elementMapping; - VertexFormat(List p_343616_, List p_345241_, IntList p_345522_, int p_344162_) { - this.elements = p_343616_; -@@ -41,6 +_,11 @@ - int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1; - this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1; + private VertexFormat(final List elements, final int vertexSize, final int stepRate) { + this.vertexSize = vertexSize; +@@ -29,6 +_,11 @@ } + + this.elementValues = elements; + -+ ImmutableMap.Builder elements = ImmutableMap.builder(); -+ for (int i = 0; i < p_343616_.size(); i++) -+ elements.put(p_345241_.get(i), p_343616_.get(i)); -+ this.elementMapping = elements.buildOrThrow(); ++ var elementMapping = com.google.common.collect.ImmutableMap.builder(); ++ for (var element : elements) ++ elementMapping.put(element.name(), element); ++ this.elementMapping = elementMapping.buildOrThrow(); } - public static VertexFormat.Builder builder() { -@@ -139,6 +_,9 @@ - this.immediateDrawIndexBuffer = uploadToBuffer(this.immediateDrawIndexBuffer, p_391835_, 72, () -> "Immediate index buffer for " + this); - return this.immediateDrawIndexBuffer; + public static VertexFormat.Builder builder(final int stepRate) { +@@ -69,6 +_,8 @@ + public int hashCode() { + return this.elementValues.hashCode(); } + -+ public ImmutableMap getElementMapping() { return elementMapping; } -+ public int getOffset(int index) { return offsetsByElement[index]; } ++ public com.google.common.collect.ImmutableMap getElementMapping() { return elementMapping; } @OnlyIn(Dist.CLIENT) - @DontObfuscate + public static class Builder { diff --git a/patches/minecraft/com/mojang/math/Transformation.java.patch b/patches/minecraft/com/mojang/math/Transformation.java.patch index e93bfb6862..a08cc0d2b5 100644 --- a/patches/minecraft/com/mojang/math/Transformation.java.patch +++ b/patches/minecraft/com/mojang/math/Transformation.java.patch @@ -1,31 +1,32 @@ --- a/com/mojang/math/Transformation.java +++ b/com/mojang/math/Transformation.java -@@ -16,7 +_,7 @@ +@@ -14,7 +_,7 @@ import org.joml.Vector3fc; import org.jspecify.annotations.Nullable; -public final class Transformation { +public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation { - private final Matrix4fc matrix; - public static final Codec CODEC = RecordCodecBuilder.create( - p_269604_ -> p_269604_.group( -@@ -168,5 +_,19 @@ - this.getScale().lerp(p_175938_.getScale(), p_175939_, new Vector3f()), - this.getRightRotation().slerp(p_175938_.getRightRotation(), p_175939_, new Quaternionf()) + private static final Vector3fc ZERO_TRANSLATION = new Vector3f(); + private static final Vector3fc UNIT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F); + private static final Quaternionfc ZERO_ROTATION = new Quaternionf(); +@@ -172,6 +_,20 @@ + this.scale().lerp(that.scale(), progress, new Vector3f()), + this.rightRotation().slerp(that.rightRotation(), progress, new Quaternionf()) ); + } + -+ private Matrix3f normalTransform = null; -+ public Matrix3f getNormalMatrix() { ++ private org.joml.Matrix3f normalTransform = null; ++ public org.joml.Matrix3f getNormalMatrix() { + checkNormalTransform(); + return normalTransform; + } + + private void checkNormalTransform() { + if (normalTransform == null) { -+ normalTransform = new Matrix3f(matrix); ++ normalTransform = new org.joml.Matrix3f(matrix); + normalTransform.invert(); + normalTransform.transpose(); + } } - } + + public static Matrix4fc compose(final Matrix4fc parent, final Optional transform) { 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 8c5b232669..f7cb1fe45c 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -1,18 +1,18 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java -@@ -62,6 +_,15 @@ +@@ -60,6 +_,15 @@ } @Override + public boolean keyPressed(net.minecraft.client.input.KeyEvent event) { + if (event.key() == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) { -+ minecraft.setScreen(this.nextScreen); ++ minecraft.gui.setScreen(this.nextScreen); + return true; + } + return super.keyPressed(event); + } + + @Override - public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) { - super.render(p_283497_, p_88680_, p_88681_, p_88682_); - p_283497_.drawCenteredString(this.font, this.title, this.width / 2, 80, -1); + public void extractRenderState(final GuiGraphicsExtractor graphics, final int xm, final int ym, final float a) { + super.extractRenderState(graphics, xm, ym, a); + graphics.centeredText(this.font, this.title, this.width / 2, 80, -1); diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch index f11de71060..fc1e5576c9 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch @@ -1,11 +1,11 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java -@@ -263,7 +_,7 @@ - int k = this.getY(); - p_282595_.blit(RenderPipelines.GUI_TEXTURED, this.image, j + 2, k + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, i); - p_282595_.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, j, k, 60, 60, i); -- int l = flag ? -6250336 : -1; -+ int l = getFGColor(); - p_282595_.drawCenteredString(RealmsResetWorldScreen.this.font, this.getMessage(), j + 28, k - 14, l); +@@ -300,7 +_,7 @@ + int y = this.getY(); + graphics.blit(RenderPipelines.GUI_TEXTURED, this.image, x + 2, y + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, color); + graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, x, y, 60, 60, color); +- int textColor = hoveredOrFocused ? -6250336 : -1; ++ int textColor = getFGColor(); + graphics.centeredText(RealmsResetWorldScreen.this.font, this.getMessage(), x + 28, y - 14, textColor); } } diff --git a/patches/minecraft/net/minecraft/CrashReport.java.patch b/patches/minecraft/net/minecraft/CrashReport.java.patch index 7cc8adff3a..cbf30e33e5 100644 --- a/patches/minecraft/net/minecraft/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/CrashReport.java.patch @@ -1,48 +1,45 @@ --- a/net/minecraft/CrashReport.java +++ b/net/minecraft/CrashReport.java @@ -58,14 +_,9 @@ - if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) { - p_127520_.append("-- Head --\n"); - p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); -- p_127520_.append("Stacktrace:\n"); + if (this.uncategorizedStackTrace.length > 0) { + builder.append("-- Head --\n"); + builder.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); +- builder.append("Stacktrace:\n"); - -- for (StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { -- p_127520_.append("\t").append("at ").append(stacktraceelement); -- p_127520_.append("\n"); +- for (StackTraceElement element : this.uncategorizedStackTrace) { +- builder.append("\t").append("at ").append(element); +- builder.append("\n"); - } - -- p_127520_.append("\n"); -+ p_127520_.append(net.minecraftforge.logging.CrashReportAnalyser.appendSuspectedMods(this.exception, this.uncategorizedStackTrace)); -+ p_127520_.append("Stacktrace:"); -+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace)); +- builder.append("\n"); ++ builder.append(net.minecraftforge.logging.CrashReportAnalyser.appendSuspectedMods(this.exception, this.uncategorizedStackTrace)); ++ builder.append("Stacktrace:"); ++ builder.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace)); } - for (CrashReportCategory crashreportcategory : this.details) { + for (CrashReportCategory entry : this.details) { @@ -73,6 +_,7 @@ - p_127520_.append("\n\n"); + builder.append("\n\n"); } + net.minecraftforge.logging.CrashReportExtender.extendSystemReport(systemReport); - this.systemReport.appendToCrashReportString(p_127520_); + this.systemReport.appendToCrashReportString(builder); } -@@ -92,18 +_,7 @@ - throwable.setStackTrace(this.exception.getStackTrace()); +@@ -84,15 +_,7 @@ + exception = replaceMessage(exception, this.title); } -- String s; - try { -- stringwriter = new StringWriter(); -- printwriter = new PrintWriter(stringwriter); -- throwable.printStackTrace(printwriter); -- s = stringwriter.toString(); +- writer = new StringWriter(); +- printWriter = new PrintWriter(writer); +- exception.printStackTrace(printWriter); +- return writer.toString(); - } finally { -- IOUtils.closeQuietly((Writer)stringwriter); -- IOUtils.closeQuietly((Writer)printwriter); +- IOUtils.closeQuietly(writer); +- IOUtils.closeQuietly(printWriter); - } -- -- return s; -+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable); ++ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(exception); } - public String getFriendlyReport(ReportType p_343869_, List p_342487_) { + private static Throwable copyProperties(final Throwable original, final Throwable copy) { diff --git a/patches/minecraft/net/minecraft/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/CrashReportCategory.java.patch index 3979566f0b..c6cf02d013 100644 --- a/patches/minecraft/net/minecraft/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/CrashReportCategory.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/CrashReportCategory.java +++ b/net/minecraft/CrashReportCategory.java -@@ -116,8 +_,10 @@ - if (astacktraceelement.length <= 0) { +@@ -138,8 +_,10 @@ return 0; - } else { -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - p_128149_]; -- System.arraycopy(astacktraceelement, 3 + p_128149_, this.stackTrace, 0, this.stackTrace.length); -+ int len = astacktraceelement.length - 3 - p_128149_; -+ if (len <= 0) len = astacktraceelement.length; -+ this.stackTrace = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); - return this.stackTrace.length; } - } -@@ -164,16 +_,16 @@ - if (this.stackTrace != null && this.stackTrace.length > 0) { - p_128169_.append("\nStacktrace:"); +- this.stackTrace = new StackTraceElement[full.length - 3 - nestedOffset]; +- System.arraycopy(full, 3 + nestedOffset, this.stackTrace, 0, this.stackTrace.length); ++ int len = full.length - 3 - nestedOffset; ++ if (len <= 0) len = full.length; ++ this.stackTrace = new StackTraceElement[len]; ++ System.arraycopy(full, full.length - len, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + +@@ -181,16 +_,16 @@ + + if (this.stackTrace.length > 0) { + builder.append("\nStacktrace:"); - -- for (StackTraceElement stacktraceelement : this.stackTrace) { -- p_128169_.append("\n\tat "); -- p_128169_.append(stacktraceelement); +- for (StackTraceElement element : this.stackTrace) { +- builder.append("\n\tat "); +- builder.append(element); - } -+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace)); ++ builder.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace)); } } @@ -34,4 +34,4 @@ + this.stackTrace = t.getStackTrace(); } - public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, BlockState p_178954_) { + public static void populateBlockDetails( diff --git a/patches/minecraft/net/minecraft/SharedConstants.java.patch b/patches/minecraft/net/minecraft/SharedConstants.java.patch index a22540af53..661c3eada0 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 -@@ -216,6 +_,7 @@ +@@ -218,6 +_,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch index 83c55b6745..ededdcc34c 100644 --- a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch +++ b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/advancements/Advancement.java +++ b/net/minecraft/advancements/Advancement.java -@@ -231,7 +_,11 @@ +@@ -220,7 +_,11 @@ } - public AdvancementHolder save(Consumer p_138390_, String p_138391_) { -- AdvancementHolder advancementholder = this.build(Identifier.parse(p_138391_)); -+ return save(p_138390_, Identifier.parse(p_138391_)); + public AdvancementHolder save(final Consumer output, final String name) { +- AdvancementHolder advancement = this.build(Identifier.parse(name)); ++ return save(output, Identifier.parse(name)); + } + -+ public AdvancementHolder save(Consumer p_138390_, Identifier id) { -+ AdvancementHolder advancementholder = this.build(id); - p_138390_.accept(advancementholder); - return advancementholder; ++ public AdvancementHolder save(Consumer output, Identifier id) { ++ AdvancementHolder advancement = this.build(id); + output.accept(advancement); + return advancement; } diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch index 14ff7b8a36..24a7b0abf3 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java -@@ -44,6 +_,7 @@ - LootParams lootparams = new LootParams.Builder(serverlevel) - .withParameter(LootContextParams.THIS_ENTITY, p_9990_) - .withParameter(LootContextParams.ORIGIN, p_9990_.position()) -+ .withLuck(p_9990_.getLuck()) +@@ -43,6 +_,7 @@ + LootParams params = new LootParams.Builder(level) + .withParameter(LootContextParams.THIS_ENTITY, player) + .withParameter(LootContextParams.ORIGIN, player.position()) ++ .withLuck(player.getLuck()) .create(LootContextParamSets.ADVANCEMENT_REWARD); - boolean flag = false; + boolean changes = false; diff --git a/patches/minecraft/net/minecraft/client/Camera.java.patch b/patches/minecraft/net/minecraft/client/Camera.java.patch index 577ff804ab..2b21b2469f 100644 --- a/patches/minecraft/net/minecraft/client/Camera.java.patch +++ b/patches/minecraft/net/minecraft/client/Camera.java.patch @@ -1,21 +1,37 @@ --- a/net/minecraft/client/Camera.java +++ b/net/minecraft/client/Camera.java -@@ -136,9 +_,13 @@ +@@ -224,11 +_,13 @@ + } + + float fov = this.minecraft.options.fov().get().intValue() * Mth.lerp(partialTicks, this.oldFovModifier, this.fovModifier); +- return this.modifyFovBasedOnDeathOrFluid(partialTicks, fov); ++ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, fov); ++ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, true).getFOV(); } - protected void setRotation(float p_90573_, float p_90574_) { -+ setRotation(p_90573_, p_90574_, 0.0f); + private float calculateHudFov(final float partialTicks) { +- return this.modifyFovBasedOnDeathOrFluid(partialTicks, 70.0F); ++ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, 70.0F); ++ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, false).getFOV(); + } + + private float modifyFovBasedOnDeathOrFluid(final float partialTicks, float fov) { +@@ -337,9 +_,13 @@ + } + + protected void setRotation(final float yRot, final float xRot) { ++ setRotation(yRot, xRot, 0.0f); + } + -+ public void setRotation(float p_90573_, float p_90574_, float z) { - this.xRot = p_90574_; - this.yRot = p_90573_; -- this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), 0.0F); -+ this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), z * (float) (Math.PI / 180.0)); ++ public void setRotation(float yRot, float xRot, float z) { + this.xRot = xRot; + this.yRot = yRot; +- this.rotation.rotationYXZ((float) Math.PI - yRot * (float) (Math.PI / 180.0), -xRot * (float) (Math.PI / 180.0), 0.0F); ++ this.rotation.rotationYXZ((float) Math.PI - yRot * (float) (Math.PI / 180.0), -xRot * (float) (Math.PI / 180.0), z * (float) (Math.PI / 180.0)); FORWARDS.rotate(this.rotation, this.forwards); UP.rotate(this.rotation, this.up); LEFT.rotate(this.rotation, this.left); -@@ -168,6 +_,13 @@ +@@ -370,6 +_,13 @@ public float yRot() { return this.yRot; diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch index c48665e519..fd1326cdb5 100644 --- a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/ClientBrandRetriever.java +++ b/net/minecraft/client/ClientBrandRetriever.java -@@ -10,6 +_,6 @@ +@@ -8,6 +_,6 @@ + public static final String VANILLA_NAME = "vanilla"; - @DontObfuscate public static String getClientModName() { - return "vanilla"; + return net.minecraftforge.internal.BrandingControl.getBranding(); diff --git a/patches/minecraft/net/minecraft/client/DeltaTracker.java.patch b/patches/minecraft/net/minecraft/client/DeltaTracker.java.patch index 28a485d707..55a71c3c89 100644 --- a/patches/minecraft/net/minecraft/client/DeltaTracker.java.patch +++ b/patches/minecraft/net/minecraft/client/DeltaTracker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/DeltaTracker.java +++ b/net/minecraft/client/DeltaTracker.java -@@ -87,18 +_,22 @@ +@@ -82,18 +_,22 @@ private void pause() { if (!this.paused) { @@ -22,4 +22,4 @@ + net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(false); } - public void updateFrozenState(boolean p_344005_) { + public void updateFrozenState(final boolean frozen) { diff --git a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch index 8b764326c0..ef8d086d33 100644 --- a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch @@ -15,12 +15,12 @@ @@ -39,7 +_,7 @@ } - private static void forAllKeyMappings(InputConstants.Key p_424096_, Consumer p_427756_) { -- List list = MAP.get(p_424096_); -+ List list = MAP.getAll(p_424096_); - if (list != null && !list.isEmpty()) { - for (KeyMapping keymapping : list) { - p_427756_.accept(keymapping); + private static void forAllKeyMappings(final InputConstants.Key key, final Consumer operation) { +- List keyMappings = MAP.get(key); ++ List keyMappings = MAP.getAll(key); + if (keyMappings != null && !keyMappings.isEmpty()) { + for (KeyMapping keyMapping : keyMappings) { + operation.accept(keyMapping); @@ -106,7 +_,7 @@ } @@ -30,12 +30,12 @@ } public KeyMapping.Category getCategory() { -@@ -149,8 +_,17 @@ - ? I18n.get(this.name).compareTo(I18n.get(p_90841_.name)) - : Integer.compare(this.order, p_90841_.order); +@@ -147,8 +_,17 @@ + if (this.category == o.category) { + return this.order == o.order ? I18n.get(this.name).compareTo(I18n.get(o.name)) : Integer.compare(this.order, o.order); } else { -- return Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(p_90841_.category)); -+ return compareSort(this.category, p_90841_.category); +- return Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(o.category)); ++ return compareSort(this.category, o.category); } + } + @@ -48,17 +48,17 @@ + return o1 - o2; } - public static Supplier createNameSupplier(String p_90843_) { -@@ -159,6 +_,20 @@ + public static Supplier createNameSupplier(final String key) { +@@ -157,6 +_,20 @@ } - public boolean same(KeyMapping p_90851_) { -+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) { + public boolean same(final KeyMapping that) { ++ if (getKeyConflictContext().conflicts(that.getKeyConflictContext()) || that.getKeyConflictContext().conflicts(getKeyConflictContext())) { + var keyModifier = getKeyModifier(); -+ var otherKeyModifier = p_90851_.getKeyModifier(); -+ if (keyModifier.matches(p_90851_.getKey()) || otherKeyModifier.matches(getKey())) { ++ var otherKeyModifier = that.getKeyModifier(); ++ if (keyModifier.matches(that.getKey()) || otherKeyModifier.matches(getKey())) { + return true; -+ } else if (getKey().equals(p_90851_.getKey())) { ++ } else if (getKey().equals(that.getKey())) { + // IN_GAME key contexts have a conflict when at least one modifier is NONE. + // For example: If you hold shift to crouch, you can still press E to open your inventory. This means that a Shift+E hotkey is in conflict with E. + // GUI and other key contexts do not have this limitation. @@ -67,10 +67,10 @@ + (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE)); + } + } - return this.key.equals(p_90851_.key); + return this.key.equals(that.key); } -@@ -177,11 +_,13 @@ +@@ -179,11 +_,13 @@ } public Component getTranslatedKeyMessage() { @@ -85,16 +85,16 @@ } public String saveString() { -@@ -193,11 +_,94 @@ +@@ -195,11 +_,94 @@ } - private void registerMapping(InputConstants.Key p_423386_) { -- MAP.computeIfAbsent(p_423386_, p_420623_ -> new ArrayList<>()).add(this); -+ MAP.put(p_423386_, this); + private void registerMapping(final InputConstants.Key key) { +- MAP.computeIfAbsent(key, k -> new ArrayList<>()).add(this); ++ MAP.put(key, this); } - public static @Nullable KeyMapping get(String p_378660_) { - return ALL.get(p_378660_); + public static @Nullable KeyMapping get(final String name) { + return ALL.get(name); + } + + private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; diff --git a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch index c69d99d906..121ab8fa48 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/client/KeyboardHandler.java +++ b/net/minecraft/client/KeyboardHandler.java -@@ -497,7 +_,7 @@ - if (screen != null) { - try { - if (p_90895_ != 1 && p_90895_ != 2) { -- if (p_90895_ == 0 && screen.keyReleased(p_423534_)) { -+ if (p_90895_ == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, p_423534_)) { - if (options.keyDebugModifier.matches(p_423534_)) { - this.usedDebugKeyAsModifier = false; +@@ -478,7 +_,7 @@ + if (screen != null) { + try { + if (action != 1 && action != 2) { +- if (action == 0 && screen.keyReleased(event)) { ++ if (action == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, event)) { + if (options.keyDebugModifier.matches(event)) { + this.usedDebugKeyAsModifier = false; + } +@@ -487,7 +_,7 @@ } -@@ -506,7 +_,7 @@ - } - } else { - screen.afterKeyboardAction(); -- if (screen.keyPressed(p_423534_)) { -+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, p_423534_)) { - if (this.minecraft.screen == null) { - InputConstants.Key inputconstants$key = InputConstants.getKey(p_423534_); - KeyMapping.set(inputconstants$key, false); -@@ -582,6 +_,7 @@ + } else { + screen.afterKeyboardAction(); +- if (screen.keyPressed(event)) { ++ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, event)) { + if (this.minecraft.gui.screen() == null) { + InputConstants.Key key = InputConstants.getKey(event); + KeyMapping.set(key, false); +@@ -562,6 +_,7 @@ } } } -+ net.minecraftforge.client.ForgeHooksClient.onKeyInput(p_423534_, p_90895_); ++ net.minecraftforge.client.ForgeHooksClient.onKeyInput(event, action); } } -@@ -590,7 +_,7 @@ - Screen screen = this.minecraft.screen; - if (screen != null && this.minecraft.getOverlay() == null) { +@@ -570,7 +_,7 @@ + Screen screen = this.minecraft.gui.screen(); + if (screen != null && this.minecraft.gui.overlay() == null) { try { -- screen.charTyped(p_427531_); -+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, p_427531_); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "charTyped event handler"); - screen.fillCrashDetails(crashreport); +- screen.charTyped(event); ++ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, event); + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "charTyped event handler"); + screen.fillCrashDetails(report); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 931fff65d8..1986a3b198 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -265,7 +_,7 @@ +@@ -258,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) -public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler { +public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft { - static Minecraft instance; + private static Minecraft instance; private static final Logger LOGGER = LogUtils.getLogger(); private static final int MAX_TICKS_PER_UPDATE = 10; -@@ -431,7 +_,6 @@ +@@ -410,7 +_,6 @@ } }, Util.nonCriticalIoPool()); LOGGER.info("Setting user: {}", this.user.getName()); - LOGGER.debug("(Session ID is {})", this.user.getSessionId()); - this.demo = p_91084_.game.demo; - this.allowsMultiplayer = !p_91084_.game.disableMultiplayer; - this.allowsChat = !p_91084_.game.disableChat; -@@ -483,10 +_,9 @@ - LOGGER.error("Couldn't set icon", (Throwable)ioexception); + this.demo = gameConfig.game.demo; + this.allowsMultiplayer = !gameConfig.game.disableMultiplayer; + this.allowsChat = !gameConfig.game.disableChat; +@@ -547,12 +_,12 @@ + LOGGER.error("Couldn't set icon", e); } + // FORGE: Move mouse and keyboard handler setup further below @@ -26,159 +26,117 @@ - this.mouseHandler.setup(this.window); this.keyboardHandler = new KeyboardHandler(this); - this.keyboardHandler.setup(this.window); - RenderSystem.initRenderer( - this.window.handle(), - this.options.glDebugVerbosity, -@@ -498,6 +_,7 @@ - LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions())); - this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight()); + this.options.applyGraphicsPreset(this.options.graphicsPreset().get()); this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES); + net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager); this.resourcePackRepository.reload(); this.options.loadSelectedResourcePacks(this.resourcePackRepository); - this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> { -@@ -585,6 +_,7 @@ - this.particleResources = new ParticleResources(); - this.resourceManager.registerReloadListener(this.particleResources); - this.particleEngine = new ParticleEngine(this.level, this.particleResources); -+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleResources); - this.particleResources.onReload(this.particleEngine::clearParticles); - this.waypointStyles = new WaypointStyleManager(); - this.resourceManager.registerReloadListener(this.waypointStyles); -@@ -596,6 +_,9 @@ - this.resourceManager.registerReloadListener(this.gpuWarnlistManager); + this.languageManager = new LanguageManager(this.options.languageCode, var1 -> { +@@ -630,6 +_,7 @@ + ParticleResources particleResources = new ParticleResources(); + this.resourceManager.registerReloadListener(particleResources); + this.particleEngine = new ParticleEngine(this.level, particleResources); ++ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(particleResources); + particleResources.onReload(this.particleEngine::clearParticles); + this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.modelManager); + WindowRenderState windowRenderState = this.gameRenderer.gameRenderState().windowRenderState; +@@ -647,6 +_,7 @@ + this.window.getHeight() + ); + this.levelExtractor = new LevelExtractor(this, this.gameRenderer.gameRenderState().levelRenderState, this.levelRenderer); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onInitLevelRenderer(); + this.resourceManager.registerReloadListener(this.levelExtractor); + this.resourceManager.registerReloadListener(this.levelRenderer.cloudRenderer()); + this.gpuWarnlistManager = new GpuWarnlistManager(); +@@ -654,6 +_,9 @@ this.resourceManager.registerReloadListener(this.regionalCompliancies); - this.gui = new Gui(this); + this.gui = new Gui(this, new Hud(this), this.gameRenderer.gameRenderState().guiRenderState); + this.gui.registerReloadListeners(this.resourceManager); + // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them. + this.mouseHandler.setup(this.window); + this.keyboardHandler.setup(this.window); - RealmsClient realmsclient = RealmsClient.getOrCreate(this); - this.realmsDataFetcher = new RealmsDataFetcher(realmsclient); + RealmsClient realmsClient = RealmsClient.getOrCreate(this); + this.realmsDataFetcher = new RealmsDataFetcher(realmsClient); RenderSystem.setErrorCallback(this::onFullscreenError); -@@ -628,6 +_,7 @@ +@@ -686,6 +_,7 @@ } } + net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager); - this.window.updateVsync(this.options.enableVsync().get()); this.window.updateRawMouseInput(this.options.rawMouseInput().get()); this.window.setAllowCursorChanges(this.options.allowCursorChanges().get()); -@@ -651,16 +_,17 @@ + this.window.setDefaultErrorCallback(); +@@ -710,14 +_,15 @@ + .createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, packs); GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS); - Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay); - this.setOverlay( -- new LoadingOverlay( -- this, reloadinstance, p_447796_ -> Util.ifElse(p_447796_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> { -+ net.minecraftforge.fml.loading.ImmediateWindowHandler.loadingOverlay( -+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_447796_ -> this.rollbackResourcePacks(p_447796_, minecraft$gameloadcookie), () -> { - if (SharedConstants.IS_RUNNING_IN_IDE) { - this.selfTest(); - } + GameLoadCookie loadCookie = new GameLoadCookie(realmsClient, gameConfig.quickPlay); +- this.gui.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> { ++ this.gui.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.loadingOverlay(() -> this, () ->reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> { + if (SharedConstants.IS_RUNNING_IN_IDE) { + this.selfTest(); + } - this.reloadStateTracker.finishReload(); - this.onResourceLoadFinished(minecraft$gameloadcookie); -+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading(); - }), false -- ) -+ ).get() - ); - this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.logPath()); + this.reloadStateTracker.finishReload(); + this.onResourceLoadFinished(loadCookie); +- }), false)); ++ net.minecraftforge.client.loading.ClientModLoader.completeModLoading(); ++ }), false).get()); + this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.logPath()); this.framerateLimitTracker = new FramerateLimitTracker(this.options, this); -@@ -779,6 +_,7 @@ - StringBuilder stringbuilder = new StringBuilder("Minecraft"); + this.fpsPieProfiler = new ContinuousProfiler(Util.timeSource(), () -> this.fpsPieRenderTicks, this.framerateLimitTracker::isHeavilyThrottled); +@@ -801,6 +_,7 @@ + StringBuilder builder = new StringBuilder("Minecraft"); if (checkModStatus().shouldReportAsModified()) { - stringbuilder.append("*"); -+ stringbuilder.append(" Forge"); + builder.append("*"); ++ builder.append(" Forge"); } - stringbuilder.append(" "); -@@ -802,6 +_,8 @@ + builder.append(" "); +@@ -824,6 +_,8 @@ } - private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { -+ if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam. + private static UserApiService createUserApiService(final YggdrasilAuthenticationService authService, final GameConfig config) { ++ if ("0".equals(config.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam. + return UserApiService.OFFLINE; - return p_193587_.game.offlineDeveloperMode ? UserApiService.OFFLINE : p_193586_.createUserApiService(p_193587_.user.user.getAccessToken()); + return config.game.offlineDeveloperMode ? UserApiService.OFFLINE : authService.createUserApiService(config.user.user.getAccessToken()); } -@@ -814,7 +_,7 @@ +@@ -840,7 +_,7 @@ } - private void rollbackResourcePacks(Throwable p_91240_, Minecraft.@Nullable GameLoadCookie p_299515_) { + private void rollbackResourcePacks(final Throwable t, final @Nullable GameLoadCookie loadCookie) { - if (this.resourcePackRepository.getSelectedIds().size() > 1) { + if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. - this.clearResourcePacksOnError(p_91240_, null, p_299515_); + this.clearResourcePacksOnError(t, null, loadCookie); } else { - Util.throwAsRuntime(p_91240_); -@@ -1100,12 +_,6 @@ - LOGGER.error("setScreen called from non-game thread"); - } - -- if (this.screen != null) { -- this.screen.removed(); -- } else { -- this.setLastInputType(InputType.NONE); -- } -- - if (p_91153_ == null) { - if (this.clientLevelTeardownInProgress) { - throw new IllegalStateException("Trying to return to in-game GUI during disconnection"); -@@ -1124,6 +_,23 @@ - } - } - -+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this); -+ Screen old = this.screen; -+ if (p_91153_ != null) { -+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, p_91153_); -+ if (event == null) return; -+ p_91153_ = event; -+ } -+ -+ if (p_91153_ != old) { -+ if (old != null) { -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old); -+ old.removed(); -+ } else { -+ this.setLastInputType(InputType.NONE); -+ } -+ } -+ - this.screen = p_91153_; - if (this.screen != null) { - this.screen.added(); -@@ -1207,6 +_,7 @@ + Util.throwAsRuntime(t); +@@ -1141,6 +_,7 @@ Util.shutdownExecutors(); - RenderSystem.getSamplerCache().close(); - RenderSystem.getDevice().close(); -+ net.minecraftforge.fml.config.ConfigTracker.INSTANCE.forceUnload(); - } catch (Throwable throwable) { - LOGGER.error("Shutdown failure!", throwable); - throw throwable; -@@ -1289,7 +_,9 @@ - RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(rendertarget.getColorTexture(), 0, rendertarget.getDepthTexture(), 1.0); - profilerfiller.push("gameRenderer"); - if (!this.noRender) { + this.windowSurface.close(); + RenderSystem.shutdownRenderer(); ++ net.minecraftforge.fml.config.ConfigTracker.forceUnload(); + } catch (Throwable t) { + LOGGER.error("Shutdown failure!", t); + throw t; +@@ -1301,7 +_,9 @@ + profiler.popPush("gpuAsync"); + RenderSystem.executePendingTasks(); + profiler.pop(); + net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker); - this.gameRenderer.render(this.deltaTracker, p_91384_); + this.gameRenderer.render(this.deltaTracker, advanceGameTime); + net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker); } - profilerfiller.popPush("blit"); -@@ -1401,10 +_,12 @@ - this.window.setGuiScale(i); - if (this.screen != null) { - this.screen.resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); -+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); + profiler.push("present"); +@@ -1425,6 +_,7 @@ + this.window.setGuiScale(guiScale); + if (this.gui.screen() != null) { + this.gui.screen().resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); ++ this.gui.resizeLayers(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); } - RenderTarget rendertarget = this.getMainRenderTarget(); - rendertarget.resize(this.window.getWidth(), this.window.getHeight()); -+ if (this.gameRenderer != null) - this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight()); this.mouseHandler.setIgnoreFirstMove(); - } -@@ -1542,6 +_,7 @@ +@@ -1576,6 +_,7 @@ } public void stop() { @@ -186,169 +144,168 @@ this.running = false; } -@@ -1571,10 +_,18 @@ - if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) { - BlockHitResult blockhitresult = (BlockHitResult)this.hitResult; - BlockPos blockpos = blockhitresult.getBlockPos(); -- if (!this.level.getBlockState(blockpos).isAir()) { -+ if (!this.level.isEmptyBlock(blockpos)) { +@@ -1599,10 +_,18 @@ + if (down && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) { + BlockHitResult blockHit = (BlockHitResult)this.hitResult; + BlockPos pos = blockHit.getBlockPos(); +- if (!this.level.getBlockState(pos).isAir()) { ++ if (!this.level.isEmptyBlock(pos)) { + var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND); + if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) { + if (inputEvent.shouldSwingHand()) { -+ this.level.addBreakingBlockEffect(blockpos, blockhitresult); ++ this.level.addBreakingBlockEffect(pos, blockHit); + this.player.swing(InteractionHand.MAIN_HAND); + } + return; + } - Direction direction = blockhitresult.getDirection(); -- if (this.gameMode.continueDestroyBlock(blockpos, direction)) { -- this.level.addBreakingBlockEffect(blockpos, direction); -+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) { -+ this.level.addBreakingBlockEffect(blockpos, blockhitresult); + Direction direction = blockHit.getDirection(); +- if (this.gameMode.continueDestroyBlock(pos, direction)) { +- this.level.addBreakingBlockEffect(pos, direction); ++ if (this.gameMode.continueDestroyBlock(pos, direction) && inputEvent.shouldSwingHand()) { ++ this.level.addBreakingBlockEffect(pos, blockHit); this.player.swing(InteractionHand.MAIN_HAND); } } -@@ -1611,6 +_,8 @@ - this.player.swing(InteractionHand.MAIN_HAND); +@@ -1656,6 +_,8 @@ return true; - } else { -+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND); -+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) - switch (this.hitResult.getType()) { - case ENTITY: - AttackRange attackrange = itemstack.get(DataComponents.ATTACK_RANGE); -@@ -1621,7 +_,7 @@ - case BLOCK: - BlockHitResult blockhitresult = (BlockHitResult)this.hitResult; - BlockPos blockpos = blockhitresult.getBlockPos(); -- if (!this.level.getBlockState(blockpos).isAir()) { -+ if (!this.level.isEmptyBlock(blockpos)) { - this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection()); - if (this.level.getBlockState(blockpos).isAir()) { - flag = true; -@@ -1634,9 +_,10 @@ - } - - this.player.resetAttackStrengthTicker(); -+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player); - } - -- if (!this.player.isSpectator()) { -+ if (!this.player.isSpectator() && inputEvent.shouldSwingHand()) { - this.player.swing(InteractionHand.MAIN_HAND); - } - -@@ -1655,6 +_,12 @@ } - for (InteractionHand interactionhand : InteractionHand.values()) { -+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(1, this.options.keyUse, interactionhand); ++ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND); ++ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) + switch (this.hitResult.getType()) { + case ENTITY: + AttackRange customItemRange = heldItem.get(DataComponents.ATTACK_RANGE); +@@ -1666,7 +_,7 @@ + case BLOCK: + BlockHitResult blockHit = (BlockHitResult)this.hitResult; + BlockPos pos = blockHit.getBlockPos(); +- if (!this.level.getBlockState(pos).isAir()) { ++ if (!this.level.isEmptyBlock(pos)) { + this.gameMode.startDestroyBlock(pos, blockHit.getDirection()); + if (this.level.getBlockState(pos).isAir()) { + endAttack = true; +@@ -1679,8 +_,10 @@ + } + + this.player.resetAttackStrengthTicker(); ++ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player); + } + ++ if (inputEvent.shouldSwingHand()) + this.player.swing(InteractionHand.MAIN_HAND); + return endAttack; + } +@@ -1696,6 +_,12 @@ + } + + for (InteractionHand hand : InteractionHand.values()) { ++ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(1, this.options.keyUse, hand); + if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) { -+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand); ++ if (inputEvent.shouldSwingHand()) this.player.swing(hand); + return; + } + - ItemStack itemstack = this.player.getItemInHand(interactionhand); - if (!itemstack.isItemEnabled(this.level.enabledFeatures())) { + ItemStack heldItem = this.player.getItemInHand(hand); + if (!heldItem.isItemEnabled(this.level.enabledFeatures())) { return; -@@ -1676,7 +_,7 @@ +@@ -1712,7 +_,7 @@ + + if (this.player.isWithinEntityInteractionRange(entity, 0.0) + && this.gameMode.interact(this.player, entity, entityHit, hand) instanceof InteractionResult.Success success) { +- if (success.swingSource() == InteractionResult.SwingSource.CLIENT) { ++ if (success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) { + this.player.swing(hand); } - if (interactionresult instanceof InteractionResult.Success interactionresult$success2) { -- if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT) { -+ if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) { - this.player.swing(interactionhand); - } - -@@ -1689,7 +_,7 @@ - int i = itemstack.getCount(); - InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult); - if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) { -- if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT) { -+ if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) { - this.player.swing(interactionhand); - if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) { - this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand); -@@ -1705,6 +_,9 @@ +@@ -1724,7 +_,7 @@ + int oldCount = heldItem.getCount(); + InteractionResult useResult = this.gameMode.useItemOn(this.player, hand, blockHit); + if (useResult instanceof InteractionResult.Success success) { +- if (success.swingSource() == InteractionResult.SwingSource.CLIENT) { ++ if (success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) { + this.player.swing(hand); + if (!heldItem.isEmpty() && (heldItem.getCount() != oldCount || this.player.hasInfiniteMaterials())) { + this.gameRenderer.itemInHandRenderer.itemUsed(hand); +@@ -1740,6 +_,9 @@ } } -+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS)) -+ net.minecraftforge.event.ForgeEventFactory.onRightClickEmpty(this.player, interactionhand); ++ if (heldItem.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS)) ++ net.minecraftforge.event.ForgeEventFactory.onRightClickEmpty(this.player, hand); + - if (!itemstack.isEmpty() - && this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) { - if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) { -@@ -1734,6 +_,8 @@ + if (!heldItem.isEmpty() && this.gameMode.useItem(this.player, hand) instanceof InteractionResult.Success success) { + if (success.swingSource() == InteractionResult.SwingSource.CLIENT) { + this.player.swing(hand); +@@ -1768,6 +_,8 @@ } - ProfilerFiller profilerfiller = Profiler.get(); + ProfilerFiller profiler = Profiler.get(); + net.minecraftforge.event.ForgeEventFactory.onPreClientTick(); + - profilerfiller.push("gui"); - this.chatListener.tick(); - this.gui.tick(this.pause); -@@ -1815,6 +_,7 @@ + profiler.push("gameMode"); + if (!this.pause && this.level != null) { + this.gameMode.tick(); +@@ -1817,6 +_,7 @@ this.tutorial.tick(); + net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true); try { this.level.tick(() -> true); - } catch (Throwable throwable1) { -@@ -1828,6 +_,7 @@ + } catch (Throwable t) { +@@ -1830,6 +_,7 @@ - throw new ReportedException(crashreport1); + throw new ReportedException(report); } + net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true); } - profilerfiller.popPush("animateTick"); -@@ -1852,6 +_,7 @@ - profilerfiller.popPush("keyboard"); + profiler.popPush("animateTick"); +@@ -1854,6 +_,7 @@ + profiler.popPush("keyboard"); this.keyboardHandler.tick(); - profilerfiller.pop(); + profiler.pop(); + net.minecraftforge.event.ForgeEventFactory.onPostClientTick(); } private boolean isLevelRunningNormally() { -@@ -2070,6 +_,7 @@ +@@ -2059,6 +_,7 @@ } - public void setLevel(ClientLevel p_91157_) { + public void setLevel(final ClientLevel level) { + if (this.level != null) net.minecraftforge.event.ForgeEventFactory.onLevelUnload(this.level); - this.level = p_91157_; - this.updateLevelInEngines(p_91157_); + this.level = level; + this.updateLevelInEngines(level); } -@@ -2131,6 +_,7 @@ - IntegratedServer integratedserver = this.singleplayerServer; +@@ -2120,6 +_,7 @@ + IntegratedServer server = this.singleplayerServer; this.singleplayerServer = null; this.gameRenderer.resetData(); + net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerLogout(this.gameMode, this.player); this.gameMode = null; this.narrator.clear(); - this.clientLevelTeardownInProgress = true; -@@ -2138,6 +_,7 @@ + this.gui.setClientLevelTeardownInProgress(true); +@@ -2127,6 +_,7 @@ try { if (this.level != null) { - this.gui.onDisconnected(); + this.gui.hud.onDisconnected(); + net.minecraftforge.event.ForgeEventFactory.onLevelUnload(this.level); } - if (integratedserver != null) { -@@ -2150,6 +_,7 @@ + this.level = null; +@@ -2141,6 +_,7 @@ } - profilerfiller.pop(); + profiler.pop(); + net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level); } - this.setScreenAndShow(p_457642_); -@@ -2292,6 +_,7 @@ + this.setScreenAndShow(screen); +@@ -2354,6 +_,7 @@ - private void pickBlock() { + private void pickBlockOrEntity() { if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) { + if (net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInputPickBlock(this.options.keyPickItem)) return; - boolean flag = this.hasControlDown(); + boolean includeData = this.hasControlDown(); switch (this.hitResult) { - case BlockHitResult blockhitresult: + case BlockHitResult blockHitResult: diff --git a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch index 115936b269..7be4daacb7 100644 --- a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch @@ -1,68 +1,68 @@ --- a/net/minecraft/client/MouseHandler.java +++ b/net/minecraft/client/MouseHandler.java -@@ -87,6 +_,7 @@ +@@ -77,6 +_,7 @@ this.activeButton = null; } -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(mousebuttoninfo, p_423948_)) return; - if (this.minecraft.getOverlay() == null) { - if (this.minecraft.screen == null) { - if (!this.mouseGrabbed && flag) { -@@ -106,7 +_,7 @@ - && i - this.lastClick.time() < 250L ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(buttonInfo, action)) return; + if (this.minecraft.gui.overlay() == null) { + if (pressed + && this.minecraft.handleGlobalKeyPress(InputConstants.Type.MOUSE.getOrCreate(buttonInfo.button()), buttonInfo.hasControlDownWithQuirk())) { +@@ -101,7 +_,7 @@ + && currentTime - this.lastClick.time() < 250L && this.lastClick.screen() == screen - && this.lastClickButton == mousebuttonevent.button(); -- if (screen.mouseClicked(mousebuttonevent, flag1)) { -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, mousebuttonevent, flag1)) { - this.lastClick = new MouseHandler.LastClick(i, screen); - this.lastClickButton = mousebuttoninfo.button(); + && this.lastClickButton == event.button(); +- if (screen.mouseClicked(event, doubleClick)) { ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, xm, ym, event, doubleClick)) { + this.lastClick = new MouseHandler.LastClick(currentTime, screen); + this.lastClickButton = buttonInfo.button(); return; -@@ -121,7 +_,7 @@ +@@ -116,7 +_,7 @@ } } else { try { -- if (screen.mouseReleased(mousebuttonevent)) { -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, d0, d1, mousebuttonevent)) { +- if (screen.mouseReleased(event)) { ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, xm, ym, event)) { return; } - } catch (Throwable throwable) { -@@ -151,6 +_,7 @@ - KeyMapping.click(inputconstants$key); + } catch (Throwable t) { +@@ -146,6 +_,7 @@ + KeyMapping.click(mouseKey); } } -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(mousebuttoninfo, p_423948_); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(buttonInfo, action); } } -@@ -207,7 +_,9 @@ - if (this.minecraft.screen != null) { - double d3 = this.getScaledXPos(this.minecraft.getWindow()); - double d4 = this.getScaledYPos(this.minecraft.getWindow()); -- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2); -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return; -+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return; -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2); - this.minecraft.screen.afterMouseAction(); +@@ -197,7 +_,9 @@ + if (this.minecraft.gui.screen() != null) { + double xm = this.getScaledXPos(this.minecraft.getWindow()); + double ym = this.getScaledYPos(this.minecraft.getWindow()); +- this.minecraft.gui.screen().mouseScrolled(xm, ym, scaledXOffset, scaledYOffset); ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.gui.screen(), xm, ym, scaledXOffset, scaledYOffset)) return; ++ if (this.minecraft.gui.screen().mouseScrolled(xm, ym, scaledXOffset, scaledYOffset)) return; ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.gui.screen(), xm, ym, scaledXOffset, scaledYOffset); + this.minecraft.gui.screen().afterMouseAction(); } else if (this.minecraft.player != null) { - Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2); -@@ -216,6 +_,7 @@ + Vector2i wheelXY = this.scrollWheelHandler.onMouseScroll(scaledXOffset, scaledYOffset); +@@ -206,6 +_,7 @@ } - int i = vector2i.y == 0 ? -vector2i.x : vector2i.y; -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return; + int wheel = wheelXY.y == 0 ? -wheelXY.x : wheelXY.y; ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, scaledXOffset, scaledYOffset)) return; if (this.minecraft.player.isSpectator()) { - if (this.minecraft.gui.getSpectatorGui().isMenuActive()) { - this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i); -@@ -324,7 +_,7 @@ - double d5 = getScaledYPos(window, this.accumulatedDY); + if (this.minecraft.gui.hud.getSpectatorGui().isMenuActive()) { + this.minecraft.gui.hud.getSpectatorGui().onMouseScrolled(-wheel); +@@ -312,7 +_,7 @@ + double dy = getScaledYPos(window, this.accumulatedDY); try { -- screen.mouseDragged(new MouseButtonEvent(d2, d3, this.activeButton), d4, d5); -+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(d2, d3, this.activeButton), d4, d5); - } catch (Throwable throwable) { - CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler"); - screen.fillCrashDetails(crashreport1); -@@ -411,6 +_,14 @@ +- screen.mouseDragged(new MouseButtonEvent(xm, ym, this.activeButton), dx, dy); ++ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(xm, ym, this.activeButton), dx, dy); + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "mouseDragged event handler"); + screen.fillCrashDetails(report); +@@ -397,6 +_,14 @@ public double ypos() { return this.ypos; diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index 84379c7f31..165bac1558 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -1,62 +1,52 @@ --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java -@@ -816,7 +_,8 @@ - }, - new OptionInstance.LazyEnum<>( - () -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(), -- p_232011_ -> Minecraft.getInstance().isRunning() && p_232011_ != "" && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) -+ // FORGE: fix incorrect string comparison - PR #8767 -+ p_232011_ -> Minecraft.getInstance().isRunning() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) - ? Optional.empty() - : Optional.of(p_232011_), - Codec.STRING -@@ -848,6 +_,7 @@ +@@ -986,6 +_,7 @@ ); public boolean syncWrites; public boolean startedCleanly = true; + private final Map unknownKeys = new java.util.HashMap<>(); - private static void operateOnLevelRenderer(Consumer p_457625_) { - LevelRenderer levelrenderer = Minecraft.getInstance().levelRenderer; -@@ -1313,6 +_,7 @@ + public static boolean isSoundDeviceDefault(final String deviceName) { + return deviceName.equals(""); +@@ -1474,6 +_,7 @@ } - public Options(Minecraft p_92138_, File p_92139_) { + public Options(final Minecraft minecraft, final File workingDirectory) { + setForgeKeybindProperties(); - this.minecraft = p_92138_; - this.optionsFile = new File(p_92139_, "options.txt"); - boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L; -@@ -1463,15 +_,28 @@ - this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly); - p_168428_.process("musicToast", this.musicToast); - p_168428_.process("musicFrequency", this.musicFrequency); -+ processOptionsKeysOnly(p_168428_); -+ processOptionsEnd(p_168428_); + this.minecraft = minecraft; + this.optionsFile = new File(workingDirectory, "options.txt"); + boolean largeDistances = Runtime.getRuntime().maxMemory() >= 1000000000L; +@@ -1624,15 +_,28 @@ + this.startedCleanly = access.process("startedCleanly", this.startedCleanly); + access.process("musicToast", this.musicToast); + access.process("musicFrequency", this.musicFrequency); ++ processOptionsKeysOnly(access); ++ processOptionsEnd(access); + } + // FORGE: split off to allow reloading keys after mod loading is done -+ private void processOptionsKeysOnly(Options.FieldAccess p_168428_) { - for (KeyMapping keymapping : this.keyMappings) { -- String s = keymapping.saveString(); -+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : ""); - String s1 = p_168428_.process("key_" + keymapping.getName(), s); - if (!s.equals(s1)) { - keymapping.setKey(InputConstants.getKey(s1)); -+ if (s1.indexOf(':') != -1) { -+ String[] pts = s1.split(":"); -+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0])); ++ private void processOptionsKeysOnly(Options.FieldAccess access) { + for (KeyMapping keyMapping : this.keyMappings) { +- String currentValue = keyMapping.saveString(); ++ String currentValue = keyMapping.saveString() + (keyMapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keyMapping.getKeyModifier() : ""); + String newValue = access.process("key_" + keyMapping.getName(), currentValue); + if (!currentValue.equals(newValue)) { + keyMapping.setKey(InputConstants.getKey(newValue)); ++ if (newValue.indexOf(':') != -1) { ++ String[] pts = newValue.split(":"); ++ keyMapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0])); + } else { -+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(s1)); ++ keyMapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(newValue)); + } } } + } -+ private void processOptionsEnd(Options.FieldAccess p_168428_) { - for (SoundSource soundsource : SoundSource.values()) { - p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource)); ++ private void processOptionsEnd(Options.FieldAccess access) { + for (SoundSource source : SoundSource.values()) { + access.process("soundCategory_" + source.getName(), this.soundSourceVolumes.get(source)); } -@@ -1486,6 +_,10 @@ +@@ -1647,6 +_,10 @@ } public void load() { @@ -67,60 +57,60 @@ try { if (!this.optionsFile.exists()) { return; -@@ -1505,7 +_,8 @@ +@@ -1666,7 +_,8 @@ } - final CompoundTag compoundtag1 = this.dataFix(compoundtag); + final CompoundTag options = this.dataFix(rawOptions); - this.processOptions( + java.util.function.Consumer processor = limited ? this::processOptionsKeysOnly : this::processOptions; + processor.accept( new Options.FieldAccess() { - private @Nullable String getValue(String p_394210_) { - Tag tag = compoundtag1.get(p_394210_); -@@ -1585,6 +_,17 @@ + private @Nullable String getValue(final String name) { + Tag tag = options.get(name); +@@ -1748,6 +_,17 @@ ); - compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_); + options.getString("fullscreenResolution").ifPresent(fullscreenResolution -> this.fullscreenVideoModeString = fullscreenResolution); KeyMapping.resetMapping(); + + if (limited) { + this.unknownKeys.clear(); + } else { + var knownKeys = Arrays.stream(this.keyMappings).map(k -> "key_" + k.getName()).collect(Collectors.toSet()); -+ for (var entry : compoundtag1.entrySet()) { ++ for (var entry : options.entrySet()) { + if (entry.getKey().startsWith("key_") && entry.getValue().asString().isPresent() && !knownKeys.contains(entry.getKey())) + this.unknownKeys.put(entry.getKey(), entry.getValue().asString().get()); + } + } + - } catch (Exception exception) { - LOGGER.error("Failed to load options", (Throwable)exception); + } catch (Exception e) { + LOGGER.error("Failed to load options", e); } -@@ -1612,9 +_,11 @@ +@@ -1778,9 +_,11 @@ public void save() { - try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) { - printwriter.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version()); + try (final PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) { + writer.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version()); + var seen = new java.util.HashSet(); this.processOptions( new Options.FieldAccess() { - public void writePrefix(String p_168491_) { -+ seen.add(p_168491_); - printwriter.print(p_168491_); - printwriter.print(':'); + public void writePrefix(final String name) { ++ seen.add(name); + writer.print(name); + writer.print(':'); } -@@ -1670,6 +_,12 @@ - if (s != null) { - printwriter.println("fullscreenResolution:" + s); +@@ -1836,6 +_,12 @@ + if (fullscreenVideoModeString != null) { + writer.println("fullscreenResolution:" + fullscreenVideoModeString); } + // Forge add any unknown keys so that Mods can add keybindings between vanilla loading/saving its config. + for (var entry : this.unknownKeys.entrySet()) { + if (!seen.contains(entry.getKey())) -+ printwriter.println(entry.getKey() + ":" + entry.getValue()); ++ writer.println(entry.getKey() + ":" + entry.getValue()); + } + - } catch (Exception exception) { - LOGGER.error("Failed to save options", (Throwable)exception); + } catch (Exception e) { + LOGGER.error("Failed to save options", e); } -@@ -1707,6 +_,7 @@ +@@ -1873,6 +_,7 @@ } public void broadcastOptions() { @@ -128,10 +118,10 @@ if (this.minecraft.player != null) { this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation()); } -@@ -1820,6 +_,23 @@ +@@ -1986,6 +_,23 @@ - public static Component genericValueLabel(Component p_231901_, int p_231902_) { - return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_))); + public static Component genericValueLabel(final Component caption, final int value) { + return genericValueLabel(caption, Component.literal(Integer.toString(value))); + } + + private void setForgeKeybindProperties() { @@ -151,4 +141,4 @@ + keySmoothCamera.setKeyConflictContext(inGame); } - public static Component genericValueOrOffLabel(Component p_345288_, int p_344826_) { + public static Component genericValueOrOffLabel(final Component caption, final int value) { diff --git a/patches/minecraft/net/minecraft/client/Screenshot.java.patch b/patches/minecraft/net/minecraft/client/Screenshot.java.patch index 00d0e36e11..b5df8b3e6a 100644 --- a/patches/minecraft/net/minecraft/client/Screenshot.java.patch +++ b/patches/minecraft/net/minecraft/client/Screenshot.java.patch @@ -1,32 +1,30 @@ --- a/net/minecraft/client/Screenshot.java +++ b/net/minecraft/client/Screenshot.java -@@ -43,6 +_,13 @@ - file2 = new File(file1, p_92297_); +@@ -53,14 +_,24 @@ + file = new File(picDir, forceName); } -+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_447863_, file2); ++ var event = new net.minecraftforge.client.event.ScreenshotEvent(image, file); + if (net.minecraftforge.client.event.ScreenshotEvent.BUS.post(event)) { -+ p_92301_.accept(event.getCancelMessage()); ++ callback.accept(event.getCancelMessage()); + return; + } -+ final File target = event.getScreenshotFile(); ++ final File outputFile = event.getScreenshotFile(); + Util.ioPool() .execute( () -> { -@@ -50,10 +_,13 @@ - NativeImage $$4x = p_447863_; - - try { -- p_447863_.writeToFile(file2); -- Component component = Component.literal(file2.getName()) -+ p_447863_.writeToFile(target); -+ Component component = Component.literal(target.getName()) - .withStyle(ChatFormatting.UNDERLINE) - .withStyle(p_389149_ -> p_389149_.withClickEvent(new ClickEvent.OpenFile(file2.getAbsoluteFile()))); -+ if (event.getResultMessage() != null) -+ p_92301_.accept(event.getResultMessage()); -+ else - p_92301_.accept(Component.translatable("screenshot.success", component)); - } catch (Throwable throwable1) { - if (p_447863_ != null) { + try (image) { +- image.writeToFile(file); +- Component component = Component.literal(file.getName()) ++ image.writeToFile(outputFile); ++ Component component = Component.literal(outputFile.getName()) + .withStyle(ChatFormatting.UNDERLINE) +- .withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(file.getAbsoluteFile()))); ++ .withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(outputFile.getAbsoluteFile()))); ++ if (event.getResultMessage() != null) ++ callback.accept(event.getResultMessage()); ++ else + callback.accept(Component.translatable("screenshot.success", component)); + } catch (Exception e) { + LOGGER.warn("Couldn't save screenshot", e); diff --git a/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch b/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch index 698cb7c847..93c77d9a18 100644 --- a/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch @@ -1,21 +1,22 @@ --- a/net/minecraft/client/ToggleKeyMapping.java +++ b/net/minecraft/client/ToggleKeyMapping.java -@@ -31,7 +_,7 @@ +@@ -38,7 +_,7 @@ @Override - public void setDown(boolean p_92534_) { + public void setDown(final boolean down) { if (this.needsToggle.getAsBoolean()) { -- if (p_92534_) { -+ if (p_92534_ && isConflictContextAndModifierActive()) { +- if (down) { ++ if (down && isConflictContextAndModifierActive()) { super.setDown(!this.isDown()); } } else { -@@ -56,5 +_,9 @@ +@@ -66,5 +_,10 @@ protected void reset() { super.setDown(false); + } + -+ @Override public boolean isDown() { ++ @Override ++ public boolean isDown() { + return this.isDown && (isConflictContextAndModifierActive() || needsToggle.getAsBoolean()); } } diff --git a/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch b/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch index 66cbe4f364..7f5ef9ee48 100644 --- a/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch @@ -1,44 +1,19 @@ --- a/net/minecraft/client/color/block/BlockColors.java +++ b/net/minecraft/client/color/block/BlockColors.java -@@ -30,7 +_,8 @@ - private static final int DEFAULT = -1; - public static final int LILY_PAD_IN_WORLD = -14647248; - public static final int LILY_PAD_DEFAULT = -9321636; -- private final IdMapper blockColors = new IdMapper<>(32); -+ // Forge: Use registry delegate as non-Vanilla block ids are not constant -+ private final java.util.Map, BlockColor> blockColors = new java.util.HashMap<>(32); - private final Map>> coloringStates = Maps.newHashMap(); - - public static BlockColors createDefault() { -@@ -95,11 +_,12 @@ - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockcolors.addColoringState(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? -14647248 : -9321636, Blocks.LILY_PAD); -+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors); - return blockcolors; +@@ -45,6 +_,7 @@ + colors.register(List.of(BlockTintSources.constant(-2046180)), Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); + colors.register(List.of(BlockTintSources.stem()), Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); + colors.register(List.of(BlockTintSources.constant(-9321636, -14647248)), Blocks.LILY_PAD); ++ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(colors); + return colors; } - public int getColor(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) { -- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92583_.getBlock())); -+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.getBlock())); - if (blockcolor != null) { - return blockcolor.getColor(p_92583_, null, null, 0); - } else { -@@ -109,13 +_,15 @@ - } - - public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) { -- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92578_.getBlock())); -+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.getBlock())); - return blockcolor == null ? -1 : blockcolor.getColor(p_92578_, p_92579_, p_92580_, p_92581_); +@@ -57,6 +_,8 @@ + return layer >= layers.size() ? null : layers.get(layer); } + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */ + @Deprecated - public void register(BlockColor p_92590_, Block... p_92591_) { - for (Block block : p_92591_) { -- this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block)); -+ this.blockColors.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_); - } - } - + public void register(final List layers, final Block... blocks) { + for (Block block : blocks) { + this.sources.put(block, layers); diff --git a/patches/minecraft/net/minecraft/client/data/Main.java.patch b/patches/minecraft/net/minecraft/client/data/Main.java.patch index bcf0229d80..e270fa81b4 100644 --- a/patches/minecraft/net/minecraft/client/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/client/data/Main.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/data/Main.java +++ b/net/minecraft/client/data/Main.java -@@ -30,13 +_,18 @@ - OptionSpec optionspec1 = optionparser.accepts("client", "Include client generators"); - OptionSpec optionspec2 = optionparser.accepts("all", "Include all generators"); - OptionSpec optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); -+ OptionSpec inputSpec = optionparser.accepts("input", "Input folder").withRequiredArg(); -+ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(optionparser, true); - OptionSet optionset = optionparser.parse(p_375526_); -- if (!optionset.has(optionspec) && optionset.hasOptions()) { -+ if (!optionset.has(optionspec) && optionset.hasOptions() && loader.hasArgs(optionset)) { -+ var input = optionset.valuesOf(inputSpec).stream().map(Paths::get).toList(); - Path path = Paths.get(optionspec3.value(optionset)); - boolean flag = optionset.has(optionspec2); - boolean flag1 = flag || optionset.has(optionspec1); +@@ -28,13 +_,18 @@ + OptionSpec clientOption = parser.accepts("client", "Include client generators"); + OptionSpec allOption = parser.accepts("all", "Include all generators"); + OptionSpec outputOption = parser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); ++ OptionSpec inputSpec = parser.accepts("input", "Input folder").withRequiredArg(); ++ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(parser, true); + OptionSet optionSet = parser.parse(args); +- if (!optionSet.has(helpOption) && optionSet.hasOptions()) { ++ if (!optionSet.has(helpOption) && optionSet.hasOptions() && loader.hasArgs(optionSet)) { ++ var input = optionSet.valuesOf(inputSpec).stream().map(Paths::get).toList(); + Path output = Paths.get(outputOption.value(optionSet)); + boolean allOptions = optionSet.has(allOption); + boolean client = allOptions || optionSet.has(clientOption); Bootstrap.bootStrap(); ClientBootstrap.bootstrap(); -+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, true)) ++ if (!loader.run(optionSet, output, input, allOptions, client, allOptions, allOptions)) + return; - DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true); - addClientProviders(datagenerator, flag1); - datagenerator.run(); + DataGenerator generator = new DataGenerator.Cached(output, SharedConstants.getCurrentVersion(), true); + addClientProviders(generator, client); + generator.run(); diff --git a/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch b/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch index 0e51e543ac..bc85a58c04 100644 --- a/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch +++ b/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/data/models/ItemModelGenerators.java +++ b/net/minecraft/client/data/models/ItemModelGenerators.java -@@ -912,6 +_,9 @@ +@@ -868,6 +_,9 @@ this.declareCustomModelItem(Items.COD); this.declareCustomModelItem(Items.FEATHER); this.declareCustomModelItem(Items.LEAD); diff --git a/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch b/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch index 10244c1a92..ddd4b0600a 100644 --- a/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch +++ b/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/client/data/models/ModelProvider.java +++ b/net/minecraft/client/data/models/ModelProvider.java -@@ -45,11 +_,11 @@ +@@ -43,11 +_,11 @@ @Override - public CompletableFuture run(CachedOutput p_376268_) { -- ModelProvider.ItemInfoCollector modelprovider$iteminfocollector = new ModelProvider.ItemInfoCollector(); -- ModelProvider.BlockStateGeneratorCollector modelprovider$blockstategeneratorcollector = new ModelProvider.BlockStateGeneratorCollector(); -+ ModelProvider.ItemInfoCollector modelprovider$iteminfocollector = new ModelProvider.ItemInfoCollector(this::getKnownItems); -+ ModelProvider.BlockStateGeneratorCollector modelprovider$blockstategeneratorcollector = new ModelProvider.BlockStateGeneratorCollector(this::getKnownBlocks); - ModelProvider.SimpleModelCollector modelprovider$simplemodelcollector = new ModelProvider.SimpleModelCollector(); -- new BlockModelGenerators(modelprovider$blockstategeneratorcollector, modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run(); -- new ItemModelGenerators(modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run(); -+ getBlockModelGenerators(modelprovider$blockstategeneratorcollector, modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run(); -+ getItemModelGenerators(modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run(); - modelprovider$blockstategeneratorcollector.validate(); - modelprovider$iteminfocollector.finalizeAndValidate(); + public CompletableFuture run(final CachedOutput cache) { +- ModelProvider.ItemInfoCollector itemModels = new ModelProvider.ItemInfoCollector(); +- ModelProvider.BlockStateGeneratorCollector blockStateGenerators = new ModelProvider.BlockStateGeneratorCollector(); ++ ModelProvider.ItemInfoCollector itemModels = new ModelProvider.ItemInfoCollector(this::getKnownItems); ++ ModelProvider.BlockStateGeneratorCollector blockStateGenerators = new ModelProvider.BlockStateGeneratorCollector(this::getKnownBlocks); + ModelProvider.SimpleModelCollector simpleModels = new ModelProvider.SimpleModelCollector(); +- new BlockModelGenerators(blockStateGenerators, itemModels, simpleModels).run(); +- new ItemModelGenerators(itemModels, simpleModels).run(); ++ getBlockModelGenerators(blockStateGenerators, itemModels, simpleModels).run(); ++ getItemModelGenerators(itemModels, simpleModels).run(); + blockStateGenerators.validate(); + itemModels.finalizeAndValidate(); return CompletableFuture.allOf( -@@ -59,6 +_,22 @@ +@@ -57,6 +_,22 @@ ); } -+ protected Stream getKnownBlocks() { ++ protected java.util.stream.Stream getKnownBlocks() { + return BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace())); + } + -+ protected Stream getKnownItems() { ++ protected java.util.stream.Stream getKnownItems() { + return BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace())); + } + @@ -39,73 +39,74 @@ @Override public final String getName() { return "Model Definitions"; -@@ -67,6 +_,15 @@ +@@ -65,6 +_,15 @@ @OnlyIn(Dist.CLIENT) public static class BlockStateGeneratorCollector implements Consumer { private final Map generators = new HashMap<>(); -+ private final Supplier> known; ++ private final Supplier> known; + + public BlockStateGeneratorCollector() { + this(() -> BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace()))); + } + -+ public BlockStateGeneratorCollector(Supplier> known) { ++ public BlockStateGeneratorCollector(Supplier> known) { + this.known = known; + } - public void accept(BlockModelDefinitionGenerator p_393399_) { - Block block = p_393399_.block(); -@@ -77,7 +_,7 @@ + public void accept(final BlockModelDefinitionGenerator generator) { + Block block = generator.block(); +@@ -75,8 +_,7 @@ } public void validate() { -- Stream> stream = BuiltInRegistries.BLOCK.listElements().filter(p_376480_ -> true); -+ Stream> stream = known.get().map(Block::builtInRegistryHolder); - List list = stream.filter(p_378423_ -> !this.generators.containsKey(p_378423_.value())) - .map(p_447940_ -> p_447940_.key().identifier()) +- List missingDefinitions = BuiltInRegistries.BLOCK +- .listElements() ++ List missingDefinitions = known.get().map(Block::builtInRegistryHolder) + .filter(e -> !this.generators.containsKey(e.value())) + .map(e -> e.key().identifier()) .toList(); -@@ -97,6 +_,15 @@ +@@ -96,6 +_,15 @@ public static class ItemInfoCollector implements ItemModelOutput { private final Map itemInfos = new HashMap<>(); private final Map copies = new HashMap<>(); -+ private final Supplier> known; ++ private final Supplier> known; + + public ItemInfoCollector() { + this(() -> BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace()))); + } + -+ public ItemInfoCollector(Supplier> known) { ++ public ItemInfoCollector(Supplier> known) { + this.known = known; + } @Override - public void accept(Item p_376450_, ItemModel.Unbaked p_378513_, ClientItem.Properties p_455809_) { -@@ -115,7 +_,7 @@ - this.copies.put(p_376965_, p_377438_); + public void accept(final Item item, final ItemModel.Unbaked model, final ClientItem.Properties properties) { +@@ -114,7 +_,7 @@ + this.copies.put(acceptor, donor); } - public void finalizeAndValidate() { + public void generateDefaultBlockModels() { - BuiltInRegistries.ITEM.forEach(p_447944_ -> { - if (!this.copies.containsKey(p_447944_)) { - if (p_447944_ instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) { -@@ -124,6 +_,8 @@ + BuiltInRegistries.ITEM.forEach(item -> { + if (!this.copies.containsKey(item)) { + if (item instanceof BlockItem blockItem && !this.itemInfos.containsKey(blockItem)) { +@@ -123,6 +_,8 @@ } } }); + } + public void finalizeAndValidate() { - this.copies.forEach((p_376289_, p_375718_) -> { - ClientItem clientitem = this.itemInfos.get(p_375718_); - if (clientitem == null) { -@@ -132,8 +_,8 @@ - this.register(p_376289_, clientitem); - } + this.copies.forEach((acceptor, donor) -> { + ClientItem donorInfo = this.itemInfos.get(donor); + if (donorInfo == null) { +@@ -131,8 +_,8 @@ + + this.register(acceptor, donorInfo); }); -- List list = BuiltInRegistries.ITEM +- List missingDefinitions = BuiltInRegistries.ITEM - .listElements() -+ List list = known.get() ++ List missingDefinitions = known.get() + .map(item -> item.builtInRegistryHolder()) - .filter(p_377225_ -> !this.itemInfos.containsKey(p_377225_.value())) - .map(p_447943_ -> p_447943_.key().identifier()) + .filter(e -> !this.itemInfos.containsKey(e.value())) + .map(e -> e.key().identifier()) .toList(); diff --git a/patches/minecraft/net/minecraft/client/gui/Font.java.patch b/patches/minecraft/net/minecraft/client/gui/Font.java.patch index b1f7cfe172..1749a11c05 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 -@@ -32,7 +_,7 @@ +@@ -28,7 +_,7 @@ import org.jspecify.annotations.Nullable; @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch index 2e4041d577..8aeebcebc3 100644 --- a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch @@ -1,101 +1,75 @@ --- a/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java -@@ -151,7 +_,7 @@ - public float vignetteBrightness = 1.0F; - private int toolHighlightTimer; - private ItemStack lastToolHighlight = ItemStack.EMPTY; -- private final DebugScreenOverlay debugOverlay; -+ protected DebugScreenOverlay debugOverlay; - private final SubtitleOverlay subtitleOverlay; - private final SpectatorGui spectatorGui; - private final PlayerTabOverlay tabList; -@@ -193,6 +_,7 @@ - () -> new JumpableVehicleBarRenderer(p_330021_) - ); - this.resetTitleTimes(); -+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.init(this, p_330021_); - } +@@ -64,7 +_,7 @@ + import org.slf4j.Logger; - public void resetTitleTimes() { -@@ -203,6 +_,10 @@ + @OnlyIn(Dist.CLIENT) +-public class Gui { ++public class Gui extends net.minecraftforge.client.gui.overlay.ForgeLayerInstance { + private static final Logger LOGGER = LogUtils.getLogger(); + private static final Component SOCIAL_INTERACTIONS_NOT_AVAILABLE = Component.translatable("multiplayer.socialInteractions.not_available"); + public static final Component SAVING_LEVEL = Component.translatable("menu.savingLevel"); +@@ -80,6 +_,7 @@ + private @Nullable TutorialToast socialInteractionsToast; - public void render(GuiGraphics p_282884_, DeltaTracker p_342095_) { - if (!(this.minecraft.screen instanceof LevelLoadingScreen)) { -+ if (Boolean.valueOf(true)) { -+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.beginRender(p_282884_, p_342095_); -+ return; -+ } - if (!this.minecraft.options.hideGui) { - this.renderCameraOverlays(p_282884_, p_342095_); - this.renderCrosshair(p_282884_, p_342095_); -@@ -386,7 +_,7 @@ - int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window)); - int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window)); - p_329202_.nextStratum(); -- this.chat.render(p_329202_, this.getFont(), this.tickCount, i, j, false, false); -+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount, this.getFont()); + public Gui(final Minecraft minecraft, final Hud hud, final GuiRenderState guiRenderState) { ++ super(minecraft); + this.minecraft = minecraft; + this.hud = hud; + this.splashManager = new SplashManager(minecraft.getUser()); +@@ -175,7 +_,7 @@ + profiler.push("screen"); + + try { +- this.screen.extractRenderStateWithTooltipAndSubtitles(graphics, xMouse, yMouse, deltaTracker.getGameTimeDeltaTicks()); ++ drawScreen(graphics, xMouse, yMouse, deltaTracker.getRealtimeDeltaTicks()); + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "Rendering screen"); + CrashReportCategory category = report.addCategory("Screen render details"); +@@ -224,12 +_,6 @@ + LOGGER.error("setScreen called from non-game thread"); } - } -@@ -476,6 +_,8 @@ - - for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { - Holder holder = mobeffectinstance.getEffect(); -+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); -+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue; - if (mobeffectinstance.showIcon()) { - int k = p_282812_.guiWidth(); - int l = 1; -@@ -506,6 +_,7 @@ - } - } - -+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, k, l, 0, f)) continue; - p_282812_.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(holder), k + 3, l + 3, 18, 18, ARGB.white(f)); - } +- if (this.screen != null) { +- this.screen.removed(); +- } else { +- this.minecraft.setLastInputType(InputType.NONE); +- } +- + if (screen == null) { + if (this.clientLevelTeardownInProgress) { + throw new IllegalStateException("Trying to return to in-game GUI during disconnection"); +@@ -248,6 +_,22 @@ } -@@ -602,6 +_,10 @@ - } + } - public void renderSelectedItemName(GuiGraphics p_283501_) { -+ renderSelectedItemName(p_283501_, 0); ++ clearLayers(); ++ Screen old = this.screen; ++ if (screen != null) { ++ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, screen); ++ if (event == null) return; ++ screen = event; ++ } ++ ++ if (screen != old) { ++ if (old != null) { ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old); ++ old.removed(); ++ } else { ++ this.minecraft.setLastInputType(InputType.NONE); ++ } ++ } + this.screen = screen; + if (this.screen != null) { + this.screen.added(); +@@ -465,5 +_,10 @@ + } + ) + ); + } + -+ public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) { - Profiler.get().push("selectedItemName"); - if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) { - MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color()); -@@ -609,9 +_,13 @@ - mutablecomponent.withStyle(ChatFormatting.ITALIC); - } - -- int i = this.getFont().width(mutablecomponent); -+ Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent); -+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME); -+ if (font == null) -+ font = this.getFont(); -+ int i = font.width(highlightTip); - int j = (p_283501_.guiWidth() - i) / 2; -- int k = p_283501_.guiHeight() - 59; -+ int k = p_283501_.guiHeight() - Math.max(yShift, 59); - if (!this.minecraft.gameMode.canHurtPlayer()) { - k += 14; - } -@@ -622,7 +_,7 @@ - } - - if (l > 0) { -- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.white(l)); -+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, ARGB.white(l)); - } - } - -@@ -1148,7 +_,7 @@ - ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem(); - if (itemstack.isEmpty()) { - this.toolHighlightTimer = 0; -- } else if (this.lastToolHighlight.isEmpty() || !itemstack.is(this.lastToolHighlight.getItem()) || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) { -+ } else if (this.lastToolHighlight.isEmpty() || !itemstack.is(this.lastToolHighlight.getItem()) || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) || !itemstack.getHighlightTip(itemstack.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName()))) { - this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get()); - } else if (this.toolHighlightTimer > 0) { - this.toolHighlightTimer--; ++ @Override ++ protected void setScreenInternal(Screen value) { ++ this.screen = value; + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch deleted file mode 100644 index 7a27b0d1fa..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch +++ /dev/null @@ -1,164 +0,0 @@ ---- a/net/minecraft/client/gui/GuiGraphics.java -+++ b/net/minecraft/client/gui/GuiGraphics.java -@@ -86,7 +_,7 @@ - import org.jspecify.annotations.Nullable; - - @OnlyIn(Dist.CLIENT) --public class GuiGraphics { -+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics { - private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2; - final Minecraft minecraft; - private final Matrix3x2fStack pose; -@@ -972,6 +_,7 @@ - CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered"); - crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_283653_.getItem())); -+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_283653_.getItem()))); - crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_283653_.getComponents())); - crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_283653_.hasFoil())); - throw new ReportedException(crashreport); -@@ -990,6 +_,7 @@ - this.renderItemCooldown(p_283349_, p_282641_, p_282146_); - this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_); - this.pose.popMatrix(); -+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_); - } - } - -@@ -1001,21 +_,30 @@ - this.setTooltipForNextFrame(this.minecraft.font, p_407686_, DefaultTooltipPositioner.INSTANCE, p_410475_, p_407139_, false); - } - -+ private ItemStack tooltipStack = ItemStack.EMPTY; -+ - public void setTooltipForNextFrame(Font p_408152_, ItemStack p_410145_, int p_410585_, int p_408354_) { -+ this.tooltipStack = p_410145_; - this.setTooltipForNextFrame( - p_408152_, Screen.getTooltipFromItem(this.minecraft, p_410145_), p_410145_.getTooltipImage(), p_410585_, p_408354_, p_410145_.get(DataComponents.TOOLTIP_STYLE) - ); -+ this.tooltipStack = ItemStack.EMPTY; - } - - public void setTooltipForNextFrame(Font p_407170_, List p_407123_, Optional p_409349_, int p_406573_, int p_409911_) { - this.setTooltipForNextFrame(p_407170_, p_407123_, p_409349_, p_406573_, p_409911_, null); - } - -+ public void setTooltipForNextFrame(Font font, List textComponents, Optional tooltipComponent, ItemStack stack, int mouseX, int mouseY) { -+ this.tooltipStack = stack; -+ this.setTooltipForNextFrame(font, textComponents, tooltipComponent, mouseX, mouseY, stack.get(DataComponents.TOOLTIP_STYLE)); -+ this.tooltipStack = ItemStack.EMPTY; -+ } -+ - public void setTooltipForNextFrame( - Font p_408450_, List p_405939_, Optional p_456997_, int p_409519_, int p_410392_, @Nullable Identifier p_460731_ - ) { -- List list = p_405939_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList()); -- p_456997_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_))); -+ List list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_405939_, p_456997_, p_409519_, guiWidth(), guiHeight(), p_408450_); - this.setTooltipForNextFrameInternal(p_408450_, list, p_409519_, p_410392_, DefaultTooltipPositioner.INSTANCE, p_460731_, false); - } - -@@ -1028,7 +_,22 @@ - } - - public void setComponentTooltipForNextFrame(Font p_406239_, List p_410275_, int p_410594_, int p_409343_) { -- this.setComponentTooltipForNextFrame(p_406239_, p_410275_, p_410594_, p_409343_, null); -+ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_410275_, p_410594_, guiWidth(), guiHeight(), p_406239_); -+ this.setTooltipForNextFrameInternal(p_406239_, components, p_410594_, p_409343_, DefaultTooltipPositioner.INSTANCE, null, false); -+ } -+ -+ 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, guiWidth(), guiHeight(), font); -+ this.setTooltipForNextFrameInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null, false); -+ this.tooltipStack = ItemStack.EMPTY; -+ } -+ -+ public void renderComponentTooltipFromElements(Font font, List> elements, int mouseX, int mouseY, ItemStack stack) { -+ this.tooltipStack = stack; -+ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font); -+ this.setTooltipForNextFrameInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null, false); -+ this.tooltipStack = ItemStack.EMPTY; - } - - public void setComponentTooltipForNextFrame(Font p_408650_, List p_407512_, int p_406019_, int p_408123_, @Nullable Identifier p_456486_) { -@@ -1073,24 +_,31 @@ - int p_407794_, - int p_408784_, - ClientTooltipPositioner p_408798_, -- @Nullable Identifier p_451079_, -+ @Nullable Identifier p_456486_, - boolean p_410618_ - ) { - if (!p_409928_.isEmpty()) { - if (this.deferredTooltip == null || p_410618_) { -- this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_451079_); -+ final var stackContext = this.tooltipStack; -+ this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_456486_, stackContext); - } - } -+ } -+ -+ public void renderTooltip(Font p_283128_, List p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_456486_) { -+ renderTooltip(p_283128_, p_282716_, p_283678_, p_281696_, p_409451_, p_456486_, ItemStack.EMPTY); - } - - public void renderTooltip( -- Font p_283128_, List p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_ -+ Font p_283128_, List p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_, ItemStack itemstack - ) { -+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_, p_459396_); -+ if (preEvent == null) return; - int i = 0; - int j = p_282716_.size() == 1 ? -2 : 0; - - for (ClientTooltipComponent clienttooltipcomponent : p_282716_) { -- int k = clienttooltipcomponent.getWidth(p_283128_); -+ int k = clienttooltipcomponent.getWidth(preEvent.getFont()); - if (k > i) { - i = k; - } -@@ -1100,16 +_,16 @@ - - int l1 = i; - int i2 = j; -- Vector2ic vector2ic = p_409451_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283678_, p_281696_, i, j); -+ Vector2ic vector2ic = p_409451_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i, j); - int l = vector2ic.x(); - int i1 = vector2ic.y(); - this.pose.pushMatrix(); -- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_459396_); -+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, preEvent.getBackground()); - int j1 = i1; - - for (int k1 = 0; k1 < p_282716_.size(); k1++) { - ClientTooltipComponent clienttooltipcomponent1 = p_282716_.get(k1); -- clienttooltipcomponent1.renderText(this, p_283128_, l, j1); -+ clienttooltipcomponent1.renderText(this, preEvent.getFont(), l, j1); - j1 += clienttooltipcomponent1.getHeight(p_283128_) + (k1 == 0 ? 2 : 0); - } - -@@ -1117,7 +_,7 @@ - - for (int j2 = 0; j2 < p_282716_.size(); j2++) { - ClientTooltipComponent clienttooltipcomponent2 = p_282716_.get(j2); -- clienttooltipcomponent2.renderImage(p_283128_, l, j1, l1, i2, this); -+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, j1, l1, i2, this); - j1 += clienttooltipcomponent2.getHeight(p_283128_) + (j2 == 0 ? 2 : 0); - } - -@@ -1328,6 +_,14 @@ - - public void submitProfilerChartRenderState(List p_408565_, int p_410147_, int p_406156_, int p_407365_, int p_408180_) { - this.guiRenderState.submitPicturesInPictureState(new GuiProfilerChartRenderState(p_408565_, p_410147_, p_406156_, p_407365_, p_408180_, this.scissorStack.peek())); -+ } -+ -+ public GuiRenderState getRenderState() { -+ return this.guiRenderState; -+ } -+ -+ public GuiGraphics.ScissorStack getScissorStack() { -+ return this.scissorStack; - } - - public TextureAtlasSprite getSprite(Material p_430745_) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch new file mode 100644 index 0000000000..3f0f48e0ba --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch @@ -0,0 +1,174 @@ +--- a/net/minecraft/client/gui/GuiGraphicsExtractor.java ++++ b/net/minecraft/client/gui/GuiGraphicsExtractor.java +@@ -85,7 +_,7 @@ + import org.jspecify.annotations.Nullable; + + @OnlyIn(Dist.CLIENT) +-public class GuiGraphicsExtractor { ++public class GuiGraphicsExtractor implements net.minecraftforge.client.extensions.IForgeGuiGraphicsExtractor { + private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2; + private final Minecraft minecraft; + private final Matrix3x2fStack pose; +@@ -912,6 +_,7 @@ + CrashReport report = CrashReport.forThrowable(t, "Rendering item"); + CrashReportCategory category = report.addCategory("Item being rendered"); + category.setDetail("Item Type", () -> String.valueOf(itemStack.getItem())); ++ category.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem()))); + category.setDetail("Item Components", () -> String.valueOf(itemStack.getComponents())); + category.setDetail("Item Foil", () -> String.valueOf(itemStack.hasFoil())); + throw new ReportedException(report); +@@ -938,6 +_,7 @@ + this.itemCooldown(itemStack, x, y); + this.itemCount(font, itemStack, x, y, countText); + this.pose.popMatrix(); ++ net.minecraftforge.client.ItemDecoratorHandler.of(itemStack).render(this, font, itemStack, x, y); + } + } + +@@ -1106,16 +_,25 @@ + this.setTooltipForNextFrame(this.minecraft.font, formattedCharSequences, DefaultTooltipPositioner.INSTANCE, x, y, false); + } + ++ private ItemStack tooltipStack = ItemStack.EMPTY; + public void setTooltipForNextFrame(final Font font, final ItemStack itemStack, final int xo, final int yo) { ++ this.tooltipStack = itemStack; + this.setTooltipForNextFrame( + font, Screen.getTooltipFromItem(this.minecraft, itemStack), itemStack.getTooltipImage(), xo, yo, itemStack.get(DataComponents.TOOLTIP_STYLE) + ); ++ this.tooltipStack = ItemStack.EMPTY; + } + + public void setTooltipForNextFrame(final Font font, final List texts, final Optional optionalImage, final int xo, final int yo) { + this.setTooltipForNextFrame(font, texts, optionalImage, xo, yo, null); + } + ++ public void setTooltipForNextFrame(Font font, List texts, Optional optionalImage, ItemStack stack, int xo, int yo) { ++ this.tooltipStack = stack; ++ this.setTooltipForNextFrame(font, texts, optionalImage, xo, yo, stack.get(DataComponents.TOOLTIP_STYLE)); ++ this.tooltipStack = ItemStack.EMPTY; ++ } ++ + public void setTooltipForNextFrame( + final Font font, + final List texts, +@@ -1124,11 +_,7 @@ + final int yo, + final @Nullable Identifier style + ) { +- List components = texts.stream() +- .map(Component::getVisualOrderText) +- .map(ClientTooltipComponent::create) +- .collect(Util.toMutableList()); +- optionalImage.ifPresent(image -> components.add(components.isEmpty() ? 0 : 1, ClientTooltipComponent.create(image))); ++ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, texts, optionalImage, xo, guiWidth(), guiHeight(), font); + this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, style, false); + } + +@@ -1156,7 +_,22 @@ + } + + public void setComponentTooltipForNextFrame(final Font font, final List lines, final int xo, final int yo) { +- this.setComponentTooltipForNextFrame(font, lines, xo, yo, null); ++ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, lines, xo, guiWidth(), guiHeight(), font); ++ this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, null, false); ++ } ++ ++ public void renderComponentTooltip(Font font, List lines, int xo, int yo, ItemStack stack) { ++ this.tooltipStack = stack; ++ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, lines, xo, guiWidth(), guiHeight(), font); ++ this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, null, false); ++ this.tooltipStack = ItemStack.EMPTY; ++ } ++ ++ public void renderComponentTooltipFromElements(Font font, List> lines, int xo, int yo, ItemStack stack) { ++ this.tooltipStack = stack; ++ List components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, lines, xo, guiWidth(), guiHeight(), font); ++ this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, null, false); ++ this.tooltipStack = ItemStack.EMPTY; + } + + public void setComponentTooltipForNextFrame(final Font font, final List lines, final int xo, final int yo, final @Nullable Identifier style) { +@@ -1207,10 +_,16 @@ + ) { + if (!lines.isEmpty()) { + if (this.deferredTooltip == null || replaceExisting) { +- this.deferredTooltip = () -> this.tooltip(font, lines, xo, yo, positioner, style); ++ final var stackContext = this.tooltipStack; ++ this.deferredTooltip = () -> this.tooltip(font, lines, xo, yo, positioner, style, stackContext); + } + } + } ++ ++ public void tooltip(Font font, List lines, int xo, int yo, ClientTooltipPositioner positioner, @Nullable Identifier style) { ++ tooltip(font, lines, xo, yo, positioner, style, ItemStack.EMPTY); ++ } ++ + + public void tooltip( + final Font font, +@@ -1218,13 +_,16 @@ + final int xo, + final int yo, + final ClientTooltipPositioner positioner, +- final @Nullable Identifier style ++ final @Nullable Identifier style, ++ ItemStack itemstack + ) { ++ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, xo, yo, guiWidth(), guiHeight(), lines, font, positioner, style); ++ if (preEvent == null) return; + int textWidth = 0; + int tempHeight = lines.size() == 1 ? -2 : 0; + + for (ClientTooltipComponent line : lines) { +- int lineWidth = line.getWidth(font); ++ int lineWidth = line.getWidth(preEvent.getFont()); + if (lineWidth > textWidth) { + textWidth = lineWidth; + } +@@ -1234,25 +_,25 @@ + + int w = textWidth; + int h = tempHeight; +- Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), xo, yo, w, h); ++ Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), w, h); + int x = positionedTooltip.x(); + int y = positionedTooltip.y(); + this.pose.pushMatrix(); +- TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, style); ++ TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, preEvent.getBackground()); + int localY = y; + + for (int i = 0; i < lines.size(); i++) { + ClientTooltipComponent line = lines.get(i); +- line.extractText(this, font, x, localY); +- localY += line.getHeight(font) + (i == 0 ? 2 : 0); ++ line.extractText(this, preEvent.getFont(), x, localY); ++ localY += line.getHeight(preEvent.getFont()) + (i == 0 ? 2 : 0); + } + + localY = y; + + for (int i = 0; i < lines.size(); i++) { + ClientTooltipComponent line = lines.get(i); +- line.extractImage(font, x, localY, w, h, this); +- localY += line.getHeight(font) + (i == 0 ? 2 : 0); ++ line.extractImage(preEvent.getFont(), x, localY, w, h, this); ++ localY += line.getHeight(preEvent.getFont()) + (i == 0 ? 2 : 0); + } + + this.pose.popMatrix(); +@@ -1326,6 +_,14 @@ + + private ActiveTextCollector.Parameters createDefaultTextParameters(final float opacity) { + return new ActiveTextCollector.Parameters(new Matrix3x2f(this.pose), opacity, this.scissorStack.peek()); ++ } ++ ++ public GuiRenderState getRenderState() { ++ return this.guiRenderState; ++ } ++ ++ public GuiGraphicsExtractor.ScissorStack getScissorStack() { ++ return this.scissorStack; + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/gui/Hud.java.patch b/patches/minecraft/net/minecraft/client/gui/Hud.java.patch new file mode 100644 index 0000000000..52f4edb8f3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/Hud.java.patch @@ -0,0 +1,116 @@ +--- a/net/minecraft/client/gui/Hud.java ++++ b/net/minecraft/client/gui/Hud.java +@@ -156,7 +_,7 @@ + public float vignetteBrightness = 1.0F; + private int toolHighlightTimer; + private ItemStack lastToolHighlight = ItemStack.EMPTY; +- private final DebugScreenOverlay debugOverlay; ++ protected DebugScreenOverlay debugOverlay; + private final SubtitleOverlay subtitleOverlay; + private final SpectatorGui spectatorGui; + private final PlayerTabOverlay tabList; +@@ -198,6 +_,7 @@ + () -> new JumpableVehicleBar(minecraft) + ); + this.resetTitleTimes(); ++ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.init(this, minecraft); + } + + public void registerReloadListeners(final ReloadableResourceManager resourceManager) { +@@ -221,6 +_,10 @@ + public void extractRenderState(final GuiGraphicsExtractor graphics, final DeltaTracker deltaTracker) { + this.minecraft.gameRenderer.gameRenderState().guiRenderState.isHudHidden = this.isHidden; + if (!(this.minecraft.gui.screen() instanceof LevelLoadingScreen)) { ++ if (Boolean.valueOf(true)) { ++ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.extractRenderState(graphics, deltaTracker); ++ return; ++ } + if (!this.isHidden) { + this.extractCameraOverlays(graphics, deltaTracker); + this.extractCrosshair(graphics, deltaTracker); +@@ -404,7 +_,7 @@ + int mouseX = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window)); + int mouseY = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window)); + graphics.nextStratum(); +- this.chat.extractRenderState(graphics, this.getFont(), this.tickCount, mouseX, mouseY, ChatComponent.DisplayMode.BACKGROUND, false); ++ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(graphics, this.chat, window, mouseX, mouseY, this.tickCount, this.getFont()); + } + } + +@@ -497,6 +_,8 @@ + + for (MobEffectInstance instance : Ordering.natural().reverse().sortedCopy(activeEffects)) { + Holder effect = instance.getEffect(); ++ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(instance); ++ if (!renderer.isVisibleInGui(instance)) continue; + if (instance.showIcon()) { + int x = graphics.guiWidth(); + int y = 1; +@@ -527,6 +_,7 @@ + } + } + ++ if (renderer.extractGuiIcon(instance, this, graphics, x, y, 0, alpha)) continue; + graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(effect), x + 3, y + 3, 18, 18, ARGB.white(alpha)); + } + } +@@ -629,15 +_,37 @@ + } + + public void extractSelectedItemName(final GuiGraphicsExtractor graphics) { ++ renderSelectedItemName(graphics, 0); ++ } ++ ++ // Forge: Maintain vanilla parity during FLD#BACKGROUND ++ public final void updateContextualInfo(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) { ++ var nextContextualInfo = this.nextContextualInfoState(); ++ if (nextContextualInfo != this.contextualInfoBar.getFirst()) { ++ this.contextualInfoBar = Pair.of(nextContextualInfo, this.contextualInfoBars.get(nextContextualInfo).get()); ++ } ++ ++ this.contextualInfoBar.getSecond().extractBackground(graphics, deltaTracker); ++ } ++ // Forge: Same as above but for FLD#CONTEXTUAL_INFO ++ public final void extractContextualInfoState(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) { ++ this.contextualInfoBar.getSecond().extractRenderState(graphics, deltaTracker); ++ } ++ ++ public void renderSelectedItemName(final GuiGraphicsExtractor graphics, int yShift) { + if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) { + MutableComponent str = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color()); + if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) { + str.withStyle(ChatFormatting.ITALIC); + } + +- int strWidth = this.getFont().width(str); ++ Component highlightTip = this.lastToolHighlight.getHighlightTip(str); ++ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME); ++ if (font == null) ++ font = this.getFont(); ++ int strWidth = font.width(highlightTip); + int x = (graphics.guiWidth() - strWidth) / 2; +- int y = graphics.guiHeight() - 59; ++ int y = graphics.guiHeight() - Math.max(yShift, 59); + if (!this.minecraft.gameMode.canHurtPlayer()) { + y += 14; + } +@@ -648,7 +_,7 @@ + } + + if (alpha > 0) { +- graphics.textWithBackdrop(this.getFont(), str, x, y, strWidth, ARGB.white(alpha)); ++ graphics.textWithBackdrop(font, highlightTip, x, y, strWidth, ARGB.white(alpha)); + } + } + } +@@ -1216,7 +_,9 @@ + this.toolHighlightTimer = 0; + } else if (this.lastToolHighlight.isEmpty() + || !selected.is(this.lastToolHighlight.getItem()) +- || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())) { ++ || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName()) ++ || !selected.getHighlightTip(selected.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName())) ++ ) { + this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get()); + } else if (this.toolHighlightTimer > 0) { + this.toolHighlightTimer--; 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 ec5506bcfb..a836cbc212 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/gui/components/AbstractWidget.java +++ b/net/minecraft/client/gui/components/AbstractWidget.java -@@ -221,6 +_,23 @@ - this.focused = p_93693_; +@@ -225,6 +_,23 @@ + this.focused = focused; } + public static final int UNSET_FG_COLOR = -1; 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 7b7dd0003d..99351df883 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/gui/components/BossHealthOverlay.java +++ b/net/minecraft/client/gui/components/BossHealthOverlay.java -@@ -67,13 +_,16 @@ - - for (LerpingBossEvent lerpingbossevent : this.events.values()) { - int k = i / 2 - 91; -+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight); -+ if (event != null) { - this.drawBar(p_283175_, k, j, lerpingbossevent); - Component component = lerpingbossevent.getName(); - int l = this.minecraft.font.width(component); - int i1 = i / 2 - l / 2; - int j1 = j - 9; - p_283175_.drawString(this.minecraft.font, component, i1, j1, -1); -- j += 10 + 9; +@@ -68,13 +_,16 @@ + for (LerpingBossEvent event : this.events.values()) { + int xLeft = screenWidth / 2 - 91; + int yo = yOffset; ++ var progressEvent = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(graphics, this.minecraft.getWindow(), event, xLeft, yOffset, 10 + this.minecraft.font.lineHeight); ++ if (progressEvent != null) { + this.extractBar(graphics, xLeft, yo, event); + Component msg = event.getName(); + int width = this.minecraft.font.width(msg); + int x = screenWidth / 2 - width / 2; + int y = yo - 9; + graphics.text(this.minecraft.font, msg, x, y, -1); +- yOffset += 10 + 9; + } -+ j += event.getIncrement(); - if (j >= p_283175_.guiHeight() / 3) { ++ yOffset += progressEvent.getIncrement(); + if (yOffset >= graphics.guiHeight() / 3) { break; } diff --git a/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch b/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch index 4d0baf356f..20b60d68c4 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/Button.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/gui/components/Button.java +++ b/net/minecraft/client/gui/components/Button.java -@@ -33,6 +_,12 @@ - this.createNarration = p_259552_; +@@ -39,6 +_,12 @@ + this.createNarration = createNarration; } + // Forge (GH-9238) @@ -11,9 +11,9 @@ + } + @Override - public void onPress(InputWithModifiers p_424878_) { + public void onPress(final InputWithModifiers input) { this.onPress.onPress(this); -@@ -96,9 +_,12 @@ +@@ -102,9 +_,12 @@ } public Button build() { @@ -29,10 +29,10 @@ } } -@@ -118,6 +_,10 @@ - int p_455297_, int p_455388_, int p_459653_, int p_452847_, Component p_459347_, Button.OnPress p_453378_, Button.CreateNarration p_456163_ +@@ -130,6 +_,10 @@ + final Button.CreateNarration createNarration ) { - super(p_455297_, p_455388_, p_459653_, p_452847_, p_459347_, p_453378_, p_456163_); + super(x, y, width, height, message, onPress, createNarration); + } + + protected Plain(Builder builder) { diff --git a/patches/minecraft/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java.patch b/patches/minecraft/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java.patch index 5e7fbe8aa2..f4e973747c 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java +++ b/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java -@@ -25,6 +_,7 @@ +@@ -29,6 +_,7 @@ if (entity != null) { - list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); - list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()))); -+ entity.getType().builtInRegistryHolder().tags().forEach(t -> list.add("#" + t.location())); + result.add(ChatFormatting.UNDERLINE + "Targeted Entity"); + result.add(entity.typeHolder().getRegisteredName()); ++ entity.getType().builtInRegistryHolder().tags().forEach(t -> result.add("#" + t.location())); } - p_426755_.addToGroup(GROUP, list); + displayer.addToGroup(GROUP, result); diff --git a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch index 7748660371..c24fc060da 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch @@ -3,8 +3,8 @@ @@ -142,6 +_,7 @@ } - public void addToast(Toast p_360768_) { -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onToastAdd(p_360768_)) return; - this.queued.add(p_360768_); + public void addToast(final Toast toast) { ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onToastAdd(toast)) return; + this.queued.add(toast); } diff --git a/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch index ccc3b32802..3a38a98fa3 100644 --- a/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/render/GuiRenderer.java +++ b/net/minecraft/client/gui/render/GuiRenderer.java -@@ -138,6 +_,7 @@ - builder.put((Class)pictureinpicturerenderer.getRenderStateClass(), pictureinpicturerenderer); +@@ -110,6 +_,7 @@ + builder.put((Class)pictureInPictureRenderer.getRenderStateClass(), pictureInPictureRenderer); } -+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(p_410565_, p_410441_, builder); ++ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, builder); this.pictureInPictureRenderers = builder.buildOrThrow(); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch index d09f7af5d3..44572e9d4b 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/screens/ChatScreen.java +++ b/net/minecraft/client/gui/screens/ChatScreen.java -@@ -115,6 +_,7 @@ - } else if (p_426273_.isConfirmation()) { +@@ -141,6 +_,7 @@ this.handleChatInput(this.input.getValue(), true); - this.exitReason = ChatScreen.ExitReason.DONE; -+ if (this.minecraft.screen == this) // FORGE: Prevent closing the screen if another screen has been opened. - this.minecraft.setScreen(null); - return true; - } else { + if (this.closeOnSubmit) { + this.exitReason = ChatScreen.ExitReason.DONE; ++ if (this.minecraft.gui.screen() == this) // FORGE: Prevent closing the screen if another screen has been opened. + this.minecraft.gui.setScreen(null); + } else { + this.input.setValue(""); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch index a25bf46104..cc71b72a4e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screens/ConnectScreen.java +++ b/net/minecraft/client/gui/screens/ConnectScreen.java -@@ -102,6 +_,8 @@ +@@ -109,6 +_,8 @@ } - if (optional.isEmpty()) { -+ ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.getHost()); + if (resolvedAddress.isEmpty()) { ++ ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", hostAndPort.getHost()); + net.minecraftforge.network.DualStackUtils.logInitialPreferences(); - p_251955_.execute( - () -> p_251955_.setScreen(new DisconnectedScreen(ConnectScreen.this.parent, ConnectScreen.this.connectFailedTitle, ConnectScreen.UNKNOWN_HOST_MESSAGE)) - ); + minecraft.execute( + () -> minecraft.gui + .setScreen( 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 02a700943b..a63c4a7bd0 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/client/gui/screens/LoadingOverlay.java +++ b/net/minecraft/client/gui/screens/LoadingOverlay.java -@@ -63,6 +_,8 @@ - return p_169325_ & 16777215 | p_169326_ << 24; +@@ -64,6 +_,8 @@ + return color & 16777215 | alpha << 24; } -+ protected boolean renderContents(GuiGraphics gui, float alpha) { return true; } ++ protected boolean extractContentRenderState(final GuiGraphicsExtractor graphics, float alpha) { return true; } + @Override - public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) { - int i = p_281839_.guiWidth(); + public void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) { + int width = graphics.guiWidth(); @@ -103,6 +_,7 @@ - f2 = 1.0F; + logoAlpha = 1.0F; } -+ if (renderContents(p_281839_, f2)) { - int l2 = (int)(p_281839_.guiWidth() * 0.5); - int i1 = (int)(p_281839_.guiHeight() * 0.5); - double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25; -@@ -118,6 +_,7 @@ - if (f < 1.0F) { - this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F)); ++ if (extractContentRenderState(graphics, logoAlpha)) { + int contentX = (int)(graphics.guiWidth() * 0.5); + int logoY = (int)(graphics.guiHeight() * 0.5); + double logoHeight = Math.min(graphics.guiWidth() * 0.75, graphics.guiHeight()) * 0.25; +@@ -148,6 +_,7 @@ + graphics, width / 2 - logoWidthHalf, barY - 5, width / 2 + logoWidthHalf, barY + 5, 1.0F - Mth.clamp(fadeOutAnim, 0.0F, 1.0F) + ); } + } - if (f >= 2.0F) { - this.minecraft.setOverlay(null); -@@ -127,6 +_,7 @@ + if (fadeOutAnim >= 2.0F) { + this.minecraft.gui.setOverlay(null); +@@ -157,6 +_,7 @@ @Override public void tick() { if (this.fadeOutStart == -1L && this.reload.isDone() && this.isReadyToFadeOut()) { @@ -33,11 +33,11 @@ try { this.reload.checkExceptions(); this.onFinish.accept(Optional.empty()); -@@ -134,7 +_,6 @@ - this.onFinish.accept(Optional.of(throwable)); +@@ -164,7 +_,6 @@ + this.onFinish.accept(Optional.of(t)); } - this.fadeOutStart = Util.getMillis(); - if (this.minecraft.screen != null) { + if (this.minecraft.gui.screen() != null) { Window window = this.minecraft.getWindow(); - this.minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight()); + this.minecraft.gui.screen().init(window.getGuiScaledWidth(), window.getGuiScaledHeight()); 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 0c698b161a..b68e34708a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch @@ -3,18 +3,18 @@ @@ -41,11 +_,16 @@ private static final Map, MenuScreens.ScreenConstructor> SCREENS = Maps.newHashMap(); - public static void create(MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { -+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_)); + public static void create(final MenuType type, final Minecraft minecraft, final int containerId, final Component title) { ++ getScreenFactory(type, minecraft, containerId, title).ifPresent(f -> f.fromPacket(title, type, minecraft, containerId)); + } + -+ public static java.util.Optional> getScreenFactory(@Nullable MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { - MenuScreens.ScreenConstructor screenconstructor = getConstructor(p_96202_); - if (screenconstructor == null) { - LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(p_96202_)); ++ public static java.util.Optional> getScreenFactory(@Nullable MenuType type, Minecraft minecraft, int containerId, Component title) { + MenuScreens.ScreenConstructor constructor = getConstructor(type); + if (constructor == null) { + LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(type)); + return java.util.Optional.empty(); } else { -- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_); -+ return java.util.Optional.of(screenconstructor); +- constructor.fromPacket(title, type, minecraft, containerId); ++ return java.util.Optional.of(constructor); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch index 28f341ddfb..7e40bbe1dc 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/screens/PauseScreen.java +++ b/net/minecraft/client/gui/screens/PauseScreen.java -@@ -102,6 +_,7 @@ - } else { - gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this))); +@@ -165,6 +_,7 @@ + Button.builder(OPTIONS, var1x -> this.minecraft.gui.setScreen(new OptionsScreen(this, this.minecraft.options, true))).width(204).build(), 2 + ); } -+ gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2); ++ helper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.gui.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2); - this.disconnectButton = gridlayout$rowhelper.addChild(Button.builder(CommonComponents.disconnectButtonLabel(this.minecraft.isLocalServer()), p_280815_ -> { - p_280815_.active = false; + this.disconnectButton = helper.addChild( + Button.builder( 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 8aa9980d34..9ec2c33b30 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/client/gui/screens/Screen.java +++ b/net/minecraft/client/gui/screens/Screen.java -@@ -194,7 +_,7 @@ +@@ -196,7 +_,7 @@ } public void onClose() { -- this.minecraft.setScreen(null); -+ this.minecraft.popGuiLayer(); +- this.minecraft.gui.setScreen(null); ++ this.minecraft.gui.popLayer(); } - protected T addRenderableWidget(T p_169406_) { -@@ -326,8 +_,10 @@ - this.width = p_96608_; - this.height = p_96609_; + protected T addRenderableWidget(final T widget) { +@@ -327,8 +_,10 @@ + this.width = width; + this.height = height; if (!this.initialized) { + if (!net.minecraftforge.client.event.ScreenEvent.Init.Pre.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget))) this.init(); @@ -20,7 +20,7 @@ } else { this.repositionElements(); } -@@ -344,8 +_,10 @@ +@@ -345,8 +_,10 @@ protected void rebuildWidgets() { this.clearWidgets(); this.clearFocus(); @@ -30,20 +30,20 @@ + net.minecraftforge.client.event.ScreenEvent.Init.Post.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget)); } - protected void fadeWidgets(float p_409453_) { -@@ -385,6 +_,8 @@ - this.renderMenuBackground(p_283688_); + protected void fadeWidgets(final float widgetFade) { +@@ -386,6 +_,8 @@ + this.extractMenuBackground(graphics); } -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, p_283688_); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, graphics); + - this.minecraft.gui.renderDeferredSubtitles(); + this.minecraft.gui.hud.extractDeferredSubtitles(); } -@@ -467,6 +_,19 @@ +@@ -471,6 +_,19 @@ } - public void onFilesDrop(List p_96591_) { + public void onFilesDrop(final List files) { + } + + @Nullable @@ -59,4 +59,4 @@ + this.children.add(guiEventListener); } - private void scheduleNarration(long p_169381_, boolean p_169382_) { + private void scheduleNarration(final long delay, final boolean ignoreSuppression) { 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 69a6fe19d0..e4a863df35 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java -@@ -53,6 +_,7 @@ +@@ -57,6 +_,7 @@ private boolean fading; private long fadeInStart; private final LogoRenderer logoRenderer; @@ -8,48 +8,48 @@ public TitleScreen() { this(false); -@@ -105,11 +_,15 @@ - int j = this.width - i - 2; - int k = 24; - int l = this.height / 4 + 48; +@@ -114,11 +_,15 @@ + int copyrightX = this.width - copyrightWidth - 2; + int spacing = 24; + int topPos = this.height / 4 + 48; + Button modButton = null; if (this.minecraft.isDemo()) { - l = this.createDemoMenuOptions(l, 24); + topPos = this.createDemoMenuOptions(topPos, 24); } else { - l = this.createNormalMenuOptions(l, 24); -+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))) -+ .pos(this.width / 2 - 100, l).size(98, 20).build()); + topPos = this.createNormalMenuOptions(topPos, 24); ++ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.gui.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))) ++ .pos(this.width / 2 - 100, topPos).size(98, 20).build()); } + modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton); - l = this.createTestWorldButton(l, 24); - SpriteIconButton spriteiconbutton = this.addRenderableWidget( -@@ -176,7 +_,7 @@ - }).bounds(this.width / 2 - 100, i = p_96764_ + p_96765_, 200, 20).tooltip(tooltip).build()).active = flag; + int numberOfButtons = 3; + int currentButton = 0; +@@ -199,7 +_,7 @@ + }).bounds(this.width / 2 - 100, var7 = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = multiplayerAllowed; this.addRenderableWidget( - Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this))) -- .bounds(this.width / 2 - 100, p_96764_ = i + p_96765_, 200, 20) -+ .bounds(this.width / 2 + 2, p_96764_ = i + p_96765_, 98, 20) + Button.builder(Component.translatable("menu.online"), var1 -> this.minecraft.gui.setScreen(new RealmsMainScreen(this))) +- .bounds(this.width / 2 - 100, topPos = var7 + spacing, 200, 20) ++ .bounds(this.width / 2 + 2, topPos = var7 + spacing, 98, 20) .tooltip(tooltip) .build() ) -@@ -295,9 +_,18 @@ - s = s + I18n.get("menu.modded"); +@@ -323,9 +_,18 @@ + versionString = versionString + I18n.get("menu.modded"); } -- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.white(f)); -+ final float f_f = f; +- graphics.text(this.font, versionString, 2, this.height - 10, ARGB.white(widgetFade)); ++ final float widgetFade_f = widgetFade; + net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) -> -+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(f_f, -1)) ++ graphics.text(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(widgetFade_f, -1)) + ); + + net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) -> -+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), ARGB.color(f_f, -1)) ++ graphics.text(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), ARGB.color(widgetFade_f, -1)) + ); + - if (this.realmsNotificationsEnabled() && f >= 1.0F) { - this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_); -+ if (f >= 1.0f) this.modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_); + if (this.realmsNotificationsEnabled() && widgetFade >= 1.0F) { + this.realmsNotificationsScreen.extractRenderState(graphics, mouseX, mouseY, a); ++ if (widgetFade >= 1.0f) this.modUpdateNotification.extractRenderState(graphics, mouseX, mouseY, a); } } 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 f547d3f96a..a76516fffd 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,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java -@@ -40,6 +_,7 @@ - private int maxY = Integer.MIN_VALUE; +@@ -41,6 +_,7 @@ private float fade; private boolean centered; + private @Nullable AdvancementWidget hovered; + private int page; public AdvancementTab( - Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, AdvancementNode p_297568_, DisplayInfo p_97150_ -@@ -56,6 +_,15 @@ - this.addWidget(this.root, p_297568_.holder()); + final Minecraft minecraft, +@@ -62,6 +_,15 @@ + this.addWidget(this.root, rootNode.holder()); } + public AdvancementTab(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, AdvancementNode adv, DisplayInfo info) { @@ -24,14 +24,14 @@ public AdvancementTabType getType() { return this.type; } -@@ -150,8 +_,8 @@ - return null; - } else { - for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) { -- if (p_97173_ < advancementtabtype.getMax()) { -- return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_299876_, optional.get()); -+ if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) { -+ return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_ % AdvancementTabType.MAX_TABS, p_97173_ / AdvancementTabType.MAX_TABS, p_299876_, optional.get()); - } +@@ -169,8 +_,8 @@ + } - p_97173_ -= advancementtabtype.getMax(); + for (AdvancementTabType type : AdvancementTabType.values()) { +- if (index < type.getMax()) { +- return new AdvancementTab(minecraft, screen, type, index, root, display.get()); ++ if ((index % AdvancementTabType.MAX_TABS) < type.getMax()) { ++ return new AdvancementTab(minecraft, screen, type, index % AdvancementTabType.MAX_TABS, index / AdvancementTabType.MAX_TABS, root, display.get()); + } + + index -= type.getMax(); 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 9de20e03fc..a1e863e50a 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 @@ -6,8 +6,8 @@ private boolean isScrolling; + private static int tabPage, maxPages; - public AdvancementsScreen(ClientAdvancements p_97340_) { - this(p_97340_, null); + public AdvancementsScreen(final ClientAdvancements advancements) { + this(advancements, null); @@ -65,6 +_,19 @@ @Override @@ -28,33 +28,33 @@ this.layout.addTitleHeader(TITLE, this.font); this.tabs.clear(); this.selectedTab = null; -@@ -109,7 +_,7 @@ - int j = (this.height - 140) / 2; +@@ -119,7 +_,7 @@ + int yo = (this.height - 140) / 2; - for (AdvancementTab advancementtab : this.tabs.values()) { -- if (advancementtab.isMouseOver(i, j, p_431395_.x(), p_431395_.y())) { -+ if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(i, j, p_431395_.x(), p_431395_.y())) { - this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true); + for (AdvancementTab tab : this.tabs.values()) { +- if (tab.isMouseOver(xo, yo, event.x(), event.y())) { ++ if (tab.getPage() == tabPage && tab.isMouseOver(xo, yo, event.x(), event.y())) { + this.advancements.setSelectedTab(tab.getRootNode().holder(), true); break; } -@@ -200,10 +_,12 @@ - p_283395_.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, p_281890_, p_282532_, 0.0F, 0.0F, 252, 140, 256, 256); +@@ -208,10 +_,12 @@ + graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, this.leftPos, this.topPos, 0.0F, 0.0F, 252, 140, 256, 256); if (this.tabs.size() > 1) { - for (AdvancementTab advancementtab : this.tabs.values()) { -+ if (advancementtab.getPage() == tabPage) - advancementtab.drawTab(p_283395_, p_281890_, p_282532_, p_451461_, p_451545_, advancementtab == this.selectedTab); + for (AdvancementTab tab : this.tabs.values()) { ++ if (tab.getPage() == tabPage) + tab.extractTab(graphics, this.leftPos, this.topPos, mouseX, mouseY, tab == this.selectedTab); } - for (AdvancementTab advancementtab1 : this.tabs.values()) { -+ if (advancementtab1.getPage() == tabPage) - advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_); + for (AdvancementTab tab : this.tabs.values()) { ++ if (tab.getPage() == tabPage) + tab.extractIcon(graphics, this.leftPos, this.topPos); } } -@@ -222,6 +_,7 @@ +@@ -230,6 +_,7 @@ if (this.tabs.size() > 1) { - for (AdvancementTab advancementtab : this.tabs.values()) { -+ if (advancementtab.getPage() == tabPage) - if (advancementtab.isMouseOver(p_281519_, p_283371_, p_283556_, p_282458_)) { - p_282784_.setTooltipForNextFrame(this.font, advancementtab.getTitle(), p_283556_, p_282458_); + for (AdvancementTab tab : this.tabs.values()) { ++ if (tab.getPage() == tabPage) + if (tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) { + graphics.setTooltipForNextFrame(this.font, tab.getTitle(), mouseX, mouseY); } 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 9e3b7bf433..54657e5031 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,119 +1,118 @@ --- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java -@@ -102,6 +_,7 @@ - int i = this.leftPos; - int j = this.topPos; - super.render(p_409971_, p_409213_, p_408205_, p_408282_); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, p_409971_, p_409213_, p_408205_); - p_409971_.pose().pushMatrix(); - p_409971_.pose().translate(i, j); - this.renderLabels(p_409971_, p_409213_, p_408205_); -@@ -114,6 +_,8 @@ - this.onStopHovering(slot); +@@ -98,6 +_,7 @@ + int xo = this.leftPos; + int yo = this.topPos; + super.extractRenderState(graphics, mouseX, mouseY, a); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, graphics, mouseX, mouseY); + graphics.pose().pushMatrix(); + graphics.pose().translate(xo, yo); + this.extractLabels(graphics, mouseX, mouseY); +@@ -109,6 +_,7 @@ + if (previouslyHoveredSlot != null && previouslyHoveredSlot != this.hoveredSlot) { + this.onStopHovering(previouslyHoveredSlot); } ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, graphics, mouseX, mouseY); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, p_409971_, p_409213_, p_408205_); -+ - p_409971_.pose().popMatrix(); + graphics.pose().popMatrix(); } - -@@ -197,7 +_,7 @@ - ItemStack itemstack = this.hoveredSlot.getItem(); - if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) { - p_283594_.setTooltipForNextFrame( -- this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_, itemstack.get(DataComponents.TOOLTIP_STYLE) -+ this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_ +@@ -170,7 +_,7 @@ + ItemStack item = this.hoveredSlot.getItem(); + if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(item)) { + graphics.setTooltipForNextFrame( +- this.font, this.getTooltipFromContainerItem(item), item.getTooltipImage(), mouseX, mouseY, item.get(DataComponents.TOOLTIP_STYLE) ++ this.font, this.getTooltipFromContainerItem(item), item.getTooltipImage(), item, mouseX, mouseY ); } } -@@ -213,7 +_,8 @@ +@@ -186,7 +_,8 @@ - private void renderFloatingItem(GuiGraphics p_282567_, ItemStack p_281330_, int p_281772_, int p_281689_, @Nullable String p_282568_) { - p_282567_.renderItem(p_281330_, p_281772_, p_281689_); -- p_282567_.renderItemDecorations(this.font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_); -+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT); -+ p_282567_.renderItemDecorations(font == null ? this.font : font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_); + private void extractFloatingItem(final GuiGraphicsExtractor graphics, final ItemStack carried, final int x, final int y, final @Nullable String itemCount) { + graphics.item(carried, x, y); +- graphics.itemDecorations(this.font, carried, x, y, itemCount); ++ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(carried).getFont(carried, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT); ++ graphics.itemDecorations(font == null ? this.font : font, carried, x, y, itemCount); } - protected void renderLabels(GuiGraphics p_281635_, int p_282681_, int p_283686_) { -@@ -313,7 +_,8 @@ - if (super.mouseClicked(p_427253_, p_427622_)) { + protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) { +@@ -285,7 +_,8 @@ return true; - } else { -- boolean flag = this.minecraft.options.keyPickItem.matchesMouse(p_427253_) && this.minecraft.player.hasInfiniteMaterials(); -+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(p_427253_.button()); -+ boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey) && this.minecraft.player.hasInfiniteMaterials(); - Slot slot = this.getHoveredSlot(p_427253_.x(), p_427253_.y()); - this.doubleclick = this.lastClickSlot == slot && p_427622_; - this.skipNextRelease = false; -@@ -323,6 +_,7 @@ - int i = this.leftPos; - int j = this.topPos; - boolean flag1 = this.hasClickedOutside(p_427253_.x(), p_427253_.y(), i, j); -+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries - int k = -1; - if (slot != null) { - k = slot.index; -@@ -348,7 +_,7 @@ - } - } else if (!this.isQuickCrafting) { - if (this.menu.getCarried().isEmpty()) { -- if (flag) { -+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { - this.slotClicked(slot, k, p_427253_.button(), ClickType.CLONE); - } else { - boolean flag2 = k != -999 && p_427253_.hasShiftDown(); -@@ -372,7 +_,7 @@ - this.quickCraftingType = 0; - } else if (p_427253_.button() == 1) { - this.quickCraftingType = 1; -- } else if (flag) { -+ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { - this.quickCraftingType = 2; - } - } -@@ -449,10 +_,13 @@ + } + +- boolean cloning = this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials(); ++ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button()); ++ boolean cloning = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey) && this.minecraft.player.hasInfiniteMaterials(); + Slot slot = this.getHoveredSlot(event.x(), event.y()); + this.doubleclick = this.lastClickSlot == slot && doubleClick; + this.skipNextRelease = false; +@@ -295,6 +_,7 @@ + int xo = this.leftPos; + int yo = this.topPos; + boolean clickedOutside = this.hasClickedOutside(event.x(), event.y(), xo, yo); ++ if (slot != null) clickedOutside = false; // Forge, prevent dropping of items through slots outside of GUI boundaries + int slotId = -1; + if (slot != null) { + slotId = slot.index; +@@ -306,7 +_,7 @@ + + if (slotId != -1 && !this.isQuickCrafting) { + if (this.menu.getCarried().isEmpty()) { +- if (cloning) { ++ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE); + } else { + boolean quickKey = slotId != -999 && event.hasShiftDown(); +@@ -330,7 +_,7 @@ + this.quickCraftingType = 0; + } else if (event.button() == 1) { + this.quickCraftingType = 1; +- } else if (cloning) { ++ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.quickCraftingType = 2; + } + } +@@ -374,10 +_,13 @@ @Override - public boolean mouseReleased(MouseButtonEvent p_430939_) { -+ super.mouseReleased(p_430939_); //Forge, Call parent to release buttons - Slot slot = this.getHoveredSlot(p_430939_.x(), p_430939_.y()); - int i = this.leftPos; - int j = this.topPos; - boolean flag = this.hasClickedOutside(p_430939_.x(), p_430939_.y(), i, j); -+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries -+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(p_430939_.button()); - int k = -1; + public boolean mouseReleased(final MouseButtonEvent event) { ++ super.mouseReleased(event); //Forge, Call parent to release buttons + Slot slot = this.getHoveredSlot(event.x(), event.y()); + int xo = this.leftPos; + int yo = this.topPos; + boolean clickedOutside = this.hasClickedOutside(event.x(), event.y(), xo, yo); ++ if (slot != null) clickedOutside = false; // Forge, prevent dropping of items through slots outside of GUI boundaries ++ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button()); + int slotId = -1; if (slot != null) { - k = slot.index; -@@ -469,7 +_,7 @@ - if (slot2 != null - && slot2.mayPickup(this.minecraft.player) - && slot2.hasItem() -- && slot2.container == slot.container -+ && slot2.isSameInventory(slot) - && AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) { - this.slotClicked(slot2, slot2.index, p_430939_.button(), ClickType.QUICK_MOVE); + slotId = slot.index; +@@ -394,7 +_,7 @@ + if (target != null + && target.mayPickup(this.minecraft.player) + && target.hasItem() +- && target.container == slot.container ++ && target.isSameInventory(slot) + && AbstractContainerMenu.canItemQuickReplace(target, this.lastQuickMoved, true)) { + this.slotClicked(target, target.index, event.button(), ContainerInput.QUICK_MOVE); } -@@ -534,7 +_,7 @@ - - this.slotClicked(null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT); +@@ -421,7 +_,7 @@ + if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) { + this.quickCraftToSlots(); } else if (!this.menu.getCarried().isEmpty()) { -- if (this.minecraft.options.keyPickItem.matchesMouse(p_430939_)) { +- if (this.minecraft.options.keyPickItem.matchesMouse(event)) { + if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { - this.slotClicked(slot, k, p_430939_.button(), ClickType.CLONE); + this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE); } else { - boolean flag1 = k != -999 && p_430939_.hasShiftDown(); -@@ -605,7 +_,7 @@ - public boolean keyPressed(KeyEvent p_424324_) { - if (super.keyPressed(p_424324_)) { + boolean quickKey = slotId != -999 && event.hasShiftDown(); +@@ -489,7 +_,7 @@ return true; -- } else if (this.minecraft.options.keyInventory.matches(p_424324_)) { -+ } else if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(p_424324_))) { + } + +- if (this.minecraft.options.keyInventory.matches(event)) { ++ if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(event))) { this.onClose(); return true; - } else { -@@ -684,6 +_,13 @@ + } +@@ -587,4 +_,11 @@ super.onClose(); } @@ -124,6 +123,4 @@ + public int getGuiTop() { return topPos; } + public int getXSize() { return imageWidth; } + public int getYSize() { return imageHeight; } - - @OnlyIn(Dist.CLIENT) - record SnapbackData(ItemStack item, Vector2i start, Vector2i end, long time) { + } 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 9259e62ba1..89c9860fb0 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,24 +1,24 @@ --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java -@@ -115,6 +_,8 @@ +@@ -116,6 +_,8 @@ private final Set> visibleTags = new HashSet<>(); private final boolean displayOperatorCreativeTab; private final EffectsInInventory effects; + private final List pages = new java.util.ArrayList<>(); + private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>()); - public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) { - super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY); -@@ -163,7 +_,7 @@ - private void refreshCurrentTabContents(Collection p_261591_) { - int i = this.menu.getRowIndexForScroll(this.scrollOffs); + public CreativeModeInventoryScreen(final LocalPlayer player, final FeatureFlagSet enabledFeatures, final boolean displayOperatorCreativeTab) { + super(new CreativeModeInventoryScreen.ItemPickerMenu(player), player.getInventory(), CommonComponents.EMPTY, 195, 136); +@@ -164,7 +_,7 @@ + private void refreshCurrentTabContents(final Collection displayList) { + int oldRowIndex = this.menu.getRowIndexForScroll(this.scrollOffs); this.menu.items.clear(); - if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) { + if (selectedTab.hasSearchBar()) { this.refreshSearchResults(); } else { - this.menu.items.addAll(p_261591_); -@@ -329,6 +_,36 @@ + this.menu.items.addAll(displayList); +@@ -330,6 +_,36 @@ protected void init() { if (this.minecraft.player.hasInfiniteMaterials()) { super.init(); @@ -55,74 +55,73 @@ this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search")); this.searchBox.setMaxLength(50); this.searchBox.setBordered(false); -@@ -376,7 +_,7 @@ - public boolean charTyped(CharacterEvent p_424087_) { - if (this.ignoreTextInput) { +@@ -379,7 +_,7 @@ return false; -- } else if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) { -+ } else if (!selectedTab.hasSearchBar()) { + } + +- if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) { ++ if (!selectedTab.hasSearchBar()) { return false; - } else { - String s = this.searchBox.getValue(); -@@ -395,7 +_,7 @@ + } + +@@ -407,7 +_,7 @@ @Override - public boolean keyPressed(KeyEvent p_429237_) { + public boolean keyPressed(final KeyEvent event) { this.ignoreTextInput = false; - if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) { + if (!selectedTab.hasSearchBar()) { - if (this.minecraft.options.keyChat.matches(p_429237_)) { + if (this.minecraft.options.keyChat.matches(event)) { this.ignoreTextInput = true; this.selectTab(CreativeModeTabs.searchTab()); -@@ -431,6 +_,7 @@ +@@ -443,6 +_,7 @@ } private void refreshSearchResults() { + if (!selectedTab.hasSearchBar()) return; this.menu.items.clear(); this.visibleTags.clear(); - String s = this.searchBox.getValue(); -@@ -443,10 +_,10 @@ - SearchTree searchtree; - if (s.startsWith("#")) { - s = s.substring(1); -- searchtree = sessionsearchtrees.creativeTagSearch(); -+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab)); - this.updateVisibleTags(s); + String searchTerm = this.searchBox.getValue(); +@@ -455,10 +_,10 @@ + SearchTree tree; + if (searchTerm.startsWith("#")) { + searchTerm = searchTerm.substring(1); +- tree = searchTrees.creativeTagSearch(); ++ tree = searchTrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab)); + this.updateVisibleTags(searchTerm); } else { -- searchtree = sessionsearchtrees.creativeNameSearch(); -+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab)); +- tree = searchTrees.creativeNameSearch(); ++ tree = searchTrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab)); } - this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT))); -@@ -478,7 +_,8 @@ + this.menu.items.addAll(tree.search(searchTerm.toLowerCase(Locale.ROOT))); +@@ -486,7 +_,7 @@ @Override - protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) { + protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) { if (selectedTab.showTitle()) { -- p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, -12566464, false); -+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend(); -+ p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false); +- graphics.text(this.font, selectedTab.getDisplayName(), 8, 6, -12566464, false); ++ graphics.text(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false); } } -@@ -488,7 +_,7 @@ - double d0 = p_430803_.x() - this.leftPos; - double d1 = p_430803_.y() - this.topPos; +@@ -496,7 +_,7 @@ + double xm = event.x() - this.leftPos; + double ym = event.y() - this.topPos; -- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { -+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { - if (this.checkTabClicked(creativemodetab, d0, d1)) { +- for (CreativeModeTab tab : CreativeModeTabs.tabs()) { ++ for (CreativeModeTab tab : currentPage.getVisibleTabs()) { + if (this.checkTabClicked(tab, xm, ym)) { return true; } -@@ -510,7 +_,7 @@ - double d1 = p_423848_.y() - this.topPos; +@@ -518,7 +_,7 @@ + double ym = event.y() - this.topPos; this.scrolling = false; -- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { -+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { - if (this.checkTabClicked(creativemodetab, d0, d1)) { - this.selectTab(creativemodetab); +- for (CreativeModeTab tab : CreativeModeTabs.tabs()) { ++ for (CreativeModeTab tab : currentPage.getVisibleTabs()) { + if (this.checkTabClicked(tab, xm, ym)) { + this.selectTab(tab); return true; -@@ -604,13 +_,15 @@ +@@ -611,13 +_,15 @@ this.originalSlots = null; } @@ -131,7 +130,7 @@ this.searchBox.setVisible(true); this.searchBox.setCanLoseFocus(false); this.searchBox.setFocused(true); - if (creativemodetab != p_98561_) { + if (oldTab != tab) { this.searchBox.setValue(""); } + this.searchBox.setWidth(selectedTab.getSearchBarWidth()); @@ -139,95 +138,87 @@ this.refreshSearchResults(); } else { -@@ -673,7 +_,14 @@ - this.effects.render(p_283000_, p_281317_, p_282770_); - super.render(p_283000_, p_281317_, p_282770_, p_281295_); +@@ -682,7 +_,14 @@ + this.effects.extractRenderState(graphics, mouseX, mouseY); + super.extractRenderState(graphics, mouseX, mouseY, a); -- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab tab : CreativeModeTabs.tabs()) { + if (this.pages.size() != 1) { + Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size())); -+ p_283000_.pose().pushMatrix(); -+ p_283000_.drawString(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1); -+ p_283000_.pose().popMatrix(); ++ graphics.pose().pushMatrix(); ++ graphics.text(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1); ++ graphics.pose().popMatrix(); + } + -+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { - if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) { ++ for (CreativeModeTab tab : currentPage.getVisibleTabs()) { + if (this.checkTabHovering(graphics, tab, mouseX, mouseY)) { break; } -@@ -697,7 +_,7 @@ - public List getTooltipFromContainerItem(ItemStack p_281769_) { - boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot; - boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY; -- boolean flag2 = selectedTab.getType() == CreativeModeTab.Type.SEARCH; -+ boolean flag2 = selectedTab.hasSearchBar(); - TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; - TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default; - List list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag); -@@ -718,7 +_,7 @@ - int i = 1; +@@ -704,7 +_,7 @@ + public List getTooltipFromContainerItem(final ItemStack itemStack) { + boolean isCreativeSlot = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot; + boolean isSingleCategoryTab = selectedTab.getType() == CreativeModeTab.Type.CATEGORY; +- boolean isSearchTab = selectedTab.getType() == CreativeModeTab.Type.SEARCH; ++ boolean isSearchTab = selectedTab.hasSearchBar(); + TooltipFlag.Default originalTooltipStyle = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; + TooltipFlag tooltipStyle = isCreativeSlot ? originalTooltipStyle.asCreative() : originalTooltipStyle; + List originalLines = itemStack.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipStyle); +@@ -728,7 +_,7 @@ + int i = 1; - for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { -- if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) { -+ if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) { - list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE)); - } + for (CreativeModeTab tab : CreativeModeTabs.tabs()) { +- if (tab.getType() != CreativeModeTab.Type.SEARCH && tab.contains(itemStack)) { ++ if (!tab.hasSearchBar() && tab.contains(itemStack)) { + linesToDisplay.add(i++, tab.getDisplayName().copy().withStyle(ChatFormatting.BLUE)); } -@@ -729,7 +_,7 @@ + } +@@ -740,7 +_,7 @@ + public void extractBackground(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) { + super.extractBackground(graphics, mouseX, mouseY, a); - @Override - protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) { -- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { -+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { - if (creativemodetab != selectedTab) { - this.renderTabButton(p_282663_, p_282089_, p_282249_, creativemodetab); +- for (CreativeModeTab tab : CreativeModeTabs.tabs()) { ++ for (CreativeModeTab tab : currentPage.getVisibleTabs()) { + if (tab != selectedTab) { + this.extractTabButton(graphics, mouseX, mouseY, tab); } -@@ -749,6 +_,7 @@ - p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, identifier, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15); +@@ -775,6 +_,7 @@ + graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprite, xscr, yscr + (int)((yscr2 - yscr - 17) * this.scrollOffs), 12, 15); } + if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page - this.renderTabButton(p_282663_, p_282089_, p_282249_, selectedTab); + this.extractTabButton(graphics, mouseX, mouseY, selectedTab); if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { - InventoryScreen.renderEntityInInventoryFollowsMouse( -@@ -767,7 +_,7 @@ + InventoryScreen.extractEntityInInventoryFollowsMouse( +@@ -784,7 +_,7 @@ } - private int getTabX(CreativeModeTab p_260136_) { -- int i = p_260136_.column(); -+ int i = currentPage.getColumn(p_260136_); - int j = 27; - int k = 27 * i; - if (p_260136_.isAlignedRight()) { -@@ -779,7 +_,7 @@ + private int getTabX(final CreativeModeTab tab) { +- int pos = tab.column(); ++ int pos = currentPage.getColumn(tab); + int spacing = 27; + int x = 27 * pos; + if (tab.isAlignedRight()) { +@@ -796,7 +_,7 @@ - private int getTabY(CreativeModeTab p_260181_) { - int i = 0; -- if (p_260181_.row() == CreativeModeTab.Row.TOP) { -+ if (currentPage.isTop(p_260181_)) { - i -= 32; + private int getTabY(final CreativeModeTab tab) { + int y = 0; +- if (tab.row() == CreativeModeTab.Row.TOP) { ++ if (currentPage.isTop(tab)) { + y -= 32; } else { - i += this.imageHeight; -@@ -807,8 +_,8 @@ + y += this.imageHeight; +@@ -824,8 +_,8 @@ - protected void renderTabButton(GuiGraphics p_283590_, int p_454271_, int p_455485_, CreativeModeTab p_283489_) { - boolean flag = p_283489_ == selectedTab; -- boolean flag1 = p_283489_.row() == CreativeModeTab.Row.TOP; -- int i = p_283489_.column(); -+ boolean flag1 = currentPage.isTop(p_283489_); -+ int i = currentPage.getColumn(p_283489_); - int j = this.leftPos + this.getTabX(p_283489_); - int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4)); - Identifier[] aidentifier; -@@ -822,6 +_,7 @@ - p_283590_.requestCursor(CursorTypes.POINTING_HAND); - } - -+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aidentifier[Mth.clamp(i, 0, aidentifier.length)], j, k, 26, 32); - int l = j + 13 - 8; - int i1 = k + 16 - 8 + (flag1 ? 1 : -1); -@@ -858,6 +_,14 @@ + protected void extractTabButton(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final CreativeModeTab tab) { + boolean selected = tab == selectedTab; +- boolean isTop = tab.row() == CreativeModeTab.Row.TOP; +- int pos = tab.column(); ++ boolean isTop = currentPage.isTop(tab); ++ int pos = currentPage.getColumn(tab); + int x = this.leftPos + this.getTabX(tab); + int y = this.topPos - (isTop ? 28 : -(this.imageHeight - 4)); + Identifier[] sprites; +@@ -875,6 +_,14 @@ } } @@ -240,12 +231,12 @@ + } + @OnlyIn(Dist.CLIENT) - static class CustomCreativeSlot extends Slot { - public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) { -@@ -1038,6 +_,22 @@ + private static class CustomCreativeSlot extends Slot { + public CustomCreativeSlot(final Container container, final int slot, final int x, final int y) { +@@ -1055,6 +_,22 @@ @Override - public boolean mayPickup(Player p_98665_) { - return this.target.mayPickup(p_98665_); + public boolean mayPickup(final Player player) { + return this.target.mayPickup(player); + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java.patch index ac6d20ff10..38a927f73f 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java.patch @@ -1,39 +1,39 @@ --- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java +++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java @@ -47,12 +_,16 @@ - int j = this.screen.width - i; - Collection collection = this.minecraft.player.getActiveEffects(); - if (!collection.isEmpty() && j >= 32) { -- int k = j >= 120 ? j - 7 : 32; -+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, j < 120, i); + int availableWidth = this.screen.width - xo; + Collection activeEffects = this.minecraft.player.getActiveEffects(); + if (!activeEffects.isEmpty() && availableWidth >= 32) { +- int maxWidth = availableWidth >= 120 ? availableWidth - 7 : 32; ++ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, availableWidth, availableWidth < 120, xo); + if (event == null) return; -+ int k = !event.isCompact() ? j - 7 : 32; -+ i = event.getHorizontalOffset(); - int l = 33; - if (collection.size() > 5) { - l = 132 / (collection.size() - 1); ++ int maxWidth = !event.isCompact() ? availableWidth - 7 : 32; ++ xo = event.getHorizontalOffset(); + int yStep = 33; + if (activeEffects.size() > 5) { + yStep = 132 / (activeEffects.size() - 1); } -+ Iterable iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList(); - this.renderEffects(p_456221_, collection, i, l, p_453611_, p_457243_, k); ++ Iterable iterable = activeEffects.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList(); + this.extractEffects(graphics, activeEffects, xo, yStep, mouseX, mouseY, maxWidth); } } -@@ -66,6 +_,11 @@ +@@ -72,6 +_,11 @@ - for (MobEffectInstance mobeffectinstance : iterable) { - boolean flag = mobeffectinstance.isAmbient(); -+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); -+ if (renderer.renderInventory(mobeffectinstance, this, p_362146_, p_370153_, i, 0)) { -+ i += p_365612_; + for (MobEffectInstance effect : sortedEffects) { + boolean isAmbient = effect.isAmbient(); ++ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(effect); ++ if (renderer.extractInventory(effect, this, graphics, x0, y0, 0)) { ++ y0 += yStep; + continue; + } - Component component = this.getEffectName(mobeffectinstance); - Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate()); - int j = this.renderBackground(p_362146_, font, component, component1, p_370153_, i, flag, p_457235_); -@@ -123,5 +_,9 @@ + Component effectText = this.getEffectName(effect); + Component duration = MobEffectUtil.formatDuration(effect, 1.0F, this.minecraft.level.tickRateManager().tickrate()); + int textureWidth = this.extractBackground(graphics, font, effectText, duration, x0, y0, isAmbient, maxWidth); +@@ -136,5 +_,9 @@ } - return mutablecomponent; + return name; + } + + public AbstractContainerScreen getScreen() { 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 3c0b691404..d32f83cb84 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,32 +1,33 @@ --- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java -@@ -108,7 +_,7 @@ - int l1 = 86 - this.font.width(s); - FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1); - int i2 = -9937334; -- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) { -+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{ - p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19); - p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16); - p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, ARGB.opaque((i2 & 16711422) >> 1), false); -@@ -160,13 +_,16 @@ +@@ -111,7 +_,7 @@ + int textWidth = 86 - this.font.width(costText); + FormattedText message = EnchantmentNames.getInstance().getRandomName(this.font, textWidth); + int col = -9937334; +- if ((goldCount < i + 1 || this.minecraft.player.experienceLevel < cost) && !this.minecraft.player.hasInfiniteMaterials()) { ++ if (((goldCount < i + 1 || this.minecraft.player.experienceLevel < cost) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[i] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{ + graphics.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, leftPos, yo + 14 + 19 * i, 108, 19); + graphics.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[i], leftPos + 1, yo + 15 + 19 * i, 16, 16); + graphics.textWithWordWrap(this.font, message, leftPosText, yo + 16 + 19 * i, textWidth, ARGB.opaque((col & 16711422) >> 1), false); +@@ -162,14 +_,18 @@ .registryAccess() .lookupOrThrow(Registries.ENCHANTMENT) - .get(this.menu.enchantClue[j]); -- if (!optional.isEmpty()) { + .get(this.menu.enchantClue[i]); +- if (!enchant.isEmpty()) { + { - int l = this.menu.levelClue[j]; - int i1 = j + 1; -- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0) { -+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && l >= 0) { - List list = Lists.newArrayList(); -- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE)); -- if (!flag) { -+ list.add(Component.translatable("container.enchant.clue", optional.isEmpty() ? "" : Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE)); -+ if (optional.isEmpty()) { -+ list.add(Component.literal("")); -+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED)); -+ } else if (!flag) { - list.add(CommonComponents.EMPTY); - if (this.minecraft.player.experienceLevel < k) { - list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED)); + int enchantLevel = this.menu.levelClue[i]; + int cost = i + 1; +- if (this.isHovering(60, 14 + 19 * i, 108, 17, mouseX, mouseY) && minLevel > 0 && enchantLevel >= 0) { ++ if (this.isHovering(60, 14 + 19 * i, 108, 17, (double)mouseX, (double)mouseY) && enchantLevel >= 0) { + List texts = Lists.newArrayList(); + texts.add( +- Component.translatable("container.enchant.clue", Enchantment.getFullname(enchant.get(), enchantLevel)).withStyle(ChatFormatting.WHITE) ++ Component.translatable("container.enchant.clue", enchant.isEmpty() ? "" : Enchantment.getFullname(enchant.get(), enchantLevel)).withStyle(ChatFormatting.WHITE) + ); ++ if (enchant.isEmpty()) { ++ texts.add(Component.literal("")); ++ texts.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED)); ++ } else + if (!infiniteMaterials) { + texts.add(CommonComponents.EMPTY); + if (this.minecraft.player.experienceLevel < minLevel) { 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 a7c216573a..617ada3af3 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 -@@ -15,7 +_,7 @@ - private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F); +@@ -16,7 +_,7 @@ + private static final Vector3fc TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F); private static final int TEXTURE_WIDTH = 16; private static final int TEXTURE_HEIGHT = 16; - private final Identifier texture = Identifier.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png"); + private final Identifier texture = Identifier.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/"); - public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) { - super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit")); + public HangingSignEditScreen(final SignBlockEntity sign, final boolean isFrontText, final boolean shouldFilter) { + super(sign, isFrontText, shouldFilter, Component.translatable("hanging_sign.edit")); 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 deleted file mode 100644 index 115fbc94d1..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/MerchantScreen.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java -+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java -@@ -236,6 +_,14 @@ - } else { - p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null); - p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null); -+ /* -+ // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations -+ p_281357_.pose().pushPose(); -+ p_281357_.pose().translate(0.0F, 0.0F, 200.0F); -+ String count = p_283466_.getCount() == 1 ? "1" : String.valueOf(p_283466_.getCount()); -+ font.drawInBatch(count, (float) (p_282403_ + 14) + 19 - 2 - font.width(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.pose().last().pose(), p_281357_.bufferSource(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false); -+ p_281357_.pose().popPose(); -+ */ - p_281357_.blitSprite(RenderPipelines.GUI_TEXTURED, DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 9, 2); - } - } 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 4fb7987094..1c74ad59e2 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,11 +1,11 @@ --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java -@@ -20,7 +_,7 @@ - case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip( - clientactiveplayerstooltip$activeplayerstooltip - ); +@@ -18,7 +_,7 @@ + return switch (component) { + case BundleTooltip bundleTooltip -> new ClientBundleTooltip(bundleTooltip.contents()); + case ClientActivePlayersTooltip.ActivePlayersTooltip activePlayersTooltip -> new ClientActivePlayersTooltip(activePlayersTooltip); - default -> throw new IllegalArgumentException("Unknown TooltipComponent"); -+ default -> net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_); - }); ++ default -> net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(component); + }; } 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 92346a5781..770354dba6 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 -@@ -361,6 +_,8 @@ - p_425273_.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), p_424268_, p_430737_); +@@ -369,6 +_,8 @@ + graphics.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), mouseX, mouseY); } -+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, p_425273_, this.getContentX(), this.getContentY(), this.getContentWidth(), p_424268_ - this.getContentX(), p_430737_ - this.getContentY()); ++ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, graphics, this.getContentX(), this.getContentY(), this.getContentWidth(), mouseX - this.getContentX(), mouseY - this.getContentY()); + - if (this.minecraft.options.touchscreen().get() || p_425246_) { - p_425273_.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544); - int i1 = p_424268_ - this.getContentX(); + if (hovered) { + graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544); + int relX = mouseX - this.getContentX(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch index 2ef27b141f..c377afcffa 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java +++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java @@ -116,9 +_,10 @@ - this.name = p_343976_; - this.changeButton = Button.builder(p_343976_, p_342196_ -> { - KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_; -+ p_343088_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN); + this.name = name; + this.changeButton = Button.builder(name, button -> { + KeyBindsList.this.keyBindsScreen.selectedKey = key; ++ key.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN); KeyBindsList.this.resetMappingAndUpdateButtons(); }) - .bounds(0, 0, 75, 20) + .bounds(0, 0, 75 + 20 /* Forge: Add space */, 20) .createNarration( - p_342179_ -> p_343088_.isUnbound() - ? Component.translatable("narrator.controls.unbound", p_343976_) + defaultNarrationSupplier -> key.isUnbound() + ? Component.translatable("narrator.controls.unbound", name) @@ -126,7 +_,7 @@ ) .build(); - this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_357685_ -> { -- p_343088_.setKey(p_343088_.getDefaultKey()); + this.resetButton = Button.builder(RESET_BUTTON_TITLE, button -> { +- key.setKey(key.getDefaultKey()); + this.key.setToDefault(); KeyBindsList.this.resetMappingAndUpdateButtons(); - }).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build(); + }).bounds(0, 0, 50, 20).createNarration(defaultNarrationSupplier -> Component.translatable("narrator.controls.reset", name)).build(); this.refreshEntry(); @@ -167,7 +_,8 @@ - MutableComponent mutablecomponent = Component.empty(); + MutableComponent tooltip = Component.empty(); if (!this.key.isUnbound()) { - for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) { -- if (keymapping != this.key && this.key.same(keymapping) && (!keymapping.isDefault() || !this.key.isDefault())) { -+ var vanillConflict = keymapping != this.key && this.key.same(keymapping) && (!keymapping.isDefault() || !this.key.isDefault()); -+ if (vanillConflict || keymapping.hasKeyModifierConflict(this.key)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G + for (KeyMapping otherKey : KeyBindsList.this.minecraft.options.keyMappings) { +- if (otherKey != this.key && this.key.same(otherKey) && (!otherKey.isDefault() || !this.key.isDefault())) { ++ var vanillConflict = otherKey != this.key && this.key.same(otherKey) && (!otherKey.isDefault() || !this.key.isDefault()); ++ if (vanillConflict || otherKey.hasKeyModifierConflict(this.key)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G if (this.hasCollision) { - mutablecomponent.append(", "); + tooltip.append(", "); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java.patch index 5bc6d38767..8558529b3e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java.patch @@ -2,32 +2,32 @@ +++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java @@ -42,7 +_,7 @@ protected void addFooter() { - this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> { - for (KeyMapping keymapping : this.options.keyMappings) { -- keymapping.setKey(keymapping.getDefaultKey()); -+ keymapping.setToDefault(); + this.resetButton = Button.builder(Component.translatable("controls.resetAll"), button -> { + for (KeyMapping key : this.options.keyMappings) { +- key.setKey(key.getDefaultKey()); ++ key.setToDefault(); } this.keyBindsList.resetMappingAndUpdateButtons(); @@ -74,11 +_,12 @@ - public boolean keyPressed(KeyEvent p_424487_) { + public boolean keyPressed(final KeyEvent event) { if (this.selectedKey != null) { - if (p_424487_.isEscape()) { + if (event.isEscape()) { - this.selectedKey.setKey(InputConstants.UNKNOWN); + this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN); } else { -- this.selectedKey.setKey(InputConstants.getKey(p_424487_)); -+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_424487_)); +- this.selectedKey.setKey(InputConstants.getKey(event)); ++ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(event)); } -+ if (p_424487_.isEscape() || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey())) ++ if (event.isEscape() || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey())) this.selectedKey = null; this.lastKeySelection = Util.getMillis(); this.keyBindsList.resetMappingAndUpdateButtons(); @@ -101,5 +_,18 @@ } - this.resetButton.active = flag; + this.resetButton.active = canReset; + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch index 4e595b6635..10e954a55a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java +++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java -@@ -108,6 +_,10 @@ +@@ -111,6 +_,10 @@ boolean canMoveUp(); boolean canMoveDown(); @@ -11,7 +11,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -207,6 +_,11 @@ +@@ -210,6 +_,11 @@ @Override public void moveDown() { this.move(1); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch index b83455dd08..53617793d5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java +++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java @@ -65,7 +_,7 @@ - Component component = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD); - this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, component), (int)(9.0F * 1.5F)); + Component header = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD); + this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, header), (int)(9.0F * 1.5F)); this.setSelected(null); -- p_429245_.forEach(p_430444_ -> { -+ p_429245_.filter(PackSelectionModel.Entry::notHidden).forEach(p_430444_ -> { - TransferableSelectionList.PackEntry transferableselectionlist$packentry = new TransferableSelectionList.PackEntry(this.minecraft, this, p_430444_); - this.addEntry(transferableselectionlist$packentry); - if (p_430177_ != null && p_430177_.getId().equals(p_430444_.getId())) { +- entries.forEach(e -> { ++ entries.filter(PackSelectionModel.Entry::notHidden).forEach(e -> { + TransferableSelectionList.PackEntry entry = new TransferableSelectionList.PackEntry(this.minecraft, this, e); + this.addEntry(entry); + if (transferredEntry != null && transferredEntry.getId().equals(e.getId())) { 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 4634eeafe7..6e72414996 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,26 +1,26 @@ --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java -@@ -173,6 +_,7 @@ - WorldDataConfiguration worlddataconfiguration = SharedConstants.IS_RUNNING_IN_IDE +@@ -172,6 +_,7 @@ + WorldDataConfiguration dataConfig = SharedConstants.IS_RUNNING_IN_IDE ? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS) : WorldDataConfiguration.DEFAULT; -+ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(packrepository::addPackFinder); - WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, worlddataconfiguration); - CompletableFuture completablefuture = WorldLoader.load( - worldloader$initconfig, -@@ -472,7 +_,7 @@ - if (p_269627_) { - p_270552_.accept(this.uiState.getSettings().dataConfiguration()); ++ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(vanillaOnlyPackRepository::addPackFinder); + WorldLoader.InitConfig loadConfig = createDefaultLoadConfig(vanillaOnlyPackRepository, dataConfig); + CompletableFuture loadResult = WorldLoader.load( + loadConfig, +@@ -512,7 +_,7 @@ + if (retry) { + onAbort.accept(this.uiState.getSettings().dataConfiguration()); } else { -- p_270552_.accept(WorldDataConfiguration.DEFAULT); -+ p_270552_.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.DEFAULT_FLAGS)); // FORGE: Revert to *actual* vanilla data +- onAbort.accept(WorldDataConfiguration.DEFAULT); ++ onAbort.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.DEFAULT_FLAGS)); // FORGE: Revert to *actual* vanilla data } }, Component.translatable("dataPack.validation.failed"), -@@ -584,6 +_,7 @@ - if (path != null) { +@@ -621,6 +_,7 @@ + if (dataPackDir != null) { if (this.tempDataPackRepository == null) { - this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator); + this.tempDataPackRepository = ServerPacksSource.createPackRepository(dataPackDir, this.packValidator); + net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.tempDataPackRepository, false); this.tempDataPackRepository.reload(); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/PresetEditor.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/PresetEditor.java.patch index fe2dd36152..2deeb0af17 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/PresetEditor.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/PresetEditor.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java +++ b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java -@@ -29,6 +_,10 @@ +@@ -28,6 +_,10 @@ @OnlyIn(Dist.CLIENT) public interface PresetEditor { @@ -10,4 +10,4 @@ + @Deprecated Map>, PresetEditor> EDITORS = Map.of( Optional.of(WorldPresets.FLAT), - (p_232974_, p_232975_) -> { + (parent, settings) -> { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java.patch index 17da7eab79..76c5581e26 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java -@@ -75,6 +_,14 @@ +@@ -98,6 +_,14 @@ ); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch index ab9704c50d..628bc0c979 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java -@@ -232,7 +_,7 @@ +@@ -239,7 +_,7 @@ public @Nullable PresetEditor getPresetEditor() { - Holder holder = this.getWorldType().preset(); -- return holder != null ? PresetEditor.EDITORS.get(holder.unwrapKey()) : null; -+ return holder != null ? holder.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map + Holder preset = this.getWorldType().preset(); +- return preset != null ? PresetEditor.EDITORS.get(preset.unwrapKey()) : null; ++ return preset != null ? preset.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map } public List getNormalPresetList() { 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 7bd2834a28..f34ed9e0f1 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,11 +1,29 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java -@@ -331,6 +_,8 @@ +@@ -495,6 +_,8 @@ this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load"))); - PackRepository packrepository = ServerPacksSource.createPackRepository(p_333651_); + PackRepository packRepository = ServerPacksSource.createPackRepository(worldAccess); -+ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(p_333651_, p_333651_.getLevelDirectory()); ++ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(worldAccess, worldAccess.getLevelDirectory()); + - WorldStem worldstem; + WorldStem worldStem; try { - worldstem = this.loadWorldStem(p_332568_, p_334192_, packrepository); + worldStem = this.loadWorldStem(worldAccess, levelDataTag, safeMode, packRepository); +@@ -537,6 +_,8 @@ + WorldData data = worldDataAndGenSettings.data(); + boolean oldCustomized = worldDataAndGenSettings.genSettings().options().isOldCustomizedWorld(); + boolean unstable = data.worldGenSettingsLifecycle() != Lifecycle.stable(); ++ if (unstable && data instanceof PrimaryLevelData primaryData) ++ unstable = !primaryData.hasConfirmedExperimentalWarning(); + if (!oldCustomized && !unstable) { + this.openWorldLoadBundledResourcePack(worldAccess, worldStem, packRepository, onCancel); + } else { +@@ -553,6 +_,8 @@ + private void openWorldLoadBundledResourcePack( + final LevelStorageSource.LevelStorageAccess worldAccess, final WorldStem worldStem, final PackRepository packRepository, final Runnable onCancel + ) { ++ if (worldStem.worldDataAndGenSettings().data() instanceof PrimaryLevelData primaryLevelData) ++ primaryLevelData.withConfirmedWarning(worldStem.worldDataAndGenSettings().data().worldGenSettingsLifecycle() != Lifecycle.stable()); + DownloadedPackSource packSource = this.minecraft.getDownloadedPackSource(); + this.loadBundledResourcePack(packSource, worldAccess).thenApply(unused -> true).exceptionallyComposeAsync(t -> { + LOGGER.warn("Failed to load pack: ", t); 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 d01d5d550e..4612184de5 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,19 +1,19 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java @@ -83,6 +_,7 @@ - static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted"); - static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join"); - static final Logger LOGGER = LogUtils.getLogger(); + private static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted"); + private static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join"); + private static final Logger LOGGER = LogUtils.getLogger(); + private static final Identifier FORGE_EXPERIMENTAL_WARNING_ICON = Identifier.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png"); - static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED); - static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED); - static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD); -@@ -489,6 +_,19 @@ + private static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED); + private static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED); + private static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD); +@@ -483,6 +_,19 @@ } } + // FORGE: Patch in experimental warning icon for worlds in the world selection screen -+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) { ++ private void renderExperimentalWarning(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, int top, int left) { + if (this.summary.isLifecycleExperimental()) { + int leftStart = left + this.list.getRowWidth(); + guiGraphics.blit(RenderPipelines.GUI_TEXTURED, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32); @@ -27,12 +27,12 @@ + @Override public Component getNarration() { - Component component = Component.translatable( -@@ -515,6 +_,7 @@ - this.infoText.setPosition(i, this.getContentY() + 9 + 9 + 3); - this.infoText.render(p_424437_, p_425443_, p_425024_, p_424775_); - p_424437_.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32); -+ renderExperimentalWarning(p_424437_, p_425443_, p_425024_, this.getContentY(), this.getContentX()); - if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && (this.minecraft.options.touchscreen().get() || p_430261_)) { - p_424437_.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544); - int j = p_425443_ - this.getContentX(); + Component entryNarration = Component.translatable( +@@ -512,6 +_,7 @@ + this.infoText.setPosition(textX, this.getContentY() + 9 + 9 + 3); + this.infoText.extractRenderState(graphics, mouseX, mouseY, a); + graphics.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32); ++ renderExperimentalWarning(graphics, mouseX, mouseY, this.getContentY(), this.getContentX()); + if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && hovered) { + graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544); + int relX = mouseX - this.getContentX(); diff --git a/patches/minecraft/net/minecraft/client/main/Main.java.patch b/patches/minecraft/net/minecraft/client/main/Main.java.patch index 5aff77b2c4..30246c1da7 100644 --- a/patches/minecraft/net/minecraft/client/main/Main.java.patch +++ b/patches/minecraft/net/minecraft/client/main/Main.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/client/main/Main.java +++ b/net/minecraft/client/main/Main.java -@@ -116,8 +_,8 @@ +@@ -159,8 +_,8 @@ CrashReport.preload(); logger = LogUtils.getLogger(); - s1 = "Bootstrap"; + stage = "Bootstrap"; - Bootstrap.bootStrap(); - ClientBootstrap.bootstrap(); + net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(Bootstrap::bootStrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); + net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(ClientBootstrap::bootstrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get()); Bootstrap.validate(); - s1 = "Argument parsing"; + stage = "Argument parsing"; diff --git a/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch b/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch index 7c9ca4033e..8309858145 100644 --- a/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch +++ b/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch @@ -1,36 +1,36 @@ --- a/net/minecraft/client/model/HumanoidModel.java +++ b/net/minecraft/client/model/HumanoidModel.java -@@ -308,6 +_,8 @@ +@@ -391,6 +_,8 @@ break; case SPEAR: - SpearAnimations.thirdPersonHandUse(this.rightArm, this.head, true, p_362371_.getUseItemStackForArm(HumanoidArm.RIGHT), p_362371_); + SpearAnimations.thirdPersonHandUse(this.rightArm, this.head, true, state.getUseItemStackForArm(HumanoidArm.RIGHT), state); + default: -+ p_362371_.rightArmPose.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT); ++ state.rightArmPose.applyTransform(this, state, net.minecraft.world.entity.HumanoidArm.RIGHT); } } -@@ -355,6 +_,8 @@ +@@ -436,6 +_,8 @@ break; case SPEAR: - SpearAnimations.thirdPersonHandUse(this.leftArm, this.head, false, p_363560_.getUseItemStackForArm(HumanoidArm.LEFT), p_363560_); + SpearAnimations.thirdPersonHandUse(this.leftArm, this.head, false, state.getUseItemStackForArm(HumanoidArm.LEFT), state); + default: -+ p_363560_.leftArmPose.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT); ++ state.leftArmPose.applyTransform(this, state, net.minecraft.world.entity.HumanoidArm.LEFT); } } -@@ -427,7 +_,7 @@ +@@ -497,7 +_,7 @@ } @OnlyIn(Dist.CLIENT) -- public static enum ArmPose { -+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum { +- public enum ArmPose { ++ public enum ArmPose implements net.minecraftforge.common.IExtensibleEnum { EMPTY(false, false), ITEM(false, false), BLOCK(false, false), -@@ -453,10 +_,29 @@ - ArmPose(final boolean p_102896_, final boolean p_456170_) { - this.twoHanded = p_102896_; - this.affectsOffhandPose = p_456170_; +@@ -523,10 +_,29 @@ + ArmPose(final boolean twoHanded, final boolean affectsOffhandPose) { + this.twoHanded = twoHanded; + this.affectsOffhandPose = affectsOffhandPose; + this.forgeArmPose = null; } diff --git a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch index cd7ef0833c..2c26bba477 100644 --- a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch +++ b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java -@@ -524,6 +_,7 @@ - builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition58); - } - }); -+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder); - ImmutableMap immutablemap = builder.build(); - List list = ModelLayers.getKnownLocations().filter(p_171117_ -> !immutablemap.containsKey(p_171117_)).toList(); - if (!list.isEmpty()) { +@@ -557,6 +_,7 @@ + result.put(ModelLayers.PALE_OAK_CHEST_BOAT, chestBoatModel); + result.put(ModelLayers.MANGROVE_BOAT, boatModel); + result.put(ModelLayers.MANGROVE_CHEST_BOAT, chestBoatModel); ++ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(result); + ImmutableMap definitions = result.build(); + List missingDefinitions = ModelLayers.getKnownLocations().filter(l -> !definitions.containsKey(l)).toList(); + if (!missingDefinitions.isEmpty()) { diff --git a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch b/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch deleted file mode 100644 index d45ba84155..0000000000 --- a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/net/minecraft/client/model/geom/ModelLayers.java -+++ b/net/minecraft/client/model/geom/ModelLayers.java -@@ -341,15 +_,18 @@ - } - - public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) { -- return createLocation("sign/standing/" + p_171292_.name(), "main"); -+ Identifier location = Identifier.parse(p_171292_.name()); -+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/standing/" + location.getPath()), "main"); - } - - public static ModelLayerLocation createWallSignModelName(WoodType p_363532_) { -- return createLocation("sign/wall/" + p_363532_.name(), "main"); -+ Identifier location = Identifier.parse(p_363532_.name()); -+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main"); - } - - public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_, HangingSignRenderer.AttachmentType p_378070_) { -- return createLocation("hanging_sign/" + p_252225_.name() + "/" + p_378070_.getSerializedName(), "main"); -+ Identifier location = Identifier.parse(p_252225_.name()); -+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + p_378070_.getSerializedName()), "main"); - } - - public static Stream getKnownLocations() { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch index 6b8bb5b98a..18309f6ec9 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java +++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java -@@ -74,6 +_,8 @@ - this.writeProfileKeyPair(profilekeypair); - return Optional.ofNullable(profilekeypair); - } catch (CryptException | MinecraftClientException | IOException ioexception) { +@@ -75,6 +_,8 @@ + this.writeProfileKeyPair(fetchedKeyPair); + return Optional.ofNullable(fetchedKeyPair); + } catch (IOException | CryptException | MinecraftClientException e) { + // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev + if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE) - LOGGER.error("Failed to retrieve profile key pair", (Throwable)ioexception); + LOGGER.error("Failed to retrieve profile key pair", e); this.writeProfileKeyPair(null); - return p_254074_; + return cachedKeyPair; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch index 1769befafd..e20e0e1797 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/multiplayer/ClientChunkCache.java +++ b/net/minecraft/client/multiplayer/ClientChunkCache.java @@ -64,6 +_,7 @@ - int i = this.storage.getIndex(p_298665_.x, p_298665_.z); - LevelChunk levelchunk = this.storage.getChunk(i); - if (isValidChunk(levelchunk, p_298665_.x, p_298665_.z)) { -+ net.minecraftforge.event.level.ChunkEvent.Unload.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk)); - this.storage.drop(i, levelchunk); + int index = this.storage.getIndex(pos.x(), pos.z()); + LevelChunk currentChunk = this.storage.getChunk(index); + if (isValidChunk(currentChunk, pos.x(), pos.z())) { ++ net.minecraftforge.event.level.ChunkEvent.Unload.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(currentChunk)); + this.storage.drop(index, currentChunk); } } -@@ -123,6 +_,7 @@ - } +@@ -124,6 +_,7 @@ + } - this.level.onChunkLoaded(chunkpos); -+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false)); - return levelchunk; - } + this.level.onChunkLoaded(pos); ++ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(chunk, false)); + return chunk; } + diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch index dd4c4a84db..7502d7fa93 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch @@ -3,8 +3,8 @@ @@ -157,6 +_,7 @@ @Override - public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) { -+ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_298103_.payload(), this.connection)) return; - CustomPacketPayload custompacketpayload = p_298103_.payload(); - if (!(custompacketpayload instanceof DiscardedPayload)) { - PacketUtils.ensureRunningOnSameThread(p_298103_, this, this.minecraft.packetProcessor()); + public void handleCustomPayload(final ClientboundCustomPayloadPacket packet) { ++ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(packet.payload(), this.connection)) return; + CustomPacketPayload payload = packet.payload(); + if (!(payload instanceof DiscardedPayload)) { + PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft.packetProcessor()); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch index f2537afe36..5276b053c2 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java -@@ -182,6 +_,7 @@ - return true; - } - })); +@@ -144,6 +_,7 @@ + } + })); + } + net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch index 8d0dfca66c..e35f76eaec 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java -@@ -209,6 +_,7 @@ - Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED; +@@ -211,6 +_,7 @@ + Component title = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED; if (this.serverData != null && this.serverData.isRealm()) { - this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_.reason(), CommonComponents.GUI_BACK)); -+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) { + this.minecraft.gui.setScreen(new DisconnectedScreen(this.parent, title, details.reason(), CommonComponents.GUI_BACK)); ++ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, details.reason())) { } else { - this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_)); + this.minecraft.gui.setScreen(new DisconnectedScreen(this.parent, title, details)); } -@@ -233,6 +_,7 @@ +@@ -235,6 +_,7 @@ @Override - public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) { -+ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_104545_, this.connection)) return; + public void handleCustomQuery(final ClientboundCustomQueryPacket packet) { ++ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(packet, this.connection)) return; this.updateStatus.accept(Component.translatable("connect.negotiating")); - this.connection.send(new ServerboundCustomQueryAnswerPacket(p_104545_.transactionId(), null)); + this.connection.send(new ServerboundCustomQueryAnswerPacket(packet.transactionId(), null)); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch index a2ad588964..e4aedd7cfb 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -1,94 +1,92 @@ --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java -@@ -143,6 +_,7 @@ - p_389331_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER))); - p_389331_.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_389335_ -> this.calculateBlockTint(p_389335_, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER))); - p_389331_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER))); -+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_389331_); +@@ -165,6 +_,7 @@ + cache.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.FOLIAGE_COLOR_RESOLVER))); + cache.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER))); + cache.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.WATER_COLOR_RESOLVER))); ++ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, cache); }); private final ClientChunkCache chunkSource; private final Deque lightUpdateQueue = Queues.newArrayDeque(); -@@ -155,6 +_,8 @@ +@@ -178,6 +_,8 @@ + private final Long2ObjectMap> destructionProgress = new Long2ObjectOpenHashMap<>(); private final int seaLevel; - private boolean tickDayTime; private static final Set MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT); + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); + private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this); - public void handleBlockChangedAck(int p_233652_) { + public void handleBlockChangedAck(final int sequence) { if (SharedConstants.DEBUG_BLOCK_BREAK) { -@@ -240,6 +_,8 @@ - if (this.canHaveWeather()) { - this.prepareWeather(); - } +@@ -260,6 +_,8 @@ + this.serverSimulationDistance = serverSimulationDistance; + this.environmentAttributes = this.addEnvironmentAttributeLayers(EnvironmentAttributeSystem.builder()).build(); + this.updateSkyBrightness(); + this.gatherCapabilities(); + net.minecraftforge.event.ForgeEventFactory.onLevelLoad(this); } - private EnvironmentAttributeSystem.Builder addEnvironmentAttributeLayers(EnvironmentAttributeSystem.Builder p_450625_) { -@@ -350,6 +_,7 @@ - p_104640_.setOldPosAndRot(); - p_104640_.tickCount++; - Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString()); -+ if (p_104640_.canUpdate()) - p_104640_.tick(); + private EnvironmentAttributeSystem.Builder addEnvironmentAttributeLayers(final EnvironmentAttributeSystem.Builder environmentAttributes) { +@@ -471,6 +_,7 @@ + entity.setOldPosAndRot(); + entity.tickCount++; + Profiler.get().push(entity.typeHolder()::getRegisteredName); ++ if (entity.canUpdate()) + entity.tick(); Profiler.get().pop(); -@@ -401,8 +_,10 @@ +@@ -527,8 +_,10 @@ } - public void addEntity(Entity p_104741_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel(p_104741_, this)) return; - this.removeEntity(p_104741_.getId(), Entity.RemovalReason.DISCARDED); - this.entityStorage.addEntity(p_104741_); -+ p_104741_.onAddedToWorld(); + public void addEntity(final Entity entity) { ++ if (net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel(entity, this)) return; + this.removeEntity(entity.getId(), Entity.RemovalReason.DISCARDED); + this.entityStorage.addEntity(entity); ++ entity.onAddedToLevel(); } - public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) { -@@ -576,6 +_,12 @@ - float p_263349_, - long p_263408_ + public void removeEntity(final int id, final Entity.RemovalReason reason) { +@@ -692,8 +_,10 @@ + final float pitch, + final long seed ) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, x, y, z, sound, source, volume, pitch); + if (event == null || event.getSound() == null) return; -+ p_263335_ = event.getSound(); -+ p_263417_ = event.getSource(); -+ p_263416_ = event.getNewVolume(); -+ p_263349_ = event.getNewPitch(); - if (p_394722_ == this.minecraft.player) { - this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_); + if (except == this.minecraft.player) { +- this.playSound(x, y, z, sound.value(), source, volume, pitch, false, seed); ++ this.playSound(x, y, z, event.getSound().value(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false, seed); } -@@ -585,6 +_,12 @@ - public void playSeededSound( - @Nullable Entity p_263536_, Entity p_396496_, Holder p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_ + } + +@@ -707,8 +_,10 @@ + final float pitch, + final long seed ) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.minecraft.level, p_263536_, p_263518_, p_263487_, p_263538_, p_263524_); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, except, sound, source, volume, pitch); + if (event == null || event.getSound() == null) return; -+ p_263518_ = event.getSound(); -+ p_263487_ = event.getSource(); -+ p_263538_ = event.getNewVolume(); -+ p_263524_ = event.getNewPitch(); - if (p_263536_ == this.minecraft.player) { - this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_396496_, p_263509_)); + if (except == this.minecraft.player) { +- this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(sound.value(), source, volume, pitch, sourceEntity, seed)); ++ this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(event.getSound().value(), event.getSource(), event.getNewVolume(), event.getNewPitch(), sourceEntity, seed)); } -@@ -954,7 +_,7 @@ + } + +@@ -1081,7 +_,7 @@ @Override - public void addDestroyBlockEffect(BlockPos p_171667_, BlockState p_171668_) { -- if (!p_171668_.isAir() && p_171668_.shouldSpawnTerrainParticles()) { -+ if (!p_171668_.isAir() && !net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(p_171668_).addDestroyEffects(p_171668_, this, p_171667_, this.minecraft.particleEngine)) { - VoxelShape voxelshape = p_171668_.getShape(this, p_171667_); - double d0 = 0.25; - voxelshape.forAllBoxes( -@@ -989,6 +_,7 @@ - p_171668_, - p_171667_ + public void addDestroyBlockEffect(final BlockPos pos, final BlockState blockState) { +- if (!blockState.isAir() && blockState.shouldSpawnTerrainParticles()) { ++ if (!blockState.isAir() && !net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(blockState).addDestroyEffects(blockState, this, pos, this.minecraft.particleEngine)) { + VoxelShape shape = blockState.getShape(this, pos); + double density = 0.25; + shape.forAllBoxes( +@@ -1108,6 +_,7 @@ + new TerrainParticle( + this, pos.getX() + x, pos.getY() + y, pos.getZ() + z, relX - 0.5, relY - 0.5, relZ - 0.5, blockState, pos ) -+ .updateSprite(p_171668_, p_171667_) ++ .updateSprite(blockState, pos) ); } } -@@ -998,6 +_,13 @@ +@@ -1117,6 +_,13 @@ } } @@ -99,20 +97,20 @@ + } + + /** @deprecated Forge - Use crack(BlockPos, BlockHitResult) as it has more context and gives more control to modders */ - public void addBreakingBlockEffect(BlockPos p_425440_, Direction p_431745_) { - BlockState blockstate = this.getBlockState(p_425440_); - if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) { -@@ -1033,7 +_,7 @@ - d0 = i + aabb.maxX + 0.1F; + public void addBreakingBlockEffect(final BlockPos pos, final Direction direction) { + BlockState blockState = this.getBlockState(pos); + if (blockState.getRenderShape() != RenderShape.INVISIBLE && blockState.shouldSpawnTerrainParticles()) { +@@ -1152,7 +_,7 @@ + xp = x + shape.maxX + 0.1F; } -- this.minecraft.particleEngine.add(new TerrainParticle(this, d0, d1, d2, 0.0, 0.0, 0.0, blockstate, p_425440_).setPower(0.2F).scale(0.6F)); -+ this.minecraft.particleEngine.add(new TerrainParticle(this, d0, d1, d2, 0.0, 0.0, 0.0, blockstate, p_425440_).updateSprite(blockstate, p_425440_).setPower(0.2F).scale(0.6F)); +- this.minecraft.particleEngine.add(new TerrainParticle(this, xp, yp, zp, 0.0, 0.0, 0.0, blockState, pos).setPower(0.2F).scale(0.6F)); ++ this.minecraft.particleEngine.add(new TerrainParticle(this, xp, yp, zp, 0.0, 0.0, 0.0, blockState, pos).updateSprite(blockState, pos).setPower(0.2F).scale(0.6F)); } } -@@ -1097,6 +_,16 @@ - this.explosionTracker.track(p_429129_, p_428744_, p_431051_, p_431683_); +@@ -1218,6 +_,16 @@ + this.explosionTracker.track(center, radius, blockCount, blockParticles); } + @Override @@ -128,38 +126,38 @@ @OnlyIn(Dist.CLIENT) public static class ClientLevelData implements WritableLevelData { private final boolean hardcore; -@@ -1178,6 +_,7 @@ +@@ -1273,6 +_,7 @@ } - public void setDifficulty(Difficulty p_104852_) { -+ net.minecraftforge.event.ForgeEventFactory.onDifficultyChange(p_104852_, this.difficulty); - this.difficulty = p_104852_; + public void setDifficulty(final Difficulty difficulty) { ++ net.minecraftforge.event.ForgeEventFactory.onDifficultyChange(difficulty, this.difficulty); + this.difficulty = difficulty; } -@@ -1220,6 +_,12 @@ +@@ -1315,6 +_,12 @@ break; default: } + -+ if (p_171712_.isMultipartEntity()) { -+ for (var part : p_171712_.getParts()) { ++ if (entity.isMultipartEntity()) { ++ for (var part : entity.getParts()) { + ClientLevel.this.partEntities.put(part.getId(), part); + } + } } - public void onTrackingEnd(Entity p_171716_) { -@@ -1232,6 +_,15 @@ - ClientLevel.this.dragonParts.removeAll(Arrays.asList(enderdragon.getSubEntities())); + public void onTrackingEnd(final Entity entity) { +@@ -1327,6 +_,15 @@ + ClientLevel.this.dragonParts.removeAll(Arrays.asList(dragon.getSubEntities())); break; default: + } + -+ p_171716_.onRemovedFromWorld(); -+ net.minecraftforge.event.ForgeEventFactory.onEntityLeaveLevel(p_171716_, ClientLevel.this); ++ entity.onRemovedFromLevel(); ++ net.minecraftforge.event.ForgeEventFactory.onEntityLeaveLevel(entity, ClientLevel.this); + -+ if (p_171716_.isMultipartEntity()) { -+ for (var part : p_171716_.getParts()) { ++ if (entity.isMultipartEntity()) { ++ for (var part : entity.getParts()) { + ClientLevel.this.partEntities.remove(part.getId()); + } } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 716329dbe6..93ba01ef1f 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -1,81 +1,83 @@ --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java -@@ -527,6 +_,7 @@ +@@ -531,6 +_,7 @@ this.debugSubscriber.clear(); - this.minecraft.levelRenderer.debugRenderer.refreshRendererList(); + this.minecraft.levelExtractor.debugRenderer.refreshRendererList(); this.minecraft.player.resetPos(); + net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerLogin(this.minecraft.gameMode, this.minecraft.player, this.minecraft.getConnection().connection); - this.minecraft.player.setId(p_105030_.playerId()); + this.minecraft.player.setId(packet.playerId()); this.level.addEntity(this.minecraft.player); this.minecraft.player.input = new KeyboardInput(this.minecraft.options); -@@ -1334,6 +_,8 @@ - localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes()); +@@ -1323,6 +_,8 @@ + newPlayer.getAttributes().assignBaseValues(oldPlayer.getAttributes()); } -+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657 -+ net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerRespawn(this.minecraft.gameMode, localplayer, localplayer1, localplayer1.connection.connection); - this.level.addEntity(localplayer1); - localplayer1.input = new KeyboardInput(this.minecraft.options); - this.minecraft.gameMode.adjustPlayer(localplayer1); -@@ -1489,7 +_,7 @@ - ProblemReporter.ScopedCollector problemreporter$scopedcollector = new ProblemReporter.ScopedCollector(p_404890_.problemPath(), LOGGER); ++ newPlayer.updateSyncFields(oldPlayer); // Forge: fix MC-10657 ++ net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerRespawn(this.minecraft.gameMode, oldPlayer, newPlayer, newPlayer.connection.connection); + this.level.addEntity(newPlayer); + newPlayer.input = new KeyboardInput(this.minecraft.options); + this.minecraft.gameMode.adjustPlayer(newPlayer); +@@ -1478,7 +_,7 @@ + ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(blockEntity.problemPath(), LOGGER); try { -- p_404890_.loadWithComponents(TagValueInput.create(problemreporter$scopedcollector, this.registryAccess, p_104976_.getTag())); -+ p_404890_.onDataPacket(connection, TagValueInput.create(problemreporter$scopedcollector, this.registryAccess, p_104976_.getTag()), this.registryAccess); - } catch (Throwable throwable1) { +- blockEntity.loadWithComponents(TagValueInput.create(reporter, this.registryAccess, packet.getTag())); ++ blockEntity.onDataPacket(connection, TagValueInput.create(reporter, this.registryAccess, packet.getTag()), this.registryAccess); + } catch (Throwable t$) { try { - problemreporter$scopedcollector.close(); -@@ -1666,7 +_,9 @@ + reporter.close(); +@@ -1686,7 +_,9 @@ @Override - public void handleCommands(ClientboundCommandsPacket p_104990_) { - PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft.packetProcessor()); -- this.commands = new CommandDispatcher<>(p_104990_.getRoot(CommandBuildContext.simple(this.registryAccess, this.enabledFeatures), COMMAND_NODE_BUILDER)); + public void handleCommands(final ClientboundCommandsPacket packet) { + PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft.packetProcessor()); +- this.commands = new CommandDispatcher<>(packet.getRoot(CommandBuildContext.simple(this.registryAccess, this.enabledFeatures), COMMAND_NODE_BUILDER)); + var context = CommandBuildContext.simple(this.registryAccess, this.enabledFeatures); -+ this.commands = new CommandDispatcher<>(p_104990_.getRoot(context, COMMAND_NODE_BUILDER)); ++ this.commands = new CommandDispatcher<>(packet.getRoot(context, COMMAND_NODE_BUILDER)); + this.commands = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.commands, context); } @Override -@@ -1767,6 +_,7 @@ - if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) { - recipeupdatelistener.recipesUpdated(); +@@ -1787,6 +_,7 @@ + if (this.minecraft.gui.screen() instanceof RecipeUpdateListener updateListener) { + updateListener.recipesUpdated(); } -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRecipesUpdated(p_364029_); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onRecipesUpdated(recipeBook); } @Override -@@ -1805,6 +_,8 @@ +@@ -1830,6 +_,8 @@ this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures); - List list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems()); - this.searchTrees.updateCreativeTags(list1); + List searchItems = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems()); + this.searchTrees.updateCreativeTags(searchItems); + + net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registryAccess, true, this.connection.isMemoryConnection()); } @Override -@@ -2631,6 +_,8 @@ +@@ -2652,7 +_,9 @@ + } } - public void sendChat(String p_249888_) { -+ p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_); -+ if (p_249888_.isEmpty()) return; - Instant instant = Instant.now(); - long i = Crypt.SaltSupplier.getLong(); - LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate(); -@@ -2639,6 +_,7 @@ +- public void sendChat(final String content) { ++ public void sendChat(String content) { ++ content = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(content); ++ if (content.isEmpty()) return; + Instant timeStamp = Instant.now(); + long salt = Crypt.SaltSupplier.getLong(); + LastSeenMessagesTracker.Update lastSeenUpdate = this.lastSeenMessages.generateAndApplyUpdate(); +@@ -2661,6 +_,7 @@ } - public void sendCommand(String p_250092_) { -+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return; - SignableCommand signablecommand = SignableCommand.of(this.commands.parse(p_250092_, this.suggestionsProvider)); - if (signablecommand.arguments().isEmpty()) { - this.send(new ServerboundChatCommandPacket(p_250092_)); -@@ -2655,6 +_,7 @@ + public void sendCommand(final String command) { ++ if (net.minecraftforge.client.ClientCommandHandler.runCommand(command)) return; + SignableCommand signableCommand = SignableCommand.of(this.commands.parse(command, this.suggestionsProvider)); + if (signableCommand.arguments().isEmpty()) { + this.send(new ServerboundChatCommandPacket(command)); +@@ -2677,6 +_,7 @@ } - public void sendUnattendedCommand(String p_407213_, @Nullable Screen p_406262_) { -+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_407213_)) return; - switch (this.verifyCommand(p_407213_)) { + public void sendUnattendedCommand(final String command, final @Nullable Screen screenAfterCommand) { ++ if (net.minecraftforge.client.ClientCommandHandler.runCommand(command)) return; + switch (this.verifyCommand(command)) { case NO_ISSUES: - this.send(new ServerboundChatCommandPacket(p_407213_)); + this.send(new ServerboundChatCommandPacket(command)); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index 3edc8e15d7..3f564487bf 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch @@ -1,174 +1,173 @@ --- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java +++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java -@@ -112,6 +_,7 @@ +@@ -115,6 +_,7 @@ } - public boolean destroyBlock(BlockPos p_105268_) { -+ if (minecraft.player.getMainHandItem().onBlockStartBreak(p_105268_, minecraft.player)) return false; - if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) { + public boolean destroyBlock(final BlockPos pos) { ++ if (minecraft.player.getMainHandItem().onBlockStartBreak(pos, minecraft.player)) return false; + if (this.minecraft.player.blockActionRestricted(this.minecraft.level, pos, this.localPlayerMode)) { return false; - } else { -@@ -126,9 +_,8 @@ - } else if (blockstate.isAir()) { - return false; - } else { -- block.playerWillDestroy(level, p_105268_, blockstate, this.minecraft.player); - FluidState fluidstate = level.getFluidState(p_105268_); -- boolean flag = level.setBlock(p_105268_, fluidstate.createLegacyBlock(), 11); -+ boolean flag = blockstate.onDestroyedByPlayer(level, p_105268_, minecraft.player, false, fluidstate); - if (flag) { - block.destroy(level, p_105268_, blockstate); - } -@@ -157,6 +_,7 @@ - } + } +@@ -134,9 +_,8 @@ + return false; + } - this.startPrediction(this.minecraft.level, p_233757_ -> { -+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK)) - this.destroyBlock(p_105270_); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_); - }); -@@ -170,6 +_,7 @@ - this.connection - .send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_)); - } -+ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK); - - BlockState blockstate1 = this.minecraft.level.getBlockState(p_105270_); - this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate1, 0.0F); -@@ -180,9 +_,11 @@ - this.startPrediction(this.minecraft.level, p_233728_ -> { - boolean flag = !blockstate1.isAir(); - if (flag && this.destroyProgress == 0.0F) { -+ if (event != null && !event.getUseBlock().isDenied()) - blockstate1.attack(this.minecraft.level, p_105270_, this.minecraft.player); - } - -+ if (event != null && !event.getUseItem().isDenied()) { - if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) { - this.destroyBlock(p_105270_); - } else { -@@ -193,6 +_,7 @@ - this.destroyTicks = 0.0F; - this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage()); - } -+ } - - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_); - }); -@@ -233,6 +_,7 @@ +- oldBlock.playerWillDestroy(level, pos, oldState, this.minecraft.player); + FluidState fluidState = level.getFluidState(pos); +- boolean changed = level.setBlock(pos, fluidState.createLegacyBlock(), 11); ++ boolean changed = oldState.onDestroyedByPlayer(level, pos, minecraft.player, false, fluidState); + if (changed) { + oldBlock.destroy(level, pos, oldState); + } +@@ -165,6 +_,7 @@ } - this.startPrediction(this.minecraft.level, p_233753_ -> { -+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK)) - this.destroyBlock(p_105284_); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_); + this.startPrediction(this.minecraft.level, sequence -> { ++ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK)) + this.destroyBlock(pos); + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence); }); -@@ -245,7 +_,7 @@ - } else { - this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_); - if (this.destroyTicks % 4.0F == 0.0F) { -- SoundType soundtype = blockstate.getSoundType(); -+ SoundType soundtype = blockstate.getSoundType(this.minecraft.level, p_105284_, this.minecraft.player); - this.minecraft - .getSoundManager() - .play( -@@ -262,6 +_,7 @@ +@@ -178,6 +_,7 @@ + this.connection + .send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, direction)); + } ++ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK); - this.destroyTicks++; - this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F)); -+ if (net.minecraftforge.event.ForgeEventFactory.onLeftClickBlockHold(this.minecraft.player, p_105284_, p_105285_).getUseItem().isDenied()) return true; - if (this.destroyProgress >= 1.0F) { - this.isDestroying = false; - if (SharedConstants.DEBUG_BLOCK_BREAK) { -@@ -304,7 +_,7 @@ + BlockState state = this.minecraft.level.getBlockState(pos); + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, 0.0F); +@@ -188,9 +_,11 @@ + this.startPrediction(this.minecraft.level, sequence -> { + boolean notAir = !state.isAir(); + if (notAir && this.destroyProgress == 0.0F) { ++ if (event != null && !event.getUseBlock().isDenied()) + state.attack(this.minecraft.level, pos, this.minecraft.player); + } - private boolean sameDestroyTarget(BlockPos p_105282_) { - ItemStack itemstack = this.minecraft.player.getMainHandItem(); -- return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameComponents(itemstack, this.destroyingItem); -+ return p_105282_.equals(this.destroyBlockPos) && !destroyingItem.shouldCauseBlockBreakReset(itemstack); ++ if (event != null && !event.getUseItem().isDenied()) { + if (notAir && state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos) >= 1.0F) { + this.destroyBlock(pos); + } else { +@@ -201,6 +_,7 @@ + this.destroyTicks = 0.0F; + this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage()); + } ++ } + + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence); + }); +@@ -242,6 +_,7 @@ + } + + this.startPrediction(this.minecraft.level, sequence -> { ++ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK)) + this.destroyBlock(pos); + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence); + }); +@@ -255,7 +_,7 @@ + + this.destroyProgress = this.destroyProgress + state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos); + if (this.destroyTicks % 4.0F == 0.0F) { +- SoundType soundType = state.getSoundType(); ++ SoundType soundType = state.getSoundType(this.minecraft.level, pos, this.minecraft.player); + this.minecraft + .getSoundManager() + .play( +@@ -272,6 +_,7 @@ + + this.destroyTicks++; + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, Mth.clamp(this.destroyProgress, 0.0F, 1.0F)); ++ if (net.minecraftforge.event.ForgeEventFactory.onLeftClickBlockHold(this.minecraft.player, pos, direction).getUseItem().isDenied()) return true; + if (this.destroyProgress >= 1.0F) { + this.isDestroying = false; + if (SharedConstants.DEBUG_BLOCK_BREAK) { +@@ -279,6 +_,7 @@ + } + + this.startPrediction(this.minecraft.level, sequence -> { ++ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK)) + this.destroyBlock(pos); + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, direction, sequence); + }); +@@ -313,7 +_,7 @@ + + private boolean sameDestroyTarget(final BlockPos pos) { + ItemStack selected = this.minecraft.player.getMainHandItem(); +- return pos.equals(this.destroyBlockPos) && ItemStack.isSameItemSameComponents(selected, this.destroyingItem); ++ return pos.equals(this.destroyBlockPos) && !destroyingItem.shouldCauseBlockBreakReset(selected); } private void ensureHasSentCarriedItem() { -@@ -332,12 +_,23 @@ - private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) { - BlockPos blockpos = p_233749_.getBlockPos(); - ItemStack itemstack = p_233747_.getItemInHand(p_233748_); -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(p_233747_, p_233748_, blockpos, p_233749_); +@@ -341,13 +_,24 @@ + private InteractionResult performUseItemOn(final LocalPlayer player, final InteractionHand hand, final BlockHitResult blockHit) { + BlockPos pos = blockHit.getBlockPos(); + ItemStack itemStack = player.getItemInHand(hand); ++ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(player, hand, pos, blockHit); + if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock.BUS.post(event)) { + return event.getCancellationResult(); + } if (this.localPlayerMode == GameType.SPECTATOR) { return InteractionResult.CONSUME; - } else { -- boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty(); -+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); -+ if (!event.getUseItem().isDenied()) { -+ InteractionResult result = itemstack.onItemUseFirst(useoncontext); -+ if (result != InteractionResult.PASS) { -+ return result; -+ } -+ } -+ boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_); - boolean flag1 = p_233747_.isSecondaryUseActive() && flag; -- if (!flag1) { -+ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !flag1)) { - BlockState blockstate = this.minecraft.level.getBlockState(blockpos); - if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) { - return InteractionResult.FAIL; -@@ -358,8 +_,10 @@ - } + } + +- boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty(); ++ UseOnContext context = new UseOnContext(player, hand, blockHit); ++ if (!event.getUseItem().isDenied()) { ++ InteractionResult result = itemStack.onItemUseFirst(context); ++ if (result != InteractionResult.PASS) { ++ return result; ++ } ++ } ++ boolean haveSomethingInOurHands = !player.getMainHandItem().doesSneakBypassUse(player.level(), pos, player) || !player.getOffhandItem().doesSneakBypassUse(player.level(), pos, player); + boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands; +- if (!suppressUsingBlock) { ++ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !suppressUsingBlock)) { + BlockState blockState = this.minecraft.level.getBlockState(pos); + if (!this.connection.isFeatureEnabled(blockState.getBlock().requiredFeatures())) { + return InteractionResult.FAIL; +@@ -366,8 +_,10 @@ + } + } + +- if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack)) { +- UseOnContext context = new UseOnContext(player, hand, blockHit); ++ if (event.getUseItem().isDenied()) { ++ return InteractionResult.PASS; ++ } ++ if (event.getUseItem().isAllowed() || (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack))) { + InteractionResult success; + if (player.hasInfiniteMaterials()) { + int count = itemStack.getCount(); +@@ -398,6 +_,12 @@ + return packet; } -- if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack)) { -- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); -+ if (event.getUseItem().isDenied()) { -+ return InteractionResult.PASS; ++ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem(player, hand); ++ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem.BUS.post(event)) { ++ interactionResult.setValue(event.getCancellationResult()); ++ return packet; + } -+ if (event.getUseItem().isAllowed() || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack))) { - InteractionResult interactionresult2; - if (p_233747_.hasInfiniteMaterials()) { - int i = itemstack.getCount(); -@@ -393,6 +_,11 @@ - mutableobject.setValue(InteractionResult.PASS); - return serverbounduseitempacket; - } else { -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem(p_233722_, p_233723_); -+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem.BUS.post(event)) { -+ mutableobject.setValue(event.getCancellationResult()); -+ return serverbounduseitempacket; -+ } - InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_); - ItemStack itemstack1; - if (interactionresult instanceof InteractionResult.Success interactionresult$success) { -@@ -403,6 +_,9 @@ ++ + InteractionResult resultHolder = itemStack.use(this.minecraft.level, player, hand); + ItemStack result; + if (resultHolder instanceof InteractionResult.Success success) { +@@ -408,6 +_,9 @@ - if (itemstack1 != itemstack) { - p_233722_.setItemInHand(p_233723_, itemstack1); -+ if (itemstack1.isEmpty()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_); -+ } - } + if (result != itemStack) { + player.setItemInHand(hand, result); ++ if (result.isEmpty()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemStack, hand); ++ } + } - mutableobject.setValue(interactionresult); -@@ -434,6 +_,10 @@ - public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) { + interactionResult.setValue(resultHolder); +@@ -445,6 +_,10 @@ this.ensureHasSentCarriedItem(); - this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_)); + Vec3 location = hitResult.getLocation().subtract(entity.getX(), entity.getY(), entity.getZ()); + this.connection.send(new ServerboundInteractPacket(entity.getId(), hand, location, player.isShiftKeyDown())); + if (this.localPlayerMode != GameType.SPECTATOR) { -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract(p_105227_, p_105229_, p_105228_); -+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract.BUS.post(event)) return event.getCancellationResult(); -+ } - return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_)); - } - -@@ -441,6 +_,10 @@ - this.ensureHasSentCarriedItem(); - Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ()); - this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3)); -+ if (this.localPlayerMode != GameType.SPECTATOR) { -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific(p_105231_, p_105234_, p_105232_, vec3); ++ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, location); + if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific.BUS.post(event)) return event.getCancellationResult(); + } - return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_)); + return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : player.interactOn(entity, hand, location); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch index 2c606bc9ac..09c2535550 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch @@ -3,8 +3,8 @@ @@ -72,6 +_,7 @@ } - protected void setGameMode(GameType p_105318_) { -+ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameType(this, this.gameMode, p_105318_); - this.gameMode = p_105318_; + protected void setGameMode(final GameType gameMode) { ++ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameType(this, this.gameMode, gameMode); + this.gameMode = gameMode; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch index eb8bfd36b0..1028693e19 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -6,5 +6,5 @@ private ServerData.State state = ServerData.State.INITIAL; + public net.minecraftforge.client.ExtendedServerListData forgeData = null; - public ServerData(String p_105375_, String p_105376_, ServerData.Type p_297678_) { - this.name = p_105375_; + public ServerData(final String name, final String ip, final ServerData.Type type) { + this.name = name; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch index d8f717c01a..b30ddd96a7 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/multiplayer/ServerStatusPinger.java +++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java -@@ -107,6 +_,7 @@ - p_105461_.run(); +@@ -118,6 +_,7 @@ + onPersistentDataChange.run(); } }); -+ net.minecraftforge.client.ForgeHooksClient.processForgeListPingData(serverstatus, p_105460_); ++ net.minecraftforge.client.ForgeHooksClient.processForgeListPingData(status, data); this.pingStart = Util.getMillis(); connection.send(new ServerboundPingRequestPacket(this.pingStart)); this.success = true; -@@ -152,7 +_,7 @@ - } - - void pingLegacyServer(InetSocketAddress p_171812_, final ServerAddress p_300887_, final ServerData p_171813_, EventLoopGroupHolder p_457463_) { -- new Bootstrap().group(p_457463_.eventLoopGroup()).handler(new ChannelInitializer() { -+ new Bootstrap().group(p_457463_.eventLoopGroup(true)).handler(new ChannelInitializer() { +@@ -174,7 +_,7 @@ + private void pingLegacyServer( + final InetSocketAddress resolvedAddress, final ServerAddress rawAddress, final ServerData data, final EventLoopGroupHolder eventLoopGroupHolder + ) { +- new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup()).handler(new ChannelInitializer() { ++ new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup(true)).handler(new ChannelInitializer() { @Override - protected void initChannel(Channel p_105498_) { + protected void initChannel(final Channel channel) { try { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/SessionSearchTrees.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/SessionSearchTrees.java.patch index 67f10605e1..fd72487550 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/SessionSearchTrees.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/SessionSearchTrees.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/SessionSearchTrees.java +++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java -@@ -34,8 +_,8 @@ +@@ -33,8 +_,8 @@ private static final SessionSearchTrees.Key RECIPE_COLLECTIONS = new SessionSearchTrees.Key(); public static final SessionSearchTrees.Key CREATIVE_NAMES = new SessionSearchTrees.Key(); public static final SessionSearchTrees.Key CREATIVE_TAGS = new SessionSearchTrees.Key(); @@ -11,25 +11,25 @@ private CompletableFuture> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty()); private final Map reloaders = new IdentityHashMap<>(); -@@ -90,44 +_,52 @@ +@@ -89,44 +_,52 @@ } - public void updateCreativeTags(List p_344581_) { + public void updateCreativeTags(final List items) { + for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys().entrySet()) this.register( - CREATIVE_TAGS, + entry.getValue(), () -> { -- CompletableFuture completablefuture = this.creativeByTagSearch; +- CompletableFuture previous = this.creativeByTagSearch; - this.creativeByTagSearch = CompletableFuture.supplyAsync( -- () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), p_344581_), Util.backgroundExecutor() +- () -> new IdSearchTree<>(itemStack -> itemStack.tags().map(TagKey::location), items), Util.backgroundExecutor() - ); -+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_344581_ : List.copyOf(entry.getKey().getDisplayItems()); -+ CompletableFuture completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY); ++ var tabItems = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? items : List.copyOf(entry.getKey().getDisplayItems()); ++ CompletableFuture previous = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY); + this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync( -+ () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), items), Util.backgroundExecutor() ++ () -> new IdSearchTree<>(itemStack -> itemStack.tags().map(TagKey::location), tabItems), Util.backgroundExecutor() + )); - completablefuture.cancel(true); + previous.cancel(true); } ); } @@ -39,29 +39,29 @@ + return this.getSearchTree(CREATIVE_TAGS); } - public void updateCreativeTooltips(HolderLookup.Provider p_343364_, List p_342500_) { + public void updateCreativeTooltips(final HolderLookup.Provider registries, final List itemStacks) { + for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys().entrySet()) this.register( - CREATIVE_NAMES, + entry.getValue(), () -> { -+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_342500_ : List.copyOf(entry.getKey().getDisplayItems()); - Item.TooltipContext item$tooltipcontext = Item.TooltipContext.of(p_343364_); - TooltipFlag tooltipflag = TooltipFlag.Default.NORMAL.asCreative(); -- CompletableFuture completablefuture = this.creativeByNameSearch; ++ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? itemStacks : List.copyOf(entry.getKey().getDisplayItems()); + Item.TooltipContext tooltipContext = Item.TooltipContext.of(registries); + TooltipFlag tooltipFlag = TooltipFlag.Default.NORMAL.asCreative(); +- CompletableFuture previous = this.creativeByNameSearch; - this.creativeByNameSearch = CompletableFuture.supplyAsync( -+ CompletableFuture completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY); ++ CompletableFuture previous = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY); + this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync( () -> new FullTextSearchTree<>( - p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag), - p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::identifier).stream(), -- p_342500_ + itemStack -> getTooltipLines(Stream.of(itemStack), tooltipContext, tooltipFlag), + itemStack -> itemStack.typeHolder().unwrapKey().map(ResourceKey::identifier).stream(), +- itemStacks + items ), Util.backgroundExecutor() - ); + )); - completablefuture.cancel(true); + previous.cancel(true); } ); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch index bcc66ef5e3..a44448243a 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch @@ -1,41 +1,46 @@ --- a/net/minecraft/client/multiplayer/chat/ChatListener.java +++ b/net/minecraft/client/multiplayer/chat/ChatListener.java -@@ -133,7 +_,9 @@ - Instant instant = Instant.now(); - this.handleMessage(null, () -> { - Component component = p_251256_.decorate(p_250375_); -- this.minecraft.gui.getChat().addMessage(component); -+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_251256_, component, Util.NIL_UUID); -+ if (forgeComponent == null) return false; -+ this.minecraft.gui.getChat().addMessage(forgeComponent); - this.narrateChatMessage(p_251256_, p_250375_); - this.logSystemMessage(component, instant); - this.previousMessageTime = Util.getMillis(); -@@ -152,12 +_,16 @@ - MessageSignature messagesignature = p_249430_.signature(); - FilterMask filtermask = p_249430_.filterMask(); - if (filtermask.isEmpty()) { -- this.minecraft.gui.getChat().addMessage(p_249231_, messagesignature, guimessagetag); -+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_249231_, p_249430_, p_249430_.sender()); -+ if (forgeComponent == null) return false; -+ this.minecraft.gui.getChat().addMessage(forgeComponent, messagesignature, guimessagetag); - this.narrateChatMessage(p_251766_, p_249430_.decoratedContent()); - } else { - Component component = filtermask.applyWithFormatting(p_249430_.signedContent()); - if (component != null) { -- this.minecraft.gui.getChat().addMessage(p_251766_.decorate(component), messagesignature, guimessagetag); -+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_251766_.decorate(component), p_249430_, p_249430_.sender()); +@@ -142,6 +_,8 @@ + LocalPlayer receiver = this.minecraft.player; + if (receiver != null && receiver.chatAbilities().canReceivePlayerMessages()) { + Component decoratedMessage = boundChatType.decorate(message); ++ decoratedMessage = net.minecraftforge.client.ForgeHooksClient.onClientChat(boundChatType, decoratedMessage, Util.NIL_UUID); ++ if (decoratedMessage == null) return false; + this.minecraft.gui.hud.getChat().addPlayerMessage(decoratedMessage, null, GuiMessageTag.system()); + this.narrateChatMessage(boundChatType, message); + this.logSystemMessage(decoratedMessage, received); +@@ -177,12 +_,16 @@ + MessageSignature signature = message.signature(); + FilterMask filterMask = message.filterMask(); + if (filterMask.isEmpty()) { +- this.minecraft.gui.hud.getChat().addPlayerMessage(decoratedMessage, signature, tag); ++ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(boundChatType, decoratedMessage, message, message.sender()); + if (forgeComponent == null) return false; -+ this.minecraft.gui.getChat().addMessage(forgeComponent, messagesignature, guimessagetag); - this.narrateChatMessage(p_251766_, component); ++ this.minecraft.gui.hud.getChat().addPlayerMessage(forgeComponent, signature, tag); + this.narrateChatMessage(boundChatType, message.decoratedContent()); + } else { + Component filteredContent = filterMask.applyWithFormatting(message.signedContent()); + if (filteredContent != null) { +- this.minecraft.gui.hud.getChat().addPlayerMessage(boundChatType.decorate(filteredContent), signature, tag); ++ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(boundChatType, boundChatType.decorate(filteredContent), message, message.sender()); ++ if (forgeComponent == null) return false; ++ this.minecraft.gui.hud.getChat().addPlayerMessage(forgeComponent, signature, tag); + this.narrateChatMessage(boundChatType, filteredContent); + } } - } -@@ -190,6 +_,8 @@ +@@ -216,12 +_,14 @@ + chatLog.push(LoggedChatMessage.system(message, timeStamp)); + } - public void handleSystemMessage(Component p_240522_, boolean p_240642_) { - if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(p_240522_))) { -+ p_240522_ = net.minecraftforge.client.ForgeHooksClient.onClientSystemMessage(p_240522_, p_240642_); -+ if (p_240522_ == null) return; - if (p_240642_) { - this.minecraft.gui.setOverlayMessage(p_240522_, false); - this.minecraft.getNarrator().saySystemQueued(p_240522_); +- public void handleSystemMessage(final Component message, final boolean remote) { ++ public void handleSystemMessage(Component message, final boolean remote) { + UUID guessedUUID = this.guessChatUUID(message); + if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(guessedUUID)) { + if (guessedUUID == Util.NIL_UUID || !this.minecraft.isFriendOnlyRestricted(guessedUUID)) { + LocalPlayer receiver = this.minecraft.player; + if (receiver != null && receiver.chatAbilities().canReceiveSystemMessages()) { ++ message = net.minecraftforge.client.ForgeHooksClient.onClientSystemMessage(message, remote); ++ if (message == null) return; + if (remote) { + this.minecraft.gui.hud.getChat().addServerSystemMessage(message); + this.logSystemMessage(message, Instant.now()); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/resolver/AddressCheck.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/resolver/AddressCheck.java.patch index 877930652d..c7a72f7f4e 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/resolver/AddressCheck.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/resolver/AddressCheck.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/multiplayer/resolver/AddressCheck.java +++ b/net/minecraft/client/multiplayer/resolver/AddressCheck.java @@ -16,7 +_,7 @@ - boolean isAllowed(ServerAddress p_171830_); + boolean isAllowed(ServerAddress address); static AddressCheck createFromService() { -- final ImmutableList> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class)) -+ final ImmutableList> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class, net.minecraftforge.fml.loading.FMLLoader.class.getClassLoader())) +- final ImmutableList> blockLists = Streams.stream(ServiceLoader.load(BlockListSupplier.class)) ++ final ImmutableList> blockLists = Streams.stream(ServiceLoader.load(BlockListSupplier.class, net.minecraftforge.fml.loading.FMLLoader.class.getClassLoader())) .map(BlockListSupplier::createBlockList) .filter(Objects::nonNull) .collect(ImmutableList.toImmutableList()); diff --git a/patches/minecraft/net/minecraft/client/particle/BlockMarker.java.patch b/patches/minecraft/net/minecraft/client/particle/BlockMarker.java.patch new file mode 100644 index 0000000000..aa886c931d --- /dev/null +++ b/patches/minecraft/net/minecraft/client/particle/BlockMarker.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/particle/BlockMarker.java ++++ b/net/minecraft/client/particle/BlockMarker.java +@@ -13,7 +_,7 @@ + private final SingleQuadParticle.Layer layer; + + private BlockMarker(final ClientLevel level, final double x, final double y, final double z, final BlockState state) { +- super(level, x, y, z, Minecraft.getInstance().getModelManager().getBlockStateModelSet().getParticleMaterial(state).sprite()); ++ super(level, x, y, z, Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(state).particleMaterial(level.getModelDataManager().getAtOrEmpty(x, y, z)).sprite()); + this.gravity = 0.0F; + this.lifetime = 80; + this.hasPhysics = false; diff --git a/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch b/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch index ea28f7412e..e010a4a758 100644 --- a/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/client/particle/FireworkParticles.java +++ b/net/minecraft/client/particle/FireworkParticles.java -@@ -268,6 +_,10 @@ - intlist = IntList.of(DyeColor.BLACK.getFireworkColor()); +@@ -256,6 +_,10 @@ + colors = IntList.of(DyeColor.BLACK.getFireworkColor()); } -+ var factory = net.minecraftforge.client.FireworkShapeFactoryRegistry.get(fireworkexplosion1.shape()); ++ var factory = net.minecraftforge.client.FireworkShapeFactoryRegistry.get(explosion.shape()); + if (factory != null) -+ factory.build(this, flag3, flag4, intlist.toIntArray(), intlist1.toIntArray()); ++ factory.build(this, trail, twinkle, colors.toIntArray(), colors.toIntArray()); + else - switch (fireworkexplosion1.shape()) { + switch (explosion.shape()) { case SMALL_BALL: - this.createParticleBall(0.25, 2, intlist, intlist1, flag3, flag4); + this.createParticleBall(0.25, 2, colors, fadeColors, trail, twinkle); diff --git a/patches/minecraft/net/minecraft/client/particle/FlyTowardsPositionParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/FlyTowardsPositionParticle.java.patch index 39f12380da..b8cbb0e086 100644 --- a/patches/minecraft/net/minecraft/client/particle/FlyTowardsPositionParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/FlyTowardsPositionParticle.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/particle/FlyTowardsPositionParticle.java +++ b/net/minecraft/client/particle/FlyTowardsPositionParticle.java -@@ -114,6 +_,7 @@ - this.x = this.xStart + this.xd * f; - this.y = this.yStart + this.yd * f - f1 * 1.2F; - this.z = this.zStart + this.zd * f; +@@ -107,6 +_,7 @@ + this.x = this.xStart + this.xd * pos; + this.y = this.yStart + this.yd * pos - pp * 1.2F; + this.z = this.zStart + this.zd * pos; + this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box } } diff --git a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch index 5eab6734d0..a35194545d 100644 --- a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java -@@ -207,6 +_,10 @@ +@@ -208,6 +_,10 @@ return Optional.empty(); } diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch index 3934a84305..e2d8d3f95a 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/client/particle/ParticleEngine.java +++ b/net/minecraft/client/particle/ParticleEngine.java -@@ -61,7 +_,7 @@ +@@ -64,7 +_,7 @@ private @Nullable Particle makeParticle( - T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_ + final T options, final double x, final double y, final double z, final double xa, final double ya, final double za ) { -- ParticleProvider particleprovider = (ParticleProvider)this.resourceManager.getProviders().get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType())); -+ ParticleProvider particleprovider = (ParticleProvider)this.resourceManager.getProvider(p_107396_.getType()); - return particleprovider == null - ? null - : particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_, this.random); -@@ -111,6 +_,8 @@ +- ParticleProvider provider = (ParticleProvider)this.resourceManager.getProviders().get(BuiltInRegistries.PARTICLE_TYPE.getId(options.getType())); ++ ParticleProvider provider = (ParticleProvider)this.resourceManager.getProvider(options.getType()); + return provider == null ? null : provider.createParticle(options, this.level, x, y, z, xa, ya, za, this.random); + } + +@@ -114,6 +_,8 @@ return new ItemPickupParticleGroup(this); - } else if (p_428647_ == ParticleRenderType.ELDER_GUARDIANS) { + } else if (type == ParticleRenderType.ELDER_GUARDIANS) { return new ElderGuardianParticleGroup(this); -+ } else if (factories.containsKey(p_428647_)) { -+ return factories.get(p_428647_).apply(this); ++ } else if (factories.containsKey(type)) { ++ return factories.get(type).apply(this); } else { - return (ParticleGroup)(p_428647_ == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, p_428647_)); + return type == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, type); } -@@ -120,8 +_,20 @@ - this.trackedParticleCounts.addTo(p_423291_, p_172283_); +@@ -123,8 +_,20 @@ + this.trackedParticleCounts.addTo(limit, change); } + @@ -34,9 +34,9 @@ + particleRenderOrder.add(type); + } + - public void extract(ParticlesRenderState p_423938_, Frustum p_424803_, Camera p_430521_, float p_426823_) { -- for (ParticleRenderType particlerendertype : RENDER_ORDER) { -+ for (ParticleRenderType particlerendertype : particleRenderOrder) { // Forge: allow custom ParticleRenderType's - ParticleGroup particlegroup = this.particles.get(particlerendertype); - if (particlegroup != null && !particlegroup.isEmpty()) { - p_423938_.add(particlegroup.extractRenderState(p_424803_, p_430521_, p_426823_)); + public void extract(final ParticlesRenderState particlesRenderState, final Frustum frustum, final Camera camera, final float partialTickTime) { +- for (ParticleRenderType particleType : RENDER_ORDER) { ++ for (ParticleRenderType particleType : particleRenderOrder) { // Forge: allow custom ParticleRenderType's + ParticleGroup particles = this.particles.get(particleType); + if (particles != null && !particles.isEmpty()) { + particlesRenderState.add(particles.extractRenderState(frustum, camera, partialTickTime)); diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch index 4549237bda..405fb678b4 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch @@ -8,26 +8,26 @@ private @Nullable Runnable onReload; public ParticleResources() { -@@ -173,14 +_,17 @@ - this.register(ParticleTypes.FIREFLY, FireflyParticle.FireflyProvider::new); +@@ -183,14 +_,17 @@ + this.register(ParticleTypes.SULFUR_CUBE_GOO, BreakingItemParticle.SulfurCubeProvider::new); } + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */ - public void register(ParticleType p_427222_, ParticleProvider p_423729_) { - this.providers.put(BuiltInRegistries.PARTICLE_TYPE.getId(p_427222_), p_423729_); -+ this.providersByName.put(BuiltInRegistries.PARTICLE_TYPE.getKey(p_427222_), p_423729_); + public void register(final ParticleType type, final ParticleProvider provider) { + this.providers.put(BuiltInRegistries.PARTICLE_TYPE.getId(type), provider); ++ this.providersByName.put(BuiltInRegistries.PARTICLE_TYPE.getKey(type), provider); } + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */ - public void register(ParticleType p_427223_, ParticleResources.SpriteParticleRegistration p_423156_) { - ParticleResources.MutableSpriteSet particleresources$mutablespriteset = new ParticleResources.MutableSpriteSet(); - this.spriteSets.put(BuiltInRegistries.PARTICLE_TYPE.getKey(p_427223_), particleresources$mutablespriteset); -- this.providers.put(BuiltInRegistries.PARTICLE_TYPE.getId(p_427223_), p_423156_.create(particleresources$mutablespriteset)); -+ register(p_427223_, p_423156_.create(particleresources$mutablespriteset)); + public void register(final ParticleType type, final ParticleResources.SpriteParticleRegistration provider) { + ParticleResources.MutableSpriteSet spriteSet = new ParticleResources.MutableSpriteSet(); + this.spriteSets.put(BuiltInRegistries.PARTICLE_TYPE.getKey(type), spriteSet); +- this.providers.put(BuiltInRegistries.PARTICLE_TYPE.getId(type), provider.create(spriteSet)); ++ register(type, provider.create(spriteSet)); } @Override -@@ -265,8 +_,13 @@ +@@ -281,8 +_,13 @@ } } diff --git a/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch index ccff6769f1..755c17877b 100644 --- a/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/particle/PortalParticle.java +++ b/net/minecraft/client/particle/PortalParticle.java -@@ -91,6 +_,7 @@ - this.x = this.xStart + this.xd * f2; - this.y = this.yStart + this.yd * f2 + (1.0F - f); - this.z = this.zStart + this.zd * f2; +@@ -85,6 +_,7 @@ + this.x = this.xStart + this.xd * pos; + this.y = this.yStart + this.yd * pos + (1.0F - a); + this.z = this.zStart + this.zd * pos; + this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box } } diff --git a/patches/minecraft/net/minecraft/client/particle/ReversePortalParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/ReversePortalParticle.java.patch index bd115b3485..9e4ae118c2 100644 --- a/patches/minecraft/net/minecraft/client/particle/ReversePortalParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ReversePortalParticle.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/particle/ReversePortalParticle.java +++ b/net/minecraft/client/particle/ReversePortalParticle.java @@ -42,6 +_,7 @@ - this.x = this.x + this.xd * f; - this.y = this.y + this.yd * f; - this.z = this.z + this.zd * f; + this.x = this.x + this.xd * speedMultiplier; + this.y = this.y + this.yd * speedMultiplier; + this.z = this.z + this.zd * speedMultiplier; + this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box } } diff --git a/patches/minecraft/net/minecraft/client/particle/TerrainParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/TerrainParticle.java.patch index 175cec886b..b72b1f8e6a 100644 --- a/patches/minecraft/net/minecraft/client/particle/TerrainParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/TerrainParticle.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/client/particle/TerrainParticle.java +++ b/net/minecraft/client/particle/TerrainParticle.java @@ -43,7 +_,7 @@ - this.rCol = 0.6F; this.gCol = 0.6F; this.bCol = 0.6F; -- if (!p_172458_.is(Blocks.GRASS_BLOCK)) { -+ if (net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(p_172458_).areBreakingParticlesTinted(p_172458_, p_172451_, p_172459_)) { - int i = Minecraft.getInstance().getBlockColors().getColor(p_172458_, p_172451_, p_172459_, 0); - this.rCol *= (i >> 16 & 0xFF) / 255.0F; - this.gCol *= (i >> 8 & 0xFF) / 255.0F; -@@ -99,8 +_,14 @@ + BlockTintSource tintSource = Minecraft.getInstance().getBlockColors().getTintSource(blockState, 0); +- if (tintSource != null) { ++ if (tintSource != null && net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(blockState).areBreakingParticlesTinted(blockState, level, pos)) { + int col = tintSource.colorAsTerrainParticle(blockState, level, pos); + this.rCol *= (col >> 16 & 0xFF) / 255.0F; + this.gCol *= (col >> 8 & 0xFF) / 255.0F; +@@ -93,8 +_,14 @@ ) { - BlockState blockstate = p_331600_.getState(); - return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles() -- ? new TerrainParticle(p_334810_, p_328897_, p_329583_, p_331123_, p_333546_, p_335782_, p_335068_, blockstate) -+ ? (TerrainParticle)new TerrainParticle(p_334810_, p_328897_, p_329583_, p_331123_, p_333546_, p_335782_, p_335068_, blockstate).updateSprite(blockstate, p_331600_.getPos()) + BlockState state = options.getState(); + return !state.isAir() && !state.is(Blocks.MOVING_PISTON) && state.shouldSpawnTerrainParticles() +- ? new TerrainParticle(level, x, y, z, xAux, yAux, zAux, state) ++ ? (TerrainParticle)new TerrainParticle(level, x, y, z, xAux, yAux, zAux, state).updateSprite(state, options.getPos()) : null; + } + + public Particle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. + if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version -+ this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getParticleIcon(state, level, pos)); ++ this.setSprite(Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(state).particleMaterial(level.getModelDataManager().getAt(pos)).sprite()); + return this; } diff --git a/patches/minecraft/net/minecraft/client/particle/VibrationSignalParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/VibrationSignalParticle.java.patch index b8a6f0704d..1233dedf45 100644 --- a/patches/minecraft/net/minecraft/client/particle/VibrationSignalParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/VibrationSignalParticle.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/particle/VibrationSignalParticle.java +++ b/net/minecraft/client/particle/VibrationSignalParticle.java -@@ -80,6 +_,7 @@ - this.x = Mth.lerp(d0, this.x, vec3.x()); - this.y = Mth.lerp(d0, this.y, vec3.y()); - this.z = Mth.lerp(d0, this.z, vec3.z()); +@@ -87,6 +_,7 @@ + this.x = Mth.lerp(alpha, this.x, destination.x()); + this.y = Mth.lerp(alpha, this.y, destination.y()); + this.z = Mth.lerp(alpha, this.z, destination.z()); + this.setPos(this.x, this.y, this.z); // FORGE: Update the particle's bounding box - double d1 = this.x - vec3.x(); - double d2 = this.y - vec3.y(); - double d3 = this.z - vec3.z(); + double dx = this.x - destination.x(); + double dy = this.y - destination.y(); + double dz = this.z - destination.z(); diff --git a/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch index 702677d22b..c0cd60352a 100644 --- a/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/player/AbstractClientPlayer.java +++ b/net/minecraft/client/player/AbstractClientPlayer.java -@@ -133,7 +_,7 @@ +@@ -113,7 +_,7 @@ } } -- return Mth.lerp(p_362521_, 1.0F, f); -+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireFovModifierEvent(this, f, p_362521_).getNewFovModifier(); +- return Mth.lerp(effectScale, 1.0F, modifier); ++ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireFovModifierEvent(this, modifier, effectScale).getNewFovModifier(); } @Override diff --git a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch index 53c7a40455..6ccb204b23 100644 --- a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch @@ -1,35 +1,34 @@ --- a/net/minecraft/client/player/LocalPlayer.java +++ b/net/minecraft/client/player/LocalPlayer.java -@@ -310,6 +_,7 @@ - ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_ +@@ -318,6 +_,7 @@ + ServerboundPlayerActionPacket.Action action = all ? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS : ServerboundPlayerActionPacket.Action.DROP_ITEM; -+ if (isUsingItem() && getUsedItemHand() == InteractionHand.MAIN_HAND && (p_108701_ || getUseItem().getCount() == 1)) stopUsingItem(); // Forge: fix MC-231097 on the clientside - ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_); - this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN)); - return !itemstack.isEmpty(); -@@ -521,7 +_,11 @@ ++ if (isUsingItem() && getUsedItemHand() == InteractionHand.MAIN_HAND && (all || getUseItem().getCount() == 1)) stopUsingItem(); // Forge: fix MC-231097 on the clientside + ItemStack prediction = this.getInventory().removeFromSelected(all); + this.connection.send(new ServerboundPlayerActionPacket(action, BlockPos.ZERO, Direction.DOWN)); + return !prediction.isEmpty(); +@@ -545,7 +_,10 @@ @Override - public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) { -- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), p_108651_, this.getSoundSource(), p_108652_, p_108653_, false); -+ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(p_108651_); -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.level(), this, holder, this.getSoundSource(), p_108652_, p_108653_); + public void playSound(final SoundEvent sound, final float volume, final float pitch) { +- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), volume, pitch, false); ++ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.level(), this, holder, this.getSoundSource(), volume, pitch); + if (event == null || event.getSound() == null) return; + this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), event.getSound().get(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false); -+ } @Override -@@ -761,6 +_,7 @@ +@@ -787,6 +_,7 @@ && this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING) && (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING)); this.input.tick(); + net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.input); this.minecraft.getTutorial().onInput(this.input); - boolean flag3 = false; + boolean wasAutoJump = false; if (this.autoJumpTime > 0) { -@@ -833,8 +_,9 @@ +@@ -859,8 +_,9 @@ } this.wasFallFlying = this.isFallFlying(); @@ -41,7 +40,7 @@ } if (this.isEyeInFluid(FluidTags.WATER)) { -@@ -900,7 +_,7 @@ +@@ -928,7 +_,7 @@ } private boolean shouldStopSwimSprinting() { @@ -50,16 +49,16 @@ } public Portal.Transition getActivePortalLocalTransition() { -@@ -943,6 +_,8 @@ +@@ -973,6 +_,8 @@ @Override public void rideTick() { super.rideTick(); + if (this.wantsToStopRiding() && this.isPassenger()) + this.input.keyPresses = this.input.keyPresses.jump(false); this.handsBusy = false; - if (this.getControlledVehicle() instanceof AbstractBoat abstractboat) { - abstractboat.setInput( -@@ -1120,7 +_,7 @@ + if (this.getControlledVehicle() instanceof AbstractBoat boat) { + boat.setInput(this.input.keyPresses.left(), this.input.keyPresses.right(), this.input.keyPresses.forward(), this.input.keyPresses.backward()); +@@ -1147,7 +_,7 @@ && this.isSprintingPossible(this.getAbilities().flying) && !this.isSlowDueToUsingItem() && (!this.isFallFlying() || this.isUnderWater()) @@ -67,8 +66,8 @@ + && (!this.isMovingSlowly() || this.isUnderWater() || this.canStartSwimming()); } - private boolean vehicleCanSprint(Entity p_265184_) { -@@ -1195,6 +_,17 @@ + private boolean vehicleCanSprint(final Entity vehicle) { +@@ -1222,6 +_,17 @@ @Override public float getVisualRotationYInDegrees() { return this.getYRot(); diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 793442238f..6c126a4949 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,65 +1,33 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -242,6 +_,9 @@ +@@ -220,6 +_,9 @@ case null: default: this.clearPostEffect(); -+ var rl = p_109107_ == null ? null : net.minecraftforge.client.EntitySpectatorShaderManager.get(p_109107_.getType()); ++ var rl = cameraEntity == null ? null : net.minecraftforge.client.EntitySpectatorShaderManager.get(cameraEntity.getType()); + if (rl != null) + this.setPostEffect(rl); } } -@@ -253,7 +_,13 @@ - public void processBlurEffect() { - PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS); - if (postchain != null) { -+ // TODO: [Forge][Rendering] Check if this blend management is needed anymnore with the new render pipeline changes -+ boolean wasBlendEnabled = com.mojang.blaze3d.opengl.GlStateManager._isBlendEnabled(); -+ if (wasBlendEnabled) -+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend(); - postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool); -+ if (wasBlendEnabled) -+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); - } - } - -@@ -377,7 +_,7 @@ - f *= Mth.lerp(f2, 1.0F, 0.85714287F); - } - -- return f; -+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this, p_109142_, p_109143_, f, p_109144_).getFOV(); - } - } - -@@ -530,7 +_,7 @@ - } - } else if (flag && this.minecraft.screen != null) { - try { -- this.minecraft.screen.renderWithTooltipAndSubtitles(guigraphics, i, j, p_343467_.getGameTimeDeltaTicks()); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, p_343467_.getRealtimeDeltaTicks()); - } catch (Throwable throwable1) { - CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen"); - CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details"); -@@ -696,6 +_,10 @@ - BlockInWorld blockinworld = new BlockInWorld(this.minecraft.level, blockpos, false); - Registry registry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK); - flag = !itemstack.isEmpty() && (itemstack.canBreakBlockInAdventureMode(blockinworld) || itemstack.canPlaceOnBlockInAdventureMode(blockinworld)); -+ if (!flag && blockstate.hasBlockEntity()) { -+ var blockEntity = this.minecraft.level.getBlockEntity(blockpos); -+ flag = blockEntity != null && blockEntity.hasCustomOutlineRendering(); -+ } - } +@@ -515,6 +_,10 @@ + Registry blockRegistry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK); + renderOutline = !itemStack.isEmpty() + && (itemStack.canBreakBlockInAdventureMode(blockInWorld) || itemStack.canPlaceOnBlockInAdventureMode(blockInWorld)); ++ if (!renderOutline && blockState.hasBlockEntity()) { ++ var blockEntity = this.minecraft.level.getBlockEntity(pos); ++ renderOutline = blockEntity != null && blockEntity.hasCustomOutlineRendering(); ++ } } } -@@ -736,6 +_,9 @@ - if (this.minecraft.options.bobView().get()) { - this.bobView(posestack, this.mainCamera.getPartialTickTime()); + } +@@ -538,6 +_,9 @@ + if (optionsState.bobView) { + this.bobView(cameraState, bobStack); } + -+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, this.mainCamera, f); ++ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, this.mainCamera, worldPartialTicks); + this.mainCamera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll()); - matrix4f.mul(posestack.last().pose()); - float f2 = this.minecraft.options.screenEffectScale().get().floatValue(); + projectionMatrix.mul(bobStack.last().pose()); + float screenEffectScale = optionsState.screenEffectScale; diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch deleted file mode 100644 index ad3708e390..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch +++ /dev/null @@ -1,115 +0,0 @@ ---- a/net/minecraft/client/renderer/ItemBlockRenderTypes.java -+++ b/net/minecraft/client/renderer/ItemBlockRenderTypes.java -@@ -19,6 +_,7 @@ - - @OnlyIn(Dist.CLIENT) - public class ItemBlockRenderTypes { -+ @Deprecated - private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_448152_ -> { - ChunkSectionLayer chunksectionlayer = ChunkSectionLayer.TRIPWIRE; - p_448152_.put(Blocks.TRIPWIRE, chunksectionlayer); -@@ -356,12 +_,15 @@ - p_448152_.put(Blocks.BUBBLE_COLUMN, chunksectionlayer2); - p_448152_.put(Blocks.TINTED_GLASS, chunksectionlayer2); - }); -+ @Deprecated - private static final Map LAYER_BY_FLUID = Util.make(Maps.newHashMap(), p_404902_ -> { - p_404902_.put(Fluids.FLOWING_WATER, ChunkSectionLayer.TRANSLUCENT); - p_404902_.put(Fluids.WATER, ChunkSectionLayer.TRANSLUCENT); - }); - private static boolean cutoutLeaves; - -+ /** @deprecated Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */ -+ @Deprecated // Note: this method does NOT support model-based render types - public static ChunkSectionLayer getChunkRenderType(BlockState p_109283_) { - Block block = p_109283_.getBlock(); - if (block instanceof LeavesBlock) { -@@ -372,6 +_,8 @@ - } - } - -+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getMovingBlockRenderType(ChunkSectionLayer)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */ -+ @Deprecated // Note: this method does NOT support model-based render types - public static RenderType getMovingBlockRenderType(BlockState p_109294_) { - Block block = p_109294_.getBlock(); - if (block instanceof LeavesBlock) { -@@ -391,17 +_,78 @@ - } - } - -+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getEntityRenderType(ChunkSectionLayer)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */ -+ @Deprecated // Note: this method does NOT support model-based render types - public static RenderType getRenderType(BlockState p_364446_) { - ChunkSectionLayer chunksectionlayer = getChunkRenderType(p_364446_); - return chunksectionlayer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentBlockItemSheet() : Sheets.cutoutBlockSheet(); - } - -+ // Note: this method does NOT support model-based render types - public static ChunkSectionLayer getRenderLayer(FluidState p_109288_) { -- ChunkSectionLayer chunksectionlayer = LAYER_BY_FLUID.get(p_109288_.getType()); -+ var chunksectionlayer = FLUID_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_109288_.getType())); - return chunksectionlayer != null ? chunksectionlayer : ChunkSectionLayer.SOLID; - } - - public static void setCutoutLeaves(boolean p_454762_) { - cutoutLeaves = p_454762_; -+ } -+ -+ /** Forge: Check if we are running in {@linkplain net.minecraft.client.Minecraft#useFancyGraphics() fancy graphics} to account for fast graphics render types */ -+ public static boolean isFancy() { -+ return cutoutLeaves; -+ } -+ -+ private static final java.util.Collection CUTOUT_MIPPED = java.util.EnumSet.of(ChunkSectionLayer.CUTOUT); -+ private static final java.util.Collection SOLID = java.util.EnumSet.of(ChunkSectionLayer.SOLID); -+ private static final Map, java.util.Collection> BLOCK_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_BLOCK.size(), 0.5F), map -> { -+ map.defaultReturnValue(SOLID); -+ for(Map.Entry entry : TYPE_BY_BLOCK.entrySet()) -+ map.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(entry.getKey()), java.util.EnumSet.of(entry.getValue())); -+ }); -+ private static final Map, ChunkSectionLayer> FLUID_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(LAYER_BY_FLUID.size(), 0.5F), map -> { -+ map.defaultReturnValue(ChunkSectionLayer.SOLID); -+ for(var entry : LAYER_BY_FLUID.entrySet()) -+ map.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(entry.getKey()), entry.getValue()); -+ }); -+ -+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */ -+ public static java.util.Collection getRenderLayers(BlockState state) { -+ Block block = state.getBlock(); -+ if (block instanceof LeavesBlock) { -+ return cutoutLeaves ? CUTOUT_MIPPED : SOLID; -+ } else { -+ return BLOCK_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block)); -+ } -+ } -+ -+ /** -+ * It is recommended to set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) so that it can be data driven. -+ * But if you want to set it in code feel free to set it here like vanilla does. -+ */ -+ public static void setRenderLayer(Block block, ChunkSectionLayer type) { -+ checkClientLoading(); -+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), java.util.EnumSet.of(type)); -+ } -+ -+ /** -+ * It is recommended to set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) so that it can be data driven. -+ * But if you want to set it in code feel free to set it here like vanilla does. -+ */ -+ public static synchronized void setRenderLayer(Block block, ChunkSectionLayer first, ChunkSectionLayer... others) { -+ checkClientLoading(); -+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), java.util.EnumSet.of(first, others)); -+ } -+ -+ public static synchronized void setRenderLayer(Fluid fluid, ChunkSectionLayer type) { -+ checkClientLoading(); -+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type); -+ } -+ -+ private static void checkClientLoading() { -+ com.google.common.base.Preconditions.checkState(net.minecraftforge.client.loading.ClientModLoader.isLoading(), -+ "Render layers can only be set during client loading! " + -+ "This might ideally be done from `FMLClientSetupEvent`." -+ ); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch index a9de77348a..4406fd83bb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch @@ -1,55 +1,57 @@ --- a/net/minecraft/client/renderer/ItemInHandRenderer.java +++ b/net/minecraft/client/renderer/ItemInHandRenderer.java -@@ -329,12 +_,14 @@ - if (iteminhandrenderer$handrenderselection.renderMainHand) { - float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F; - float f5 = this.itemModelResolver.swapAnimationScale(this.mainHandItem) * (1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight)); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.MAIN_HAND, p_109316_, p_424174_, p_109319_, p_109315_, f1, f4, f5, this.mainHandItem)) - this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.MAIN_HAND, f4, this.mainHandItem, f5, p_109316_, p_424174_, p_109319_); - } - - if (iteminhandrenderer$handrenderselection.renderOffHand) { - float f6 = interactionhand == InteractionHand.OFF_HAND ? f : 0.0F; - float f7 = this.itemModelResolver.swapAnimationScale(this.offHandItem) * (1.0F - Mth.lerp(p_109315_, this.oOffHandHeight, this.offHandHeight)); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.OFF_HAND, p_109316_, p_424174_, p_109319_, p_109315_, f1, f6, f7, this.offHandItem)) - this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_424174_, p_109319_); - } - -@@ -401,7 +_,7 @@ +@@ -362,6 +_,7 @@ + float mainHandAttack = attackHand == InteractionHand.MAIN_HAND ? attackValue : 0.0F; + float mainhandInverseArmHeight = this.itemModelResolver.swapAnimationScale(this.mainHandItem) + * (1.0F - Mth.lerp(frameInterp, this.oMainHandHeight, this.mainHandHeight)); ++ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.MAIN_HAND, poseStack, submitNodeCollector, lightCoords, frameInterp, xRot, mainHandAttack, mainhandInverseArmHeight, this.mainHandItem)) + this.submitArmWithItem( + player, + frameInterp, +@@ -380,6 +_,8 @@ + float offHandAttack = attackHand == InteractionHand.OFF_HAND ? attackValue : 0.0F; + float offhandInverseArmHeight = this.itemModelResolver.swapAnimationScale(this.offHandItem) + * (1.0F - Mth.lerp(frameInterp, this.oOffHandHeight, this.offHandHeight)); ++ ++ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.OFF_HAND, poseStack, submitNodeCollector, lightCoords, frameInterp, xRot, offHandAttack, offhandInverseArmHeight, this.offHandItem)) + this.submitArmWithItem( + player, + frameInterp, +@@ -454,7 +_,7 @@ } else { - this.renderOneHandedMap(p_109379_, p_425151_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_); + this.renderOneHandedMap(poseStack, submitNodeCollector, lightCoords, inverseArmHeight, arm, attack, itemStack); } -- } else if (p_109377_.is(Items.CROSSBOW)) { -+ } else if (p_109377_.getItem() instanceof CrossbowItem) { - this.applyItemArmTransform(p_109379_, humanoidarm, p_109378_); - boolean flag1 = CrossbowItem.isCharged(p_109377_); - boolean flag2 = humanoidarm == HumanoidArm.RIGHT; -@@ -446,6 +_,7 @@ +- } else if (itemStack.is(Items.CROSSBOW)) { ++ } else if (itemStack.getItem() instanceof CrossbowItem) { + this.applyItemArmTransform(poseStack, arm, inverseArmHeight); + boolean charged = CrossbowItem.isCharged(itemStack); + boolean isRightArm = arm == HumanoidArm.RIGHT; +@@ -499,6 +_,7 @@ } else { - boolean flag3 = humanoidarm == HumanoidArm.RIGHT; - int j = flag3 ? 1 : -1; -+ if (!net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_109377_).applyForgeHandTransform(p_109379_, minecraft.player, humanoidarm, p_109377_, p_109373_, p_109378_, p_109376_)) // FORGE: Allow items to define custom arm animation - if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) { - ItemUseAnimation itemuseanimation = p_109377_.getUseAnimation(); - if (!itemuseanimation.hasCustomArmTransform()) { -@@ -589,8 +_,18 @@ + boolean isRightArm = arm == HumanoidArm.RIGHT; + int invert = isRightArm ? 1 : -1; ++ if (!net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemStack).applyForgeHandTransform(poseStack, minecraft.player, arm, itemStack, frameInterp, inverseArmHeight, attack)) // FORGE: Allow items to define custom arm animation + if (player.isUsingItem() && player.getUseItemRemainingTicks() > 0 && player.getUsedItemHand() == hand) { + ItemUseAnimation useAnimation = itemStack.getUseAnimation(); + if (!useAnimation.hasCustomArmTransform()) { +@@ -647,8 +_,18 @@ this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F); } else { - float f = localplayer.getItemSwapScale(1.0F); -- float f1 = this.mainHandItem != itemstack ? 0.0F : f * f * f; -- float f2 = this.offHandItem != itemstack1 ? 0.0F : 1.0F; + float attackAnim = player.getItemSwapScale(1.0F); +- float mainHandTargetHeight = this.mainHandItem != nextMainHand ? 0.0F : attackAnim * attackAnim * attackAnim; +- float offHandTargetHeight = this.offHandItem != nextOffHand ? 0.0F : 1.0F; + -+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.mainHandItem, itemstack, localplayer.getInventory().getSelectedSlot()); -+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.offHandItem, itemstack1, -1); ++ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.mainHandItem, nextMainHand, player.getInventory().getSelectedSlot()); ++ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.offHandItem, nextOffHand, -1); + -+ if (!requipM && this.mainHandItem != itemstack) -+ this.mainHandItem = itemstack; -+ if (!requipO && this.offHandItem != itemstack1) -+ this.offHandItem = itemstack1; ++ if (!requipM && this.mainHandItem != nextMainHand) ++ this.mainHandItem = nextMainHand; ++ if (!requipO && this.offHandItem != nextOffHand) ++ this.offHandItem = nextOffHand; + -+ float f1 = requipM ? 0.0F : f * f * f; -+ float f2 = requipO ? 0.0F : 1.0F; ++ float mainHandTargetHeight = requipM ? 0.0F : attackAnim * attackAnim * attackAnim; ++ float offHandTargetHeight = requipO ? 0.0F : 1.0F; + - this.mainHandHeight = this.mainHandHeight + Mth.clamp(f1 - this.mainHandHeight, -0.4F, 0.4F); - this.offHandHeight = this.offHandHeight + Mth.clamp(f2 - this.offHandHeight, -0.4F, 0.4F); + this.mainHandHeight = this.mainHandHeight + Mth.clamp(mainHandTargetHeight - this.mainHandHeight, -0.4F, 0.4F); + this.offHandHeight = this.offHandHeight + Mth.clamp(offHandTargetHeight - this.offHandHeight, -0.4F, 0.4F); } diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch index cc326d9f0b..72a8555d01 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/LevelEventHandler.java +++ b/net/minecraft/client/renderer/LevelEventHandler.java -@@ -325,7 +_,7 @@ +@@ -305,7 +_,7 @@ case 2001: - BlockState blockstate1 = Block.stateById(p_368262_); - if (!blockstate1.isAir()) { -- SoundType soundtype = blockstate1.getSoundType(); -+ SoundType soundtype = blockstate1.getSoundType(this.level, p_362689_, null); + BlockState blockState = Block.stateById(data); + if (!blockState.isAir()) { +- SoundType soundType = blockState.getSoundType(); ++ SoundType soundType = blockState.getSoundType(this.level, pos, null); this.level .playLocalSound( - p_362689_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false + pos, soundType.getBreakSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch index 3fb670e20b..905e188bac 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch @@ -1,111 +1,38 @@ --- a/net/minecraft/client/renderer/LevelRenderer.java +++ b/net/minecraft/client/renderer/LevelRenderer.java -@@ -184,6 +_,7 @@ - this.submitNodeStorage = p_427160_.getSubmitNodeStorage(); - this.levelRenderState = p_429507_; - this.featureRenderDispatcher = p_427160_; -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onInitLevelRenderer(); - } - - @Override -@@ -485,9 +_,10 @@ - profilerfiller.push("entities"); - this.extractVisibleEntities(p_109604_, frustum, p_342180_, this.levelRenderState); - profilerfiller.popPush("blockEntities"); -- this.extractVisibleBlockEntities(p_109604_, f, this.levelRenderState); -+ this.extractVisibleBlockEntities(p_109604_, f, this.levelRenderState, frustum); - profilerfiller.popPush("blockOutline"); -- this.extractBlockOutline(p_109604_, this.levelRenderState); -+ this.extractBlockOutline(p_109604_, this.levelRenderState, p_109603_); -+ p_109603_ = this.levelRenderState.blockOutlineRenderState != null; - profilerfiller.popPush("blockBreaking"); - this.extractBlockDestroyAnimation(p_109604_, this.levelRenderState); - profilerfiller.popPush("weather"); -@@ -561,6 +_,7 @@ +@@ -235,6 +_,7 @@ } - this.addLateDebugPass(framegraphbuilder, this.levelRenderState.cameraRenderState, p_407881_, p_254120_); -+ net.minecraftforge.client.FramePassManager.insertForgePasses(framegraphbuilder, targets, this.levelRenderState); // Forge: Modded passes are inserted here. - profilerfiller.popPush("executeFrameGraph"); - framegraphbuilder.execute(p_367325_, new FrameGraphBuilder.Inspector() { + this.addAlwaysOnTopPass(frame, featureFrame, terrainFog); ++ net.minecraftforge.client.FramePassManager.insertForgePasses(frame, targets, this.levelRenderState, deltaTracker); // Forge: Modded passes are inserted here. + profiler.popPush("executeFrameGraph"); + frame.execute(resourceAllocator, new FrameGraphBuilder.Inspector() { @Override -@@ -841,7 +_,7 @@ +@@ -285,7 +_,8 @@ + this.submitBlockDestroyAnimation(poseStack, submitNodeCollector, levelRenderState); + levelRenderState.blockBreakingRenderStates.clear(); + levelRenderState.particlesRenderState.submit(submitNodeCollector, levelRenderState.cameraRenderState); +- if (renderOutline) { ++ var hasCustomOutline = this.levelRenderState.blockOutlineRenderState != null && this.levelRenderState.blockOutlineRenderState.customRenderer() != null; ++ if (renderOutline || hasCustomOutline) { + this.submitBlockOutline(poseStack, this.submitNodeStorage, levelRenderState); } - } -- private void extractVisibleBlockEntities(Camera p_427254_, float p_426770_, LevelRenderState p_428920_) { -+ private void extractVisibleBlockEntities(Camera p_427254_, float p_426770_, LevelRenderState p_428920_, Frustum frustum) { - Vec3 vec3 = p_427254_.position(); - double d0 = vec3.x(); - double d1 = vec3.y(); -@@ -852,6 +_,7 @@ - List list = sectionrenderdispatcher$rendersection.getSectionMesh().getRenderableBlockEntities(); - if (!list.isEmpty() && !(sectionrenderdispatcher$rendersection.getVisibility(Util.getMillis()) < 0.3F)) { - for (BlockEntity blockentity : list) { -+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue; - BlockPos blockpos = blockentity.getBlockPos(); - SortedSet sortedset = this.destructionProgress.get(blockpos.asLong()); - ModelFeatureRenderer.CrumblingOverlay modelfeaturerenderer$crumblingoverlay; -@@ -879,6 +_,7 @@ - if (blockentity1.isRemoved()) { - iterator.remove(); - } else { -+ if (!frustum.isVisible(blockentity1.getRenderBoundingBox())) continue; - BlockEntityRenderState blockentityrenderstate1 = this.blockEntityRenderDispatcher.tryExtractRenderState(blockentity1, p_426770_, null); - if (blockentityrenderstate1 != null) { - p_428920_.blockEntityRenderStates.add(blockentityrenderstate1); -@@ -935,13 +_,21 @@ - VertexConsumer vertexconsumer = new SheetedDecalTextureGenerator( - p_365998_.getBuffer(ModelBakery.DESTROY_TYPES.get(blockbreakingrenderstate.progress)), posestack$pose, 1.0F - ); -- this.minecraft.getBlockRenderer().renderBreakingTexture(blockbreakingrenderstate.blockState, blockpos, blockbreakingrenderstate, p_366956_, vertexconsumer); -+ this.minecraft.getBlockRenderer().renderBreakingTexture(blockbreakingrenderstate.blockState, blockpos, blockbreakingrenderstate, p_366956_, vertexconsumer, level.getModelDataManager().getAtOrEmpty(blockpos)); - p_366956_.popPose(); - } - } - -- private void extractBlockOutline(Camera p_428965_, LevelRenderState p_424419_) { -+ private void extractBlockOutline(Camera p_428965_, LevelRenderState p_424419_, boolean shouldRender) { - p_424419_.blockOutlineRenderState = null; -+ var custom = net.minecraftforge.client.ForgeHooksClient.onExtractBlockOutline(this, p_428965_, p_424419_, this.minecraft.hitResult); -+ if (custom != null) { -+ p_424419_.blockOutlineRenderState = new BlockOutlineRenderState(BlockPos.ZERO, false, false, net.minecraft.world.phys.shapes.Shapes.empty(), null, null, null, custom); -+ return; -+ } else if (!shouldRender) { -+ return; -+ } -+ - if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) { - if (blockhitresult.getType() != HitResult.Type.MISS) { - BlockPos blockpos = blockhitresult.getBlockPos(); -@@ -967,6 +_,10 @@ - private void renderBlockOutline(MultiBufferSource.BufferSource p_367206_, PoseStack p_365062_, boolean p_368189_, LevelRenderState p_422597_) { - BlockOutlineRenderState blockoutlinerenderstate = p_422597_.blockOutlineRenderState; - if (blockoutlinerenderstate != null) { -+ if (blockoutlinerenderstate.customRenderer() != null) { -+ blockoutlinerenderstate.customRenderer().render(p_367206_, p_365062_, p_368189_, p_422597_); +@@ -705,6 +_,10 @@ + private void submitBlockOutline(final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final LevelRenderState levelRenderState) { + BlockOutlineRenderState state = levelRenderState.blockOutlineRenderState; + if (state != null) { ++ if (state.customRenderer() != null) { ++ state.customRenderer().render(submitNodeCollector, poseStack, levelRenderState); + return; + } - if (blockoutlinerenderstate.isTranslucent() == p_368189_) { - Vec3 vec3 = p_422597_.cameraRenderState.pos; - if (blockoutlinerenderstate.highContrast()) { -@@ -1435,7 +_,7 @@ - } else { - int i = p_398213_.packedBrightness(p_109538_, p_109540_); - int j = LightTexture.block(i); -- int k = p_109539_.getLightEmission(); -+ int k = p_109539_.getLightEmission(p_109538_, p_109540_); - if (j < k) { - int l = LightTexture.sky(i); - return LightTexture.pack(k, l); -@@ -1492,6 +_,18 @@ + Vec3 cameraPos = levelRenderState.cameraRenderState.pos; + BlockPos pos = state.pos(); + poseStack.pushPose(); +@@ -979,6 +_,14 @@ - public CloudRenderer getCloudRenderer() { - return this.cloudRenderer; -+ } -+ -+ public int getTicks() { -+ return this.ticks; + public SectionOcclusionGraph sectionOcclusionGraph() { + return this.sectionOcclusionGraph; + } + + public WeatherEffectRenderer getWeatherEffects() { @@ -116,4 +43,4 @@ + this.weatherEffectRenderer = value; } - public Gizmos.TemporaryCollection collectPerFrameGizmos() { + public Gizmos.TemporaryCollection collectPerFrameRenderThreadGizmos() { diff --git a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch deleted file mode 100644 index c74d3334bd..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/LightTexture.java -+++ b/net/minecraft/client/renderer/LightTexture.java -@@ -171,7 +_,7 @@ - } - - public static int block(int p_109884_) { -- return p_109884_ >>> 4 & 15; -+ return (p_109884_ & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806 - } - - public static int sky(int p_109895_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index a165897504..7250254598 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -1,70 +1,70 @@ --- a/net/minecraft/client/renderer/ScreenEffectRenderer.java +++ b/net/minecraft/client/renderer/ScreenEffectRenderer.java -@@ -59,19 +_,25 @@ +@@ -61,8 +_,9 @@ + PoseStack poseStack = new PoseStack(); Player player = this.minecraft.player; - if (this.minecraft.options.getCameraType().isFirstPerson() && !p_409640_) { - if (!player.noPhysics) { -- BlockState blockstate = getViewBlockingState(player); -+ var overlay = getOverlayBlock(player); -+ BlockState blockstate = overlay == null ? null : overlay.getLeft(); - if (blockstate != null) { -+ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, posestack, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) - renderTex(this.minecraft.getBlockRenderer().getBlockModelShaper().getParticleIcon(blockstate), posestack, this.bufferSource); - } - } + if (isFirstPerson && !isSleeping) { +- BlockState blockState = getViewBlockingState(player); +- if (blockState != null) { ++ var overlay = getOverlayBlock(player); ++ BlockState blockState = overlay == null ? null : overlay.getLeft(); ++ if (blockState != null && net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, poseStack, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) { + BlockStateModelSet blockStateModelSet = this.minecraft.getModelManager().getBlockStateModelSet(); + TextureAtlasSprite sprite = blockStateModelSet.getParticleMaterial(blockState).sprite(); + submitBlockSprite(sprite, poseStack, submitNodeCollector, -15132391); +@@ -70,11 +_,15 @@ if (!this.minecraft.player.isSpectator()) { if (this.minecraft.player.isEyeInFluid(FluidTags.WATER)) { -+ if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, posestack)) - renderWater(this.minecraft, posestack, this.bufferSource); ++ if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, poseStack)) + submitWater(this.minecraft, poseStack, submitNodeCollector); + } else if (!player.getEyeInFluidType().isAir()) { -+ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(this.minecraft, posestack, this.bufferSource); ++ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(this.minecraft, poseStack, submitNodeCollector); } if (this.minecraft.player.isOnFire()) { - TextureAtlasSprite textureatlassprite = this.materials.get(ModelBakery.FIRE_1); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, posestack)) - renderFire(posestack, this.bufferSource, textureatlassprite); + TextureAtlasSprite fireSprite = this.sprites.get(ModelBakery.FIRE_1); ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, poseStack)) + submitFire(poseStack, submitNodeCollector, fireSprite); } } -@@ -120,6 +_,11 @@ - } +@@ -128,6 +_,11 @@ + return null; + } - private static @Nullable BlockState getViewBlockingState(Player p_110717_) { -+ var ret = getOverlayBlock(p_110717_); ++ var ret = getOverlayBlock(player); + return ret == null ? null : ret.getLeft(); + } + -+ private static org.apache.commons.lang3.tuple.@Nullable Pair getOverlayBlock(Player p_110717_) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); ++ private static org.apache.commons.lang3.tuple.@Nullable Pair getOverlayBlock(Player player) { + BlockPos.MutableBlockPos testPos = new BlockPos.MutableBlockPos(); for (int i = 0; i < 8; i++) { -@@ -129,7 +_,7 @@ - blockpos$mutableblockpos.set(d0, d1, d2); - BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos); - if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.isViewBlocking(p_110717_.level(), blockpos$mutableblockpos)) { -- return blockstate; -+ return org.apache.commons.lang3.tuple.Pair.of(blockstate, blockpos$mutableblockpos.immutable()); +@@ -138,7 +_,7 @@ + ); + BlockState blockState = player.level().getBlockState(testPos); + if (blockState.getRenderShape() != RenderShape.INVISIBLE && blockState.isViewBlocking(player.level(), testPos)) { +- return blockState; ++ return org.apache.commons.lang3.tuple.Pair.of(blockState, testPos.immutable()); } } -@@ -157,6 +_,10 @@ +@@ -156,13 +_,17 @@ } - private static void renderWater(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_) { -+ renderFluid(p_110726_, p_110727_, p_376402_, UNDERWATER_LOCATION); + private static void submitWater(final Minecraft minecraft, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector) { ++ renderFluid(minecraft, poseStack, submitNodeCollector, UNDERWATER_LOCATION); + } + -+ public static void renderFluid(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_, Identifier texture) { - BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ()); - float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos)); - int i = ARGB.colorFromFloat(0.1F, f, f, f); -@@ -169,7 +_,7 @@ - float f7 = -p_110726_.player.getYRot() / 64.0F; - float f8 = p_110726_.player.getXRot() / 64.0F; - Matrix4f matrix4f = p_110727_.last().pose(); -- VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderTypes.blockScreenEffect(UNDERWATER_LOCATION)); -+ VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderTypes.blockScreenEffect(texture)); - vertexconsumer.addVertex(matrix4f, -1.0F, -1.0F, -0.5F).setUv(4.0F + f7, 4.0F + f8).setColor(i); - vertexconsumer.addVertex(matrix4f, 1.0F, -1.0F, -0.5F).setUv(0.0F + f7, 4.0F + f8).setColor(i); - vertexconsumer.addVertex(matrix4f, 1.0F, 1.0F, -0.5F).setUv(0.0F + f7, 0.0F + f8).setColor(i); ++ public static void renderFluid(Minecraft minecraft, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, Identifier texture) { + LocalPlayer player = minecraft.player; + BlockPos pos = BlockPos.containing(player.getEyePosition()); + float brightness = Lightmap.getBrightness(player.level().dimensionType(), player.level().getMaxLocalRawBrightness(pos)); + int color = ARGB.colorFromFloat(0.1F, brightness, brightness, brightness); + float u0 = -player.getYRot() / 64.0F; + float v0 = player.getXRot() / 64.0F; +- submitNodeCollector.submitCustomGeometry(poseStack, RenderTypes.blockScreenEffect(UNDERWATER_LOCATION), (pose, builder) -> { ++ submitNodeCollector.submitCustomGeometry(poseStack, RenderTypes.blockScreenEffect(texture), (pose, builder) -> { + float uvSize = 4.0F; + buildQuad(builder, pose.pose(), -1.0F, -1.0F, 1.0F, 1.0F, -0.5F, u0 + 4.0F, v0 + 4.0F, u0, v0, color); + }); diff --git a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch index 88f845440e..3486c46905 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch @@ -1,40 +1,16 @@ --- a/net/minecraft/client/renderer/Sheets.java +++ b/net/minecraft/client/renderer/Sheets.java -@@ -179,11 +_,11 @@ +@@ -120,4 +_,13 @@ + case COPPER_OXIDIZED -> (SpriteId)CHEST_COPPER.oxidized().select(type); + }; } - - private static Material createSignMaterial(WoodType p_173386_) { -- return SIGN_MAPPER.defaultNamespaceApply(p_173386_.name()); -+ return SIGN_MAPPER.apply(Identifier.parse(p_173386_.name())); - } - - private static Material createHangingSignMaterial(WoodType p_251735_) { -- return HANGING_SIGN_MAPPER.defaultNamespaceApply(p_251735_.name()); -+ return HANGING_SIGN_MAPPER.apply(Identifier.parse(p_251735_.name())); - } - - public static Material getSignMaterial(WoodType p_173382_) { -@@ -228,6 +_,23 @@ - case SINGLE: - default: - return p_110773_; -+ } -+ } -+ -+ /** -+ * Not thread-safe. Enqueue it in client setup. -+ */ -+ public static void addWoodType(WoodType woodType) { -+ SIGN_MATERIALS.put(woodType, createSignMaterial(woodType)); -+ HANGING_SIGN_MATERIALS.put(woodType, createHangingSignMaterial(woodType)); -+ } + + static { -+ if (net.minecraftforge.fml.ModLoader.isLoadingStateValid() && !net.minecraftforge.fml.ModLoader.get().hasCompletedState(net.minecraftforge.common.ForgeStatesProvider.LOAD_REGISTRIES)) { ++ if (net.minecraftforge.fml.ModLoader.isLoadingStateValid() && !net.minecraftforge.fml.ModLoader.hasCompletedState(net.minecraftforge.common.ForgeStatesProvider.LOAD_REGISTRIES)) { + com.mojang.logging.LogUtils.getLogger().error( + "net.minecraft.client.renderer.Sheets loaded too early, modded registry-based materials may not work correctly", + new IllegalStateException("net.minecraft.client.renderer.Sheets loaded too early") + ); - } - } ++ } ++ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/SpriteCoordinateExpander.java.patch b/patches/minecraft/net/minecraft/client/renderer/SpriteCoordinateExpander.java.patch index 2127ec9e0e..0cbf08ef66 100644 --- a/patches/minecraft/net/minecraft/client/renderer/SpriteCoordinateExpander.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/SpriteCoordinateExpander.java.patch @@ -3,16 +3,16 @@ @@ -17,12 +_,14 @@ @Override - public VertexConsumer addVertex(float p_342932_, float p_342886_, float p_342696_) { -- return this.delegate.addVertex(p_342932_, p_342886_, p_342696_); -+ this.delegate.addVertex(p_342932_, p_342886_, p_342696_); + public VertexConsumer addVertex(final float x, final float y, final float z) { +- return this.delegate.addVertex(x, y, z); ++ this.delegate.addVertex(x, y, z); + return this; // Forge: Fix MC-263524 not working with chained methods } @Override - public VertexConsumer setColor(int p_344589_, int p_342555_, int p_344320_, int p_345258_) { -- return this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_); -+ this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_); + public VertexConsumer setColor(final int r, final int g, final int b, final int a) { +- return this.delegate.setColor(r, g, b, a); ++ this.delegate.setColor(r, g, b, a); + return this; // Forge: Fix MC-263524 not working with chained methods } @@ -20,30 +20,30 @@ @@ -32,22 +_,26 @@ @Override - public VertexConsumer setUv(float p_343856_, float p_344420_) { -- return this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_)); -+ this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_)); + public VertexConsumer setUv(final float u, final float v) { +- return this.delegate.setUv(this.sprite.getU(u), this.sprite.getV(v)); ++ this.delegate.setUv(this.sprite.getU(u), this.sprite.getV(v)); + return this; // Forge: Fix MC-263524 not working with chained methods } @Override - public VertexConsumer setUv1(int p_343784_, int p_344827_) { -- return this.delegate.setUv1(p_343784_, p_344827_); -+ this.delegate.setUv1(p_343784_, p_344827_); + public VertexConsumer setUv1(final int u, final int v) { +- return this.delegate.setUv1(u, v); ++ this.delegate.setUv1(u, v); + return this; // Forge: Fix MC-263524 not working with chained methods } @Override - public VertexConsumer setUv2(int p_345257_, int p_344124_) { -- return this.delegate.setUv2(p_345257_, p_344124_); -+ this.delegate.setUv2(p_345257_, p_344124_); + public VertexConsumer setUv2(final int u, final int v) { +- return this.delegate.setUv2(u, v); ++ this.delegate.setUv2(u, v); + return this; // Forge: Fix MC-263524 not working with chained methods } @Override - public VertexConsumer setNormal(float p_342779_, float p_342534_, float p_344783_) { -- return this.delegate.setNormal(p_342779_, p_342534_, p_344783_); -+ this.delegate.setNormal(p_342779_, p_342534_, p_344783_); + public VertexConsumer setNormal(final float x, final float y, final float z) { +- return this.delegate.setNormal(x, y, z); ++ this.delegate.setNormal(x, y, z); + return this; // Forge: Fix MC-263524 not working with chained methods } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch deleted file mode 100644 index 83e6e44400..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/client/renderer/block/BlockModelShaper.java -+++ b/net/minecraft/client/renderer/block/BlockModelShaper.java -@@ -17,8 +_,13 @@ - this.modelManager = p_110880_; - } - -+ /** @deprecated Forge: Use {@link #getParticleIcon(BlockState, net.minecraft.world.level.Level, net.minecraft.core.BlockPos) getParticleIcon(BlockState, Level, Pos)} */ - public TextureAtlasSprite getParticleIcon(BlockState p_110883_) { -- return this.getBlockModel(p_110883_).particleIcon(); -+ return this.getBlockModel(p_110883_).particleIcon(net.minecraftforge.client.model.data.ModelData.EMPTY); -+ } -+ -+ public TextureAtlasSprite getParticleIcon(BlockState p_110883_, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) { -+ return this.getBlockModel(p_110883_).particleIcon(level.getModelDataManager().getAt(pos)); - } - - public BlockStateModel getBlockModel(BlockState p_110894_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch deleted file mode 100644 index d8ed39f4d7..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/net/minecraft/client/renderer/block/BlockRenderDispatcher.java -+++ b/net/minecraft/client/renderer/block/BlockRenderDispatcher.java -@@ -48,12 +_,17 @@ - return this.blockModelShaper; - } - -+ @Deprecated //Forge: Model data parameter - public void renderBreakingTexture(BlockState p_110919_, BlockPos p_110920_, BlockAndTintGetter p_110921_, PoseStack p_110922_, VertexConsumer p_110923_) { -+ renderBreakingTexture(p_110919_, p_110920_, p_110921_, p_110922_, p_110923_, net.minecraftforge.client.model.data.ModelData.EMPTY); -+ } -+ -+ public void renderBreakingTexture(BlockState p_110919_, BlockPos p_110920_, BlockAndTintGetter p_110921_, PoseStack p_110922_, VertexConsumer p_110923_, net.minecraftforge.client.model.data.ModelData modelData) { - if (p_110919_.getRenderShape() == RenderShape.MODEL) { - BlockStateModel blockstatemodel = this.blockModelShaper.getBlockModel(p_110919_); - this.singleThreadRandom.setSeed(p_110919_.getSeed(p_110920_)); - this.singleThreadPartList.clear(); -- blockstatemodel.collectParts(this.singleThreadRandom, this.singleThreadPartList); -+ blockstatemodel.collectParts(this.singleThreadRandom, this.singleThreadPartList, modelData, null); - this.modelRenderer.tesselateBlock(p_110921_, this.singleThreadPartList, p_110919_, p_110920_, p_110922_, p_110923_, true, OverlayTexture.NO_OVERLAY); - } - } -@@ -96,7 +_,12 @@ - return this.blockModelShaper.getBlockModel(p_110911_); - } - -+ @Deprecated //Forge: Model data and render type parameter - public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_) { -+ renderSingleBlock(p_110913_, p_110914_, p_110915_, p_110916_, p_110917_, net.minecraftforge.client.model.data.ModelData.EMPTY, null); -+ } -+ -+ public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.rendertype.@Nullable RenderType renderType) { - RenderShape rendershape = p_110913_.getRenderShape(); - if (rendershape != RenderShape.INVISIBLE) { - BlockStateModel blockstatemodel = this.getBlockModel(p_110913_); -@@ -104,8 +_,9 @@ - float f = (i >> 16 & 0xFF) / 255.0F; - float f1 = (i >> 8 & 0xFF) / 255.0F; - float f2 = (i & 0xFF) / 255.0F; -+ for (var rt : blockstatemodel.getRenderTypes(p_110913_, RandomSource.create(42), modelData)) - ModelBlockRenderer.renderModel( -- p_110914_.last(), p_110915_.getBuffer(ItemBlockRenderTypes.getRenderType(p_110913_)), blockstatemodel, f, f1, f2, p_110916_, p_110917_ -+ p_110914_.last(), p_110915_.getBuffer(renderType != null ? renderType : net.minecraftforge.client.RenderTypeHelper.getEntityRenderType(rt)), blockstatemodel, f, f1, f2, p_110916_, p_110917_, modelData, rt - ); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch new file mode 100644 index 0000000000..5bdbaa158c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/client/renderer/block/FluidRenderer.java ++++ b/net/minecraft/client/renderer/block/FluidRenderer.java +@@ -86,8 +_,10 @@ + boolean renderEast = shouldRenderFace(fluidState, blockState, Direction.EAST, fluidStateEast); + if (renderUp || renderDown || renderEast || renderWest || renderNorth || renderSouth) { + FluidModel model = this.fluidModels.get(fluidState); ++ var fluidExt = net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(fluidState); ++ model = fluidExt.getModel(fluidState, level, pos, model); + VertexConsumer builder = output.getBuilder(model.layer()); +- int tintColor = model.tintSource() != null ? model.tintSource().colorInWorld(blockState, level, pos) : -1; ++ int tintColor = model.tintSource() != null ? model.tintSource().colorInWorld(blockState, level, pos) : fluidExt.getTintColor(); + CardinalLighting cardinalLighting = level.cardinalLighting(); + Fluid type = fluidState.getType(); + float heightSelf = this.getHeight(level, type, pos, blockState, fluidState); +@@ -294,7 +_,7 @@ + boolean isOverlay = false; + if (model.overlayMaterial() != null) { + Block relativeBlock = faceState.getBlock(); +- if (relativeBlock instanceof HalfTransparentBlock || relativeBlock instanceof LeavesBlock) { ++ if (faceState.shouldDisplayFluidOverlay(level, pos.relative(faceDir), fluidState)) { + sprite = model.overlayMaterial().sprite(); + isOverlay = true; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch deleted file mode 100644 index e3cf8f2d86..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch +++ /dev/null @@ -1,109 +0,0 @@ ---- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java -+++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java -@@ -71,9 +_,12 @@ - - public void tesselate(BlockAndTintGetter p_234370_, BlockPos p_234371_, VertexConsumer p_234372_, BlockState p_234373_, FluidState p_234374_) { - boolean flag = p_234374_.is(FluidTags.LAVA); -- TextureAtlasSprite textureatlassprite = flag ? this.lavaStill : this.waterStill; -- TextureAtlasSprite textureatlassprite1 = flag ? this.lavaFlowing : this.waterFlowing; -- int i = flag ? 16777215 : BiomeColors.getAverageWaterColor(p_234370_, p_234371_); -+ var sprites = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_234370_, p_234371_, p_234374_); -+ TextureAtlasSprite textureatlassprite = sprites[0]; -+ TextureAtlasSprite textureatlassprite1 = sprites[1]; -+ int i = net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(p_234374_).getTintColor(p_234374_, p_234370_, p_234371_); -+ float alpha = (float)(i >> 24 & 255) / 255.0F; -+ - float f = (i >> 16 & 0xFF) / 255.0F; - float f1 = (i >> 8 & 0xFF) / 255.0F; - float f2 = (i & 0xFF) / 255.0F; -@@ -169,15 +_,15 @@ - float f54 = f4 * f; - float f55 = f4 * f1; - float f56 = f4 * f2; -- this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l); -- this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l); -+ this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l, alpha); -+ this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l, alpha); - if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) { -- this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l); -- this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l); -+ this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l, alpha); -+ this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l, alpha); - } - } - -@@ -190,10 +_,10 @@ - float f47 = f3 * f; - float f49 = f3 * f1; - float f51 = f3 * f2; -- this.vertex(p_234372_, f37, f38 + f16, f39 + 1.0F, f47, f49, f51, f41, f44, k); -- this.vertex(p_234372_, f37, f38 + f16, f39, f47, f49, f51, f41, f43, k); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39, f47, f49, f51, f42, f43, k); -- this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39 + 1.0F, f47, f49, f51, f42, f44, k); -+ this.vertex(p_234372_, f37, f38 + f16, f39 + 1.0F, f47, f49, f51, f41, f44, k, alpha); -+ this.vertex(p_234372_, f37, f38 + f16, f39, f47, f49, f51, f41, f43, k, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39, f47, f49, f51, f42, f43, k, alpha); -+ this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39 + 1.0F, f47, f49, f51, f42, f44, k, alpha); - } - - int j = this.getLightColor(p_234370_, p_234371_); -@@ -247,10 +_,9 @@ - if (flag7 && !isFaceOccludedByNeighbor(direction, Math.max(f45, f46), p_234370_.getBlockState(p_234371_.relative(direction)))) { - BlockPos blockpos = p_234371_.relative(direction); - TextureAtlasSprite textureatlassprite2 = textureatlassprite1; -- if (!flag) { -- Block block = p_234370_.getBlockState(blockpos).getBlock(); -- if (block instanceof HalfTransparentBlock || block instanceof LeavesBlock) { -- textureatlassprite2 = this.waterOverlay; -+ if (sprites[2] != null) { -+ if (p_234370_.getBlockState(blockpos).shouldDisplayFluidOverlay(p_234370_, blockpos, p_234374_)) { -+ textureatlassprite2 = sprites[2]; - } - } - -@@ -263,15 +_,15 @@ - float f34 = f4 * f33 * f; - float f35 = f4 * f33 * f1; - float f36 = f4 * f33 * f2; -- this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j); -- this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j); -- this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j); -- this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j); -+ this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j, alpha); -+ this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j, alpha); -+ this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j, alpha); -+ this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j, alpha); - if (textureatlassprite2 != this.waterOverlay) { -- this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j); -- this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j); -- this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j); -- this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j); -+ this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j, alpha); -+ this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j, alpha); -+ this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j, alpha); -+ this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j, alpha); - } - } - } -@@ -333,10 +_,11 @@ - float p_343128_, - float p_344448_, - float p_344284_, -- int p_110994_ -+ int p_110994_, -+ float alpha - ) { - p_110985_.addVertex(p_110989_, p_110990_, p_110991_) -- .setColor(p_110992_, p_110993_, p_343128_, 1.0F) -+ .setColor(p_110992_, p_110993_, p_343128_, alpha) - .setUv(p_344448_, p_344284_) - .setLight(p_110994_) - .setNormal(0.0F, 1.0F, 0.0F); 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 6f55593942..6607f98f7e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -1,37 +1,34 @@ --- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java +++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java -@@ -49,7 +_,7 @@ - int p_234389_ - ) { - if (!p_393688_.isEmpty()) { -- boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission() == 0 && p_393688_.getFirst().useAmbientOcclusion(); -+ boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission(p_234380_, p_234383_) == 0 && p_393688_.getFirst().useAmbientOcclusion(); - p_234384_.translate(p_234382_.getOffset(p_234383_)); - - try { -@@ -319,6 +_,11 @@ - } +@@ -49,6 +_,12 @@ + return !cutoutLeaves && blockState.getBlock() instanceof LeavesBlock; } -+ @Deprecated //Forge: Model data and render type parameter -+ public static void renderModel(PoseStack.Pose p_111068_, VertexConsumer p_111069_, BlockStateModel p_111070_, float p_111072_, float p_111073_, float p_111074_, int p_111075_, int p_111076_) { -+ renderModel(p_111068_, p_111069_, p_111070_, p_111072_, p_111073_, p_111074_, p_111075_, p_111076_, net.minecraftforge.client.model.data.ModelData.EMPTY, null); ++ ++ /** @deprecated Use ModelData variant */ ++ public void tesselateBlock(final BlockQuadOutput output, final float x, final float y, final float z, final BlockAndTintGetter level, final BlockPos pos, final BlockState blockState, final BlockStateModel model, final long seed) { ++ tesselateBlock(output, x, y, z, level, pos, blockState, model, seed, net.minecraftforge.client.model.data.ModelData.EMPTY); + } + - public static void renderModel( - PoseStack.Pose p_111068_, - VertexConsumer p_111069_, -@@ -327,9 +_,11 @@ - float p_111073_, - float p_111074_, - int p_111075_, -- int p_111076_ -+ int p_111076_, -+ net.minecraftforge.client.model.data.ModelData modelData, -+ @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.chunk.ChunkSectionLayer renderType + public void tesselateBlock( + final BlockQuadOutput output, + final float x, +@@ -58,14 +_,15 @@ + final BlockPos pos, + final BlockState blockState, + final BlockStateModel model, +- final long seed ++ final long seed, ++ net.minecraftforge.client.model.data.ModelData modelData ) { -- for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L))) { -+ for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L), modelData, renderType)) { - for (Direction direction : DIRECTIONS) { - renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, blockmodelpart.getQuads(direction), p_111075_, p_111076_); - } + this.random.setSeed(seed); +- model.collectParts(this.random, this.parts); ++ model.collectParts(this.random, this.parts, modelData); + if (!this.parts.isEmpty()) { + try { + Vec3 offset = blockState.getOffset(pos); +- if (this.ambientOcclusion && blockState.getLightEmission() == 0 && this.parts.getFirst().useAmbientOcclusion()) { ++ if (this.ambientOcclusion && blockState.getLightEmission(level, pos) == 0 && this.parts.getFirst().useAmbientOcclusion()) { + this.tesselateAmbientOcclusion(output, x + (float)offset.x, y + (float)offset.y, z + (float)offset.z, this.parts, level, blockState, pos); + } else { + this.tesselateFlat(output, x + (float)offset.x, y + (float)offset.y, z + (float)offset.z, this.parts, level, blockState, pos); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch new file mode 100644 index 0000000000..938f1d1453 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java ++++ b/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java +@@ -20,9 +_,11 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + + @OnlyIn(Dist.CLIENT) +-public interface BlockStateModel { ++public interface BlockStateModel extends net.minecraftforge.client.extensions.IForgeBlockStateModel { ++ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#collectParts(RandomSource, List, net.minecraftforge.client.model.data.ModelData)}*/ + void collectParts(RandomSource random, List output); + ++ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#particleMaterial(net.minecraftforge.client.model.data.ModelData)}*/ + Material.Baked particleMaterial(); + + @BakedQuad.MaterialFlags int materialFlags(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch new file mode 100644 index 0000000000..6d820387cf --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java ++++ b/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java +@@ -16,11 +_,13 @@ + private final WeightedList list; + private final Material.Baked particleMaterial; + private final @BakedQuad.MaterialFlags int materialFlags; ++ private final BlockStateModel first; + + public WeightedVariants(final WeightedList list) { + this.list = list; + BlockStateModel firstModel = list.unwrap().getFirst().value(); + this.particleMaterial = firstModel.particleMaterial(); ++ this.first = firstModel; + this.materialFlags = computeMaterialFlags(list); + } + +@@ -40,6 +_,11 @@ + } + + @Override ++ public Material.Baked particleMaterial(net.minecraftforge.client.model.data.ModelData data) { ++ return this.first.particleMaterial(data); ++ } ++ ++ @Override + public @BakedQuad.MaterialFlags int materialFlags() { + return this.materialFlags; + } +@@ -47,6 +_,11 @@ + @Override + public void collectParts(final RandomSource random, final List output) { + this.list.getRandomOrThrow(random).collectParts(random, output); ++ } ++ ++ @Override ++ public void collectParts(final RandomSource random, final List output, net.minecraftforge.client.model.data.ModelData data) { ++ this.list.getRandomOrThrow(random).collectParts(random, output, data); + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch new file mode 100644 index 0000000000..886541fbd5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java ++++ b/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java +@@ -38,12 +_,24 @@ + } + + @Override ++ public Material.Baked particleMaterial(net.minecraftforge.client.model.data.ModelData data) { ++ if (this.models == null) ++ this.models = this.shared.selectModels(this.blockState); ++ return this.models.getFirst().particleMaterial(data); ++ } ++ ++ @Override + public @BakedQuad.MaterialFlags int materialFlags() { + return this.shared.materialFlags; + } + + @Override + public void collectParts(final RandomSource random, final List output) { ++ collectParts(random, output, net.minecraftforge.client.model.data.ModelData.EMPTY); ++ } ++ ++ @Override ++ public void collectParts(final RandomSource random, final List output, net.minecraftforge.client.model.data.ModelData data) { + if (this.models == null) { + this.models = this.shared.selectModels(this.blockState); + } +@@ -52,7 +_,7 @@ + + for (BlockStateModel model : this.models) { + random.setSeed(seed); +- model.collectParts(random, output); ++ model.collectParts(random, output, data); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch deleted file mode 100644 index 441e567ab0..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/BakedQuad.java -+++ b/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -20,9 +_,17 @@ - Direction direction, - TextureAtlasSprite sprite, - boolean shade, -- int lightEmission -+ int lightEmission, -+ boolean ambientOcclusion - ) { - public static final int VERTEX_COUNT = 4; -+ -+ public BakedQuad( -+ Vector3fc position0, Vector3fc position1, Vector3fc position2, Vector3fc position3, -+ long packedUV0, long packedUV1, long packedUV2, long packedUV3, -+ int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) { -+ this(position0, position1, position2, position3, packedUV0, packedUV1, packedUV2, packedUV3, tintIndex, direction, sprite, shade, lightEmission, true); -+ } - - public boolean isTinted() { - return this.tintIndex != -1; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch deleted file mode 100644 index 5246327b28..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElementFace.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/BlockElementFace.java -+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java -@@ -15,9 +_,18 @@ - import org.jspecify.annotations.Nullable; - - @OnlyIn(Dist.CLIENT) --public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation) { -+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation, net.minecraftforge.client.model.@Nullable ForgeFaceData data) { - public static final int NO_TINT = -1; - -+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation) { -+ this(cullForDirection, tintIndex, texture, uvs, rotation, null); -+ } -+ -+ @Override -+ public net.minecraftforge.client.model.ForgeFaceData data() { -+ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data; -+ } -+ - public static float getU(BlockElementFace.UVs p_396140_, Quadrant p_396737_, int p_395337_) { - return p_396140_.getVertexU(p_396737_.rotateVertexIndex(p_395337_)) / 16.0F; - } -@@ -38,7 +_,7 @@ - String s = getTexture(jsonobject); - BlockElementFace.UVs blockelementface$uvs = getUVs(jsonobject); - Quadrant quadrant = getRotation(jsonobject); -- return new BlockElementFace(direction, i, s, blockelementface$uvs, quadrant); -+ return new BlockElementFace(direction, i, s, blockelementface$uvs, quadrant, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), null)); - } - - private static int getTintIndex(JsonObject p_111369_) { 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 deleted file mode 100644 index 3f11530b5a..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/BlockModel.java -+++ b/net/minecraft/client/renderer/block/model/BlockModel.java -@@ -27,8 +_,20 @@ - @Nullable Boolean ambientOcclusion, - @Nullable ItemTransforms transforms, - TextureSlots.Data textureSlots, -- @Nullable Identifier parent -+ @Nullable Identifier parent, -+ net.minecraftforge.client.model.@Nullable ForgeBlockModelData forgeData - ) implements UnbakedModel { -+ public BlockModel( -+ @Nullable UnbakedGeometry geometry, -+ UnbakedModel.@Nullable GuiLight guiLight, -+ @Nullable Boolean ambientOcclusion, -+ @Nullable ItemTransforms transforms, -+ TextureSlots.Data textureSlots, -+ @Nullable Identifier parent -+ ) { -+ this(geometry, guiLight, ambientOcclusion, transforms, textureSlots, parent, null); -+ } -+ - @VisibleForTesting - static final Gson GSON = new GsonBuilder() - .registerTypeAdapter(BlockModel.class, new BlockModel.Deserializer()) -@@ -91,8 +_,9 @@ - unbakedmodel$guilight = UnbakedModel.GuiLight.getByName(GsonHelper.getAsString(jsonobject, "gui_light")); - } - -+ var forgeData = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModel(jsonobject, p_111500_); - Identifier identifier = s.isEmpty() ? null : Identifier.parse(s); -- return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, identifier); -+ return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, identifier, forgeData); - } - - private TextureSlots.Data getTextureMap(JsonObject p_111510_) { -@@ -113,6 +_,9 @@ - } - - protected @Nullable UnbakedGeometry getElements(JsonDeserializationContext p_111507_, JsonObject p_111508_) { -+ var geo = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModelGeometry(p_111508_, p_111507_); -+ if (geo != null) -+ return geo; - if (!p_111508_.has("elements")) { - return null; - } else { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModelPart.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModelPart.java.patch deleted file mode 100644 index e9be8b4949..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModelPart.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/BlockModelPart.java -+++ b/net/minecraft/client/renderer/block/model/BlockModelPart.java -@@ -10,7 +_,7 @@ - import org.jspecify.annotations.Nullable; - - @OnlyIn(Dist.CLIENT) --public interface BlockModelPart { -+public interface BlockModelPart extends net.minecraftforge.client.extensions.IForgeBlockModelPart { - List getQuads(@Nullable Direction p_395320_); - - boolean useAmbientOcclusion(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockStateModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockStateModel.java.patch deleted file mode 100644 index 98f0c8f968..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockStateModel.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/BlockStateModel.java -+++ b/net/minecraft/client/renderer/block/model/BlockStateModel.java -@@ -22,15 +_,21 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - @OnlyIn(Dist.CLIENT) --public interface BlockStateModel { -+public interface BlockStateModel extends net.minecraftforge.client.extensions.IForgeBlockStateModel { -+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#collectParts(RandomSource, List, net.minecraftforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType)}*/ -+ @Deprecated - void collectParts(RandomSource p_397689_, List p_394710_); - -+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#collectParts(RandomSource, net.minecraftforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType)}*/ -+ @Deprecated - default List collectParts(RandomSource p_392713_) { - List list = new ObjectArrayList<>(); -- this.collectParts(p_392713_, list); -+ this.collectParts(p_392713_, list, net.minecraftforge.client.model.data.ModelData.EMPTY, null); - return list; - } - -+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#particleIcon(net.minecraftforge.client.model.data.ModelData)}*/ -+ @Deprecated - TextureAtlasSprite particleIcon(); - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index 7c241afd8a..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -93,7 +_,8 @@ - Objects.requireNonNullElse(direction, Direction.UP), - p_111604_, - p_111608_, -- p_364904_ -+ p_364904_, -+ p_111603_.data().ambientOcclusion() - ); - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransform.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransform.java.patch deleted file mode 100644 index e0c3de578b..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransform.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/ItemTransform.java -+++ b/net/minecraft/client/renderer/block/model/ItemTransform.java -@@ -17,7 +_,11 @@ - import org.joml.Vector3fc; - - @OnlyIn(Dist.CLIENT) --public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) { -+public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale, Vector3fc rightRotation) { -+ public ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) { -+ this(rotation, translation, scale, new Vector3f()); -+ } -+ - public static final ItemTransform NO_TRANSFORM = new ItemTransform(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - - public void apply(boolean p_111764_, PoseStack.Pose p_397991_) { -@@ -62,7 +_,7 @@ - vector3f1.set(Mth.clamp(vector3f1.x, -5.0F, 5.0F), Mth.clamp(vector3f1.y, -5.0F, 5.0F), Mth.clamp(vector3f1.z, -5.0F, 5.0F)); - Vector3f vector3f2 = this.getVector3f(jsonobject, "scale", DEFAULT_SCALE); - vector3f2.set(Mth.clamp(vector3f2.x, -4.0F, 4.0F), Mth.clamp(vector3f2.y, -4.0F, 4.0F), Mth.clamp(vector3f2.z, -4.0F, 4.0F)); -- return new ItemTransform(vector3f, vector3f1, vector3f2); -+ return new ItemTransform(vector3f, vector3f1, vector3f2, this.getVector3f(jsonobject, "right_rotation", DEFAULT_ROTATION)); - } - - private Vector3f getVector3f(JsonObject p_111779_, String p_111780_, Vector3f p_253777_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java.patch deleted file mode 100644 index 877aa5978a..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java -+++ b/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java -@@ -18,7 +_,7 @@ - import org.slf4j.Logger; - - @OnlyIn(Dist.CLIENT) --public record SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon) implements BlockModelPart { -+public record SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon, net.minecraft.client.renderer.chunk.ChunkSectionLayer layer, net.minecraft.client.renderer.chunk.ChunkSectionLayer layerFast) implements BlockModelPart { - private static final Logger LOGGER = LogUtils.getLogger(); - - public static BlockModelPart bake(ModelBaker p_395631_, Identifier p_457297_, ModelState p_396899_) { -@@ -44,8 +_,13 @@ - LOGGER.warn("Rejecting block model {}, since it contains sprites from outside of supported atlas: {}", p_457297_, multimap); - return p_395631_.missingBlockModelPart(); - } else { -- return new SimpleModelWrapper(quadcollection, flag, textureatlassprite); -+ var ctx = resolvedmodel.getContext(); -+ return new SimpleModelWrapper(quadcollection, flag, textureatlassprite, ctx.getRenderType().block(), ctx.getRenderTypeFast().block()); - } -+ } -+ -+ public SimpleModelWrapper(QuadCollection quadcollection, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon) { -+ this(quadcollection, useAmbientOcclusion, particleIcon, null, null); - } - - @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/SingleVariant.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/SingleVariant.java.patch deleted file mode 100644 index 738a4fe743..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/SingleVariant.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/SingleVariant.java -+++ b/net/minecraft/client/renderer/block/model/SingleVariant.java -@@ -12,9 +_,13 @@ - @OnlyIn(Dist.CLIENT) - public class SingleVariant implements BlockStateModel { - private final BlockModelPart model; -+ private final java.util.Collection layer; -+ private final java.util.Collection layerFast; - - public SingleVariant(BlockModelPart p_394592_) { - this.model = p_394592_; -+ this.layer = this.model.layer() == null ? null : java.util.EnumSet.of(this.model.layer()); -+ this.layerFast = this.model.layerFast() == null ? null : java.util.EnumSet.of(this.model.layerFast()); - } - - @Override -@@ -25,6 +_,12 @@ - @Override - public TextureAtlasSprite particleIcon() { - return this.model.particleIcon(); -+ } -+ -+ @Override -+ public java.util.Collection getRenderTypes(net.minecraft.world.level.block.state.BlockState state, RandomSource rand, net.minecraftforge.client.model.data.ModelData data) { -+ var type = net.minecraft.client.renderer.ItemBlockRenderTypes.isFancy() ? layer : layerFast; -+ return type != null ? type : BlockStateModel.super.getRenderTypes(state, rand, data); - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java.patch deleted file mode 100644 index 03dbedf447..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java -+++ b/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java -@@ -25,6 +_,8 @@ - private final MultiPartModel.SharedBakedState shared; - private final BlockState blockState; - private @Nullable List models; -+ private boolean cacheKey = false; -+ private java.util.@Nullable Collection cache; - - MultiPartModel(MultiPartModel.SharedBakedState p_391554_, BlockState p_397918_) { - this.shared = p_391554_; -@@ -37,6 +_,11 @@ - } - - @Override -+ public TextureAtlasSprite particleIcon(net.minecraftforge.client.model.data.ModelData data) { -+ return this.shared.firstModel.particleIcon(data); -+ } -+ -+ @Override - public void collectParts(RandomSource p_391247_, List p_397207_) { - if (this.models == null) { - this.models = this.shared.selectModels(this.blockState); -@@ -50,6 +_,33 @@ - } - } - -+ @Override -+ public void collectParts(RandomSource rand, List dest, net.minecraftforge.client.model.data.ModelData extraData, net.minecraft.client.renderer.chunk.ChunkSectionLayer renderType) { -+ if (this.models == null) { -+ this.models = this.shared.selectModels(this.blockState); -+ } -+ -+ long i = rand.nextLong(); -+ -+ for (BlockStateModel blockstatemodel : this.models) { -+ rand.setSeed(i); -+ blockstatemodel.collectParts(rand, dest, extraData, renderType); -+ } -+ } -+ -+ @Override -+ public java.util.Collection getRenderTypes(BlockState state, RandomSource rand, net.minecraftforge.client.model.data.ModelData data) { -+ if (this.models == null) -+ this.models = this.shared.selectModels(this.blockState); -+ if (this.cache == null || this.cacheKey != net.minecraft.client.renderer.ItemBlockRenderTypes.isFancy()) { -+ var tmp = java.util.EnumSet.noneOf(net.minecraft.client.renderer.chunk.ChunkSectionLayer.class); -+ for (var model : this.models) -+ tmp.addAll(model.getRenderTypes(state, rand, data)); -+ this.cache = tmp; -+ } -+ return !this.cache.isEmpty() ? this.cache : BlockStateModel.super.getRenderTypes(state, rand, data); -+ } -+ - @OnlyIn(Dist.CLIENT) - public record Selector(Predicate condition, T model) { - public MultiPartModel.Selector with(S p_393772_) { -@@ -61,6 +_,7 @@ - static final class SharedBakedState { - private final List> selectors; - final TextureAtlasSprite particleIcon; -+ final BlockStateModel firstModel; - private final Map> subsets = new ConcurrentHashMap<>(); - - private static BlockStateModel getFirstModel(List> p_392132_) { -@@ -73,8 +_,8 @@ - - public SharedBakedState(List> p_393647_) { - this.selectors = p_393647_; -- BlockStateModel blockstatemodel = getFirstModel(p_393647_); -- this.particleIcon = blockstatemodel.particleIcon(); -+ this.firstModel = getFirstModel(p_393647_); -+ this.particleIcon = firstModel.particleIcon(); - } - - public List selectModels(BlockState p_392405_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch index ab526d9673..9c94cca359 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java +++ b/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java -@@ -13,7 +_,7 @@ +@@ -14,7 +_,7 @@ @OnlyIn(Dist.CLIENT) public class BlockEntityRenderers { @@ -8,4 +8,4 @@ + private static final Map, BlockEntityRendererProvider> PROVIDERS = new java.util.concurrent.ConcurrentHashMap<>(); public static void register( - BlockEntityType p_173591_, BlockEntityRendererProvider p_173592_ + final BlockEntityType type, final BlockEntityRendererProvider renderer diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch index 3cfc89f09f..9248946751 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java +++ b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java -@@ -37,6 +_,7 @@ - - @OnlyIn(Dist.CLIENT) - public class SkullBlockRenderer implements BlockEntityRenderer { +@@ -43,6 +_,7 @@ + public static final WallAndGroundTransformations TRANSFORMATIONS = new WallAndGroundTransformations<>( + SkullBlockRenderer::createWallTransformation, SkullBlockRenderer::createGroundTransformation, 16 + ); + private static Map> customModels; private final Function modelByType; - public static final Map SKIN_BY_TYPE = Util.make(Maps.newHashMap(), p_340906_ -> { - p_340906_.put(SkullBlock.Types.SKELETON, Identifier.withDefaultNamespace("textures/entity/skeleton/skeleton.png")); -@@ -61,7 +_,9 @@ - case PIGLIN -> new PiglinHeadModel(p_376421_.bakeLayer(ModelLayers.PIGLIN_HEAD)); - }); + public static final Map SKIN_BY_TYPE = Util.make(Maps.newHashMap(), map -> { + map.put(SkullBlock.Types.SKELETON, Identifier.withDefaultNamespace("textures/entity/skeleton/skeleton.png")); +@@ -67,7 +_,9 @@ + case PIGLIN -> new PiglinHeadModel(modelSet.bakeLayer(ModelLayers.PIGLIN_HEAD)); + }; } else { - return null; + if (customModels == null) + customModels = net.minecraftforge.client.event.ForgeEventFactoryClient.onCreateSkullModels(); -+ return customModels.getOrDefault(p_377655_, k -> null).apply(p_376421_); ++ return customModels.getOrDefault(type, k -> null).apply(modelSet); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderSectionRegion.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderSectionRegion.java.patch index eda7b21805..31ff3a1d98 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderSectionRegion.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderSectionRegion.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/renderer/chunk/RenderSectionRegion.java +++ b/net/minecraft/client/renderer/chunk/RenderSectionRegion.java -@@ -89,4 +_,9 @@ - public static int index(int p_409495_, int p_409337_, int p_407713_, int p_409077_, int p_406510_, int p_408332_) { - return p_409077_ - p_409495_ + (p_406510_ - p_409337_) * 3 + (p_408332_ - p_407713_) * 3 * 3; +@@ -93,4 +_,9 @@ + public static int index(final int minSectionX, final int minSectionY, final int minSectionZ, final int sectionX, final int sectionY, final int sectionZ) { + return sectionX - minSectionX + (sectionY - minSectionY) * 3 + (sectionZ - minSectionZ) * 3 * 3; } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch index c6cae53317..57a9638c4e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch @@ -1,35 +1,32 @@ --- a/net/minecraft/client/renderer/chunk/SectionCompiler.java +++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java -@@ -42,6 +_,7 @@ - } - - public SectionCompiler.Results compile(SectionPos p_344383_, RenderSectionRegion p_409909_, VertexSorting p_342522_, SectionBufferBuilderPack p_343546_) { -+ var modelDataMap = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(p_344383_); - SectionCompiler.Results sectioncompiler$results = new SectionCompiler.Results(); - BlockPos blockpos = p_344383_.origin(); - BlockPos blockpos1 = blockpos.offset(15, 15, 15); -@@ -73,10 +_,14 @@ - } - - if (blockstate.getRenderShape() == RenderShape.MODEL) { -- ChunkSectionLayer chunksectionlayer2 = ItemBlockRenderTypes.getChunkRenderType(blockstate); -+ var model = this.blockRenderer.getBlockModel(blockstate); -+ var data = modelDataMap.getOrDefault(blockpos2, net.minecraftforge.client.model.data.ModelData.EMPTY); -+ data = model.getModelData(p_409909_, blockpos2, blockstate, data); -+ randomsource.setSeed(blockstate.getSeed(blockpos2)); // Forge: We set this on purpose twice so that getRenderTypes can have the same RNG as collectParts -+ for (ChunkSectionLayer chunksectionlayer2 : model.getRenderTypes(blockstate, randomsource, data)) { - BufferBuilder bufferbuilder1 = this.getOrBeginLayer(map, p_343546_, chunksectionlayer2); - randomsource.setSeed(blockstate.getSeed(blockpos2)); -- this.blockRenderer.getBlockModel(blockstate).collectParts(randomsource, list); -+ model.collectParts(randomsource, list, data, chunksectionlayer2); - posestack.pushPose(); - posestack.translate( - SectionPos.sectionRelative(blockpos2.getX()), SectionPos.sectionRelative(blockpos2.getY()), SectionPos.sectionRelative(blockpos2.getZ()) -@@ -84,6 +_,7 @@ - this.blockRenderer.renderBatched(blockstate, blockpos2, p_409909_, posestack, bufferbuilder1, true, list); - posestack.popPose(); - list.clear(); -+ } - } - } +@@ -56,6 +_,7 @@ + public SectionCompiler.Results compile( + final SectionPos sectionPos, final RenderSectionRegion region, final VertexSorting vertexSorting, final SectionBufferBuilderPack builders + ) { ++ var modelDataMap = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(sectionPos); + SectionCompiler.Results results = new SectionCompiler.Results(); + BlockPos minPos = sectionPos.origin(); + BlockPos maxPos = minPos.offset(15, 15, 15); +@@ -95,6 +_,9 @@ + } + if (blockState.getRenderShape() == RenderShape.MODEL) { ++ var model = this.blockModelSet.get(blockState); ++ var modelData = modelDataMap.getOrDefault(pos, net.minecraftforge.client.model.data.ModelData.EMPTY); ++ modelData = model.getModelData(region, pos, blockState, modelData); + blockRenderer.tesselateBlock( + ModelBlockRenderer.forceOpaque(this.cutoutLeaves, blockState) ? opaqueQuadOutput : quadOutput, + SectionPos.sectionRelative(pos.getX()), +@@ -103,8 +_,9 @@ + region, + pos, + blockState, +- this.blockModelSet.get(blockState), +- blockState.getSeed(pos) ++ model, ++ blockState.getSeed(pos), ++ modelData + ); + } + } catch (Throwable t) { diff --git a/patches/minecraft/net/minecraft/client/renderer/culling/Frustum.java.patch b/patches/minecraft/net/minecraft/client/renderer/culling/Frustum.java.patch index 56c8e797d6..f84ccf0f15 100644 --- a/patches/minecraft/net/minecraft/client/renderer/culling/Frustum.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/culling/Frustum.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/culling/Frustum.java +++ b/net/minecraft/client/renderer/culling/Frustum.java -@@ -78,6 +_,8 @@ +@@ -83,6 +_,8 @@ } - public boolean isVisible(AABB p_113030_) { + public boolean isVisible(final AABB bb) { + // Forge: exit early for infinite bounds, these would otherwise fail in the intersection test at certain camera angles (GH-9321) -+ if (p_113030_.equals(net.minecraftforge.common.extensions.IForgeBlockEntity.INFINITE_EXTENT_AABB)) return true; - int i = this.cubeInFrustum(p_113030_.minX, p_113030_.minY, p_113030_.minZ, p_113030_.maxX, p_113030_.maxY, p_113030_.maxZ); - return i == -2 || i == -1; ++ if (bb.equals(net.minecraftforge.common.extensions.IForgeBlockEntity.INFINITE_EXTENT_AABB)) return true; + int intersectionResult = this.cubeInFrustum(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ); + return intersectionResult == -2 || intersectionResult == -1; } diff --git a/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch index 952a23e3c4..7e02373768 100644 --- a/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java -@@ -100,8 +_,8 @@ +@@ -99,8 +_,8 @@ ); } -- if (p_450643_ instanceof EnderDragon enderdragon) { -- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { -+ if (p_450643_.isMultipartEntity()) { -+ for (var enderdragonpart : p_450643_.getParts()) { - Vec3 vec34 = enderdragonpart.position(); - Vec3 vec35 = enderdragonpart.getPosition(p_456396_); - Vec3 vec36 = vec35.subtract(vec34); +- if (entity instanceof EnderDragon dragon) { +- for (EnderDragonPart subEntity : dragon.getSubEntities()) { ++ if (entity.isMultipartEntity()) { ++ for (var subEntity : entity.getParts()) { + Vec3 latestSubPosition = subEntity.position(); + Vec3 currentSubPosition = subEntity.getPosition(partialTicks); + Vec3 subOffset = currentSubPosition.subtract(latestSubPosition); 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 470f778b86..a04ce8151e 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 -@@ -201,6 +_,14 @@ +@@ -207,6 +_,14 @@ return this.itemInHandRenderer; } @@ -13,12 +13,12 @@ + } + @Override - public void onResourceManagerReload(ResourceManager p_174004_) { - EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context( -@@ -218,5 +_,6 @@ - this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context); - this.playerRenderers = EntityRenderers.createAvatarRenderers(entityrendererprovider$context); - this.mannequinRenderers = EntityRenderers.createAvatarRenderers(entityrendererprovider$context); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onGatherLayers(renderers, playerRenderers, mannequinRenderers, entityrendererprovider$context); + public void onResourceManagerReload(final ResourceManager resourceManager) { + EntityRendererProvider.Context context = new EntityRendererProvider.Context( +@@ -224,5 +_,6 @@ + this.renderers = EntityRenderers.createEntityRenderers(context); + this.playerRenderers = EntityRenderers.createAvatarRenderers(context); + this.mannequinRenderers = EntityRenderers.createAvatarRenderers(context); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onGatherLayers(renderers, playerRenderers, mannequinRenderers, context); } } 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 1e2c38dba6..0b8b6f89b8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -1,24 +1,30 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java -@@ -125,9 +_,10 @@ - } - - protected void submitNameTag(S p_429896_, PoseStack p_428845_, SubmitNodeCollector p_426439_, CameraRenderState p_428408_) { -- if (p_429896_.nameTag != null) { -+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(p_429896_, p_429896_.nameTag, this, p_428845_, p_426439_, p_428408_); -+ if (!event.getResult().isDenied() && (event.getResult().isAllowed() || p_429896_.nameTag != null)) { - p_426439_.submitNameTag( -- p_428845_, p_429896_.nameTagAttachment, 0, p_429896_.nameTag, !p_429896_.isDiscrete, p_429896_.lightCoords, p_429896_.distanceToCameraSq, p_428408_ -+ p_428845_, p_429896_.nameTagAttachment, 0, event.getContent(), !p_429896_.isDiscrete, p_429896_.lightCoords, p_429896_.distanceToCameraSq, p_428408_ - ); +@@ -128,13 +_,14 @@ + final S state, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final CameraRenderState camera, final int offset + ) { + poseStack.pushPose(); +- if (state.scoreText != null) { +- submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, state.scoreText, !state.isDiscrete, state.lightCoords, camera); ++ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(state, this, poseStack, submitNodeCollector, camera); ++ if (event.getScoreContent() != null) { ++ submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, event.getScoreContent(), !state.isDiscrete, state.lightCoords, camera); + poseStack.translate(0.0F, 9.0F * 1.15F * 0.025F, 0.0F); } - } -@@ -177,7 +_,7 @@ +- if (state.nameTag != null) { +- submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, state.nameTag, !state.isDiscrete, state.lightCoords, camera); ++ if (event.getContent() != null) { ++ submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, event.getContent(), !state.isDiscrete, state.lightCoords, camera); + } + + poseStack.popPose(); +@@ -252,7 +_,7 @@ + protected final void extractNameTags(final T entity, final S state, final float partialTicks, final double nameTagDistance, final double belowNameDistance) { if (this.entityRenderDispatcher.camera != null) { - p_367427_.distanceToCameraSq = this.entityRenderDispatcher.distanceToSqr(p_367571_); -- boolean flag1 = p_367427_.distanceToCameraSq < 4096.0 && this.shouldShowName(p_367571_, p_367427_.distanceToCameraSq); -+ boolean flag1 = net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(p_367571_, p_367427_.distanceToCameraSq) && this.shouldShowName(p_367571_, p_367427_.distanceToCameraSq); - if (flag1) { - p_367427_.nameTag = this.getNameTag(p_367571_); - p_367427_.nameTagAttachment = p_367571_.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, p_367571_.getYRot(p_363243_)); + state.distanceToCameraSq = this.entityRenderDispatcher.distanceToSqr(entity); +- boolean shouldShowName = state.distanceToCameraSq < Mth.square(nameTagDistance) && this.shouldShowName(entity, state.distanceToCameraSq); ++ boolean shouldShowName = net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(entity, state.distanceToCameraSq, nameTagDistance) && this.shouldShowName(entity, state.distanceToCameraSq); + if (shouldShowName) { + state.nameTag = this.getNameTag(entity); + state.nameTagAttachment = entity.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, entity.getYRot(partialTicks)); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java.patch index bccb9fca61..b44ff59f15 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java +++ b/net/minecraft/client/renderer/entity/HumanoidMobRenderer.java -@@ -61,7 +_,7 @@ - p_369040_.isCrouching = p_362179_.isCrouching(); - p_369040_.isFallFlying = p_362179_.isFallFlying(); - p_369040_.isVisuallySwimming = p_362179_.isVisuallySwimming(); -- p_369040_.isPassenger = p_362179_.isPassenger(); -+ p_369040_.isPassenger = p_362179_.isPassenger() && (p_362179_.getVehicle() != null && p_362179_.getVehicle().shouldRiderSit());; - p_369040_.speedValue = 1.0F; - if (p_369040_.isFallFlying) { - p_369040_.speedValue = (float)p_362179_.getDeltaMovement().lengthSqr(); +@@ -69,7 +_,7 @@ + state.isCrouching = entity.isCrouching(); + state.isFallFlying = entity.isFallFlying(); + state.isVisuallySwimming = entity.isVisuallySwimming(); +- state.isPassenger = entity.isPassenger(); ++ state.isPassenger = entity.isPassenger() && (entity.getVehicle() != null && entity.getVehicle().shouldRiderSit()); + state.speedValue = 1.0F; + if (state.isFallFlying) { + state.speedValue = (float)entity.getDeltaMovement().lengthSqr(); 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 6d263bb72f..3cc42ac3d9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -95,6 +_,7 @@ - if (p_430553_.mapId != null) { - int j = p_430553_.rotation % 4 * 2; - p_431616_.mulPose(Axis.ZP.rotationDegrees(j * 360.0F / 8.0F)); -+ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderItemInFrame(p_430553_, this, p_431616_, p_423714_, p_430553_.lightCoords)) { - p_431616_.mulPose(Axis.ZP.rotationDegrees(180.0F)); - float f2 = 0.0078125F; - p_431616_.scale(0.0078125F, 0.0078125F, 0.0078125F); -@@ -102,6 +_,7 @@ - p_431616_.translate(0.0F, 0.0F, -1.0F); - int i = this.getLightCoords(p_430553_.isGlowFrame, 15728850, p_430553_.lightCoords); - this.mapRenderer.render(p_430553_.mapRenderState, p_431616_, p_423714_, true, i); +@@ -82,6 +_,7 @@ + if (state.mapId != null) { + int rotation = state.rotation % 4 * 2; + poseStack.mulPose(Axis.ZP.rotationDegrees(rotation * 360.0F / 8.0F)); ++ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderItemInFrame(state, this, poseStack, submitNodeCollector, state.lightCoords)) { + poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); + float s = 0.0078125F; + poseStack.scale(0.0078125F, 0.0078125F, 0.0078125F); +@@ -89,6 +_,7 @@ + poseStack.translate(0.0F, 0.0F, -1.0F); + int lightCoords = this.getLightCoords(state.isGlowFrame, 15728850, state.lightCoords); + this.mapRenderer.render(state.mapRenderState, poseStack, submitNodeCollector, true, lightCoords); + } - } else if (!p_430553_.item.isEmpty()) { - p_431616_.mulPose(Axis.ZP.rotationDegrees(p_430553_.rotation * 360.0F / 8.0F)); - int k = this.getLightCoords(p_430553_.isGlowFrame, 15728880, p_430553_.lightCoords); + } else if (!state.item.isEmpty()) { + poseStack.mulPose(Axis.ZP.rotationDegrees(state.rotation * 360.0F / 8.0F)); + int lightVal = this.getLightCoords(state.isGlowFrame, 15728880, state.lightCoords); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch index c79a00fe21..7ffa0ca238 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch @@ -1,26 +1,27 @@ --- a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java -@@ -72,6 +_,7 @@ +@@ -73,6 +_,7 @@ } - public void submit(S p_427824_, PoseStack p_423787_, SubmitNodeCollector p_424901_, CameraRenderState p_422963_) { -+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderLivingPre(p_427824_, this, p_423787_, p_424901_, p_422963_)) return; - p_423787_.pushPose(); - if (p_427824_.hasPose(Pose.SLEEPING)) { - Direction direction = p_427824_.bedOrientation; -@@ -107,6 +_,7 @@ + public void submit(final S state, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final CameraRenderState camera) { ++ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderLivingPre(state, this, poseStack, submitNodeCollector, camera)) return; + poseStack.pushPose(); + if (state.hasPose(Pose.SLEEPING)) { + Direction bedOrientation = state.bedOrientation; +@@ -110,6 +_,7 @@ - p_423787_.popPose(); - super.submit(p_427824_, p_423787_, p_424901_, p_422963_); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderLivingPost(p_427824_, this, p_423787_, p_424901_, p_422963_); + poseStack.popPose(); + super.submit(state, poseStack, submitNodeCollector, camera); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderLivingPost(state, this, poseStack, submitNodeCollector, camera); } - protected boolean shouldRenderLayers(S p_360804_) { -@@ -284,6 +_,7 @@ - p_363057_.isFullyFrozen = p_368665_.isFullyFrozen(); - p_363057_.isBaby = p_368665_.isBaby(); - p_363057_.isInWater = p_368665_.isInWater(); -+ p_363057_.isInWater = p_368665_.isInWaterOrSwimmable(); - p_363057_.isAutoSpinAttack = p_368665_.isAutoSpinAttack(); - p_363057_.ticksSinceKineticHitFeedback = p_368665_.getTicksSinceLastKineticHitFeedback(p_364497_); - p_363057_.hasRedOverlay = p_368665_.hurtTime > 0 || p_368665_.deathTime > 0; + protected boolean shouldRenderLayers(final S state) { +@@ -278,7 +_,7 @@ + + state.isFullyFrozen = entity.isFullyFrozen(); + state.isBaby = entity.isBaby(); +- state.isInWater = entity.isInWater(); ++ state.isInWater = entity.isInWaterOrSwimmable(); + state.isAutoSpinAttack = entity.isAutoSpinAttack(); + state.ticksSinceKineticHitFeedback = entity.getTicksSinceLastKineticHitFeedback(partialTicks); + state.hasRedOverlay = entity.hurtTime > 0 || entity.deathTime > 0; 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 4ed5219f12..f6f46b961d 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,26 +1,24 @@ --- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java -@@ -51,6 +_,7 @@ - Equippable equippable = p_366444_.get(DataComponents.EQUIPPABLE); - if (equippable != null && shouldRender(equippable, p_117122_)) { - A a = this.getArmorModel(p_423438_, p_117122_); -+ var model = this.getArmorModel(p_423438_, p_117122_, p_366444_, a); - EquipmentClientInfo.LayerType equipmentclientinfo$layertype = this.usesInnerModel(p_117122_) - ? EquipmentClientInfo.LayerType.HUMANOID_LEGGINGS - : EquipmentClientInfo.LayerType.HUMANOID; -@@ -58,7 +_,7 @@ +@@ -66,12 +_,13 @@ + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); + if (equippable != null && shouldRender(equippable, slot)) { + A model = this.getArmorModel(state, slot); ++ var newModel = this.getArmorModel(state, slot, itemStack, model); + EquipmentClientInfo.LayerType layerType = state.isBaby && state.entityType != EntityTypes.ARMOR_STAND + ? EquipmentClientInfo.LayerType.HUMANOID_BABY + : (this.usesInnerModel(slot) ? EquipmentClientInfo.LayerType.HUMANOID_LEGGINGS : EquipmentClientInfo.LayerType.HUMANOID); + this.equipmentRenderer .renderLayers( - equipmentclientinfo$layertype, - equippable.assetId().orElseThrow(), -- a, -+ model, - p_423438_, - p_366444_, - p_117119_, -@@ -75,5 +_,12 @@ +- layerType, equippable.assetId().orElseThrow(), model, state, itemStack, poseStack, submitNodeCollector, lightCoords, state.outlineColor ++ layerType, equippable.assetId().orElseThrow(), newModel, state, itemStack, poseStack, submitNodeCollector, lightCoords, state.outlineColor + ); + } + } +@@ -82,5 +_,12 @@ - private boolean usesInnerModel(EquipmentSlot p_117129_) { - return p_117129_ == EquipmentSlot.LEGS; + private boolean usesInnerModel(final EquipmentSlot slot) { + return slot == EquipmentSlot.LEGS; + } + + /** diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/WingsLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/WingsLayer.java.patch index 17f3d4ba89..67cdb05fa5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/WingsLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/WingsLayer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/entity/layers/WingsLayer.java +++ b/net/minecraft/client/renderer/entity/layers/WingsLayer.java -@@ -58,7 +_,7 @@ +@@ -60,7 +_,7 @@ } } -- protected static @Nullable Identifier getPlayerElytraTexture(HumanoidRenderState p_364125_) { -+ protected @Nullable Identifier getPlayerElytraTexture(HumanoidRenderState p_364125_) { - if (p_364125_ instanceof AvatarRenderState avatarrenderstate) { - PlayerSkin playerskin = avatarrenderstate.skin; - if (playerskin.elytra() != null) { +- protected static @Nullable Identifier getPlayerElytraTexture(final HumanoidRenderState state) { ++ protected @Nullable Identifier getPlayerElytraTexture(final HumanoidRenderState state) { + if (state instanceof AvatarRenderState playerState) { + PlayerSkin skin = playerState.skin; + if (skin.elytra() != null) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch index 325552266b..8dd36f4d24 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch @@ -1,55 +1,44 @@ --- a/net/minecraft/client/renderer/entity/player/AvatarRenderer.java +++ b/net/minecraft/client/renderer/entity/player/AvatarRenderer.java -@@ -96,7 +_,7 @@ - private static HumanoidModel.ArmPose getArmPose(Avatar p_422497_, ItemStack p_429700_, InteractionHand p_430481_) { - if (p_429700_.isEmpty()) { +@@ -98,7 +_,7 @@ return HumanoidModel.ArmPose.EMPTY; -- } else if (!p_422497_.swinging && p_429700_.is(Items.CROSSBOW) && CrossbowItem.isCharged(p_429700_)) { -+ } else if (!p_422497_.swinging && p_429700_.getItem() instanceof CrossbowItem && CrossbowItem.isCharged(p_429700_)) { + } + +- if (!avatar.swinging && itemInHand.is(Items.CROSSBOW) && CrossbowItem.isCharged(itemInHand)) { ++ if (!avatar.swinging && itemInHand.getItem() instanceof CrossbowItem && CrossbowItem.isCharged(itemInHand)) { return HumanoidModel.ArmPose.CROSSBOW_HOLD; + } + +@@ -141,7 +_,9 @@ + if (attack != null && attack.type() == SwingAnimationType.STAB && avatar.swinging) { + return HumanoidModel.ArmPose.SPEAR; } else { - if (p_422497_.getUsedItemHand() == p_430481_ && p_422497_.getUseItemRemainingTicks() > 0) { -@@ -138,7 +_,9 @@ - if (swinganimation != null && swinganimation.type() == SwingAnimationType.STAB && p_422497_.swinging) { - return HumanoidModel.ArmPose.SPEAR; - } else { -- return p_429700_.is(ItemTags.SPEARS) ? HumanoidModel.ArmPose.SPEAR : HumanoidModel.ArmPose.ITEM; -+ if (p_429700_.is(ItemTags.SPEARS)) return HumanoidModel.ArmPose.SPEAR; -+ var pose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_429700_).getArmPose(p_422497_, p_430481_, p_429700_); -+ return pose == null ? HumanoidModel.ArmPose.ITEM : pose; - } +- return itemInHand.is(ItemTags.SPEARS) ? HumanoidModel.ArmPose.SPEAR : HumanoidModel.ArmPose.ITEM; ++ if (itemInHand.is(ItemTags.SPEARS)) return HumanoidModel.ArmPose.SPEAR; ++ var pose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemInHand).getArmPose(avatar, hand, itemInHand); ++ return pose == null ? HumanoidModel.ArmPose.ITEM : pose; } } -@@ -162,9 +_,10 @@ - p_423892_.translate(0.0F, 9.0F * 1.15F * 0.025F, 0.0F); - } -- if (p_425306_.nameTag != null) { -+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(p_425306_, p_425306_.nameTag, this, p_423892_, p_428344_, p_426061_); -+ if (!event.getResult().isDenied() && (event.getResult().isAllowed() || p_425306_.nameTag != null)) { - p_428344_.submitNameTag( -- p_423892_, p_425306_.nameTagAttachment, i, p_425306_.nameTag, !p_425306_.isDiscrete, p_425306_.lightCoords, p_425306_.distanceToCameraSq, p_426061_ -+ p_423892_, p_425306_.nameTagAttachment, i, event.getContent(), !p_425306_.isDiscrete, p_425306_.lightCoords, p_425306_.distanceToCameraSq, p_426061_ - ); - } - -@@ -252,10 +_,12 @@ +@@ -241,12 +_,14 @@ + public void renderRightHand( + final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final int lightCoords, final Identifier skinTexture, final boolean hasSleeve + ) { ++ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderArm(poseStack, submitNodeCollector, lightCoords, HumanoidArm.RIGHT)) + this.renderHand(poseStack, submitNodeCollector, lightCoords, skinTexture, this.model.rightArm, hasSleeve); } - public void renderRightHand(PoseStack p_428282_, SubmitNodeCollector p_424928_, int p_427204_, Identifier p_450403_, boolean p_431039_) { -+ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderArm(p_428282_, p_424928_, p_427204_, HumanoidArm.RIGHT)) - this.renderHand(p_428282_, p_424928_, p_427204_, p_450403_, this.model.rightArm, p_431039_); + public void renderLeftHand( + final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final int lightCoords, final Identifier skinTexture, final boolean hasSleeve + ) { ++ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderArm(poseStack, submitNodeCollector, lightCoords, HumanoidArm.LEFT)) + this.renderHand(poseStack, submitNodeCollector, lightCoords, skinTexture, this.model.leftArm, hasSleeve); } - public void renderLeftHand(PoseStack p_424615_, SubmitNodeCollector p_425532_, int p_427068_, Identifier p_458705_, boolean p_423290_) { -+ if (!net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderArm(p_424615_, p_425532_, p_427068_, HumanoidArm.LEFT)) - this.renderHand(p_424615_, p_425532_, p_427068_, p_458705_, this.model.leftArm, p_423290_); - } +@@ -304,5 +_,12 @@ -@@ -306,5 +_,12 @@ - - public static boolean isPlayerUpsideDown(Player p_424650_) { - return isUpsideDownName(p_424650_.getGameProfile().name()); + public static boolean isPlayerUpsideDown(final Player player) { + return isUpsideDownName(player.getGameProfile().name()); + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch b/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch new file mode 100644 index 0000000000..1ed87d4486 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch @@ -0,0 +1,58 @@ +--- a/net/minecraft/client/renderer/extract/LevelExtractor.java ++++ b/net/minecraft/client/renderer/extract/LevelExtractor.java +@@ -172,7 +_,7 @@ + profiler.popPush("entities"); + this.extractVisibleEntities(camera, cullFrustum, deltaTracker, this.levelRenderState); + profiler.popPush("blockEntities"); +- this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState); ++ this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState, cullFrustum); + profiler.popPush("blockOutline"); + this.extractBlockOutline(camera, this.levelRenderState); + profiler.popPush("blockBreaking"); +@@ -264,7 +_,7 @@ + return this.levelRenderer.entityRenderDispatcher().extractEntity(entity, partialTickTime); + } + +- private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState) { ++ private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState, final Frustum frustum) { + Vec3 cameraPos = camera.position(); + double camX = cameraPos.x(); + double camY = cameraPos.y(); +@@ -275,6 +_,7 @@ + List renderableBlockEntities = section.getSectionMesh().getRenderableBlockEntities(); + if (!renderableBlockEntities.isEmpty() && !(section.getVisibility(Util.getMillis()) < 0.3F)) { + for (BlockEntity blockEntity : renderableBlockEntities) { ++ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; + BlockPos blockPos = blockEntity.getBlockPos(); + SortedSet progresses = this.level.destructionProgress().get(blockPos.asLong()); + ModelFeatureRenderer.CrumblingOverlay breakProgress; +@@ -304,6 +_,7 @@ + if (blockEntity.isRemoved()) { + iterator.remove(); + } else { ++ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; + BlockEntityRenderState state = this.levelRenderer + .blockEntityRenderDispatcher() + .tryExtractRenderState(blockEntity, deltaPartialTick, null, true); +@@ -327,7 +_,7 @@ + SortedSet progresses = entry.getValue(); + if (progresses != null && !progresses.isEmpty()) { + int progress = progresses.last().getProgress(); +- levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress)); ++ levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress, this.level.getModelDataManager().getAtOrEmpty(pos))); + } + } + } +@@ -335,6 +_,12 @@ + + private void extractBlockOutline(final Camera camera, final LevelRenderState levelRenderState) { + levelRenderState.blockOutlineRenderState = null; ++ var custom = net.minecraftforge.client.ForgeHooksClient.onExtractBlockOutline(this, camera, levelRenderState, this.minecraft.hitResult); ++ if (custom != null) { ++ levelRenderState.blockOutlineRenderState = new BlockOutlineRenderState(BlockPos.ZERO, false, false, net.minecraft.world.phys.shapes.Shapes.empty(), null, null, null, custom); ++ return; ++ } ++ + if (this.minecraft.hitResult instanceof BlockHitResult blockHitResult) { + if (blockHitResult.getType() != HitResult.Type.MISS) { + BlockPos pos = blockHitResult.getBlockPos(); diff --git a/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch index 6ffbf9c922..386f3cf404 100644 --- a/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch @@ -1,24 +1,23 @@ --- a/net/minecraft/client/renderer/fog/FogRenderer.java +++ b/net/minecraft/client/renderer/fog/FogRenderer.java -@@ -151,6 +_,13 @@ - f2 = Mth.lerp(f6, f2, f2 * f7); - } - -+ -+ var fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_407993_, p_409359_, p_409862_, p_409400_, p_406105_, f, f1, f2); -+ -+ f = fogColor.x(); -+ f1 = fogColor.y(); -+ f2 = fogColor.z(); -+ - return new Vector4f(f5, f1, f2, 1.0F); +@@ -159,6 +_,12 @@ + fogBlue = Mth.lerp(brightenFactor, fogBlue, fogBlue * scale); } - } -@@ -177,6 +_,7 @@ - float f2 = Mth.clamp(f1 / 10.0F, 4.0F, 64.0F); - fogdata.renderDistanceStart = f1 - f2; - fogdata.renderDistanceEnd = f1; -+ vector4f = net.minecraftforge.client.ForgeHooksClient.setupFog(fogtype, p_407701_, p_406871_, fogdata, vector4f); - try (GpuBuffer.MappedView gpubuffer$mappedview = RenderSystem.getDevice().createCommandEncoder().mapBuffer(this.regularBuffer.currentBuffer(), false, true)) { - this.updateBuffer( ++ var fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(camera, partialTicks, level, renderDistance, darkenWorldAmount, fogRed, fogGreen, fogBlue); ++ ++ fogRed = fogColor.x(); ++ fogGreen = fogColor.y(); ++ fogBlue = fogColor.z(); ++ + dest.set(fogRed, fogGreen, fogBlue, 1.0F); + } + +@@ -186,6 +_,7 @@ + float renderDistanceFogSpan = Mth.clamp(renderDistanceInBlocks / 10.0F, 4.0F, 64.0F); + fog.renderDistanceStart = renderDistanceInBlocks - renderDistanceFogSpan; + fog.renderDistanceEnd = renderDistanceInBlocks; ++ fog.color = net.minecraftforge.client.ForgeHooksClient.setupFog(fogType, camera, deltaTracker, fog, fog.color); + return fog; + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch b/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch deleted file mode 100644 index df8809c429..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/net/minecraft/client/renderer/rendertype/RenderSetup.java -+++ b/net/minecraft/client/renderer/rendertype/RenderSetup.java -@@ -32,6 +_,7 @@ - final boolean sortOnUpload; - final int bufferSize; - final LayeringTransform layeringTransform; -+ final Map texturesWithSamplers; - - RenderSetup( - RenderPipeline p_455545_, -@@ -44,7 +_,8 @@ - RenderSetup.OutlineProperty p_454071_, - boolean p_455910_, - boolean p_450946_, -- int p_453755_ -+ int p_453755_, -+ Map texturesWithSamplers - ) { - this.pipeline = p_455545_; - this.textures = p_455652_; -@@ -57,6 +_,7 @@ - this.affectsCrumbling = p_455910_; - this.sortOnUpload = p_450946_; - this.bufferSize = p_453755_; -+ this.texturesWithSamplers = texturesWithSamplers; - } - - @Override -@@ -114,6 +_,8 @@ - ); - } - -+ map.putAll(this.texturesWithSamplers); -+ - return map; - } - } -@@ -149,6 +_,7 @@ - private int bufferSize = 1536; - private RenderSetup.OutlineProperty outlineProperty = RenderSetup.OutlineProperty.NONE; - private final Map textures = new HashMap<>(); -+ private final Map texturesWithSamplers = new HashMap<>(); - - RenderSetupBuilder(RenderPipeline p_453804_) { - this.pipeline = p_453804_; -@@ -164,6 +_,11 @@ - return this; - } - -+ public RenderSetup.RenderSetupBuilder withTexture(String name, GpuTextureView textureView, GpuSampler sampler) { -+ this.texturesWithSamplers.put(name, new RenderSetup.TextureAndSampler(textureView, sampler)); -+ return this; -+ } -+ - public RenderSetup.RenderSetupBuilder useLightmap() { - this.useLightmap = true; - return this; -@@ -221,7 +_,8 @@ - this.outlineProperty, - this.affectsCrumbling, - this.sortOnUpload, -- this.bufferSize -+ this.bufferSize, -+ this.texturesWithSamplers - ); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch b/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch index d56743099a..fcbfb34b31 100644 --- a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch @@ -1,44 +1,44 @@ --- a/net/minecraft/client/renderer/rendertype/RenderTypes.java +++ b/net/minecraft/client/renderer/rendertype/RenderTypes.java -@@ -542,7 +_,7 @@ +@@ -574,7 +_,7 @@ } - public static RenderType text(Identifier p_456274_) { -- return TEXT.apply(p_456274_); -+ return net.minecraftforge.client.ForgeRenderTypes.getText(p_456274_); + public static RenderType text(final Identifier texture) { +- return TEXT.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getText(texture); } public static RenderType textBackground() { -@@ -550,19 +_,19 @@ +@@ -582,19 +_,19 @@ } - public static RenderType textIntensity(Identifier p_460070_) { -- return TEXT_INTENSITY.apply(p_460070_); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensity(p_460070_); + public static RenderType textGrayscale(final Identifier texture) { +- return TEXT_GRAYSCALE.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscale(texture); } - public static RenderType textPolygonOffset(Identifier p_450888_) { -- return TEXT_POLYGON_OFFSET.apply(p_450888_); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextPolygonOffset(p_450888_); + public static RenderType textPolygonOffset(final Identifier texture) { +- return TEXT_POLYGON_OFFSET.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextPolygonOffset(texture); } - public static RenderType textIntensityPolygonOffset(Identifier p_457059_) { -- return TEXT_INTENSITY_POLYGON_OFFSET.apply(p_457059_); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensityPolygonOffset(p_457059_); + public static RenderType textGrayscalePolygonOffset(final Identifier texture) { +- return TEXT_GRAYSCALE_POLYGON_OFFSET.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscalePolygonOffset(texture); } - public static RenderType textSeeThrough(Identifier p_452096_) { -- return TEXT_SEE_THROUGH.apply(p_452096_); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextSeeThrough(p_452096_); + public static RenderType textSeeThrough(final Identifier texture) { +- return TEXT_SEE_THROUGH.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextSeeThrough(texture); } public static RenderType textBackgroundSeeThrough() { -@@ -570,7 +_,7 @@ +@@ -602,7 +_,7 @@ } - public static RenderType textIntensitySeeThrough(Identifier p_453978_) { -- return TEXT_INTENSITY_SEE_THROUGH.apply(p_453978_); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensitySeeThrough(p_453978_); + public static RenderType textGrayscaleSeeThrough(final Identifier texture) { +- return TEXT_GRAYSCALE_SEE_THROUGH.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscaleSeeThrough(texture); } public static RenderType lightning() { diff --git a/patches/minecraft/net/minecraft/client/renderer/special/SpecialModelRenderers.java.patch b/patches/minecraft/net/minecraft/client/renderer/special/SpecialModelRenderers.java.patch deleted file mode 100644 index ff3ba08284..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/special/SpecialModelRenderers.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/special/SpecialModelRenderers.java -+++ b/net/minecraft/client/renderer/special/SpecialModelRenderers.java -@@ -199,6 +_,8 @@ - map.put(Blocks.TRAPPED_CHEST, GIFT_CHEST); - } - -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onCreateSpecialBlockRenderers(map); -+ - Builder> builder = ImmutableMap.builder(); - map.forEach((p_421033_, p_421034_) -> { - SpecialModelRenderer specialmodelrenderer = p_421034_.bake(p_431302_); diff --git a/patches/minecraft/net/minecraft/client/renderer/state/level/BlockBreakingRenderState.java.patch b/patches/minecraft/net/minecraft/client/renderer/state/level/BlockBreakingRenderState.java.patch new file mode 100644 index 0000000000..ad1b85d66f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/state/level/BlockBreakingRenderState.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/renderer/state/level/BlockBreakingRenderState.java ++++ b/net/minecraft/client/renderer/state/level/BlockBreakingRenderState.java +@@ -6,5 +_,8 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + + @OnlyIn(Dist.CLIENT) +-public record BlockBreakingRenderState(BlockPos blockPos, BlockState blockState, int progress) { ++public record BlockBreakingRenderState(BlockPos blockPos, BlockState blockState, int progress, net.minecraftforge.client.model.data.ModelData data) { ++ public BlockBreakingRenderState(BlockPos blockPos, BlockState blockState, int progress) { ++ this(blockPos, blockState, progress, net.minecraftforge.client.model.data.ModelData.EMPTY); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/state/BlockOutlineRenderState.java.patch b/patches/minecraft/net/minecraft/client/renderer/state/level/BlockOutlineRenderState.java.patch similarity index 64% rename from patches/minecraft/net/minecraft/client/renderer/state/BlockOutlineRenderState.java.patch rename to patches/minecraft/net/minecraft/client/renderer/state/level/BlockOutlineRenderState.java.patch index f3a240d193..097e9e5c88 100644 --- a/patches/minecraft/net/minecraft/client/renderer/state/BlockOutlineRenderState.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/state/level/BlockOutlineRenderState.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/client/renderer/state/BlockOutlineRenderState.java -+++ b/net/minecraft/client/renderer/state/BlockOutlineRenderState.java +--- a/net/minecraft/client/renderer/state/level/BlockOutlineRenderState.java ++++ b/net/minecraft/client/renderer/state/level/BlockOutlineRenderState.java @@ -14,9 +_,14 @@ VoxelShape shape, @Nullable VoxelShape collisionShape, @@ -8,8 +8,8 @@ + @Nullable VoxelShape interactionShape, + net.minecraftforge.client.event.RenderHighlightEvent.@Nullable Callback customRenderer ) { - public BlockOutlineRenderState(BlockPos p_425529_, boolean p_426298_, boolean p_426881_, VoxelShape p_424013_) { - this(p_425529_, p_426298_, p_426881_, p_424013_, null, null, null); + public BlockOutlineRenderState(final BlockPos pos, final boolean isTranslucent, final boolean highContrast, final VoxelShape shape) { + this(pos, isTranslucent, highContrast, shape, null, null, null); + } + + public BlockOutlineRenderState(BlockPos pos, boolean isTranslucent, boolean highContrast, VoxelShape shape, @Nullable VoxelShape collisionShape, @Nullable VoxelShape occlusionShape, @Nullable VoxelShape interactionShape) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch index 21aed2a1a7..0a07048d44 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/client/renderer/texture/MipmapGenerator.java +++ b/net/minecraft/client/renderer/texture/MipmapGenerator.java -@@ -112,12 +_,16 @@ - float f = p_450366_ == MipmapStrategy.STRICT_CUTOUT ? 0.3F : 0.5F; - float f1 = flag ? alphaTestCoverage(p_251300_[0], f, 1.0F) : 0.0F; +@@ -123,12 +_,16 @@ + float cutoutRef = mipmapStrategy == MipmapStrategy.STRICT_CUTOUT ? 0.3F : 0.5F; + float originalCoverage = isCutoutMip ? alphaTestCoverage(currentMips[0], cutoutRef, 1.0F) : 0.0F; -+ int maxMipmapLevel = net.minecraftforge.client.ForgeHooksClient.getMaxMipmapLevel(anativeimage[0].getWidth(), anativeimage[0].getHeight()); - for (int i = 1; i <= p_252326_; i++) { - if (i < p_251300_.length) { - anativeimage[i] = p_251300_[i]; - } else { - NativeImage nativeimage = anativeimage[i - 1]; -- NativeImage nativeimage1 = new NativeImage(nativeimage.getWidth() >> 1, nativeimage.getHeight() >> 1, false); -+ // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes -+ NativeImage nativeimage1 = new NativeImage(Math.max(1, nativeimage.getWidth() >> 1), Math.max(1, nativeimage.getHeight() >> 1), false); -+ if (i <= maxMipmapLevel) { ++ int maxMipmapLevel = net.minecraftforge.client.ForgeHooksClient.getMaxMipmapLevel(result[0].getWidth(), result[0].getHeight()); + for (int level = 1; level <= newMipLevel; level++) { + if (level < currentMips.length) { + result[level] = currentMips[level]; + } else { + NativeImage lastData = result[level - 1]; +- NativeImage data = new NativeImage(lastData.getWidth() >> 1, lastData.getHeight() >> 1, false); ++ // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes ++ NativeImage data = new NativeImage(Math.max(1, lastData.getWidth() >> 1), Math.max(1, lastData.getHeight() >> 1), false); ++ if (level <= maxMipmapLevel) { + - int j = nativeimage1.getWidth(); - int k = nativeimage1.getHeight(); + int width = data.getWidth(); + int height = data.getHeight(); -@@ -136,6 +_,7 @@ +@@ -147,6 +_,7 @@ - nativeimage1.setPixel(l, i1, j2); - } -+ } + data.setPixel(x, y, color); } ++ } + } - anativeimage[i] = nativeimage1; + result[level] = data; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteContents.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteContents.java.patch index b415440690..4d9df3b939 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteContents.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteContents.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/SpriteContents.java +++ b/net/minecraft/client/renderer/texture/SpriteContents.java -@@ -168,6 +_,10 @@ +@@ -183,6 +_,14 @@ return this.name; } @@ -8,6 +8,10 @@ + return this.originalImage; + } + - public IntStream getUniqueFrames() { - return this.animatedTexture != null ? this.animatedTexture.getUniqueFrames() : IntStream.of(1); ++ public int getMipLevel() { ++ return this.byMipLevel.length - 1; ++ } ++ + public IntList getUniqueFrames() { + return this.animatedTexture != null ? this.animatedTexture.getUniqueFrames() : IntList.of(1); } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch index 76fbbceb4c..0d4d9f1d02 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch @@ -1,39 +1,30 @@ --- a/net/minecraft/client/renderer/texture/SpriteLoader.java +++ b/net/minecraft/client/renderer/texture/SpriteLoader.java -@@ -72,7 +_,7 @@ - int j1 = Math.min(j, k); - int k1 = Mth.log2(j1); - int l1; -- if (k1 < p_261919_) { -+ if (k1 < p_261919_ && net.minecraftforge.common.ForgeConfig.CLIENT.allowMipmapLowering()) { // Forge: Do not lower the mipmap level - LOGGER.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.location, p_261919_, k1, j1); - l1 = k1; +@@ -71,7 +_,7 @@ + int minSize = Math.min(minTexelSize, lowestOneBit); + int minPowerOfTwo = Mth.log2(minSize); + int mipLevel; +- if (minPowerOfTwo < maxMipmapLevels) { ++ if (minPowerOfTwo < maxMipmapLevels && net.minecraftforge.common.ForgeConfig.CLIENT.allowMipmapLowering()) { // Forge: Do not lower the mipmap level + LOGGER.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.location, maxMipmapLevels, minPowerOfTwo, minSize); + mipLevel = minPowerOfTwo; } else { -@@ -126,7 +_,8 @@ - public CompletableFuture loadAndStitch( - ResourceManager p_262108_, Identifier p_459205_, int p_262104_, Executor p_261687_, Set> p_430900_ +@@ -129,7 +_,8 @@ + final Executor taskExecutor, + final Set> additionalMetadata ) { -- SpriteResourceLoader spriteresourceloader = SpriteResourceLoader.create(p_430900_); -+ var sections = net.minecraftforge.client.ForgeHooksClient.getAtlastMetadataSections(p_459205_, p_430900_); -+ SpriteResourceLoader spriteresourceloader = SpriteResourceLoader.create(sections); - return CompletableFuture.>supplyAsync(() -> SpriteSourceList.load(p_262108_, p_459205_).list(p_262108_), p_261687_) - .thenCompose(p_296297_ -> runSpriteSuppliers(spriteresourceloader, (List)p_296297_, p_261687_)) - .thenApply(p_261393_ -> this.stitch((List)p_261393_, p_262104_, p_261687_)); -@@ -135,9 +_,14 @@ - private Map getStitchedSprites(Stitcher p_276117_, int p_276111_, int p_276112_) { - Map map = new HashMap<>(); - p_276117_.gatherSprites( -- (p_448383_, p_448384_, p_448385_, p_448386_) -> map.put( -- p_448383_.name(), new TextureAtlasSprite(this.location, p_448383_, p_276111_, p_276112_, p_448384_, p_448385_, p_448386_) -- ) -+ (p_448383_, p_448384_, p_448385_, p_448386_) -> { -+ TextureAtlasSprite sprite = net.minecraftforge.client.ForgeHooksClient.loadTextureAtlasSprite(this.location, p_448383_, p_276111_, p_276112_, p_448384_, p_448385_, p_448386_, p_448383_.byMipLevel.length - 1); -+ if (sprite != null) { -+ map.put(p_448383_.name(), sprite); -+ return; -+ } -+ map.put(p_448383_.name(), new TextureAtlasSprite(this.location, p_448383_, p_276111_, p_276112_, p_448384_, p_448385_, p_448386_)); -+ } +- SpriteResourceLoader spriteResourceLoader = SpriteResourceLoader.create(additionalMetadata); ++ var sections = net.minecraftforge.client.ForgeHooksClient.getAtlastMetadataSections(atlasInfoLocation, additionalMetadata); ++ SpriteResourceLoader spriteResourceLoader = SpriteResourceLoader.create(sections); + return CompletableFuture.>supplyAsync(() -> SpriteSourceList.load(manager, atlasInfoLocation).list(manager), taskExecutor) + .thenCompose(sprites -> runSpriteSuppliers(spriteResourceLoader, (List)sprites, taskExecutor)) + .thenApply(resources -> this.stitch((List)resources, maxMipmapLevels, taskExecutor)); +@@ -138,7 +_,7 @@ + private Map getStitchedSprites(final Stitcher stitcher, final int atlasWidth, final int atlasHeight) { + Map result = new HashMap<>(); + stitcher.gatherSprites( +- (contents, x, y, padding) -> result.put(contents.name(), new TextureAtlasSprite(this.location, contents, atlasWidth, atlasHeight, x, y, padding)) ++ (contents, x, y, padding) -> result.put(contents.name(), net.minecraftforge.client.ForgeHooksClient.loadTextureAtlasSprite(this.location, contents, atlasWidth, atlasHeight, x, y, padding)) ); - return map; + return result; } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 1187eac0bd..98165c19d2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -5,30 +5,30 @@ @OnlyIn(Dist.CLIENT) public class Stitcher { + private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); - private static final Comparator> HOLDER_COMPARATOR = Comparator., Integer>comparing(p_118201_ -> -p_118201_.height) - .thenComparing(p_118199_ -> -p_118199_.width) - .thenComparing(p_448389_ -> p_448389_.entry.name()); + private static final Comparator> HOLDER_COMPARATOR = Comparator., Integer>comparing(h -> -h.height) + .thenComparing(h -> -h.width) + .thenComparing(h -> h.entry.name()); @@ -54,6 +_,14 @@ - for (Stitcher.Holder holder : list) { + for (Stitcher.Holder holder : holders) { if (!this.addToStorage(holder)) { + if (LOGGER.isInfoEnabled()) { + StringBuilder sb = new StringBuilder(); + sb.append("Unable to fit: ").append(holder.entry().name()); + sb.append(" - size: ").append(holder.entry.width()).append("x").append(holder.entry.height()); + sb.append(" - Maybe try a lower resolution resourcepack?\n"); -+ list.forEach(h -> sb.append("\t").append(h).append("\n")); ++ holders.forEach(h -> sb.append("\t").append(h).append("\n")); + LOGGER.info(sb.toString()); + } - throw new StitcherException(holder.entry, list.stream().map(p_247946_ -> p_247946_.entry).collect(ImmutableList.toImmutableList())); + throw new StitcherException(holder.entry, holders.stream().map(h -> h.entry).collect(ImmutableList.toImmutableList())); } } -@@ -93,7 +_,7 @@ - boolean flag4 = flag2 && j != l; - boolean flag; - if (flag3 ^ flag4) { -- flag = flag3; -+ flag = !flag3 && flag1; // Forge: Fix stitcher not expanding entire height before growing width, and (potentially) growing larger then the max size. - } else { - flag = flag1 && i <= j; - } +@@ -94,7 +_,7 @@ + boolean yWillGrow = yCanGrow && yCurrentSize != yNewSize; + boolean growOnX; + if (xWillGrow ^ yWillGrow) { +- growOnX = xWillGrow; ++ growOnX = !xWillGrow && xCanGrow; // Forge: Fix stitcher not expanding entire height before growing width, and (potentially) growing larger then the max size. + } else { + growOnX = xCanGrow && xCurrentSize <= yCurrentSize; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch index dc7f995bb9..6b9b413024 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlas.java +++ b/net/minecraft/client/renderer/texture/TextureAtlas.java -@@ -119,6 +_,7 @@ - this.sprites = list; - this.animatedTexturesStates = List.copyOf(list1); - this.uploadInitialContents(); -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); - if (SharedConstants.DEBUG_DUMP_TEXTURE_ATLAS) { - Path path = TextureUtil.getDebugTexturePath(); +@@ -135,6 +_,7 @@ + } -@@ -304,5 +_,10 @@ + this.uploadInitialContents(); ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); + if (SharedConstants.DEBUG_DUMP_TEXTURE_ATLAS) { + Path dumpDir = TextureUtil.getDebugTexturePath(); + +@@ -324,5 +_,10 @@ int getHeight() { return this.height; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 14ee31eb43..1d4983188c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,16 +1,26 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ b/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -129,4 +_,13 @@ +@@ -26,7 +_,7 @@ + private final float v1; + private final int padding; + +- protected TextureAtlasSprite( ++ public TextureAtlasSprite( + final Identifier atlasLocation, final SpriteContents contents, final int atlasWidth, final int atlasHeight, final int x, final int y, final int padding + ) { + this.atlasLocation = atlasLocation; +@@ -127,5 +_,14 @@ + @Override public void close() { this.contents.close(); - } ++ } + + public int getPixelRGBA(int frameIndex, int x, int y) { + if (this.contents.animatedTexture != null) { -+ x += this.contents.animatedTexture.getFrameX(frameIndex) * this.contents.width; -+ y += this.contents.animatedTexture.getFrameY(frameIndex) * this.contents.height; ++ x += this.contents.animatedTexture.getFrameX(frameIndex) * this.contents.width(); ++ y += this.contents.animatedTexture.getFrameY(frameIndex) * this.contents.height(); + } + + return this.contents.getOriginalImage().getPixel(x, y); -+ } + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java.patch index 4d4defe5dc..3fadacbcc9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java +++ b/net/minecraft/client/renderer/texture/atlas/SpriteResourceLoader.java @@ -68,6 +_,9 @@ - framesize = new FrameSize(nativeimage.getWidth(), nativeimage.getHeight()); + frameSize = new FrameSize(image.getWidth(), image.getHeight()); } -+ SpriteContents contents = net.minecraftforge.client.ForgeHooksClient.loadSpriteContents(p_448404_, p_448405_, framesize, nativeimage, list); ++ SpriteContents contents = net.minecraftforge.client.ForgeHooksClient.loadSpriteContents(spriteLocation, resource, frameSize, image, additionalMetadata); + if (contents != null) return contents; + - return new SpriteContents(p_448404_, framesize, nativeimage, optional, list, optional1); + return new SpriteContents(spriteLocation, frameSize, image, animationInfo, additionalMetadata, textureInfo); }; } diff --git a/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch b/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch index ffc20a35c0..276fcda0e3 100644 --- a/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/resources/language/ClientLanguage.java +++ b/net/minecraft/client/resources/language/ClientLanguage.java @@ -78,4 +_,9 @@ - public FormattedCharSequence getVisualOrder(FormattedText p_118925_) { - return FormattedBidiReorder.reorder(p_118925_, this.defaultRightToLeft); + public FormattedCharSequence getVisualOrder(final FormattedText logicalOrderText) { + return FormattedBidiReorder.reorder(logicalOrderText, this.defaultRightToLeft); } + + @Override diff --git a/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch b/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch deleted file mode 100644 index dfddf474e1..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/resources/language/I18n.java -+++ b/net/minecraft/client/resources/language/I18n.java -@@ -15,6 +_,7 @@ - - static void setLanguage(Language p_118942_) { - language = p_118942_; -+ net.minecraftforge.common.ForgeI18n.loadLanguageData(p_118942_.getLanguageData()); - } - - public static String get(String p_118939_, Object... p_118940_) { diff --git a/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch index a9534fcf06..03ba4a31c1 100644 --- a/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/resources/language/LanguageManager.java +++ b/net/minecraft/client/resources/language/LanguageManager.java -@@ -30,8 +_,8 @@ +@@ -29,8 +_,8 @@ private final Consumer reloadCallback; - public LanguageManager(String p_118971_, Consumer p_342376_) { -- this.currentCode = p_118971_; - this.reloadCallback = p_342376_; -+ setSelected(p_118971_); + public LanguageManager(final String languageCode, final Consumer reloadCallback) { +- this.currentCode = languageCode; + this.reloadCallback = reloadCallback; ++ setSelected(languageCode); } - private static Map extractLanguages(Stream p_118982_) { -@@ -69,8 +_,12 @@ - this.reloadCallback.accept(clientlanguage); + private static Map extractLanguages(final Stream resourcePacks) { +@@ -67,8 +_,12 @@ + this.reloadCallback.accept(locale); } + private java.util.Locale javaLocale; // Forge: add locale information for modders + public java.util.Locale getJavaLocale() { return javaLocale; } - public void setSelected(String p_265224_) { - this.currentCode = p_265224_; -+ final String[] langSplit = p_265224_.split("_", 2); + public void setSelected(final String code) { + this.currentCode = code; ++ final String[] langSplit = code.split("_", 2); + this.javaLocale = langSplit.length == 1 ? java.util.Locale.of(langSplit[0]) : java.util.Locale.of(langSplit[0], langSplit[1]); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch b/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch index c156208aa6..e5da32b5be 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/client/resources/model/BlockStateDefinitions.java @@ -33,6 +_,8 @@ - static Function> definitionLocationToBlockStateMapper() { - Map> map = new HashMap<>(STATIC_DEFINITIONS); + public static Function> definitionLocationToBlockStateMapper() { + Map> result = new HashMap<>(STATIC_DEFINITIONS); + var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onRegisterModeStateDefinitions(); -+ map.putAll(event.getStates()); ++ result.putAll(event.getStates()); for (Block block : BuiltInRegistries.BLOCK) { - map.put(block.builtInRegistryHolder().key().identifier(), block.getStateDefinition()); + result.put(block.builtInRegistryHolder().key().identifier(), block.getStateDefinition()); diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch index e1a3b306fe..1053df58f3 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/resources/model/ModelBaker.java +++ b/net/minecraft/client/resources/model/ModelBaker.java -@@ -33,4 +_,16 @@ - public interface SharedOperationKey { - T compute(ModelBaker p_393089_); +@@ -32,4 +_,16 @@ + interface SharedOperationKey { + T compute(ModelBaker modelBakery); } + + /** Forge: Return the render type to use when baking this model, its a dirty hack to pass down this value to parents */ diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelDiscovery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelDiscovery.java.patch index 0a8a34b375..4ac9113c82 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelDiscovery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelDiscovery.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ModelDiscovery.java +++ b/net/minecraft/client/resources/model/ModelDiscovery.java -@@ -172,6 +_,14 @@ +@@ -177,6 +_,14 @@ return this.parent; } @@ -15,21 +15,20 @@ @Override public String debugName() { return this.id.toString(); -@@ -224,7 +_,7 @@ +@@ -229,14 +_,14 @@ - private QuadCollection bakeDefaultState(TextureSlots p_392267_, ModelBaker p_393576_, ModelState p_391972_) { - QuadCollection quadcollection = this.getSlot(KEY_DEFAULT_GEOMETRY); -- return quadcollection != null ? quadcollection : this.updateSlot(KEY_DEFAULT_GEOMETRY, this.getTopGeometry().bake(p_392267_, p_393576_, p_391972_, this)); -+ return quadcollection != null ? quadcollection : this.updateSlot(KEY_DEFAULT_GEOMETRY, this.getTopGeometry().bake(p_392267_, p_393576_, p_391972_, this, getContext())); + private QuadCollection bakeDefaultState(final TextureSlots textureSlots, final ModelBaker baker, final ModelState state) { + QuadCollection result = this.getSlot(KEY_DEFAULT_GEOMETRY); +- return result != null ? result : this.updateSlot(KEY_DEFAULT_GEOMETRY, this.getTopGeometry().bake(textureSlots, baker, state, this)); ++ return result != null ? result : this.updateSlot(KEY_DEFAULT_GEOMETRY, this.getTopGeometry().bake(textureSlots, baker, state, this, getContext())); } @Override -@@ -233,7 +_,7 @@ - ? this.bakeDefaultState(p_396404_, p_391625_, p_396681_) - : this.modelBakeCache.computeIfAbsent(p_396681_, p_394933_ -> { - UnbakedGeometry unbakedgeometry = this.getTopGeometry(); -- return unbakedgeometry.bake(p_396404_, p_391625_, p_394933_, this); -+ return unbakedgeometry.bake(p_396404_, p_391625_, p_394933_, this, getContext()); - }); + public QuadCollection bakeTopGeometry(final TextureSlots textureSlots, final ModelBaker baker, final ModelState state) { + return state == BlockModelRotation.IDENTITY ? this.bakeDefaultState(textureSlots, baker, state) : this.modelBakeCache.computeIfAbsent(state, s -> { + UnbakedGeometry topGeometry = this.getTopGeometry(); +- return topGeometry.bake(textureSlots, baker, s, this); ++ return topGeometry.bake(textureSlots, baker, s, this, getContext()); + }); } } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch index ec3b515c80..0b9ae29949 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ModelManager.java +++ b/net/minecraft/client/resources/model/ModelManager.java -@@ -58,6 +_,7 @@ +@@ -61,6 +_,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final FileToIdConverter MODEL_LISTER = FileToIdConverter.json("models"); private Map bakedItemStackModels = Map.of(); @@ -8,83 +8,79 @@ private Map itemProperties = Map.of(); private final AtlasManager atlasManager; private final PlayerSkinRenderCache playerSkinRenderCache; -@@ -67,6 +_,7 @@ - private SpecialBlockModelRenderer specialBlockModelRenderer = SpecialBlockModelRenderer.EMPTY; - private ModelBakery.MissingModels missingModels; +@@ -71,6 +_,7 @@ + private @Nullable BlockModelSet blockModelSet; + private @Nullable FluidStateModelSet fluidStateModelSet; private Object2IntMap modelGroups = Object2IntMaps.emptyMap(); + private ModelBakery modelBakery; - public ModelManager(BlockColors p_119407_, AtlasManager p_423190_, PlayerSkinRenderCache p_429874_) { - this.blockColors = p_119407_; -@@ -83,6 +_,10 @@ - return this.bakedItemStackModels.getOrDefault(p_450917_, this.missingModels.item()); + public ModelManager(final BlockColors blockColors, final AtlasManager atlasManager, final PlayerSkinRenderCache playerSkinRenderCache) { + this.blockColors = blockColors; +@@ -82,6 +_,18 @@ + return this.bakedItemStackModels.getOrDefault(id, this.missingModels.item()); } + public Map getItemModels() { + return this.bakedItemStackModelsView; + } + - public ClientItem.Properties getItemProperties(Identifier p_453916_) { - return this.itemProperties.getOrDefault(p_453916_, ClientItem.Properties.DEFAULT); - } -@@ -95,6 +_,7 @@ - public final CompletableFuture reload( - PreparableReloadListener.SharedState p_427489_, Executor p_250550_, PreparableReloadListener.PreparationBarrier p_249079_, Executor p_249221_ - ) { -+ net.minecraftforge.client.model.geometry.GeometryLoaderManager.init(); - ResourceManager resourcemanager = p_427489_.resourceManager(); - CompletableFuture completablefuture = CompletableFuture.supplyAsync(EntityModelSet::vanilla, p_250550_); - CompletableFuture completablefuture1 = completablefuture.thenApplyAsync( -@@ -255,6 +_,7 @@ - }, p_394729_) - .thenApply( - p_421082_ -> { -+ net.minecraftforge.client.ForgeHooksClient.onModifyBakingResult(p_248945_, p_421082_); - multimap.asMap() - .forEach( - (p_376688_, p_252017_) -> LOGGER.warn( -@@ -275,7 +_,7 @@ - ) - ); - Map map = createBlockStateToModelDispatch(p_421082_.blockStateModels(), p_421082_.missingModels().block()); -- return new ModelManager.ReloadState(p_421082_, p_361513_, map, p_378097_, p_377275_); -+ return new ModelManager.ReloadState(p_421082_, p_361513_, map, p_378097_, p_377275_, p_248945_); - } - ); - } -@@ -310,10 +_,15 @@ - - private void apply(ModelManager.ReloadState p_248996_) { - ModelBakery.BakingResult modelbakery$bakingresult = p_248996_.bakedModels; -+ // TODO [BlockState Models] fix -+ //this.bakedBlockStateModelsView = java.util.Collections.unmodifiableMap(this.bakedBlockStateModels); - this.bakedItemStackModels = modelbakery$bakingresult.itemStackModels(); -+ this.bakedItemStackModelsView = java.util.Collections.unmodifiableMap(this.bakedItemStackModels); - this.itemProperties = modelbakery$bakingresult.itemProperties(); - this.modelGroups = p_248996_.modelGroups; - this.missingModels = modelbakery$bakingresult.missingModels(); -+ this.modelBakery = p_248996_.modelBakery(); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelBakery); - this.blockModelShaper.replaceCache(p_248996_.modelCache); - this.specialBlockModelRenderer = p_248996_.specialBlockModelRenderer; - this.entityModelSet = p_248996_.entityModelSet; -@@ -337,6 +_,10 @@ - } - } - ++ public ItemModel getMissingModel() { ++ return this.missingModels.item(); ++ } ++ + public ModelBakery getModelBakery() { + return com.google.common.base.Preconditions.checkNotNull(modelBakery, "Attempted to query model bakery before it has been initialized."); + } + - public SpecialBlockModelRenderer specialBlockModelRenderer() { - return this.specialBlockModelRenderer; + public ClientItem.Properties getItemProperties(final Identifier id) { + return this.itemProperties.getOrDefault(id, ClientItem.Properties.DEFAULT); } -@@ -351,7 +_,8 @@ - Object2IntMap modelGroups, - Map modelCache, - EntityModelSet entityModelSet, -- SpecialBlockModelRenderer specialBlockModelRenderer -+ SpecialBlockModelRenderer specialBlockModelRenderer, +@@ -105,6 +_,7 @@ + final PreparableReloadListener.PreparationBarrier preparationBarrier, + final Executor reloadExecutor + ) { ++ net.minecraftforge.client.model.geometry.GeometryLoaderManager.init(); + ResourceManager manager = currentReload.resourceManager(); + CompletableFuture entityModelSet = CompletableFuture.supplyAsync(EntityModelSet::vanilla, taskExecutor); + CompletableFuture> modelCache = loadBlockModels(manager, taskExecutor); +@@ -224,12 +_,14 @@ + (bakingResult, bakedModels) -> { + blockItemMaterialBaker.logMissingTextures(); + Map fluidModels = FluidStateModelSet.bake(blockOnlyMaterialBaker); ++ fluidModels = net.minecraftforge.client.ForgeHooksClient.onFluidModelBake(bakery, blockOnlyMaterialBaker, fluidModels); ++ net.minecraftforge.client.ForgeHooksClient.onModifyBakingResult(bakery, bakingResult); + blockOnlyMaterialBaker.logMissingTextures(); + Map modelByStateCache = createBlockStateToModelDispatch( + bakingResult.blockStateModels(), bakingResult.missingModels().block() + ); + return new ModelManager.ReloadState( +- bakingResult, modelGroups, modelByStateCache, (Map)bakedModels, fluidModels, entityModelSet ++ bakingResult, modelGroups, modelByStateCache, (Map)bakedModels, fluidModels, entityModelSet, bakery + ); + } + ); +@@ -261,10 +_,15 @@ + + private void apply(final ModelManager.ReloadState preparations) { + ModelBakery.BakingResult bakedModels = preparations.bakedModels; ++ // TODO [BlockState Models] fix ++ //this.bakedBlockStateModelsView = java.util.Collections.unmodifiableMap(this.bakedBlockStateModels); + this.bakedItemStackModels = bakedModels.itemStackModels(); ++ this.bakedItemStackModelsView = java.util.Collections.unmodifiableMap(this.bakedItemStackModels); + this.itemProperties = bakedModels.itemProperties(); + this.modelGroups = preparations.modelGroups; + this.missingModels = bakedModels.missingModels(); ++ this.modelBakery = preparations.modelBakery(); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelBakery); + this.blockStateModelSet = new BlockStateModelSet(preparations.blockStateModels, this.missingModels.block()); + this.blockModelSet = new BlockModelSet(this.blockStateModelSet, preparations.blockModels, this.blockColors); + this.fluidStateModelSet = new FluidStateModelSet(preparations.fluidModels, this.missingModels.fluid()); +@@ -333,7 +_,8 @@ + Map blockStateModels, + Map blockModels, + Map fluidModels, +- EntityModelSet entityModelSet ++ EntityModelSet entityModelSet, + ModelBakery modelBakery ) { } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch index f9d51028d3..d60e332b5f 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/resources/model/ResolvedModel.java +++ b/net/minecraft/client/resources/model/ResolvedModel.java -@@ -85,7 +_,7 @@ +@@ -89,7 +_,7 @@ } - default QuadCollection bakeTopGeometry(TextureSlots p_396041_, ModelBaker p_395367_, ModelState p_396505_) { -- return this.getTopGeometry().bake(p_396041_, p_395367_, p_396505_, this); -+ return this.getTopGeometry().bake(p_396041_, p_395367_, p_396505_, this, getContext()); + default QuadCollection bakeTopGeometry(final TextureSlots textureSlots, final ModelBaker baker, final ModelState state) { +- return this.getTopGeometry().bake(textureSlots, baker, state, this); ++ return this.getTopGeometry().bake(textureSlots, baker, state, this, getContext()); } - static TextureAtlasSprite resolveParticleSprite(TextureSlots p_391346_, ModelBaker p_396500_, ModelDebugName p_393309_) { -@@ -129,5 +_,9 @@ + static Material.Baked resolveParticleMaterial(final TextureSlots textureSlots, final ModelBaker baker, final ModelDebugName resolvedModel) { +@@ -133,5 +_,9 @@ default ItemTransforms getTopTransforms() { return findTopTransforms(this); diff --git a/patches/minecraft/net/minecraft/client/resources/model/UnbakedGeometry.java.patch b/patches/minecraft/net/minecraft/client/resources/model/UnbakedGeometry.java.patch deleted file mode 100644 index cff29db2b4..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/UnbakedGeometry.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/resources/model/UnbakedGeometry.java -+++ b/net/minecraft/client/resources/model/UnbakedGeometry.java -@@ -10,4 +_,8 @@ - UnbakedGeometry EMPTY = (p_396370_, p_395488_, p_393569_, p_397842_) -> QuadCollection.EMPTY; - - QuadCollection bake(TextureSlots p_391189_, ModelBaker p_391275_, ModelState p_397070_, ModelDebugName p_391995_); -+ -+ default QuadCollection bake(TextureSlots slots, ModelBaker baker, ModelState state, ModelDebugName name, net.minecraftforge.client.model.geometry.IGeometryBakingContext context) { -+ return bake(slots, baker, state, name); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/resources/model/UnbakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/UnbakedModel.java.patch index afc2503b40..05db33110e 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/UnbakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/UnbakedModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/UnbakedModel.java +++ b/net/minecraft/client/resources/model/UnbakedModel.java -@@ -59,5 +_,9 @@ +@@ -60,5 +_,9 @@ public boolean lightLikeBlock() { return this == SIDE; } diff --git a/patches/minecraft/net/minecraft/client/resources/model/WeightedVariants.java.patch b/patches/minecraft/net/minecraft/client/resources/model/WeightedVariants.java.patch deleted file mode 100644 index 3c20275ef8..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/WeightedVariants.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/net/minecraft/client/resources/model/WeightedVariants.java -+++ b/net/minecraft/client/resources/model/WeightedVariants.java -@@ -13,12 +_,13 @@ - @OnlyIn(Dist.CLIENT) - public class WeightedVariants implements BlockStateModel { - private final WeightedList list; -+ private final BlockStateModel firstModel; - private final TextureAtlasSprite particleIcon; - - public WeightedVariants(WeightedList p_394939_) { - this.list = p_394939_; -- BlockStateModel blockstatemodel = p_394939_.unwrap().getFirst().value(); -- this.particleIcon = blockstatemodel.particleIcon(); -+ this.firstModel = p_394939_.unwrap().getFirst().value(); -+ this.particleIcon = firstModel.particleIcon(); - } - - @Override -@@ -27,8 +_,23 @@ - } - - @Override -+ public TextureAtlasSprite particleIcon(net.minecraftforge.client.model.data.ModelData data) { -+ return this.firstModel.particleIcon(data); -+ } -+ -+ @Override - public void collectParts(RandomSource p_397916_, List p_394308_) { - this.list.getRandomOrThrow(p_397916_).collectParts(p_397916_, p_394308_); -+ } -+ -+ @Override -+ public void collectParts(RandomSource random, List dest, net.minecraftforge.client.model.data.ModelData data, net.minecraft.client.renderer.chunk.ChunkSectionLayer renderType) { -+ this.list.getRandomOrThrow(random).collectParts(random, dest, data, renderType); -+ } -+ -+ @Override -+ public java.util.Collection getRenderTypes(net.minecraft.world.level.block.state.BlockState state, RandomSource random, net.minecraftforge.client.model.data.ModelData data) { -+ return this.list.getRandomOrThrow(random).getRenderTypes(state, random, data); - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidFace.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidFace.java.patch new file mode 100644 index 0000000000..0623fc6b7a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidFace.java.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/client/resources/model/cuboid/CuboidFace.java ++++ b/net/minecraft/client/resources/model/cuboid/CuboidFace.java +@@ -15,9 +_,18 @@ + import org.jspecify.annotations.Nullable; + + @OnlyIn(Dist.CLIENT) +-public record CuboidFace(@Nullable Direction cullForDirection, int tintIndex, String texture, CuboidFace.@Nullable UVs uvs, Quadrant rotation) { ++public record CuboidFace(@Nullable Direction cullForDirection, int tintIndex, String texture, CuboidFace.@Nullable UVs uvs, Quadrant rotation, net.minecraftforge.client.model.@Nullable ForgeFaceData data) { + public static final int NO_TINT = -1; + ++ public CuboidFace(@Nullable Direction cullForDirection, int tintIndex, String texture, CuboidFace.@Nullable UVs uvs, Quadrant rotation) { ++ this(cullForDirection, tintIndex, texture, uvs, rotation, null); ++ } ++ ++ @Override ++ public net.minecraftforge.client.model.ForgeFaceData data() { ++ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data; ++ } ++ + public static float getU(final CuboidFace.UVs uvs, final Quadrant rotation, final int vertex) { + return uvs.getVertexU(rotation.rotateVertexIndex(vertex)) / 16.0F; + } +@@ -38,7 +_,7 @@ + String texture = getTexture(object); + CuboidFace.UVs uvs = getUVs(object); + Quadrant rotation = getRotation(object); +- return new CuboidFace(cullDirection, tintIndex, texture, uvs, rotation); ++ return new CuboidFace(cullDirection, tintIndex, texture, uvs, rotation, net.minecraftforge.client.model.ForgeFaceData.read(object.get("forge_data"), null)); + } + + private static int getTintIndex(final JsonObject object) { diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch new file mode 100644 index 0000000000..8bd3875a95 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/client/resources/model/cuboid/CuboidModel.java ++++ b/net/minecraft/client/resources/model/cuboid/CuboidModel.java +@@ -28,8 +_,20 @@ + @Nullable Boolean ambientOcclusion, + @Nullable ItemTransforms transforms, + TextureSlots.Data textureSlots, +- @Nullable Identifier parent ++ @Nullable Identifier parent, ++ net.minecraftforge.client.model.@Nullable ForgeBlockModelData forgeData + ) implements UnbakedModel { ++ public CuboidModel( ++ @Nullable UnbakedGeometry geometry, ++ UnbakedModel.@Nullable GuiLight guiLight, ++ @Nullable Boolean ambientOcclusion, ++ @Nullable ItemTransforms transforms, ++ TextureSlots.Data textureSlots, ++ @Nullable Identifier parent ++ ) { ++ this(geometry, guiLight, ambientOcclusion, transforms, textureSlots, parent, null); ++ } ++ + @VisibleForTesting + static final Gson GSON = new GsonBuilder() + .registerTypeAdapter(CuboidModel.class, new CuboidModel.Deserializer()) +@@ -62,8 +_,9 @@ + guiLight = UnbakedModel.GuiLight.getByName(GsonHelper.getAsString(object, "gui_light")); + } + ++ var forgeData = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModel(object, context); + Identifier parentLocation = parentName.isEmpty() ? null : Identifier.parse(parentName); +- return new CuboidModel(elements, guiLight, hasAmbientOcclusion, transforms, textureMap, parentLocation); ++ return new CuboidModel(elements, guiLight, hasAmbientOcclusion, transforms, textureMap, parentLocation, forgeData); + } + + private TextureSlots.Data getTextureMap(final JsonObject object) { +@@ -84,6 +_,9 @@ + } + + protected @Nullable UnbakedGeometry getElements(final JsonDeserializationContext context, final JsonObject object) { ++ var geo = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModelGeometry(object, context); ++ if (geo != null) ++ return geo; + if (!object.has("elements")) { + return null; + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemModelGenerator.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemModelGenerator.java.patch new file mode 100644 index 0000000000..3757ee8724 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemModelGenerator.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/client/resources/model/cuboid/ItemModelGenerator.java ++++ b/net/minecraft/client/resources/model/cuboid/ItemModelGenerator.java +@@ -52,8 +_,8 @@ + QuadCollection singleResult = null; + QuadCollection.Builder builder = null; + +- for (int layerIndex = 0; layerIndex < LAYERS.size(); layerIndex++) { +- String textureReference = LAYERS.get(layerIndex); ++ for (int layerIndex = 0; true; layerIndex++) { // Forge: Allow for more layers ++ String textureReference = String.format(java.util.Locale.ROOT, "layer%d", layerIndex); + Material material = textureSlots.getMaterial(textureReference); + if (material == null) { + break; +@@ -83,17 +_,29 @@ + public static void bakeExtrudedSprite( + final QuadCollection.Builder builder, final ModelBaker.Interner interner, final ModelState modelState, final BakedQuad.MaterialInfo materialInfo + ) { ++ bakeExtrudedSprite(builder, interner, modelState, materialInfo, materialInfo); ++ } ++ ++ public static void bakeExtrudedSprite( ++ final QuadCollection.Builder builder, final ModelBaker.Interner interner, final ModelState modelState, final BakedQuad.MaterialInfo materialInfo, final BakedQuad.MaterialInfo template ++ ) { + Vector3f from = new Vector3f(0.0F, 0.0F, 7.5F); + Vector3f to = new Vector3f(16.0F, 16.0F, 8.5F); + builder.addUnculledFace(FaceBakery.bakeQuad(interner, from, to, SOUTH_FACE_UVS, Quadrant.R0, materialInfo, Direction.SOUTH, modelState, null)); + builder.addUnculledFace(FaceBakery.bakeQuad(interner, from, to, NORTH_FACE_UVS, Quadrant.R0, materialInfo, Direction.NORTH, modelState, null)); +- bakeSideFaces(builder, interner, modelState, materialInfo); ++ bakeSideFaces(builder, interner, modelState, materialInfo, template); + } + + public static void bakeSideFaces( + final QuadCollection.Builder builder, final ModelBaker.Interner interner, final ModelState modelState, final BakedQuad.MaterialInfo materialInfo + ) { +- SpriteContents sprite = materialInfo.sprite().contents(); ++ bakeSideFaces(builder, interner, modelState, materialInfo, materialInfo); ++ } ++ ++ public static void bakeSideFaces( ++ final QuadCollection.Builder builder, final ModelBaker.Interner interner, final ModelState modelState, final BakedQuad.MaterialInfo materialInfo, final BakedQuad.MaterialInfo template ++ ) { ++ SpriteContents sprite = template.sprite().contents(); + float xScale = 16.0F / sprite.width(); + float yScale = 16.0F / sprite.height(); + Vector3f from = new Vector3f(); diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch new file mode 100644 index 0000000000..f053947293 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/client/resources/model/cuboid/ItemTransform.java ++++ b/net/minecraft/client/resources/model/cuboid/ItemTransform.java +@@ -17,7 +_,10 @@ + import org.joml.Vector3fc; + + @OnlyIn(Dist.CLIENT) +-public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) { ++public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale, Vector3fc rightRotation) { ++ public ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) { ++ this(rotation, translation, scale, new Vector3f()); ++ } + public static final ItemTransform NO_TRANSFORM = new ItemTransform(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + + public void apply(final boolean applyLeftHandFix, final PoseStack.Pose pose) { +@@ -63,7 +_,7 @@ + translation.set(Mth.clamp(translation.x, -5.0F, 5.0F), Mth.clamp(translation.y, -5.0F, 5.0F), Mth.clamp(translation.z, -5.0F, 5.0F)); + Vector3f scale = getVector3f(object, "scale", DEFAULT_SCALE); + scale.set(Mth.clamp(scale.x, -4.0F, 4.0F), Mth.clamp(scale.y, -4.0F, 4.0F), Mth.clamp(scale.z, -4.0F, 4.0F)); +- return new ItemTransform(rotation, translation, scale); ++ return new ItemTransform(rotation, translation, scale, this.getVector3f(object, "right_rotation", DEFAULT_ROTATION)); + } + + private static Vector3f getVector3f(final JsonObject object, final String key, final Vector3fc def) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransforms.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch rename to patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransforms.java.patch index fdce149e72..6a93fdb22f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransforms.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/client/renderer/block/model/ItemTransforms.java -+++ b/net/minecraft/client/renderer/block/model/ItemTransforms.java -@@ -20,8 +_,15 @@ +--- a/net/minecraft/client/resources/model/cuboid/ItemTransforms.java ++++ b/net/minecraft/client/resources/model/cuboid/ItemTransforms.java +@@ -20,8 +_,14 @@ ItemTransform gui, ItemTransform ground, ItemTransform fixed, @@ -8,7 +8,6 @@ + ItemTransform fixedFromBottom, + com.google.common.collect.ImmutableMap moddedTransforms ) { -+ + @Deprecated + public ItemTransforms(ItemTransform thirdPersonLeftHand, ItemTransform thirdPersonRightHand, ItemTransform firstPersonLeftHand, ItemTransform firstPersonRightHand, ItemTransform head, ItemTransform gui, ItemTransform ground, ItemTransform fixed, ItemTransform fixedFromBottom) { + this(thirdPersonLeftHand, thirdPersonRightHand, firstPersonLeftHand, firstPersonRightHand, head, gui, ground, fixed, fixedFromBottom, com.google.common.collect.ImmutableMap.of()); @@ -22,31 +21,27 @@ case FIXED -> this.fixed; case ON_SHELF -> this.fixedFromBottom; - default -> ItemTransform.NO_TRANSFORM; -+ default -> moddedTransforms.getOrDefault(p_270619_, ItemTransform.NO_TRANSFORM); ++ default -> moddedTransforms.getOrDefault(type, ItemTransform.NO_TRANSFORM); }; } -@@ -70,8 +_,22 @@ - ItemTransform itemtransform6 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.GROUND); - ItemTransform itemtransform7 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.FIXED); - ItemTransform itemtransform8 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.ON_SHELF); +@@ -70,6 +_,19 @@ + ItemTransform ground = this.getTransform(context, object, ItemDisplayContext.GROUND); + ItemTransform fixed = this.getTransform(context, object, ItemDisplayContext.FIXED); + ItemTransform fixedFromBottom = this.getTransform(context, object, ItemDisplayContext.ON_SHELF); + var builder = com.google.common.collect.ImmutableMap.builder(); + for (ItemDisplayContext type : ItemDisplayContext.values()) { + if (type.isModded()) { -+ var transform = this.getTransform(p_111822_, jsonobject, type); ++ var transform = this.getTransform(context, object, type); + var fallbackType = type; + while (transform == ItemTransform.NO_TRANSFORM && fallbackType.fallback() != null) { + fallbackType = fallbackType.fallback(); -+ transform = this.getTransform(p_111822_, jsonobject, fallbackType); ++ transform = this.getTransform(context, object, fallbackType); + } + if (transform != ItemTransform.NO_TRANSFORM) + builder.put(type, transform); + } + } -+ return new ItemTransforms( -- itemtransform1, itemtransform, itemtransform3, itemtransform2, itemtransform4, itemtransform5, itemtransform6, itemtransform7, itemtransform8 -+ itemtransform1, itemtransform, itemtransform3, itemtransform2, itemtransform4, itemtransform5, itemtransform6, itemtransform7, itemtransform8, builder.build() + thirdPersonLeftHand, thirdPersonRightHand, firstPersonLeftHand, firstPersonRightHand, head, gui, ground, fixed, fixedFromBottom ); - } - diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/UnbakedCuboidGeometry.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/UnbakedCuboidGeometry.java.patch new file mode 100644 index 0000000000..5377339e00 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/UnbakedCuboidGeometry.java.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/client/resources/model/cuboid/UnbakedCuboidGeometry.java ++++ b/net/minecraft/client/resources/model/cuboid/UnbakedCuboidGeometry.java +@@ -29,8 +_,20 @@ + final ModelState modelState, + final ModelDebugName name + ) { +- QuadCollection.Builder builder = new QuadCollection.Builder(); ++ var builder = new QuadCollection.Builder(); ++ bake(builder, elements, textures, modelBaker, modelState, name, id -> modelBaker.materials().resolveSlot(textures, id, name)); ++ return builder.build(); ++ } + ++ public static void bake( ++ final QuadCollection.Builder builder, ++ final List elements, ++ final TextureSlots textures, ++ final ModelBaker modelBaker, ++ final ModelState modelState, ++ final ModelDebugName name, ++ final java.util.function.Function materialMapper //Forge: Allow overwriting textures ++ ) { + for (CuboidModelElement element : elements) { + boolean drawXFaces = true; + boolean drawYFaces = true; +@@ -63,7 +_,7 @@ + case Z -> drawZFaces; + }; + if (shouldDrawFace) { +- Material.Baked material = modelBaker.materials().resolveSlot(textures, face.texture(), name); ++ Material.Baked material = materialMapper.apply(face.texture()); + BakedQuad quad = FaceBakery.bakeQuad( + modelBaker, from, to, face, material, facing, modelState, element.rotation(), element.shade(), element.lightEmission() + ); +@@ -76,7 +_,5 @@ + } + } + } +- +- return builder.build(); + } + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/QuadCollection.java.patch b/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/client/resources/model/QuadCollection.java.patch rename to patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch index ed32c8bf6e..94a691fada 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/QuadCollection.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/client/resources/model/QuadCollection.java -+++ b/net/minecraft/client/resources/model/QuadCollection.java -@@ -59,6 +_,12 @@ +--- a/net/minecraft/client/resources/model/geometry/QuadCollection.java ++++ b/net/minecraft/client/resources/model/geometry/QuadCollection.java +@@ -70,6 +_,12 @@ return this.all; } @@ -10,6 +10,6 @@ + transformer.process(this.west), transformer.process(this.up), transformer.process(this.down)); + } + - @OnlyIn(Dist.CLIENT) - public static class Builder { - private final ImmutableList.Builder unculledFaces = ImmutableList.builder(); + public @BakedQuad.MaterialFlags int materialFlags() { + if (this.materialFlags == -1) { + this.materialFlags = computeMaterialFlags(this.all); diff --git a/patches/minecraft/net/minecraft/client/resources/model/geometry/UnbakedGeometry.java.patch b/patches/minecraft/net/minecraft/client/resources/model/geometry/UnbakedGeometry.java.patch new file mode 100644 index 0000000000..9f38315c66 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/geometry/UnbakedGeometry.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/resources/model/geometry/UnbakedGeometry.java ++++ b/net/minecraft/client/resources/model/geometry/UnbakedGeometry.java +@@ -13,4 +_,8 @@ + UnbakedGeometry EMPTY = (var0, var1, var2, var3) -> QuadCollection.EMPTY; + + QuadCollection bake(TextureSlots textureSlots, ModelBaker modelBaker, ModelState modelState, ModelDebugName name); ++ ++ default QuadCollection bake(TextureSlots slots, ModelBaker baker, ModelState state, ModelDebugName name, net.minecraftforge.client.model.geometry.IGeometryBakingContext context) { ++ return bake(slots, baker, state, name); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch index 25740f720a..989eb4441f 100644 --- a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch @@ -1,24 +1,25 @@ --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java -@@ -83,11 +_,12 @@ +@@ -103,12 +_,13 @@ LOGGER.info("Starting integrated minecraft server version {}", SharedConstants.getCurrentVersion().name()); this.setUsesAuthentication(true); this.initializeKeyPair(); + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; this.loadLevel(); - GameProfile gameprofile = this.getSingleplayerProfile(); - String s = this.getWorldData().getLevelName(); - this.setMotd(gameprofile != null ? gameprofile.name() + " - " + s : s); + GameProfile host = this.getSingleplayerProfile(); + String levelName = this.getWorldData().getLevelName(); + this.setMotd(host != null ? host.name() + " - " + levelName : levelName); + this.saveEverything(false, true, true); - return true; + return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); } @Override -@@ -242,6 +_,7 @@ +@@ -371,6 +_,7 @@ @Override - public void halt(boolean p_120053_) { + public void halt(final boolean wait) { + if (isRunning()) this.executeBlocking(() -> { - for (ServerPlayer serverplayer : Lists.newArrayList(this.getPlayerList().getPlayers())) { - if (!serverplayer.getUUID().equals(this.uuid)) { + for (ServerPlayer player : Lists.newArrayList(this.getPlayerList().getPlayers())) { + if (!player.getUUID().equals(this.uuid)) { diff --git a/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch b/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch index 6d066162c5..fdc3c5c619 100644 --- a/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch +++ b/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch @@ -10,15 +10,15 @@ this.socket.joinGroup(this.pingGroup); } @@ -87,7 +_,11 @@ - String s = LanServerPinger.parseMotd(p_120097_); - String s1 = LanServerPinger.parseAddress(p_120097_); - if (s1 != null) { -- s1 = p_120098_.getHostAddress() + ":" + s1; -+ if (net.minecraftforge.network.DualStackUtils.checkIPv6(p_120098_)) { -+ s1 = "[" + com.google.common.net.InetAddresses.toAddrString(p_120098_) + "]:" + s1; + String motd = LanServerPinger.parseMotd(pingData); + String address = LanServerPinger.parseAddress(pingData); + if (address != null) { +- address = socketAddress.getHostAddress() + ":" + address; ++ if (net.minecraftforge.network.DualStackUtils.checkIPv6(socketAddress)) { ++ address = "[" + com.google.common.net.InetAddresses.toAddrString(socketAddress) + "]:" + address; + } else { -+ s1 = p_120098_.getHostAddress() + ":" + s1; ++ address = socketAddress.getHostAddress() + ":" + address; + } - boolean flag = false; + boolean found = false; - for (LanServer lanserver : this.servers) { + for (LanServer server : this.servers) { diff --git a/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch b/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch index 43f23fa2e3..20ca07e2b3 100644 --- a/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch @@ -13,8 +13,8 @@ while (!this.isInterrupted() && this.isRunning) { try { -- InetAddress inetaddress = InetAddress.getByName("224.0.2.60"); -+ InetAddress inetaddress = InetAddress.getByName(MULTICAST_GROUP); - DatagramPacket datagrampacket = new DatagramPacket(abyte, abyte.length, inetaddress, 4445); - this.socket.send(datagrampacket); - } catch (IOException ioexception) { +- InetAddress group = InetAddress.getByName("224.0.2.60"); ++ InetAddress group = InetAddress.getByName(MULTICAST_GROUP); + DatagramPacket packet = new DatagramPacket(ping, ping.length, group, 4445); + this.socket.send(packet); + } catch (IOException e) { diff --git a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch index 384d4d3a3e..0beb89e8a4 100644 --- a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/sounds/SoundEngine.java +++ b/net/minecraft/client/sounds/SoundEngine.java @@ -82,6 +_,7 @@ - this.soundManager = p_120236_; - this.options = p_120237_; - this.soundBuffers = new SoundBufferLibrary(p_249332_); + this.options = options; + this.soundBuffers = new SoundBufferLibrary(resourceProvider); + this.lastSeenDevices = this.deviceTracker.currentDevices(); + net.minecraftforge.client.event.sound.SoundEngineLoadEvent.BUS.post(new net.minecraftforge.client.event.sound.SoundEngineLoadEvent(this)); } @@ -16,32 +16,41 @@ } private synchronized void loadLibrary() { -@@ -339,6 +_,9 @@ - } else if (!p_120313_.canPlaySound()) { - return SoundEngine.PlayResult.NOT_STARTED; - } else { -+ p_120313_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_120313_); -+ if (p_120313_ == null || !p_120313_.canPlaySound()) -+ return SoundEngine.PlayResult.NOT_STARTED; - WeighedSoundEvents weighedsoundevents = p_120313_.resolve(this.soundManager); - Identifier identifier = p_120313_.getIdentifier(); - if (weighedsoundevents == null) { -@@ -418,15 +_,18 @@ - p_194488_.setSelfPosition(vec3); - p_194488_.setRelative(flag); - }); -+ SoundInstance soundinstance = p_120313_; - if (!flag1) { - this.soundBuffers.getCompleteBuffer(sound.getPath()).thenAccept(p_422528_ -> channelaccess$channelhandle.execute(p_194495_ -> { - p_194495_.attachStaticBuffer(p_422528_); - p_194495_.play(); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlaySoundSource(this, soundinstance, p_194495_); - })); - } else { - this.soundBuffers.getStream(sound.getPath(), flag3).thenAccept(p_430918_ -> channelaccess$channelhandle.execute(p_194498_ -> { - p_194498_.attachBufferStream(p_430918_); - p_194498_.play(); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlayStreamingSource(this, soundinstance, p_194498_); - })); - } +@@ -340,7 +_,7 @@ + } + } + +- public SoundEngine.PlayResult play(final SoundInstance instance) { ++ public SoundEngine.PlayResult play(SoundInstance instance) { + if (!this.loaded) { + return SoundEngine.PlayResult.NOT_STARTED; + } +@@ -349,6 +_,9 @@ + return SoundEngine.PlayResult.NOT_STARTED; + } + ++ instance = net.minecraftforge.client.ForgeHooksClient.playSound(this, instance); ++ if (instance == null || !instance.canPlaySound()) ++ return SoundEngine.PlayResult.NOT_STARTED; + WeighedSoundEvents soundEvent = instance.resolve(this.soundManager); + Identifier eventLocation = instance.getIdentifier(); + if (soundEvent == null) { +@@ -430,15 +_,18 @@ + channel.setSelfPosition(position); + channel.setRelative(isRelative); + }); ++ SoundInstance soundinstance = instance; + if (!isStreaming) { + this.soundBuffers.getCompleteBuffer(sound.getPath()).thenAccept(soundBuffer -> handle.execute(channel -> { + channel.attachStaticBuffer(soundBuffer); + channel.play(); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlaySoundSource(this, soundinstance, channel); + })); + } else { + this.soundBuffers.getStream(sound.getPath(), isLooping).thenAccept(stream -> handle.execute(channel -> { + channel.attachBufferStream(stream); + channel.play(); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlayStreamingSource(this, soundinstance, channel); + })); + } diff --git a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch index 78c3c8dfdc..33b4390d27 100644 --- a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch +++ b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/commands/CommandSourceStack.java +++ b/net/minecraft/commands/CommandSourceStack.java -@@ -49,7 +_,7 @@ +@@ -48,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.jspecify.annotations.Nullable; --public class CommandSourceStack implements ExecutionCommandSource, SharedSuggestionProvider { -+public class CommandSourceStack implements ExecutionCommandSource, SharedSuggestionProvider, net.minecraftforge.common.extensions.IForgeCommandSourceStack { +-public class CommandSourceStack implements SharedSuggestionProvider, ExecutionCommandSource { ++public class CommandSourceStack implements SharedSuggestionProvider, ExecutionCommandSource, net.minecraftforge.common.extensions.IForgeCommandSourceStack { public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player")); public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity")); public final CommandSource source; diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index 0181bc1f04..58a2296f83 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -264,7 +_,7 @@ +@@ -265,7 +_,7 @@ ChaseCommand.register(this.dispatcher); } - if (SharedConstants.DEBUG_DEV_COMMANDS || SharedConstants.IS_RUNNING_IN_IDE) { + if (SharedConstants.DEBUG_DEV_COMMANDS || net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) { - RaidCommand.register(this.dispatcher, p_230944_); + RaidCommand.register(this.dispatcher, context); DebugPathCommand.register(this.dispatcher); DebugMobSpawningCommand.register(this.dispatcher); -@@ -297,6 +_,7 @@ - if (p_230943_.includeIntegrated) { +@@ -299,6 +_,7 @@ PublishCommand.register(this.dispatcher); + UnpublishCommand.register(this.dispatcher); } -+ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.dispatcher, p_230943_, p_230944_); ++ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.dispatcher, commandSelection, context); this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer()); } -@@ -319,9 +_,18 @@ - public void performCommand(ParseResults p_242844_, String p_242841_) { - CommandSourceStack commandsourcestack = p_242844_.getContext().getSource(); - Profiler.get().push(() -> "/" + p_242841_); -- ContextChain contextchain = finishParsing(p_242844_, p_242841_, commandsourcestack); +@@ -321,9 +_,18 @@ + public void performCommand(final ParseResults command, final String commandString) { + CommandSourceStack sender = command.getContext().getSource(); + Profiler.get().push(() -> "/" + commandString); +- ContextChain commandChain = finishParsing(command, commandString, sender); try { -+ var event = new net.minecraftforge.event.CommandEvent(p_242844_); ++ var event = new net.minecraftforge.event.CommandEvent(command); + if (net.minecraftforge.event.CommandEvent.BUS.post(event)) { + if (event.getException() instanceof Exception exception) { + throw exception; @@ -33,19 +33,19 @@ + } + return; + } -+ ContextChain contextchain = finishParsing(event.getParseResults(), p_242841_, commandsourcestack); - if (contextchain != null) { ++ ContextChain commandChain = finishParsing(event.getParseResults(), commandString, sender); + if (commandChain != null) { executeCommandInContext( - commandsourcestack, -@@ -413,7 +_,10 @@ - Map, CommandNode> map = new HashMap<>(); - RootCommandNode rootcommandnode = new RootCommandNode<>(); - map.put(this.dispatcher.getRoot(), rootcommandnode); -- fillUsableCommands(this.dispatcher.getRoot(), rootcommandnode, p_82096_.createCommandSourceStack(), map); + sender, +@@ -414,7 +_,10 @@ + Map, CommandNode> playerCommands = new HashMap<>(); + RootCommandNode root = new RootCommandNode<>(); + playerCommands.put(this.dispatcher.getRoot(), root); +- fillUsableCommands(this.dispatcher.getRoot(), root, player.createCommandSourceStack(), playerCommands); + // FORGE: Use our own command node merging method to handle redirect nodes properly, see issue #7551 -+ net.minecraftforge.server.command.CommandHelper.mergeCommandNode(this.dispatcher.getRoot(), rootcommandnode, map, p_82096_.createCommandSourceStack(), ctx -> 0, suggest -> suggest); ++ net.minecraftforge.server.command.CommandHelper.mergeCommandNode(this.dispatcher.getRoot(), root, playerCommands, player.createCommandSourceStack(), ctx -> 0, suggest -> suggest); + // FORGE: Clean any modded command content if the client is vanilla -+ rootcommandnode = net.minecraftforge.server.command.CommandHelper.filterCommandList(p_82096_.connection.getConnection(), rootcommandnode); - p_82096_.connection.send(new ClientboundCommandsPacket(rootcommandnode, COMMAND_NODE_INSPECTOR)); ++ root = net.minecraftforge.server.command.CommandHelper.filterCommandList(player.connection.getConnection(), root); + player.connection.send(new ClientboundCommandsPacket(root, COMMAND_NODE_INSPECTOR)); } diff --git a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch index 675dedcf43..8cbc4da9a8 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -125,7 +_,7 @@ - StringReader stringreader = new StringReader(p_91483_.getInput()); - stringreader.setCursor(p_91483_.getStart()); - EntitySelectorParser entityselectorparser = new EntitySelectorParser( -- stringreader, sharedsuggestionprovider.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS) -+ stringreader, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(sharedsuggestionprovider) - ); +@@ -128,7 +_,7 @@ + if (contextBuilder.getSource() instanceof SharedSuggestionProvider source) { + StringReader reader = new StringReader(builder.getInput()); + reader.setCursor(builder.getStart()); +- EntitySelectorParser parser = new EntitySelectorParser(reader, source.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS)); ++ EntitySelectorParser parser = new EntitySelectorParser(reader, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(source)); try { + parser.parse(); diff --git a/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch index cc38cd86c1..f7bbd410a0 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch @@ -3,9 +3,9 @@ @@ -90,7 +_,7 @@ public record Message(String text, MessageArgument.Part[] parts) { - Component resolveComponent(CommandSourceStack p_232197_) throws CommandSyntaxException { -- return this.toComponent(p_232197_, p_232197_.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS)); -+ return this.toComponent(p_232197_, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(p_232197_)); + private Component resolveComponent(final CommandSourceStack sender) throws CommandSyntaxException { +- return this.toComponent(sender, sender.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS)); ++ return this.toComponent(sender, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(sender)); } - public Component toComponent(CommandSourceStack p_96850_, boolean p_96851_) throws CommandSyntaxException { + public Component toComponent(final CommandSourceStack sender, final boolean allowSelectors) throws CommandSyntaxException { diff --git a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch index 81e5a4aeb4..0f583f2c97 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/commands/arguments/ObjectiveArgument.java @@ -31,7 +_,7 @@ - public static Objective getObjective(CommandContext p_101961_, String p_101962_) throws CommandSyntaxException { - String s = p_101961_.getArgument(p_101962_, String.class); -- Scoreboard scoreboard = p_101961_.getSource().getServer().getScoreboard(); -+ Scoreboard scoreboard = p_101961_.getSource().getScoreboard(); - Objective objective = scoreboard.getObjective(s); + public static Objective getObjective(final CommandContext context, final String name) throws CommandSyntaxException { + String id = context.getArgument(name, String.class); +- Scoreboard scoreboard = context.getSource().getServer().getScoreboard(); ++ Scoreboard scoreboard = context.getSource().getScoreboard(); + Objective objective = scoreboard.getObjective(id); if (objective == null) { - throw ERROR_OBJECTIVE_NOT_FOUND.create(s); + throw ERROR_OBJECTIVE_NOT_FOUND.create(id); @@ -57,7 +_,7 @@ - public CompletableFuture listSuggestions(CommandContext p_101974_, SuggestionsBuilder p_101975_) { - S s = p_101974_.getSource(); - if (s instanceof CommandSourceStack commandsourcestack) { -- return SharedSuggestionProvider.suggest(commandsourcestack.getServer().getScoreboard().getObjectiveNames(), p_101975_); -+ return SharedSuggestionProvider.suggest(commandsourcestack.getScoreboard().getObjectiveNames(), p_101975_); + public CompletableFuture listSuggestions(final CommandContext context, final SuggestionsBuilder builder) { + S rawSource = context.getSource(); + if (rawSource instanceof CommandSourceStack source) { +- return SharedSuggestionProvider.suggest(source.getServer().getScoreboard().getObjectiveNames(), builder); ++ return SharedSuggestionProvider.suggest(source.getScoreboard().getObjectiveNames(), builder); } else { - return s instanceof SharedSuggestionProvider sharedsuggestionprovider ? sharedsuggestionprovider.customSuggestion(p_101974_) : Suggestions.empty(); + return rawSource instanceof SharedSuggestionProvider source ? source.customSuggestion(context) : Suggestions.empty(); } diff --git a/patches/minecraft/net/minecraft/commands/arguments/TeamArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/TeamArgument.java.patch index 12a11e1853..257d518e49 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/TeamArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/TeamArgument.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/commands/arguments/TeamArgument.java +++ b/net/minecraft/commands/arguments/TeamArgument.java -@@ -26,7 +_,7 @@ +@@ -28,7 +_,7 @@ - public static PlayerTeam getTeam(CommandContext p_112092_, String p_112093_) throws CommandSyntaxException { - String s = p_112092_.getArgument(p_112093_, String.class); -- Scoreboard scoreboard = p_112092_.getSource().getServer().getScoreboard(); -+ Scoreboard scoreboard = p_112092_.getSource().getScoreboard(); - PlayerTeam playerteam = scoreboard.getPlayerTeam(s); - if (playerteam == null) { - throw ERROR_TEAM_NOT_FOUND.create(s); + public static PlayerTeam getTeam(final CommandContext context, final String name) throws CommandSyntaxException { + String id = context.getArgument(name, String.class); +- Scoreboard scoreboard = context.getSource().getServer().getScoreboard(); ++ Scoreboard scoreboard = context.getSource().getScoreboard(); + PlayerTeam team = scoreboard.getPlayerTeam(id); + if (team == null) { + throw ERROR_TEAM_NOT_FOUND.create(id); diff --git a/patches/minecraft/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java.patch deleted file mode 100644 index 11bb52a3e4..0000000000 --- a/patches/minecraft/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java -+++ b/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java -@@ -36,9 +_,9 @@ - - public static BlockPos getLoadedBlockPos(CommandContext p_265283_, ServerLevel p_265219_, String p_265677_) throws CommandSyntaxException { - BlockPos blockpos = getBlockPos(p_265283_, p_265677_); -- if (!p_265219_.hasChunkAt(blockpos)) { -+ if (!p_265283_.getSource().getUnsidedLevel().hasChunkAt(blockpos)) { - throw ERROR_NOT_LOADED.create(); -- } else if (!p_265219_.isInWorldBounds(blockpos)) { -+ } else if (!p_265283_.getSource().getUnsidedLevel().isInWorldBounds(blockpos)) { - throw ERROR_OUT_OF_WORLD.create(); - } else { - return blockpos; diff --git a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelector.java.patch b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelector.java.patch index 2373a9cd79..53ab59a8bf 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelector.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelector.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/commands/arguments/selector/EntitySelector.java +++ b/net/minecraft/commands/arguments/selector/EntitySelector.java -@@ -102,7 +_,7 @@ +@@ -117,7 +_,7 @@ } - private void checkPermissions(CommandSourceStack p_121169_) throws CommandSyntaxException { -- if (this.usesSelector && !p_121169_.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS)) { -+ if (this.usesSelector && !net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(p_121169_)) { + private void checkPermissions(final CommandSourceStack sender) throws CommandSyntaxException { +- if (this.usesSelector && !sender.permissions().hasPermission(Permissions.COMMANDS_ENTITY_SELECTORS)) { ++ if (this.usesSelector && !net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(sender)) { throw EntityArgument.ERROR_SELECTORS_NOT_ALLOWED.create(); } } diff --git a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch index b4bd7bc092..51f2fe36c1 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java -@@ -463,6 +_,11 @@ +@@ -465,6 +_,11 @@ } this.reader.skip(); @@ -12,11 +12,11 @@ this.parseSelector(); } else { this.parseNameOrUUID(); -@@ -479,6 +_,7 @@ - p_121248_.suggest("@s", Component.translatable("argument.entity.selector.self")); - p_121248_.suggest("@e", Component.translatable("argument.entity.selector.allEntities")); - p_121248_.suggest("@n", Component.translatable("argument.entity.selector.nearestEntity")); -+ net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(p_121248_); +@@ -481,6 +_,7 @@ + builder.suggest("@s", Component.translatable("argument.entity.selector.self")); + builder.suggest("@e", Component.translatable("argument.entity.selector.allEntities")); + builder.suggest("@n", Component.translatable("argument.entity.selector.nearestEntity")); ++ net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(builder); } - private CompletableFuture suggestNameOrSelector(SuggestionsBuilder p_121287_, Consumer p_121288_) { + private CompletableFuture suggestNameOrSelector(final SuggestionsBuilder builder, final Consumer names) { diff --git a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch index 3058bf6c05..838237a4a8 100644 --- a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch +++ b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch @@ -19,5 +19,5 @@ + } + private static , T extends ArgumentTypeInfo.Template> ArgumentTypeInfo register( - Registry> p_235387_, String p_235388_, Class p_235389_, ArgumentTypeInfo p_235390_ + final Registry> registry, final String id, final Class brigadierType, final ArgumentTypeInfo info ) { diff --git a/patches/minecraft/net/minecraft/core/BlockPos.java.patch b/patches/minecraft/net/minecraft/core/BlockPos.java.patch index dbb24cb224..0755583bf8 100644 --- a/patches/minecraft/net/minecraft/core/BlockPos.java.patch +++ b/patches/minecraft/net/minecraft/core/BlockPos.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java -@@ -30,7 +_,7 @@ - import org.apache.commons.lang3.tuple.Pair; +@@ -29,7 +_,7 @@ + import org.apache.commons.lang3.Validate; @Immutable -public class BlockPos extends Vec3i { +public class BlockPos extends Vec3i implements net.minecraftforge.common.extensions.IForgeBlockPos { public static final Codec CODEC = Codec.INT_STREAM .comapFlatMap( - p_448556_ -> Util.fixedSize(p_448556_, 3).map(p_175270_ -> new BlockPos(p_175270_[0], p_175270_[1], p_175270_[2])), + input -> Util.fixedSize(input, 3).map(ints -> new BlockPos(ints[0], ints[1], ints[2])), pos -> IntStream.of(pos.getX(), pos.getY(), pos.getZ()) diff --git a/patches/minecraft/net/minecraft/core/DefaultedMappedRegistry.java.patch b/patches/minecraft/net/minecraft/core/DefaultedMappedRegistry.java.patch index aa424bfc94..0c5275a557 100644 --- a/patches/minecraft/net/minecraft/core/DefaultedMappedRegistry.java.patch +++ b/patches/minecraft/net/minecraft/core/DefaultedMappedRegistry.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/core/DefaultedMappedRegistry.java +++ b/net/minecraft/core/DefaultedMappedRegistry.java -@@ -41,7 +_,7 @@ +@@ -43,7 +_,7 @@ @Override - public T getValue(@Nullable Identifier p_452628_) { - T t = super.getValue(p_452628_); + public T getValue(final @Nullable Identifier key) { + T t = super.getValue(key); - return t == null ? this.defaultValue.value() : t; + return t == null && this.defaultValue != null ? this.defaultValue.value() : t; // Add null check as it errors out in validation } diff --git a/patches/minecraft/net/minecraft/core/Direction.java.patch b/patches/minecraft/net/minecraft/core/Direction.java.patch index 16d588de9b..2aba89ccd4 100644 --- a/patches/minecraft/net/minecraft/core/Direction.java.patch +++ b/patches/minecraft/net/minecraft/core/Direction.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java -@@ -57,6 +_,15 @@ - private final Vec3 normalVec3; +@@ -58,6 +_,15 @@ private final Vector3fc normalVec3f; private static final Direction[] VALUES = values(); + private static final Direction[] BY_3D_DATA = Arrays.stream(VALUES).sorted(Comparator.comparingInt(d -> d.data3d)).toArray(Direction[]::new); + private static final List VALUES_VIEW = java.util.Collections.unmodifiableList(Arrays.asList(VALUES)); + public static final List valuesView() { + return VALUES_VIEW; @@ -13,6 +13,6 @@ + public static final List getUpdateOrder() { + return UPDATE_ORDER; + } - private static final Direction[] BY_3D_DATA = Arrays.stream(VALUES) - .sorted(Comparator.comparingInt(p_235687_ -> p_235687_.data3d)) - .toArray(Direction[]::new); + private static final Direction[] BY_2D_DATA = Arrays.stream(VALUES) + .filter(d -> d.getAxis().isHorizontal()) + .sorted(Comparator.comparingInt(d -> d.data2d)) diff --git a/patches/minecraft/net/minecraft/core/Holder.java.patch b/patches/minecraft/net/minecraft/core/Holder.java.patch index 0d2426e3ad..7fbde66e6f 100644 --- a/patches/minecraft/net/minecraft/core/Holder.java.patch +++ b/patches/minecraft/net/minecraft/core/Holder.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/Holder.java +++ b/net/minecraft/core/Holder.java -@@ -11,7 +_,22 @@ +@@ -13,7 +_,22 @@ import net.minecraft.tags.TagKey; import org.jspecify.annotations.Nullable; --public interface Holder { -+public interface Holder extends java.util.function.Supplier, net.minecraftforge.registries.tags.IReverseTag { +-public sealed interface Holder permits Holder.Direct, Holder.Reference { ++public sealed interface Holder extends java.util.function.Supplier, net.minecraftforge.registries.tags.IReverseTag permits Holder.Direct, Holder.Reference { + @Override + default boolean containsTag(TagKey key) { + return this.is(key); @@ -24,7 +24,7 @@ T value(); boolean isBound(); -@@ -238,6 +_,10 @@ +@@ -258,6 +_,10 @@ @Override public Stream> tags() { return this.boundTags().stream(); diff --git a/patches/minecraft/net/minecraft/core/HolderSet.java.patch b/patches/minecraft/net/minecraft/core/HolderSet.java.patch index f9a0aee9fd..2ae19cd814 100644 --- a/patches/minecraft/net/minecraft/core/HolderSet.java.patch +++ b/patches/minecraft/net/minecraft/core/HolderSet.java.patch @@ -11,16 +11,16 @@ int size(); @@ -172,6 +_,7 @@ - public void bind(List> p_205836_) { - this.contents = List.copyOf(p_205836_); + public void bind(final List> contents) { + this.contents = List.copyOf(contents); + this.invalidationCallbacks.forEach(Runnable::run); // FORGE: invalidate listeners when tags rebind } public TagKey key() { @@ -215,6 +_,12 @@ @Override - public boolean canSerializeIn(HolderOwner p_256542_) { - return this.owner.canSerializeIn(p_256542_); + public boolean canSerializeIn(final HolderOwner context) { + return this.owner.canSerializeIn(context); + } + + // FORGE: Keep a list of invalidation callbacks so they can be run when tags rebind diff --git a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch index 1648fad79c..66de6fc518 100644 --- a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -30,6 +_,8 @@ +@@ -31,6 +_,8 @@ import org.jspecify.annotations.Nullable; public class MappedRegistry implements WritableRegistry { @@ -8,56 +8,54 @@ + private static final org.apache.logging.log4j.Marker MARKER = net.minecraftforge.registries.ForgeRegistry.REGISTRIES; private final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); - private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(), p_308420_ -> p_308420_.defaultReturnValue(-1)); -@@ -84,6 +_,7 @@ + private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(), t -> t.defaultReturnValue(-1)); +@@ -86,6 +_,7 @@ @Override - public Holder.Reference register(ResourceKey p_256252_, T p_256591_, RegistrationInfo p_329661_) { + public Holder.Reference register(final ResourceKey key, final T value, final RegistrationInfo registrationInfo) { + markKnown(); - this.validateWrite(p_256252_); - Objects.requireNonNull(p_256252_); - Objects.requireNonNull(p_256591_); -@@ -102,6 +_,8 @@ - reference.bindKey(p_256252_); - } else { - reference = this.byKey.computeIfAbsent(p_256252_, p_358082_ -> Holder.Reference.createStandAlone(this, (ResourceKey)p_358082_)); -+ // Forge: Bind the value immediately so it can be queried while the registry is not frozen -+ reference.bindValue(p_256591_); + this.validateWrite(key); + Objects.requireNonNull(key); + Objects.requireNonNull(value); +@@ -107,6 +_,8 @@ + holder.bindKey(key); + } else { + holder = this.byKey.computeIfAbsent(key, k -> Holder.Reference.createStandAlone(this, (ResourceKey)k)); ++ // Forge: Bind the value immediately so it can be queried while the registry is not frozen ++ holder.bindValue(value); + } + + this.byKey.put(key, holder); +@@ -278,7 +_,6 @@ + } + + this.frozen = true; +- this.byValue.forEach((value, holder) -> holder.bindValue((T)value)); + List unboundEntries = this.byKey + .entrySet() + .stream() +@@ -295,7 +_,8 @@ + throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); } - this.byKey.put(p_256252_, reference); -@@ -268,7 +_,6 @@ - return this; - } else { - this.frozen = true; -- this.byValue.forEach((p_247989_, p_247990_) -> p_247990_.bindValue((T)p_247989_)); - List list = this.byKey - .entrySet() - .stream() -@@ -284,7 +_,8 @@ - throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); - } - -- this.unregisteredIntrusiveHolders = null; -+ // Forge: We freeze/unfreeze vanilla registries more than once, so we need to keep the unregistered intrusive holders map around. -+ //this.unregisteredIntrusiveHolders = null; - } - - if (this.allTags.isBound()) { -@@ -298,8 +_,9 @@ - .sorted() - .toList(); - if (!list1.isEmpty()) { -- throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + list1); -- } else { -+ LOGGER.debug(MARKER, "Unbound tags in registry " + this.key() + ": " + list1); -+ bindAllUnboundTagsToEmpty(); -+ } /* else */ { - this.allTags = MappedRegistry.TagSet.fromMap(this.frozenTags); - this.refreshTagsInHolders(); - return this; -@@ -309,6 +_,13 @@ +- this.unregisteredIntrusiveHolders = null; ++ // Forge: We freeze/unfreeze vanilla registries more than once, so we need to keep the unregistered intrusive holders map around. ++ //this.unregisteredIntrusiveHolders = null; } + + if (this.allTags.isBound()) { +@@ -310,7 +_,8 @@ + .sorted() + .toList(); + if (!unboundTags.isEmpty()) { +- throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + unboundTags); ++ LOGGER.debug(MARKER, "Unbound tags in registry " + this.key() + ": " + unboundTags); ++ bindAllUnboundTagsToEmpty(); + } + + this.componentLookup = new DataComponentLookup<>(this.byId); +@@ -319,6 +_,13 @@ + return this; } + private void bindAllUnboundTagsToEmpty() { @@ -68,9 +66,9 @@ + } + @Override - public Holder.Reference createIntrusiveHolder(T p_205915_) { + public Holder.Reference createIntrusiveHolder(final T value) { if (this.unregisteredIntrusiveHolders == null) { -@@ -383,6 +_,31 @@ +@@ -393,6 +_,31 @@ }; } @@ -100,17 +98,17 @@ + } + @Override - public Registry.PendingTags prepareTagReload(TagLoader.LoadResult p_368827_) { + public Registry.PendingTags prepareTagReload(final TagLoader.LoadResult tags) { if (!this.frozen) { -@@ -430,6 +_,11 @@ - @Override - public HolderLookup.RegistryLookup lookup() { - return registrylookup; -+ } +@@ -441,6 +_,11 @@ + @Override + public HolderLookup.RegistryLookup lookup() { + return patchedHolder; ++ } + -+ @Override -+ public List> getPending(TagKey key) { -+ return map.getOrDefault(key, List.of()); - } ++ @Override ++ public List> getPending(TagKey key) { ++ return pendingContents.getOrDefault(key, List.of()); + } - @Override + @Override diff --git a/patches/minecraft/net/minecraft/core/Registry.java.patch b/patches/minecraft/net/minecraft/core/Registry.java.patch index 2b49a462f5..374850a9da 100644 --- a/patches/minecraft/net/minecraft/core/Registry.java.patch +++ b/patches/minecraft/net/minecraft/core/Registry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/Registry.java +++ b/net/minecraft/core/Registry.java -@@ -172,5 +_,7 @@ +@@ -175,5 +_,7 @@ void apply(); int size(); diff --git a/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch b/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch index d94f347343..27bba4809c 100644 --- a/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch @@ -9,13 +9,13 @@ + private final it.unimi.dsi.fastutil.objects.Object2IntMap>> indexes = new it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap<>(); private final List> entries = new ArrayList<>(); - static HolderGetter wrapContextLookup(final HolderLookup.RegistryLookup p_255625_) { + private static HolderGetter wrapContextLookup(final HolderLookup.RegistryLookup original) { @@ -66,14 +_,43 @@ public RegistrySetBuilder add( - ResourceKey> p_256446_, Lifecycle p_256394_, RegistrySetBuilder.RegistryBootstrap p_256638_ + final ResourceKey> key, final Lifecycle lifecycle, final RegistrySetBuilder.RegistryBootstrap bootstrap ) { -- this.entries.add(new RegistrySetBuilder.RegistryStub<>(p_256446_, p_256394_, p_256638_)); -+ add(new RegistrySetBuilder.RegistryStub<>(p_256446_, p_256394_, p_256638_)); +- this.entries.add(new RegistrySetBuilder.RegistryStub<>(key, lifecycle, bootstrap)); ++ add(new RegistrySetBuilder.RegistryStub<>(key, lifecycle, bootstrap)); return this; } @@ -44,50 +44,50 @@ + return ret; + } + - public RegistrySetBuilder add(ResourceKey> p_256261_, RegistrySetBuilder.RegistryBootstrap p_256010_) { - return this.add(p_256261_, Lifecycle.stable(), p_256010_); + public RegistrySetBuilder add(final ResourceKey> key, final RegistrySetBuilder.RegistryBootstrap bootstrap) { + return this.add(key, Lifecycle.stable(), bootstrap); } + public List>> getEntryKeys() { + return this.entries.stream().map(RegistrySetBuilder.RegistryStub::key).toList(); + } + - private RegistrySetBuilder.BuildState createState(RegistryAccess p_256400_) { - RegistrySetBuilder.BuildState registrysetbuilder$buildstate = RegistrySetBuilder.BuildState.create( - p_256400_, this.entries.stream().map(RegistrySetBuilder.RegistryStub::key) -@@ -180,14 +_,16 @@ - throw new NullPointerException("No cloner for " + p_313093_.identifier()); - } else { - Map, Holder.Reference> map = new HashMap<>(); -- HolderLookup.RegistryLookup registrylookup = p_311682_.lookupOrThrow(p_313093_); -+ HolderLookup.RegistryLookup registrylookup = p_311682_.lookup(p_313093_).orElse(null); - registrylookup.listElements().forEach(p_308453_ -> { - ResourceKey resourcekey = p_308453_.key(); - RegistrySetBuilder.LazyHolder lazyholder = new RegistrySetBuilder.LazyHolder<>(p_312548_, resourcekey); - lazyholder.supplier = () -> cloner.clone((T)p_308453_.value(), p_311682_, p_311605_.get()); - map.put(resourcekey, lazyholder); - }); -- HolderLookup.RegistryLookup registrylookup1 = p_313198_.lookupOrThrow(p_313093_); -+ HolderLookup.RegistryLookup registrylookup1 = p_313198_.lookup(p_313093_).orElse(null); -+ Lifecycle lifecycle = registrylookup.registryLifecycle(); -+ if (registrylookup1 != null) { - registrylookup1.listElements().forEach(p_308430_ -> { - ResourceKey resourcekey = p_308430_.key(); - map.computeIfAbsent(resourcekey, p_308437_ -> { -@@ -196,7 +_,8 @@ - return lazyholder; - }); - }); -- Lifecycle lifecycle = registrylookup.registryLifecycle().add(registrylookup1.registryLifecycle()); -+ lifecycle = registrylookup.registryLifecycle().add(registrylookup1.registryLifecycle()); -+ } - return lookupFromMap(p_313093_, lifecycle, p_312548_, map); + private RegistrySetBuilder.BuildState createState(final RegistryAccess context) { + RegistrySetBuilder.BuildState state = RegistrySetBuilder.BuildState.create(context, this.entries.stream().map(RegistrySetBuilder.RegistryStub::key)); + this.entries.forEach(e -> e.apply(state)); +@@ -181,14 +_,16 @@ } + + Map, Holder.Reference> entries = new HashMap<>(); +- HolderLookup.RegistryLookup patchContents = patchProvider.lookupOrThrow(registryKey); ++ HolderLookup.RegistryLookup patchContents = patchProvider.lookup(registryKey).orElse(null); + patchContents.listElements().forEach(elementHolder -> { + ResourceKey elementKey = elementHolder.key(); + RegistrySetBuilder.LazyHolder holder = new RegistrySetBuilder.LazyHolder<>(owner, elementKey); + holder.supplier = () -> cloner.clone((T)elementHolder.value(), patchProvider, targetProvider.get()); + entries.put(elementKey, holder); + }); +- HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookupOrThrow(registryKey); ++ HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookup(registryKey).orElse(null); ++ Lifecycle lifecycle = patchContents.registryLifecycle(); ++ if (fallbackContents != null) { + fallbackContents.listElements().forEach(elementHolder -> { + ResourceKey elementKey = elementHolder.key(); + entries.computeIfAbsent(elementKey, key -> { +@@ -197,7 +_,8 @@ + return holder; + }); + }); +- Lifecycle lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); ++ lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); ++ } + return lookupFromMap(registryKey, lifecycle, owner, entries); } -@@ -265,6 +_,11 @@ + +@@ -266,6 +_,11 @@ @Override - public HolderGetter lookup(ResourceKey> p_255961_) { - return (HolderGetter)BuildState.this.registries.getOrDefault(p_255961_.identifier(), BuildState.this.lookup); + public HolderGetter lookup(final ResourceKey> key) { + return (HolderGetter)BuildState.this.registries.getOrDefault(key.identifier(), BuildState.this.lookup); + } + + @Override diff --git a/patches/minecraft/net/minecraft/core/RegistrySynchronization.java.patch b/patches/minecraft/net/minecraft/core/RegistrySynchronization.java.patch index e9f27461d4..21d15b04a3 100644 --- a/patches/minecraft/net/minecraft/core/RegistrySynchronization.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistrySynchronization.java.patch @@ -13,4 +13,4 @@ + ); public static void packRegistries( - DynamicOps p_330752_, + final DynamicOps ops, diff --git a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch index d3e29aec3e..f756c58e99 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java @@ -29,18 +_,22 @@ - double d2 = vec3.y() + direction.getStepY() * 1.125F; - double d3 = vec3.z() + direction.getStepZ() * d0; - BlockPos blockpos = p_123375_.pos().relative(direction); -+ AbstractBoat abstractboat = this.type.create(serverlevel, EntitySpawnReason.DISPENSER); -+ if (abstractboat == null) { -+ return this.defaultDispenseItemBehavior.dispense(p_123375_, p_123376_); + double spawnY = center.y() + direction.getStepY() * 1.125F; + double spawnZ = center.z() + direction.getStepZ() * justOutsideDispenser; + BlockPos frontPos = source.pos().relative(direction); ++ AbstractBoat boat = this.type.create(level, EntitySpawnReason.DISPENSER); ++ if (boat == null) { ++ return this.defaultDispenseItemBehavior.dispense(source, dispensed); + } -+ abstractboat.setYRot(direction.toYRot()); - double d4; -- if (serverlevel.getFluidState(blockpos).is(FluidTags.WATER)) { -+ if (abstractboat.canBoatInFluid(serverlevel.getFluidState(blockpos))) { - d4 = 1.0; ++ boat.setYRot(direction.toYRot()); + double yOffset; +- if (level.getFluidState(frontPos).is(FluidTags.WATER)) { ++ if (boat.canBoatInFluid(level.getFluidState(frontPos))) { + yOffset = 1.0; } else { -- if (!serverlevel.getBlockState(blockpos).isAir() || !serverlevel.getFluidState(blockpos.below()).is(FluidTags.WATER)) { -+ if (!serverlevel.getBlockState(blockpos).isAir() || !abstractboat.canBoatInFluid(serverlevel.getFluidState(blockpos.below()))) { - return this.defaultDispenseItemBehavior.dispense(p_123375_, p_123376_); +- if (!level.getBlockState(frontPos).isAir() || !level.getFluidState(frontPos.below()).is(FluidTags.WATER)) { ++ if (!level.getBlockState(frontPos).isAir() || !boat.canBoatInFluid(level.getFluidState(frontPos.below()))) { + return this.defaultDispenseItemBehavior.dispense(source, dispensed); } - d4 = 0.0; + yOffset = 0.0; } -- AbstractBoat abstractboat = this.type.create(serverlevel, EntitySpawnReason.DISPENSER); - if (abstractboat != null) { - abstractboat.setInitialPos(d1, d2 + d4, d3); - EntityType.createDefaultStackConfig(serverlevel, p_123376_, null).accept(abstractboat); +- AbstractBoat boat = this.type.create(level, EntitySpawnReason.DISPENSER); + if (boat != null) { + boat.setInitialPos(spawnX, spawnY + yOffset, spawnZ); + EntityType.createDefaultStackConfig(level, dispensed, null).apply(boat); diff --git a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch index 03ace695b3..35d8910ab2 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch @@ -1,23 +1,11 @@ --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -179,7 +_,7 @@ - DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_334276_.getItem(); - BlockPos blockpos = p_334868_.pos().relative(p_334868_.state().getValue(DispenserBlock.FACING)); - Level level = p_334868_.level(); -- if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null)) { -+ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_334276_)) { - dispensiblecontaineritem.checkExtraContent(null, level, p_334276_, blockpos); - return this.consumeWithRemainder(p_334868_, p_334276_, new ItemStack(Items.BUCKET)); +@@ -141,7 +_,7 @@ + DispensibleContainerItem bucket = (DispensibleContainerItem)dispensed.getItem(); + BlockPos target = source.pos().relative(source.state().getValue(DispenserBlock.FACING)); + Level level = source.level(); +- if (bucket.emptyContents(null, level, target, null)) { ++ if (bucket.emptyContents(null, level, target, null, dispensed)) { + bucket.checkExtraContent(null, level, dispensed, target); + return this.consumeWithRemainder(source, dispensed, new ItemStack(Items.BUCKET)); } else { -@@ -230,8 +_,9 @@ - } else if (CampfireBlock.canLight(blockstate) || CandleBlock.canLight(blockstate) || CandleCakeBlock.canLight(blockstate)) { - serverlevel.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, true)); - serverlevel.gameEvent(null, GameEvent.BLOCK_CHANGE, blockpos); -- } else if (blockstate.getBlock() instanceof TntBlock) { -- if (TntBlock.prime(serverlevel, blockpos)) { -+ } else if (blockstate.isFlammable(serverlevel, blockpos, p_333645_.state().getValue(DispenserBlock.FACING).getOpposite())) { -+ if (blockstate.onCaughtFire(serverlevel, blockpos, p_333645_.state().getValue(DispenserBlock.FACING).getOpposite(), null)) { -+ if (blockstate.getBlock() instanceof TntBlock) - serverlevel.removeBlock(blockpos, false); - } else { - this.setSuccess(false); diff --git a/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch new file mode 100644 index 0000000000..67d867e46e --- /dev/null +++ b/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java ++++ b/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java +@@ -32,8 +_,9 @@ + } else if (CampfireBlock.canLight(target) || CandleBlock.canLight(target) || CandleCakeBlock.canLight(target)) { + level.setBlockAndUpdate(targetPos, target.setValue(BlockStateProperties.LIT, true)); + level.gameEvent(null, GameEvent.BLOCK_CHANGE, targetPos); +- } else if (target.getBlock() instanceof TntBlock) { +- if (TntBlock.prime(level, targetPos)) { ++ } else if (target.isFlammable(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite())) { ++ if (target.onCaughtFire(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite(), null)) { ++ if (target.getBlock() instanceof TntBlock) + level.removeBlock(targetPos, false); + } else { + this.setSuccess(false); diff --git a/patches/minecraft/net/minecraft/core/particles/BlockParticleOption.java.patch b/patches/minecraft/net/minecraft/core/particles/BlockParticleOption.java.patch index 651e4c43f5..34908fbd79 100644 --- a/patches/minecraft/net/minecraft/core/particles/BlockParticleOption.java.patch +++ b/patches/minecraft/net/minecraft/core/particles/BlockParticleOption.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/particles/BlockParticleOption.java +++ b/net/minecraft/core/particles/BlockParticleOption.java -@@ -35,4 +_,15 @@ +@@ -37,4 +_,15 @@ public BlockState getState() { return this.state; } diff --git a/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch b/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch deleted file mode 100644 index b4a87ed6d0..0000000000 --- a/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/core/particles/ItemParticleOption.java -+++ b/net/minecraft/core/particles/ItemParticleOption.java -@@ -25,7 +_,7 @@ - throw new IllegalArgumentException("Empty stacks are not allowed"); - } else { - this.type = p_123705_; -- this.itemStack = p_123706_; -+ this.itemStack = p_123706_.copy(); // Forge: Fix stack updating after the fact causing particle changes. - } - } - diff --git a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch index b67426a668..ebb3225c50 100644 --- a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch +++ b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -1,22 +1,27 @@ --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java -@@ -294,7 +_,9 @@ - ) { - Bootstrap.checkBootstrapCalled(() -> "registry " + p_259230_.identifier()); - Identifier identifier = p_259230_.identifier(); -- LOADERS.put(identifier, () -> p_259210_.run(p_260327_)); -+ var maybeWrapped = net.minecraftforge.registries.GameData.getWrapper(p_259230_, p_260327_); -+ p_260327_ = maybeWrapped; -+ LOADERS.put(identifier, () -> p_259210_.run(maybeWrapped)); - WRITABLE_REGISTRY.register((ResourceKey)p_259230_, p_260327_, RegistrationInfo.BUILT_IN); - return p_260327_; +@@ -389,11 +_,13 @@ } -@@ -330,7 +_,7 @@ - if (p_448623_ instanceof DefaultedRegistry) { - Identifier identifier = ((DefaultedRegistry)p_448623_).getDefaultKey(); -- Objects.requireNonNull(p_448623_.getValue(identifier), "Missing default of DefaultedMappedRegistry: " + identifier); -+ Objects.requireNonNull(p_448623_.getValue(identifier), "Missing default of DefaultedMappedRegistry: " + p_448623_.key() + " - " + identifier); + private static > R internalRegister( +- final ResourceKey> name, final R registry, final BuiltInRegistries.RegistryBootstrap loader ++ final ResourceKey> name, R registry, final BuiltInRegistries.RegistryBootstrap loader + ) { + Bootstrap.checkBootstrapCalled(() -> "registry " + name.identifier()); + Identifier key = name.identifier(); +- LOADERS.put(key, () -> loader.run(registry)); ++ var maybeWrapped = net.minecraftforge.registries.GameData.getWrapper(name, registry); ++ registry = maybeWrapped; ++ LOADERS.put(key, () -> loader.run(maybeWrapped)); + WRITABLE_REGISTRY.register((ResourceKey)name, registry, RegistrationInfo.BUILT_IN); + return registry; + } +@@ -429,7 +_,7 @@ + + if (r instanceof DefaultedRegistry) { + Identifier key = ((DefaultedRegistry)r).getDefaultKey(); +- Objects.requireNonNull(r.getValue(key), "Missing default of DefaultedMappedRegistry: " + key); ++ Objects.requireNonNull(r.getValue(key), "Missing default of DefaultedMappedRegistry: " + r.key() + " - " + key); } }); } diff --git a/patches/minecraft/net/minecraft/core/registries/Registries.java.patch b/patches/minecraft/net/minecraft/core/registries/Registries.java.patch index 7b27eae612..6069af07bf 100644 --- a/patches/minecraft/net/minecraft/core/registries/Registries.java.patch +++ b/patches/minecraft/net/minecraft/core/registries/Registries.java.patch @@ -1,17 +1,11 @@ --- a/net/minecraft/core/registries/Registries.java +++ b/net/minecraft/core/registries/Registries.java -@@ -295,10 +_,14 @@ +@@ -326,6 +_,8 @@ } - public static String elementsDirPath(ResourceKey> p_343743_) { -+ if (!p_343743_.identifier().getNamespace().equals("minecraft")) -+ return p_343743_.identifier().getNamespace() + '/' + p_343743_.identifier().getPath(); - return p_343743_.identifier().getPath(); + private static String registryDirPath(final ResourceKey> registryKey) { ++ if (!registryKey.identifier().getNamespace().equals("minecraft")) ++ return registryKey.identifier().getNamespace() + '/' + registryKey.identifier().getPath(); + return registryKey.identifier().getPath(); } - public static String tagsDirPath(ResourceKey> p_343025_) { -+ if (!p_343025_.identifier().getNamespace().equals("minecraft")) -+ return "tags/" + p_343025_.identifier().getNamespace() + '/' + p_343025_.identifier().getPath(); - return "tags/" + p_343025_.identifier().getPath(); - } - } diff --git a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch index e7fa704d6f..3aa26cd8e4 100644 --- a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch @@ -1,26 +1,17 @@ --- a/net/minecraft/data/DataGenerator.java +++ b/net/minecraft/data/DataGenerator.java -@@ -21,6 +_,7 @@ - final Map providersToRun = new LinkedHashMap<>(); - private final WorldVersion version; - private final boolean alwaysGenerate; +@@ -18,6 +_,7 @@ + protected final PackOutput vanillaPackOutput; + protected final Set allProviderIds = new HashSet<>(); + protected final Map providersToRun = new LinkedHashMap<>(); + private final Map providersView = java.util.Collections.unmodifiableMap(this.providersToRun); - public DataGenerator(Path p_251724_, WorldVersion p_250554_, boolean p_251323_) { - this.rootOutputFolder = p_251724_; -@@ -38,6 +_,7 @@ - LOGGER.debug("Generator {} already run for version {}", p_254418_, this.version.name()); - } else { - LOGGER.info("Starting provider: {}", p_254418_); -+ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + p_254418_); - stopwatch1.start(); - hashcache.applyUpdate(hashcache.generateUpdate(p_254418_, p_253750_::run).join()); - stopwatch1.stop(); -@@ -56,6 +_,35 @@ - public DataGenerator.PackGenerator getBuiltinDatapack(boolean p_253826_, String p_254134_) { - Path path = this.vanillaPackOutput.getOutputFolder(PackOutput.Target.DATA_PACK).resolve("minecraft").resolve("datapacks").resolve(p_254134_); - return new DataGenerator.PackGenerator(p_253826_, p_254134_, new PackOutput(path)); -+ } + public DataGenerator(final Path output) { + this.vanillaPackOutput = new PackOutput(output); +@@ -33,6 +_,35 @@ + Path packOutputDir = this.vanillaPackOutput.getOutputFolder(PackOutput.Target.DATA_PACK).resolve("minecraft").resolve("datapacks").resolve(packId); + return new DataGenerator.PackGenerator(toRun, packId, new PackOutput(packOutputDir)); + } + public Map getProvidersView() { + return this.providersView; + } @@ -30,7 +21,7 @@ + } + + public PackOutput getPackOutput(String path) { -+ return new PackOutput(rootOutputFolder.resolve(path)); ++ return new PackOutput(getPackOutput().getOutputFolder().resolve(path)); + } + + public T addProvider(boolean run, DataProvider.Factory factory) { @@ -49,6 +40,23 @@ + } + + return provider; - } ++ } static { + Bootstrap.bootStrap(); +@@ -60,6 +_,7 @@ + DataGenerator.LOGGER.debug("Generator {} already run for version {}", providerId, this.version.name()); + } else { + DataGenerator.LOGGER.info("Starting provider: {}", providerId); ++ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + providerId); + stopwatch.start(); + cache.applyUpdate(cache.generateUpdate(providerId, provider::run).join()); + stopwatch.stop(); +@@ -109,6 +_,7 @@ + Stopwatch stopwatch = Stopwatch.createUnstarted(); + this.providersToRun.forEach((providerId, provider) -> { + DataGenerator.LOGGER.info("Starting uncached provider: {}", providerId); ++ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + providerId); + stopwatch.start(); + provider.run(CachedOutput.NO_CACHE).join(); + stopwatch.stop(); diff --git a/patches/minecraft/net/minecraft/data/HashCache.java.patch b/patches/minecraft/net/minecraft/data/HashCache.java.patch index 6b67cc38cb..abe2871b98 100644 --- a/patches/minecraft/net/minecraft/data/HashCache.java.patch +++ b/patches/minecraft/net/minecraft/data/HashCache.java.patch @@ -6,36 +6,36 @@ private final Map caches; + private final Map originalCaches; private final Set cachesToWrite = new HashSet<>(); - final Set cachePaths = new HashSet<>(); + private final Set cachePaths = new HashSet<>(); private final int initialCount; @@ -65,6 +_,7 @@ } - this.caches = map; + this.caches = loadedCaches; + this.originalCaches = Map.copyOf(this.caches); - this.initialCount = i; + this.initialCount = initialCount; } @@ -106,6 +_,8 @@ - this.caches.forEach((p_448628_, p_448629_) -> { - if (this.cachesToWrite.contains(p_448628_)) { - Path path = this.getProviderCachePath(p_448628_); + this.caches.forEach((providerId, cache) -> { + if (this.cachesToWrite.contains(providerId)) { + Path cachePath = this.getProviderCachePath(providerId); + // Forge: Only rewrite the cache file if it changed or is missing -+ if (!p_448629_.equals(this.originalCaches.get(p_448628_)) || !Files.exists(path)) - p_448629_.save(this.rootDir, path, DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(ZonedDateTime.now()) + "\t" + p_448628_); ++ if (!cache.equals(this.originalCaches.get(providerId)) || !Files.exists(cachePath)) + cache.save(this.rootDir, cachePath, DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(ZonedDateTime.now()) + "\t" + providerId); } -@@ -221,10 +_,11 @@ - bufferedwriter.write(p_236145_); - bufferedwriter.newLine(); +@@ -217,10 +_,11 @@ + output.write(extraHeaderInfo); + output.newLine(); -- for (Entry entry : this.data.entrySet()) { +- for (Entry e : this.data.entrySet()) { + // Forge: Standardize order of entries -+ for (Entry entry : this.data.entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) { - bufferedwriter.write(entry.getValue().toString()); - bufferedwriter.write(32); -- bufferedwriter.write(p_236143_.relativize(entry.getKey()).toString()); -+ bufferedwriter.write(p_236143_.relativize(entry.getKey()).toString().replace("\\", "/")); // Forge: Standardize file paths. - bufferedwriter.newLine(); ++ for (Entry e : this.data.entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) { + output.write(e.getValue().toString()); + output.write(32); +- output.write(rootDir.relativize(e.getKey()).toString()); ++ output.write(rootDir.relativize(e.getKey()).toString().replace("\\", "/")); // Forge: Standardize file paths. + output.newLine(); } - } catch (IOException ioexception) { + } catch (IOException e) { diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index efaa93b791..5bb968547a 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -76,14 +_,17 @@ - OptionSpec optionspec4 = optionparser.accepts("all", "Include all generators"); - OptionSpec optionspec5 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); - OptionSpec optionspec6 = optionparser.accepts("input", "Input folder").withRequiredArg(); -+ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(optionparser, false); - OptionSet optionset = optionparser.parse(p_129669_); -- if (!optionset.has(optionspec) && optionset.hasOptions()) { -+ if (!optionset.has(optionspec) && optionset.hasOptions() && loader.hasArgs(optionset)) { - Path path = Paths.get(optionspec5.value(optionset)); - boolean flag = optionset.has(optionspec4); - boolean flag1 = flag || optionset.has(optionspec1); - boolean flag2 = flag || optionset.has(optionspec2); - boolean flag3 = flag || optionset.has(optionspec3); - Collection collection = optionset.valuesOf(optionspec6).stream().map(p_129659_ -> Paths.get(p_129659_)).toList(); -+ if (!loader.run(optionset, path, collection, flag1, flag, flag2, flag3, true)) +@@ -78,14 +_,17 @@ + OptionSpec allOption = parser.accepts("all", "Include all generators"); + OptionSpec outputOption = parser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); + OptionSpec inputOption = parser.accepts("input", "Input folder").withRequiredArg(); ++ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(parser, false); + OptionSet optionSet = parser.parse(args); +- if (!optionSet.has(helpOption) && optionSet.hasOptions()) { ++ if (!optionSet.has(helpOption) && optionSet.hasOptions() && loader.hasArgs(optionSet)) { + Path output = Paths.get(outputOption.value(optionSet)); + boolean allOptions = optionSet.has(allOption); + boolean server = allOptions || optionSet.has(serverOption); + boolean dev = allOptions || optionSet.has(devOption); + boolean reports = allOptions || optionSet.has(reportsOption); + Collection input = optionSet.valuesOf(inputOption).stream().map(x$0 -> Paths.get(x$0)).toList(); ++ if (!loader.run(optionSet, output, input, server, allOptions, dev, reports)) + return; - DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true); - addServerProviders(datagenerator, collection, flag1, flag2, flag3); - datagenerator.run(); + DataGenerator generator = new DataGenerator.Cached(output, SharedConstants.getCurrentVersion(), true); + addServerDefinitionProviders(generator, server, reports); + addServerConverters(generator, input, server, dev); diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch index f801a3041e..a26aec6715 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 -@@ -718,12 +_,16 @@ +@@ -721,12 +_,16 @@ protected abstract void generate(); @@ -9,9 +9,9 @@ + } + @Override - public void generate(BiConsumer, LootTable.Builder> p_249322_) { + public void generate(final BiConsumer, LootTable.Builder> output) { this.generate(); - Set> set = new HashSet<>(); + Set> seen = new HashSet<>(); - for (Block block : BuiltInRegistries.BLOCK) { + for (Block block : getKnownBlocks()) { diff --git a/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch index c891e46b5a..2cedc75886 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/EntityLootSubProvider.java +++ b/net/minecraft/data/loot/EntityLootSubProvider.java -@@ -121,12 +_,16 @@ +@@ -117,12 +_,16 @@ public abstract void generate(); @@ -9,13 +9,13 @@ + } + @Override - public void generate(BiConsumer, LootTable.Builder> p_251751_) { + public void generate(final BiConsumer, LootTable.Builder> output) { this.generate(); - Set> set = new HashSet<>(); + Set> seen = new HashSet<>(); - BuiltInRegistries.ENTITY_TYPE - .listElements() + this.getKnownEntityTypes() + .map(EntityType::builtInRegistryHolder) .forEach( - p_358214_ -> { - EntityType entitytype = p_358214_.value(); + holder -> { + EntityType type = holder.value(); diff --git a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch index 1fef36d81d..ac401dd8aa 100644 --- a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch @@ -1,35 +1,28 @@ --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java -@@ -61,7 +_,7 @@ - private CompletableFuture run(CachedOutput p_327970_, HolderLookup.Provider p_331092_) { - WritableRegistry writableregistry = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental()); - Map map = new Object2ObjectOpenHashMap<>(); -- this.subProviders.forEach(p_341016_ -> p_341016_.provider().apply(p_331092_).generate((p_448699_, p_448700_) -> { -+ this.getTables().forEach(p_341016_ -> p_341016_.provider().apply(p_331092_).generate((p_448699_, p_448700_) -> { - Identifier identifier = sequenceIdForLootTable(p_448699_); - Identifier identifier1 = map.put(RandomSequence.seedForKey(identifier), identifier); - if (identifier1 != null) { -@@ -77,18 +_,8 @@ - HolderGetter.Provider holdergetter$provider = new RegistryAccess.ImmutableRegistryAccess(List.of(writableregistry)).freeze(); - ValidationContext validationcontext = new ValidationContext(problemreporter$collector, LootContextParamSets.ALL_PARAMS, holdergetter$provider); +@@ -59,7 +_,7 @@ + private CompletableFuture run(final CachedOutput cache, final HolderLookup.Provider registries) { + WritableRegistry tables = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental()); + Map randomSequenceSeeds = new Object2ObjectOpenHashMap<>(); +- this.subProviders.forEach(subProvider -> subProvider.provider().apply(registries).generate((id, lootTable) -> { ++ this.getTables().forEach(subProvider -> subProvider.provider().apply(registries).generate((id, lootTable) -> { + Identifier sequenceId = sequenceIdForLootTable(id); + Identifier previous = randomSequenceSeeds.put(RandomSequence.seedForKey(sequenceId), sequenceId); + if (previous != null) { +@@ -75,11 +_,8 @@ + HolderGetter.Provider validationProvider = new RegistryAccess.ImmutableRegistryAccess(List.of(tables)).freeze(); + ValidationContextSource validationContext = new ValidationContextSource(problems, validationProvider); -- for (ResourceKey resourcekey : Sets.difference(this.requiredTables, writableregistry.registryKeySet())) { -- problemreporter$collector.report(new LootTableProvider.MissingTableProblem(resourcekey)); +- for (ResourceKey missingTable : Sets.difference(this.requiredTables, tables.registryKeySet())) { +- problems.report(new LootTableProvider.MissingTableProblem(missingTable)); - } -+ validate(writableregistry, validationcontext, problemreporter$collector); ++ validate(tables, validationContext, problems); -- writableregistry.listElements() -- .forEach( -- p_405062_ -> p_405062_.value() -- .validate( -- validationcontext.setContextKeySet(p_405062_.value().getParamSet()) -- .enterElement(new ProblemReporter.RootElementPathElement(p_405062_.key()), p_405062_.key()) -- ) -- ); - if (!problemreporter$collector.isEmpty()) { - problemreporter$collector.forEach( - (p_405059_, p_405060_) -> LOGGER.warn("Found validation problem in {}: {}", p_405059_, p_405060_.description()) -@@ -111,6 +_,21 @@ +- LootDataType.TABLE.runValidation(validationContext, tables); + if (!problems.isEmpty()) { + problems.forEach((id, problem) -> LOGGER.warn("Found validation problem in {}: {}", id, problem.description())); + throw new IllegalStateException("Failed to validate loot tables, see logs"); +@@ -100,6 +_,18 @@ @Override public final String getName() { return "Loot Tables"; @@ -39,15 +32,12 @@ + return this.subProviders; + } + -+ protected void validate(net.minecraft.core.Registry map, ValidationContext validationcontext, ProblemReporter report) { ++ protected void validate(net.minecraft.core.Registry map, ValidationContextSource context, ProblemReporter report) { + for (ResourceKey resourcekey : Sets.difference(this.requiredTables, map.registryKeySet())) { + report.report(new LootTableProvider.MissingTableProblem(resourcekey)); + } + -+ map.listElements().forEach(table -> table.value().validate( -+ validationcontext.setContextKeySet(table.value().getParamSet()) -+ .enterElement(new ProblemReporter.RootElementPathElement(table.key()), table.key()) -+ )); ++ LootDataType.TABLE.runValidation(context, map); } public record MissingTableProblem(ResourceKey id) implements ProblemReporter.Problem { diff --git a/patches/minecraft/net/minecraft/data/recipes/RecipeOutput.java.patch b/patches/minecraft/net/minecraft/data/recipes/RecipeOutput.java.patch index 42608fddb0..401351e3fa 100644 --- a/patches/minecraft/net/minecraft/data/recipes/RecipeOutput.java.patch +++ b/patches/minecraft/net/minecraft/data/recipes/RecipeOutput.java.patch @@ -4,7 +4,7 @@ import org.jspecify.annotations.Nullable; public interface RecipeOutput { -- void accept(ResourceKey> p_367162_, Recipe p_360758_, @Nullable AdvancementHolder p_361155_); +- void accept(ResourceKey> id, Recipe recipe, @Nullable AdvancementHolder advancement); + default void accept(ResourceKey> id, Recipe recipe, @Nullable AdvancementHolder advancement) { + if (advancement == null) { + accept(id, recipe, null, null); diff --git a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch index 78e39d071b..0dbbdf45d1 100644 --- a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,64 +1,50 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -787,7 +_,7 @@ - RecipeBuilder create(RecipeProvider p_363045_, ItemLike p_362746_, ItemLike p_364674_); - } - -- protected abstract static class Runner implements DataProvider { -+ public abstract static class Runner implements DataProvider { - private final PackOutput packOutput; - private final CompletableFuture registries; - -@@ -807,13 +_,13 @@ - final List> list = new ArrayList<>(); - RecipeOutput recipeoutput = new RecipeOutput() { +@@ -908,14 +_,14 @@ + final List> tasks = new ArrayList<>(); + RecipeOutput recipeOutput = new RecipeOutput() { @Override -- public void accept(ResourceKey> p_361204_, Recipe p_363495_, @Nullable AdvancementHolder p_364191_) { -+ public void accept(ResourceKey> p_361204_, Recipe p_363495_, net.minecraft.resources.@Nullable Identifier advancementId, com.google.gson.@Nullable JsonElement advancement) { - if (!set.add(p_361204_)) { - throw new IllegalStateException("Duplicate recipe " + p_361204_.identifier()); - } else { - this.saveRecipe(p_361204_, p_363495_); -- if (p_364191_ != null) { -- this.saveAdvancement(p_364191_); -+ if (advancement != null && advancementId != null) { -+ this.saveAdvancement(advancementId, advancement); - } +- public void accept(final ResourceKey> id, final Recipe recipe, final @Nullable AdvancementHolder advancementHolder) { ++ public void accept(final ResourceKey> id, final Recipe recipe, net.minecraft.resources.@Nullable Identifier advancementId, com.google.gson.@Nullable JsonElement advancement) { + if (!allRecipes.add(id)) { + throw new IllegalStateException("Duplicate recipe " + id.identifier()); + } + + this.saveRecipe(id, recipe); +- if (advancementHolder != null) { +- this.saveAdvancement(advancementHolder); ++ if (advancement != null && advancementId != null) { ++ this.saveAdvancement(advancementId, advancement); } } -@@ -828,7 +_,9 @@ - AdvancementHolder advancementholder = Advancement.Builder.recipeAdvancement() + +@@ -929,19 +_,26 @@ + AdvancementHolder root = Advancement.Builder.recipeAdvancement() .addCriterion("impossible", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance())) .build(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT); -- this.saveAdvancement(advancementholder); +- this.saveAdvancement(root); + var ops = registry().createSerializationContext(com.mojang.serialization.JsonOps.INSTANCE); -+ var json = Advancement.CODEC.encodeStart(ops, advancementholder.value()).getOrThrow(IllegalStateException::new); -+ this.saveAdvancement(advancementholder.id(), json); ++ var json = Advancement.CODEC.encodeStart(ops, root.value()).getOrThrow(IllegalStateException::new); ++ this.saveAdvancement(root.id(), json); } - private void saveRecipe(ResourceKey> p_368864_, Recipe p_368184_) { -@@ -839,16 +_,19 @@ - ); + private void saveRecipe(final ResourceKey> id, final Recipe recipe) { + tasks.add(DataProvider.saveStable(cache, registries, Recipe.CODEC, recipe, recipePathProvider.json(id.identifier()))); } -- private void saveAdvancement(AdvancementHolder p_361824_) { +- private void saveAdvancement(final AdvancementHolder advancementHolder) { + private void saveAdvancement(net.minecraft.resources.Identifier id, com.google.gson.JsonElement advancement) { - list.add( + tasks.add( DataProvider.saveStable( - p_363906_, -- p_362805_, -- Advancement.CODEC, -- p_361824_.value(), -- packoutput$pathprovider1.json(p_361824_.id()) -+ advancement, -+ packoutput$pathprovider1.json(id) +- cache, registries, Advancement.CODEC, advancementHolder.value(), advancementPathProvider.json(advancementHolder.id()) ++ cache, advancement, advancementPathProvider.json(id) ) ); + } + + @Override + public HolderLookup.Provider registry() { -+ return p_362805_; ++ return registries; } }; - this.createRecipeProvider(p_362805_, recipeoutput).buildRecipes(); + this.createRecipeProvider(registries, recipeOutput).buildRecipes(); diff --git a/patches/minecraft/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch b/patches/minecraft/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch index 2bca880f42..a73e9cad16 100644 --- a/patches/minecraft/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/data/registries/RegistriesDatapackGenerator.java +++ b/net/minecraft/data/registries/RegistriesDatapackGenerator.java -@@ -20,10 +_,21 @@ +@@ -18,10 +_,21 @@ public class RegistriesDatapackGenerator implements DataProvider { private final PackOutput output; private final CompletableFuture registries; + private final java.util.function.Predicate namespacePredicate; - public RegistriesDatapackGenerator(PackOutput p_256643_, CompletableFuture p_255780_) { -+ this(p_256643_, p_255780_, null); + public RegistriesDatapackGenerator(final PackOutput output, final CompletableFuture registries) { ++ this(output, registries, null); + } + -+ public RegistriesDatapackGenerator(PackOutput p_256643_, CompletableFuture p_255780_, @org.jetbrains.annotations.Nullable java.util.Set modIds) { - this.registries = p_255780_; - this.output = p_256643_; ++ public RegistriesDatapackGenerator(final PackOutput output, final CompletableFuture registries, @org.jetbrains.annotations.Nullable java.util.Set modIds) { + this.registries = registries; + this.output = output; + this.namespacePredicate = modIds == null ? namespace -> true : modIds::contains; + } + @@ -22,25 +22,23 @@ } @Override -@@ -33,8 +_,7 @@ - p_325918_ -> { - DynamicOps dynamicops = p_325918_.createSerializationContext(JsonOps.INSTANCE); +@@ -31,8 +_,7 @@ + access -> { + DynamicOps registryOps = access.createSerializationContext(JsonOps.INSTANCE); return CompletableFuture.allOf( - RegistryDataLoader.WORLDGEN_REGISTRIES - .stream() + RegistryDataLoader.getWorldGenAndDimensionStream() - .flatMap(p_256552_ -> this.dumpRegistryCap(p_255785_, p_325918_, dynamicops, (RegistryDataLoader.RegistryData)p_256552_).stream()) + .flatMap(v -> this.dumpRegistryCap(cache, access, registryOps, (RegistryDataLoader.RegistryData)v).stream()) .toArray(CompletableFuture[]::new) ); -@@ -52,6 +_,7 @@ - PackOutput.PathProvider packoutput$pathprovider = this.output.createRegistryElementsPathProvider(resourcekey); +@@ -50,11 +_,16 @@ + PackOutput.PathProvider pathProvider = this.output.createRegistryElementsPathProvider(registryKey); return CompletableFuture.allOf( - p_358460_.listElements() + registry.listElements() + .filter(holder -> shouldDump(holder.key())) - .map( - p_448721_ -> dumpValue( - packoutput$pathprovider.json(p_448721_.key().identifier()), -@@ -65,6 +_,10 @@ + .>map(e -> dumpValue(pathProvider.json(e.key().identifier()), cache, writeOps, v.elementCodec(), e.value())) + .toArray(CompletableFuture[]::new) ); } ); diff --git a/patches/minecraft/net/minecraft/data/registries/RegistryPatchGenerator.java.patch b/patches/minecraft/net/minecraft/data/registries/RegistryPatchGenerator.java.patch index 09e3ac09cf..091d98a9ab 100644 --- a/patches/minecraft/net/minecraft/data/registries/RegistryPatchGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/registries/RegistryPatchGenerator.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/data/registries/RegistryPatchGenerator.java +++ b/net/minecraft/data/registries/RegistryPatchGenerator.java @@ -21,7 +_,7 @@ - p_309945_ -> { - RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY); - Cloner.Factory cloner$factory = new Cloner.Factory(); -- RegistryDataLoader.WORLDGEN_REGISTRIES.forEach(p_313050_ -> p_313050_.runWithArguments(cloner$factory::addCodec)); -+ RegistryDataLoader.getWorldGenAndDimensionStream().forEach(p_313050_ -> p_313050_.runWithArguments(cloner$factory::addCodec)); - RegistrySetBuilder.PatchedRegistries registrysetbuilder$patchedregistries = p_310262_.buildPatch( - registryaccess$frozen, p_309945_, cloner$factory - ); + parent -> { + RegistryAccess.Frozen staticRegistries = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY); + Cloner.Factory cloner = new Cloner.Factory(); +- RegistryDataLoader.WORLDGEN_REGISTRIES.forEach(registryData -> registryData.runWithArguments(cloner::addCodec)); ++ RegistryDataLoader.getWorldGenAndDimensionStream().forEach(registryData -> registryData.runWithArguments(cloner::addCodec)); + RegistrySetBuilder.PatchedRegistries newRegistries = packBuilder.buildPatch(staticRegistries, parent, cloner); + HolderLookup.Provider fullPatchedRegistry = newRegistries.full(); + Optional> biomes = fullPatchedRegistry.lookup(Registries.BIOME); diff --git a/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch b/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch index 2004582702..adf14ed7fa 100644 --- a/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch +++ b/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/data/registries/VanillaRegistries.java +++ b/net/minecraft/data/registries/VanillaRegistries.java -@@ -94,6 +_,7 @@ - .add(Registries.CAT_VARIANT, CatVariants::bootstrap) - .add(Registries.DIALOG, Dialogs::bootstrap) - .add(Registries.TIMELINE, Timelines::bootstrap); +@@ -110,6 +_,7 @@ + .add(Registries.TIMELINE, Timelines::bootstrap) + .add(Registries.VILLAGER_TRADE, VillagerTrades::bootstrap) + .add(Registries.TRADE_SET, TradeSets::bootstrap); + public static final List>> DATAPACK_REGISTRY_KEYS = BUILDER.getEntryKeys(); - private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider p_256242_) { - validateThatAllBiomeFeaturesHaveBiomeFilter(p_256242_.lookupOrThrow(Registries.PLACED_FEATURE), p_256242_.lookupOrThrow(Registries.BIOME)); -@@ -125,5 +_,9 @@ - HolderLookup.Provider holderlookup$provider = BUILDER.build(registryaccess$frozen); - validateThatAllBiomeFeaturesHaveBiomeFilter(holderlookup$provider); - return holderlookup$provider; + private static void validateThatAllBiomeFeaturesHaveBiomeFilter(final HolderLookup.Provider provider) { + validateThatAllBiomeFeaturesHaveBiomeFilter(provider.lookupOrThrow(Registries.PLACED_FEATURE), provider.lookupOrThrow(Registries.BIOME)); +@@ -141,5 +_,9 @@ + HolderLookup.Provider newRegistries = BUILDER.build(staticRegistries); + validateThatAllBiomeFeaturesHaveBiomeFilter(newRegistries); + return newRegistries; + } + + public static RegistrySetBuilder builder() { diff --git a/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch index ae99ba015b..7f57b981e8 100644 --- a/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch @@ -3,15 +3,15 @@ @@ -9,8 +_,14 @@ import net.minecraft.world.level.block.entity.BannerPatterns; - public class BannerPatternTagsProvider extends KeyTagProvider { + public class BannerPatternTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #BannerPatternTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated - public BannerPatternTagsProvider(PackOutput p_256451_, CompletableFuture p_256420_) { - super(p_256451_, Registries.BANNER_PATTERN, p_256420_); + public BannerPatternTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { + super(output, Registries.BANNER_PATTERN, lookupProvider); + } + -+ public BannerPatternTagsProvider(PackOutput p_256451_, CompletableFuture p_256420_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256451_, Registries.BANNER_PATTERN, p_256420_, modId, existingFileHelper); ++ public BannerPatternTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.BANNER_PATTERN, lookupProvider, modId, existingFileHelper); } @Override diff --git a/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch index c37ccb8d70..fd881dc899 100644 --- a/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/BiomeTagsProvider.java +++ b/net/minecraft/data/tags/BiomeTagsProvider.java @@ -16,6 +_,10 @@ - super(p_255800_, Registries.BIOME, p_256205_); + super(output, Registries.BIOME, lookupProvider); } -+ public BiomeTagsProvider(PackOutput p_255800_, CompletableFuture p_256205_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_255800_, Registries.BIOME, p_256205_, modId, existingFileHelper); ++ public BiomeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.BIOME, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_256485_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(BiomeTags.IS_DEEP_OCEAN).add(Biomes.DEEP_FROZEN_OCEAN).add(Biomes.DEEP_COLD_OCEAN).add(Biomes.DEEP_OCEAN).add(Biomes.DEEP_LUKEWARM_OCEAN); diff --git a/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch b/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch new file mode 100644 index 0000000000..46728d91f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/data/tags/BlockItemTagAppender.java ++++ b/net/minecraft/data/tags/BlockItemTagAppender.java +@@ -56,4 +_,28 @@ + this.original.addOptionalTag(tag); + return this; + } ++ ++ @Override ++ public TagAppender addOptional(net.minecraft.resources.Identifier location) { ++ this.original.addOptional(location); ++ return this; ++ } ++ ++ @Override ++ public TagAppender replace(boolean value) { ++ this.original.replace(value); ++ return this; ++ } ++ ++ @Override ++ public TagAppender remove(final net.minecraft.resources.Identifier location) { ++ this.original.remove(location); ++ return this; ++ } ++ ++ @Override ++ public TagAppender remove(TagKey tag) { ++ this.original.remove(tag); ++ return this; ++ } + } diff --git a/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch new file mode 100644 index 0000000000..3f4b6a64db --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/data/tags/BlockItemTagsProvider.java ++++ b/net/minecraft/data/tags/BlockItemTagsProvider.java +@@ -64,6 +_,12 @@ + return this; + } + ++ default BlockItemTagsProvider.CombinedAppender add(final BlockItemTagId... ids) { ++ for (var id : ids) ++ addTag(id); ++ return this; ++ } ++ + default BlockItemTagsProvider.CombinedAppender addAll(final Collection ids) { + this.addAll(ids.stream()); + return this; diff --git a/patches/minecraft/net/minecraft/data/tags/DamageTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/DamageTypeTagsProvider.java.patch index 1422630273..93da233a40 100644 --- a/patches/minecraft/net/minecraft/data/tags/DamageTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/DamageTypeTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/DamageTypeTagsProvider.java +++ b/net/minecraft/data/tags/DamageTypeTagsProvider.java @@ -13,6 +_,10 @@ - super(p_270719_, Registries.DAMAGE_TYPE, p_270256_); + super(output, Registries.DAMAGE_TYPE, lookupProvider); } -+ public DamageTypeTagsProvider(PackOutput p_270719_, CompletableFuture p_270256_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_270719_, Registries.DAMAGE_TYPE, p_270256_, modId, existingFileHelper); ++ public DamageTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.DAMAGE_TYPE, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_270108_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(DamageTypeTags.DAMAGES_HELMET).add(DamageTypes.FALLING_ANVIL, DamageTypes.FALLING_BLOCK, DamageTypes.FALLING_STALACTITE); diff --git a/patches/minecraft/net/minecraft/data/tags/EnchantmentTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/EnchantmentTagsProvider.java.patch index 9ec606e2a8..22436bfd5e 100644 --- a/patches/minecraft/net/minecraft/data/tags/EnchantmentTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/EnchantmentTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/EnchantmentTagsProvider.java +++ b/net/minecraft/data/tags/EnchantmentTagsProvider.java @@ -17,6 +_,10 @@ - super(p_332794_, Registries.ENCHANTMENT, p_331070_); + super(output, Registries.ENCHANTMENT, lookupProvider); } -+ public EnchantmentTagsProvider(PackOutput p_332794_, CompletableFuture p_331070_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_332794_, Registries.ENCHANTMENT, p_331070_, modId, existingFileHelper); ++ public EnchantmentTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.ENCHANTMENT, lookupProvider, modId, existingFileHelper); + } + - protected void tooltipOrder(HolderLookup.Provider p_335292_, ResourceKey... p_343612_) { - this.tag(EnchantmentTags.TOOLTIP_ORDER).add(p_343612_); - Set> set = Set.of(p_343612_); + protected void tooltipOrder(final HolderLookup.Provider registries, final ResourceKey... order) { + this.tag(EnchantmentTags.TOOLTIP_ORDER).add(order); + Set> set = Set.of(order); diff --git a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch index e1aa248ee1..5159b1e7c2 100644 --- a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/EntityTypeTagsProvider.java +++ b/net/minecraft/data/tags/EntityTypeTagsProvider.java -@@ -12,6 +_,10 @@ - super(p_256095_, Registries.ENTITY_TYPE, p_256572_, p_256665_ -> p_256665_.builtInRegistryHolder().key()); +@@ -13,6 +_,10 @@ + super(output, Registries.ENTITY_TYPE, lookupProvider); } -+ public EntityTypeTagsProvider(PackOutput p_256095_, CompletableFuture p_256572_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256095_, Registries.ENTITY_TYPE, p_256572_, p_256665_ -> p_256665_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ public EntityTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.ENTITY_TYPE, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_255894_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(EntityTypeTags.SKELETONS) diff --git a/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch index 2b5be808c0..b61c6d8e24 100644 --- a/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java +++ b/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java @@ -13,6 +_,10 @@ - super(p_256604_, Registries.FLAT_LEVEL_GENERATOR_PRESET, p_255962_); + super(output, Registries.FLAT_LEVEL_GENERATOR_PRESET, lookupProvider); } -+ public FlatLevelGeneratorPresetTagsProvider(PackOutput p_256604_, CompletableFuture p_255962_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256604_, Registries.FLAT_LEVEL_GENERATOR_PRESET, p_255962_, modId, existingFileHelper); ++ public FlatLevelGeneratorPresetTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.FLAT_LEVEL_GENERATOR_PRESET, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_255741_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(FlatLevelGeneratorPresetTags.VISIBLE) diff --git a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch index 5735f3d4cb..28fd0f8030 100644 --- a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/FluidTagsProvider.java +++ b/net/minecraft/data/tags/FluidTagsProvider.java @@ -13,6 +_,10 @@ - super(p_255941_, Registries.FLUID, p_256600_, p_256474_ -> p_256474_.builtInRegistryHolder().key()); + super(output, Registries.FLUID, lookupProvider); } -+ public FluidTagsProvider(PackOutput p_255941_, CompletableFuture p_256600_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_255941_, Registries.FLUID, p_256600_, p_256474_ -> p_256474_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ public FluidTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.FLUID, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_256366_) { - this.tag(FluidTags.WATER).add(Fluids.WATER, Fluids.FLOWING_WATER); + protected void addTags(final HolderLookup.Provider registries) { + this.tag(FluidTags.WATER).add(FluidIds.WATER, FluidIds.FLOWING_WATER); diff --git a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch index 15b9d25987..dbd35d4100 100644 --- a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -59,6 +_,10 @@ - super(p_256060_, Registries.GAME_EVENT, p_255621_); +@@ -60,6 +_,10 @@ + super(output, Registries.GAME_EVENT, lookupProvider); } -+ public GameEventTagsProvider(PackOutput p_256060_, CompletableFuture p_255621_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256060_, Registries.GAME_EVENT, p_255621_, modId, existingFileHelper); ++ public GameEventTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.GAME_EVENT, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_255981_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(GameEventTags.VIBRATIONS).addAll(VIBRATIONS_EXCEPT_FLAP).addAll(VibrationSystem.RESONANCE_EVENTS).add(GameEvent.FLAP.key()); diff --git a/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch index baa6448005..4fd058537b 100644 --- a/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/InstrumentTagsProvider.java +++ b/net/minecraft/data/tags/InstrumentTagsProvider.java @@ -13,6 +_,10 @@ - super(p_256418_, Registries.INSTRUMENT, p_256038_); + super(output, Registries.INSTRUMENT, lookupProvider); } -+ public InstrumentTagsProvider(PackOutput p_256418_, CompletableFuture p_256038_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256418_, Registries.INSTRUMENT, p_256038_, modId, existingFileHelper); ++ public InstrumentTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.INSTRUMENT, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_256291_) { + protected void addTags(final HolderLookup.Provider registries) { this.tag(InstrumentTags.REGULAR_GOAT_HORNS) diff --git a/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch deleted file mode 100644 index 5623dd4ab8..0000000000 --- a/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java -+++ b/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java -@@ -12,14 +_,26 @@ - public abstract class IntrinsicHolderTagsProvider extends TagsProvider { - private final Function> keyExtractor; - -+ public IntrinsicHolderTagsProvider(PackOutput p_256164_, ResourceKey> p_256155_, CompletableFuture p_256488_, Function> p_256168_) { -+ super(p_256164_, p_256155_, p_256488_); -+ this.keyExtractor = p_256168_; -+ } -+ - public IntrinsicHolderTagsProvider( - PackOutput p_256164_, - ResourceKey> p_256155_, - CompletableFuture p_256488_, -- Function> p_256168_ -+ Function> p_256168_, -+ String modid, -+ @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper - ) { -- super(p_256164_, p_256155_, p_256488_); -+ super(p_256164_, p_256155_, p_256488_, modid, existingFileHelper); - this.keyExtractor = p_256168_; -+ } -+ -+ public IntrinsicHolderTagsProvider(PackOutput p_275304_, ResourceKey> p_275709_, CompletableFuture p_275227_, CompletableFuture> p_275311_, Function> p_275566_) { -+ super(p_275304_, p_275709_, p_275227_, p_275311_); -+ this.keyExtractor = p_275566_; - } - - public IntrinsicHolderTagsProvider( -@@ -27,14 +_,16 @@ - ResourceKey> p_275709_, - CompletableFuture p_275227_, - CompletableFuture> p_275311_, -- Function> p_275566_ -+ Function> p_275566_, -+ String modid, -+ @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper - ) { -- super(p_275304_, p_275709_, p_275227_, p_275311_); -+ super(p_275304_, p_275709_, p_275227_, p_275311_, modid, existingFileHelper); - this.keyExtractor = p_275566_; - } - - protected TagAppender tag(TagKey p_255793_) { - TagBuilder tagbuilder = this.getOrCreateRawBuilder(p_255793_); -- return TagAppender.forBuilder(tagbuilder).map(this.keyExtractor); -+ return TagAppender.forBuilder(tagbuilder, this.modId).map(this.keyExtractor); - } - } diff --git a/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch deleted file mode 100644 index b2e9e34276..0000000000 --- a/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/data/tags/KeyTagProvider.java -+++ b/net/minecraft/data/tags/KeyTagProvider.java -@@ -13,8 +_,12 @@ - super(p_407442_, p_405854_, p_409645_); - } - -+ protected KeyTagProvider(PackOutput p_407442_, ResourceKey> p_405854_, CompletableFuture p_409645_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_407442_, p_405854_, p_409645_, modId, existingFileHelper); -+ } -+ - protected TagAppender, T> tag(TagKey p_406138_) { - TagBuilder tagbuilder = this.getOrCreateRawBuilder(p_406138_); -- return TagAppender.forBuilder(tagbuilder); -+ return TagAppender.forBuilder(tagbuilder, this.modId); - } - } diff --git a/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch index abbaf8405c..f7a73aa2b4 100644 --- a/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch @@ -3,14 +3,14 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.entity.decoration.painting.PaintingVariants; - public class PaintingVariantTagsProvider extends KeyTagProvider { + public class PaintingVariantTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #PaintingVariantTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ - public PaintingVariantTagsProvider(PackOutput p_255750_, CompletableFuture p_256184_) { - super(p_255750_, Registries.PAINTING_VARIANT, p_256184_); + public PaintingVariantTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { + super(output, Registries.PAINTING_VARIANT, lookupProvider); + } + -+ public PaintingVariantTagsProvider(PackOutput p_255750_, CompletableFuture p_256184_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_255750_, Registries.PAINTING_VARIANT, p_256184_, modId, existingFileHelper); ++ public PaintingVariantTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.PAINTING_VARIANT, lookupProvider, modId, existingFileHelper); } @Override diff --git a/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch index 245388cfb8..3549bd0cd1 100644 --- a/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch @@ -3,14 +3,14 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.entity.ai.village.poi.PoiTypes; - public class PoiTypeTagsProvider extends KeyTagProvider { + public class PoiTypeTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #PoiTypeTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ - public PoiTypeTagsProvider(PackOutput p_256012_, CompletableFuture p_256617_) { - super(p_256012_, Registries.POINT_OF_INTEREST_TYPE, p_256617_); + public PoiTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { + super(output, Registries.POINT_OF_INTEREST_TYPE, lookupProvider); + } + -+ public PoiTypeTagsProvider(PackOutput p_256012_, CompletableFuture p_256617_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256012_, Registries.POINT_OF_INTEREST_TYPE, p_256617_, modId, existingFileHelper); ++ public PoiTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.POINT_OF_INTEREST_TYPE, lookupProvider, modId, existingFileHelper); } @Override diff --git a/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch index 4a129a98d2..e2f5697e5e 100644 --- a/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch @@ -3,14 +3,14 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.level.levelgen.structure.Structure; - public class StructureTagsProvider extends KeyTagProvider { + public class StructureTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #StructureTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ - public StructureTagsProvider(PackOutput p_256522_, CompletableFuture p_256661_) { - super(p_256522_, Registries.STRUCTURE, p_256661_); + public StructureTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { + super(output, Registries.STRUCTURE, lookupProvider); + } + -+ public StructureTagsProvider(PackOutput p_256522_, CompletableFuture p_256661_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256522_, Registries.STRUCTURE, p_256661_, modId, existingFileHelper); ++ public StructureTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.STRUCTURE, lookupProvider, modId, existingFileHelper); } @Override diff --git a/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch b/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch index 72a2c1aa43..f30cfc6529 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch @@ -1,67 +1,39 @@ --- a/net/minecraft/data/tags/TagAppender.java +++ b/net/minecraft/data/tags/TagAppender.java -@@ -8,7 +_,7 @@ +@@ -7,7 +_,7 @@ import net.minecraft.tags.TagBuilder; import net.minecraft.tags.TagKey; --public interface TagAppender { -+public interface TagAppender extends net.minecraftforge.common.extensions.IForgeTagAppender { - TagAppender add(E p_406816_); +-public interface TagAppender { ++public interface TagAppender extends net.minecraftforge.common.extensions.IForgeTagAppender { + TagAppender add(ResourceKey element); - default TagAppender add(E... p_406204_) { -@@ -32,6 +_,10 @@ - TagAppender addOptionalTag(TagKey p_406169_); + default TagAppender add(final ResourceKey... elements) { +@@ -31,6 +_,10 @@ + TagAppender addOptionalTag(TagKey tag); - static TagAppender, T> forBuilder(final TagBuilder p_407840_) { -+ return forBuilder(p_407840_, "unknown"); + static TagAppender forBuilder(final TagBuilder builder) { ++ return forBuilder(builder, "unknown"); + } + -+ static TagAppender, T> forBuilder(final TagBuilder p_407840_, String source) { - return new TagAppender, T>() { - public TagAppender, T> add(ResourceKey p_406023_) { - p_407840_.addElement(p_406023_.identifier()); -@@ -54,6 +_,21 @@ - p_407840_.addOptionalTag(p_407223_.location()); ++ static TagAppender forBuilder(final TagBuilder builder, String source) { + return new TagAppender() { + @Override + public TagAppender add(final ResourceKey element) { +@@ -54,6 +_,16 @@ + public TagAppender addOptionalTag(final TagKey tag) { + builder.addOptionalTag(tag.location()); return this; - } ++ } + + @Override + public TagBuilder getInternalBuilder() { -+ return p_407840_; ++ return builder; + } + + @Override + public String getSourceName() { + return source; -+ } -+ -+ @Override -+ public TagAppender, T> remove(ResourceKey value) { -+ return this.remove(value.identifier()); -+ } - }; - } - -@@ -81,6 +_,22 @@ - @Override - public TagAppender addOptionalTag(TagKey p_409695_) { - tagappender.addOptionalTag(p_409695_); -+ return this; -+ } -+ -+ @Override -+ public TagBuilder getInternalBuilder() { -+ return tagappender.getInternalBuilder(); -+ } -+ -+ @Override -+ public String getSourceName() { -+ return tagappender.getSourceName(); -+ } -+ -+ @Override -+ public TagAppender remove(U value) { -+ tagappender.remove(p_409081_.apply(value)); - return this; } }; + } diff --git a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch index 15e744b943..61dd38debc 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/TagsProvider.java +++ b/net/minecraft/data/tags/TagsProvider.java -@@ -32,26 +_,57 @@ +@@ -31,28 +_,53 @@ private final CompletableFuture> parentProvider; protected final ResourceKey> registryKey; protected final Map builders = Maps.newLinkedHashMap(); @@ -10,42 +10,38 @@ + private final net.minecraftforge.common.data.ExistingFileHelper.IResourceType resourceType; + private final net.minecraftforge.common.data.ExistingFileHelper.IResourceType elementResourceType; // FORGE: Resource type for validating required references to datapack registry elements. -+ /** -+ * @deprecated Forge: Use the {@linkplain #TagsProvider(PackOutput, ResourceKey, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} -+ */ - protected TagsProvider(PackOutput p_256596_, ResourceKey> p_255886_, CompletableFuture p_256513_) { -- this(p_256596_, p_255886_, p_256513_, CompletableFuture.completedFuture(TagsProvider.TagLookup.empty())); -+ this(p_256596_, p_255886_, p_256513_, "vanilla", null); + protected TagsProvider( + final PackOutput output, final ResourceKey> registryKey, final CompletableFuture lookupProvider + ) { +- this(output, registryKey, lookupProvider, CompletableFuture.completedFuture(TagsProvider.TagLookup.empty())); ++ this(output, registryKey, lookupProvider, "vanilla", null); + } + -+ protected TagsProvider(PackOutput p_256596_, ResourceKey> p_255886_, CompletableFuture p_256513_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ this(p_256596_, p_255886_, p_256513_, CompletableFuture.completedFuture(TagsProvider.TagLookup.empty()), modId, existingFileHelper); ++ protected TagsProvider(final PackOutput output, final ResourceKey> registryKey, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ this(output, registryKey, lookupProvider, CompletableFuture.completedFuture(TagsProvider.TagLookup.empty()), modId, existingFileHelper); + } + -+ /** -+ * @deprecated Forge: Use the {@linkplain #TagsProvider(PackOutput, ResourceKey, CompletableFuture, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} -+ */ -+ protected TagsProvider(PackOutput p_275432_, ResourceKey> p_275476_, CompletableFuture p_275222_, CompletableFuture> p_275565_) { -+ this(p_275432_, p_275476_, p_275222_, p_275565_, "vanilla", null); ++ protected TagsProvider(PackOutput output, ResourceKey> registryKey, CompletableFuture lookupProvider, CompletableFuture> parentProvider) { ++ this(output, registryKey, lookupProvider, parentProvider, "vanilla", null); } protected TagsProvider( - PackOutput p_275432_, - ResourceKey> p_275476_, - CompletableFuture p_275222_, -- CompletableFuture> p_275565_ -+ CompletableFuture> p_275565_, -+ String modId, -+ @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper + final PackOutput output, + final ResourceKey> registryKey, + final CompletableFuture lookupProvider, +- final CompletableFuture> parentProvider ++ final CompletableFuture> parentProvider, ++ final String modId, ++ final @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper ) { - this.pathProvider = p_275432_.createRegistryTagsPathProvider(p_275476_); - this.registryKey = p_275476_; - this.parentProvider = p_275565_; - this.lookupProvider = p_275222_; + this.pathProvider = output.createRegistryTagsPathProvider(registryKey); + this.registryKey = registryKey; + this.parentProvider = parentProvider; + this.lookupProvider = lookupProvider; + this.modId = modId; + this.existingFileHelper = existingFileHelper; -+ this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.tagsDirPath(p_275476_)); -+ this.elementResourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.elementsDirPath(p_275476_)); ++ this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.tagsDirPath(registryKey)); ++ this.elementResourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.elementsDirPath(registryKey)); + } + + // Forge: Allow customizing the path for a given tag or returning null @@ -60,65 +56,63 @@ + return "Tags for " + this.registryKey.identifier() + " mod id " + this.modId; } - protected abstract void addTags(HolderLookup.Provider p_256380_); -@@ -69,7 +_,13 @@ - .thenCombineAsync(this.parentProvider, (p_274778_, p_274779_) -> new CombinedData<>(p_274778_, (TagsProvider.TagLookup)p_274779_), Util.backgroundExecutor()) + protected abstract void addTags(HolderLookup.Provider registries); +@@ -70,7 +_,13 @@ + .thenCombineAsync(this.parentProvider, (x$0, x$1) -> new CombinedData<>(x$0, (TagsProvider.TagLookup)x$1), Util.backgroundExecutor()) .thenCompose( - p_325926_ -> { -- HolderLookup.RegistryLookup registrylookup = p_325926_.contents.lookupOrThrow(this.registryKey); -+ HolderLookup.RegistryLookup registrylookup = p_325926_.contents.lookup(this.registryKey).orElseThrow(() -> { + c -> { +- HolderLookup.RegistryLookup lookup = c.contents.lookupOrThrow(this.registryKey); ++ HolderLookup.RegistryLookup lookup = c.contents.lookup(this.registryKey).orElseThrow(() -> { + // FORGE: Throw a more descriptive error message if this is a Forge registry without tags enabled + if (net.minecraftforge.registries.RegistryManager.ACTIVE.getRegistry(this.registryKey) != null) { + return new IllegalStateException("Forge registry " + this.registryKey.identifier() + " does not have support for tags"); + } + return new IllegalStateException("Registry " + this.registryKey.identifier() + " not found"); + }); - Predicate predicate = p_448741_ -> registrylookup.get(ResourceKey.create(this.registryKey, p_448741_)).isPresent(); - Predicate predicate1 = p_448739_ -> this.builders.containsKey(p_448739_) - || p_325926_.parent.contains(TagKey.create(this.registryKey, p_448739_)); + Predicate elementCheck = id -> lookup.get(ResourceKey.create(this.registryKey, id)).isPresent(); + Predicate tagCheck = id -> this.builders.containsKey(id) || c.parent.contains(TagKey.create(this.registryKey, id)); + return CompletableFuture.allOf( @@ -82,7 +_,7 @@ - Identifier identifier = p_325931_.getKey(); - TagBuilder tagbuilder = p_325931_.getValue(); - List list = tagbuilder.build(); -- List list1 = list.stream().filter(p_274771_ -> !p_274771_.verifyIfPresent(predicate, predicate1)).toList(); -+ List list1 = java.util.stream.Stream.concat(list.stream(), tagbuilder.getRemoveEntries()).filter(p_274771_ -> !p_274771_.verifyIfPresent(predicate, predicate1)).filter(this::missing).toList(); - if (!list1.isEmpty()) { + Identifier id = entry.getKey(); + TagBuilder builder = entry.getValue(); + List entries = builder.build(); +- List unresolvedEntries = entries.stream().filter(e -> !e.verifyIfPresent(elementCheck, tagCheck)).toList(); ++ List unresolvedEntries = java.util.stream.Stream.concat(entries.stream(), builder.getRemoveEntries()).filter(e -> !e.verifyIfPresent(elementCheck, tagCheck)).filter(this::missing).toList(); + if (!unresolvedEntries.isEmpty()) { throw new IllegalArgumentException( String.format( -@@ -93,8 +_,11 @@ - ) +@@ -94,8 +_,11 @@ ); - } else { -- Path path = this.pathProvider.json(identifier); -- return DataProvider.saveStable(p_253684_, p_325926_.contents, TagFile.CODEC, new TagFile(list, false), path); -+ Path path = this.getPath(identifier); -+ if (path == null) { -+ return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. -+ } -+ return DataProvider.saveStable(p_253684_, p_325926_.contents, TagFile.CODEC, new TagFile(list, tagbuilder.isReplace(), tagbuilder.getRemoveEntries().toList()), path); } + +- Path path = this.pathProvider.json(id); +- return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace()), path); ++ Path path = this.getPath(id); ++ if (path == null) { ++ return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. ++ } ++ return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace(), builder.getRemoveEntries().toList()), path); } ) + .toArray(CompletableFuture[]::new) @@ -105,7 +_,12 @@ } - protected TagBuilder getOrCreateRawBuilder(TagKey p_236452_) { -- return this.builders.computeIfAbsent(p_236452_.location(), p_460082_ -> TagBuilder.create()); -+ return this.builders.computeIfAbsent(p_236452_.location(), p_460082_ -> { + protected TagBuilder getOrCreateRawBuilder(final TagKey tag) { +- return this.builders.computeIfAbsent(tag.location(), k -> TagBuilder.create()); ++ return this.builders.computeIfAbsent(tag.location(), k -> { + if (existingFileHelper != null) { -+ existingFileHelper.trackGenerated(p_460082_, resourceType); ++ existingFileHelper.trackGenerated(k, resourceType); + } + return TagBuilder.create(); + }); } public CompletableFuture> contentsGetter() { -@@ -118,6 +_,15 @@ - this.addTags(p_274768_); - return (HolderLookup.Provider)p_274768_; +@@ -120,15 +_,24 @@ }); -+ } -+ + } + + + private boolean missing(TagEntry reference) { + // Optional tags should not be validated @@ -126,6 +120,19 @@ + return existingFileHelper == null || !existingFileHelper.exists(reference.getId(), reference.isTag() ? resourceType : elementResourceType); + } + return false; ++ } ++ + protected TagAppender tag(final TagKey tag) { + TagBuilder builder = this.getOrCreateRawBuilder(tag); +- return TagAppender.forBuilder(builder); ++ return TagAppender.forBuilder(builder, this.modId); + } + + protected TagAppender tag(final TagKey tag, final boolean replace) { + TagBuilder builder = this.getOrCreateRawBuilder(tag); + builder.setReplace(replace); +- return TagAppender.forBuilder(builder); ++ return TagAppender.forBuilder(builder, this.modId); } @FunctionalInterface diff --git a/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch index 52eec03c99..4e69799faf 100644 --- a/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/VanillaBlockTagsProvider.java +++ b/net/minecraft/data/tags/VanillaBlockTagsProvider.java -@@ -16,6 +_,10 @@ - super(p_256406_, Registries.BLOCK, p_256525_, p_255627_ -> p_255627_.builtInRegistryHolder().key()); +@@ -29,6 +_,10 @@ + }; } -+ public VanillaBlockTagsProvider(PackOutput p_256406_, CompletableFuture p_256525_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256406_, Registries.BLOCK, p_256525_, p_255627_ -> p_255627_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ public VanillaBlockTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.BLOCK, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_255662_) { - (new BlockItemTagsProvider() { + protected void addTags(final HolderLookup.Provider registries) { + new VanillaBlockItemTagsProvider(tagId -> BlockItemTagsProvider.wrapForBlocks(this.tag(tagId.block()))).run(); diff --git a/patches/minecraft/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java.patch index 2cb9a2cea5..ba3d524640 100644 --- a/patches/minecraft/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java +++ b/net/minecraft/data/tags/VanillaEnchantmentTagsProvider.java @@ -11,6 +_,10 @@ - super(p_335915_, p_330302_); + super(output, lookupProvider); } -+ public VanillaEnchantmentTagsProvider(PackOutput p_335915_, CompletableFuture p_330302_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_335915_, p_330302_, modId, existingFileHelper); ++ public VanillaEnchantmentTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_331944_) { + protected void addTags(final HolderLookup.Provider registries) { this.tooltipOrder( diff --git a/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch index e3bc094676..cb163841a1 100644 --- a/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch @@ -1,26 +1,13 @@ --- a/net/minecraft/data/tags/VanillaItemTagsProvider.java +++ b/net/minecraft/data/tags/VanillaItemTagsProvider.java -@@ -19,6 +_,10 @@ - super(p_275657_, Registries.ITEM, p_275712_, p_405065_ -> p_405065_.builtInRegistryHolder().key()); +@@ -28,6 +_,10 @@ + }; } -+ public VanillaItemTagsProvider(PackOutput p_275657_, CompletableFuture p_275712_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_275657_, Registries.ITEM, p_275712_, p_405065_ -> p_405065_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ public VanillaItemTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.ITEM, lookupProvider, modId, existingFileHelper); + } + @Override - protected void addTags(HolderLookup.Provider p_255639_) { - (new BlockItemTagsProvider() { -@@ -485,6 +_,12 @@ - @Override - public TagAppender addOptionalTag(TagKey p_407315_) { - this.itemAppender.addOptionalTag(blockTagToItemTag(p_407315_)); -+ return this; -+ } -+ -+ @Override -+ public TagAppender remove(Block value) { -+ this.itemAppender.remove(Objects.requireNonNull(value.asItem())); - return this; - } - } + protected void addTags(final HolderLookup.Provider registries) { + new VanillaBlockItemTagsProvider(tagId -> BlockItemTagsProvider.wrapForItems(this.tag(tagId.item()))).run(); diff --git a/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch index dbeabd9e77..77ece4160d 100644 --- a/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch @@ -1,17 +1,13 @@ --- a/net/minecraft/data/tags/WorldPresetTagsProvider.java +++ b/net/minecraft/data/tags/WorldPresetTagsProvider.java -@@ -9,8 +_,14 @@ - import net.minecraft.world.level.levelgen.presets.WorldPresets; - - public class WorldPresetTagsProvider extends KeyTagProvider { -+ /** @deprecated Forge: Use the {@linkplain #WorldPresetTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ -+ @Deprecated - public WorldPresetTagsProvider(PackOutput p_255701_, CompletableFuture p_255974_) { - super(p_255701_, Registries.WORLD_PRESET, p_255974_); -+ } -+ -+ public WorldPresetTagsProvider(PackOutput p_255701_, CompletableFuture p_255974_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_255701_, Registries.WORLD_PRESET, p_255974_, modId, existingFileHelper); +@@ -13,6 +_,10 @@ + super(output, Registries.WORLD_PRESET, lookupProvider); } ++ public WorldPresetTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(output, Registries.WORLD_PRESET, lookupProvider, modId, existingFileHelper); ++ } ++ @Override + protected void addTags(final HolderLookup.Provider registries) { + this.tag(WorldPresetTags.NORMAL) diff --git a/patches/minecraft/net/minecraft/data/worldgen/BootstrapContext.java.patch b/patches/minecraft/net/minecraft/data/worldgen/BootstrapContext.java.patch index 5778f97604..cb40e626e5 100644 --- a/patches/minecraft/net/minecraft/data/worldgen/BootstrapContext.java.patch +++ b/patches/minecraft/net/minecraft/data/worldgen/BootstrapContext.java.patch @@ -3,7 +3,7 @@ @@ -14,4 +_,6 @@ } - HolderGetter lookup(ResourceKey> p_332059_); + HolderGetter lookup(ResourceKey> key); + + default java.util.Optional> registryLookup(ResourceKey> registry) { return java.util.Optional.empty(); } } diff --git a/patches/minecraft/net/minecraft/gametest/Main.java.patch b/patches/minecraft/net/minecraft/gametest/Main.java.patch index 9be32b9872..1adb72fc56 100644 --- a/patches/minecraft/net/minecraft/gametest/Main.java.patch +++ b/patches/minecraft/net/minecraft/gametest/Main.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/gametest/Main.java +++ b/net/minecraft/gametest/Main.java -@@ -7,6 +_,8 @@ +@@ -5,6 +_,8 @@ + public class Main { - @DontObfuscate - public static void main(String[] p_393417_) throws Exception { + public static void main(final String[] args) throws Exception { + System.setProperty("forge.enableGameTest", "true"); + System.setProperty("forge.gameTestServer", "true"); SharedConstants.tryDetectVersion(); - GameTestMainUtil.runGameTestServer(p_393417_, p_393535_ -> {}); + GameTestMainUtil.runGameTestServer(args, path -> {}); } diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch index 10b68733c4..a77a2f311d 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/gametest/framework/GameTestHelper.java +++ b/net/minecraft/gametest/framework/GameTestHelper.java -@@ -68,7 +_,7 @@ +@@ -77,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.jspecify.annotations.Nullable; @@ -9,7 +9,7 @@ private final GameTestInfo testInfo; private boolean finalCheckAdded; -@@ -1008,6 +_,12 @@ +@@ -1109,6 +_,12 @@ return this.testInfo.getTick(); } @@ -22,8 +22,8 @@ public AABB getBounds() { return this.testInfo.getStructureBounds(); } -@@ -1050,5 +_,25 @@ - if (either.right().isPresent()) { +@@ -1153,6 +_,26 @@ + if (result.right().isPresent()) { throw this.assertionException("test.error.set_biome"); } + } @@ -47,4 +47,5 @@ + @Override public void testAddedForRerun(GameTestInfo oldInfo, GameTestInfo newInfo, GameTestRunner runner) { } + }); } - } + + private static Component getItemName(final Item itemType) { diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestMainUtil.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestMainUtil.java.patch index 0fa6f4ca50..e8a168dfc6 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestMainUtil.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestMainUtil.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/gametest/framework/GameTestMainUtil.java +++ b/net/minecraft/gametest/framework/GameTestMainUtil.java -@@ -67,6 +_,7 @@ +@@ -75,6 +_,7 @@ Bootstrap.bootStrap(); Util.startTimerHackThread(); + net.minecraftforge.server.loading.ServerModLoader.load(); - String s = optionset.valueOf(universe); - createOrResetDir(s); - p_393652_.accept(s); + String universePath = options.valueOf(universe); + createOrResetDir(universePath); + onUniverseCreated.accept(universePath); diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch index 54307c3b96..76fcf278cc 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java -@@ -93,7 +_,7 @@ - Thread p_206607_, LevelStorageSource.LevelStorageAccess p_206608_, PackRepository p_206609_, Optional p_392741_, boolean p_392375_ +@@ -101,7 +_,7 @@ + final int repeatCount ) { - p_206609_.reload(); -- ArrayList arraylist = new ArrayList<>(p_206609_.getAvailableIds()); -+ ArrayList arraylist = new ArrayList<>(p_206609_.getSelectedIds()); // Forge: Use the selected datapacks as this takes sorting into account. - arraylist.remove("vanilla"); - arraylist.addFirst("vanilla"); - WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(new DataPackConfig(arraylist, List.of()), ENABLED_FEATURES); -@@ -155,6 +_,7 @@ + packRepository.reload(); +- ArrayList enabledPacks = new ArrayList<>(packRepository.getAvailableIds()); ++ ArrayList enabledPacks = new ArrayList<>(packRepository.getSelectedIds()); // Forge: Use the selected datapacks as this takes sorting into account. + enabledPacks.remove("vanilla"); + enabledPacks.addFirst("vanilla"); + WorldDataConfiguration defaultTestConfig = new WorldDataConfiguration(new DataPackConfig(enabledPacks, List.of()), ENABLED_FEATURES); +@@ -174,6 +_,7 @@ @Override - public boolean initServer() { + protected boolean initServer() { + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, new EmptyNotificationService()) {}); Gizmos.withCollector(GizmoCollector.NOOP); diff --git a/patches/minecraft/net/minecraft/gametest/framework/TestCommand.java.patch b/patches/minecraft/net/minecraft/gametest/framework/TestCommand.java.patch index a5926fcf51..5dae5ebe99 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/TestCommand.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/TestCommand.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/gametest/framework/TestCommand.java +++ b/net/minecraft/gametest/framework/TestCommand.java -@@ -487,7 +_,12 @@ +@@ -481,7 +_,12 @@ return Optional.empty(); } else { - Holder.Reference reference = optional.get(); -- GameTestInfo gametestinfo = new GameTestInfo(reference, testinstanceblockentity.getRotation(), serverlevel, p_330368_); + Holder.Reference test = maybeTest.get(); +- GameTestInfo testInfo = new GameTestInfo(test, blockEntity.getRotation(), level, retryOptions); + // Forge: The rotation is stored in the structure block, and added in the GameTestInfo constructor. + // So reverse it to find the manually specified rotation so the test runs the same every time. -+ var rotation = testinstanceblockentity.test().flatMap(testinstanceblockentity.getLevel().registryAccess()::get).map(Holder::value).map(GameTestInstance::rotation).orElse(Rotation.NONE); -+ var steps = StructureUtils.getRotationStepsForRotation(testinstanceblockentity.getRotation()) - StructureUtils.getRotationStepsForRotation(rotation); ++ var rotation = blockEntity.test().flatMap(blockEntity.getLevel().registryAccess()::get).map(Holder::value).map(GameTestInstance::rotation).orElse(Rotation.NONE); ++ var steps = StructureUtils.getRotationStepsForRotation(blockEntity.getRotation()) - StructureUtils.getRotationStepsForRotation(rotation); + if (steps < 0) steps += 4; -+ GameTestInfo gametestinfo = new GameTestInfo(reference, StructureUtils.getRotationForRotationSteps(steps), serverlevel, p_330368_); - gametestinfo.setTestBlockPos(p_332856_); - return !verifyStructureExists(p_393532_, gametestinfo.getStructure()) ? Optional.empty() : Optional.of(gametestinfo); ++ GameTestInfo testInfo = new GameTestInfo(test, StructureUtils.getRotationForRotationSteps(steps), level, retryOptions); + testInfo.setTestBlockPos(testBlockPos); + return !verifyStructureExists(source, testInfo.getStructure()) ? Optional.empty() : Optional.of(testInfo); } diff --git a/patches/minecraft/net/minecraft/locale/Language.java.patch b/patches/minecraft/net/minecraft/locale/Language.java.patch index 42f4d908da..ed7306a5e9 100644 --- a/patches/minecraft/net/minecraft/locale/Language.java.patch +++ b/patches/minecraft/net/minecraft/locale/Language.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java @@ -38,7 +_,8 @@ - BiConsumer biconsumer = map::put; - parseTranslations(biconsumer, "/assets/minecraft/lang/en_us.json"); - deprecatedtranslationsinfo.applyToMap(map); -- final Map map1 = Map.copyOf(map); -+ net.minecraftforge.server.LanguageHook.captureLanguageMap(map); -+ final Map map1 = map; + BiConsumer output = loadedData::put; + parseTranslations(output, "/assets/minecraft/lang/en_us.json"); + deprecatedInfo.applyToMap(loadedData); +- final Map storage = Map.copyOf(loadedData); ++ net.minecraftforge.server.LanguageHook.captureLanguageMap(loadedData); ++ final Map storage = loadedData; return new Language() { @Override - public String getOrDefault(String p_128127_, String p_265421_) { + public String getOrDefault(final String elementId, final String defaultValue) { @@ -63,6 +_,11 @@ ) .isPresent(); @@ -17,17 +17,19 @@ + + @Override + public Map getLanguageData() { -+ return map; ++ return loadedData; + } }; } -@@ -90,6 +_,8 @@ - public static void inject(Language p_128115_) { - instance = p_128115_; +@@ -89,7 +_,10 @@ + + public static void inject(final Language language) { + instance = language; ++ net.minecraftforge.common.ForgeI18n.loadLanguageData(language.getLanguageData()); } + + public Map getLanguageData() { return Map.of(); } - public String getOrDefault(String p_128111_) { - return this.getOrDefault(p_128111_, p_128111_); + public String getOrDefault(final String elementId) { + return this.getOrDefault(elementId, elementId); diff --git a/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch index 793bd4889b..f6f693b2ef 100644 --- a/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch @@ -10,4 +10,4 @@ + public static final Codec CODEC = Codec.PASSTHROUGH .comapFlatMap( - p_308555_ -> { + t -> { diff --git a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch index cfa08db5a7..ee3ca5ffca 100644 --- a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch +++ b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch @@ -9,16 +9,16 @@ private final byte[] encodeBuf = new byte[8192]; private final Deflater deflater; private int threshold; -@@ -24,6 +_,12 @@ - VarInt.write(p_129454_, 0); - p_129454_.writeBytes(p_129453_); - } else { -+ if (!DISABLE_PACKET_DEBUG && i > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { -+ p_129453_.markReaderIndex(); -+ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", i, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, -+ net.minecraftforge.common.util.HexDumper.dump(p_129453_)); -+ p_129453_.resetReaderIndex(); -+ } - byte[] abyte = new byte[i]; - p_129453_.readBytes(abyte); - VarInt.write(p_129454_, abyte.length); +@@ -25,6 +_,12 @@ + VarInt.write(out, 0); + out.writeBytes(uncompressed); + } else { ++ if (!DISABLE_PACKET_DEBUG && uncompressedLength > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { ++ uncompressed.markReaderIndex(); ++ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", uncompressedLength, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, ++ net.minecraftforge.common.util.HexDumper.dump(uncompressed)); ++ uncompressed.resetReaderIndex(); ++ } + byte[] input = new byte[uncompressedLength]; + uncompressed.readBytes(input); + VarInt.write(out, input.length); diff --git a/patches/minecraft/net/minecraft/network/Connection.java.patch b/patches/minecraft/net/minecraft/network/Connection.java.patch index 32fd674912..2567ce0d12 100644 --- a/patches/minecraft/net/minecraft/network/Connection.java.patch +++ b/patches/minecraft/net/minecraft/network/Connection.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java @@ -81,9 +_,17 @@ - private boolean handlingFault; private volatile @Nullable DisconnectionDetails delayedDisconnect; - @Nullable BandwidthDebugMonitor bandwidthDebugMonitor; + private @Nullable BandwidthDebugMonitor bandwidthDebugMonitor; + private @Nullable UUID intendedProfileId; + private java.util.function.Consumer activationHandler; + private final net.minecraftforge.common.util.PacketLogger packetLogger = new net.minecraftforge.common.util.PacketLogger(this); + private ProtocolInfo outboundProtocol = null; + private ProtocolInfo inboundProtocol = null; - public Connection(PacketFlow p_129482_) { - this.receiving = p_129482_; + public Connection(final PacketFlow receiving) { + this.receiving = receiving; + if (this.receiving == PacketFlow.SERVERBOUND) + this.inboundProtocol = INITIAL_PROTOCOL; + else @@ -19,93 +19,93 @@ @Override @@ -91,6 +_,7 @@ - super.channelActive(p_129525_); - this.channel = p_129525_.channel(); + super.channelActive(ctx); + this.channel = ctx.channel(); this.address = this.channel.remoteAddress(); + if (activationHandler != null) activationHandler.accept(this); if (this.delayedDisconnect != null) { this.disconnect(this.delayedDisconnect); } -@@ -151,6 +_,7 @@ - } else { - if (packetlistener.shouldHandleMessage(p_129488_)) { - try { -+ packetLogger.recv(p_129488_); - genericsFtw(p_129488_, packetlistener); - } catch (RunningOnDifferentThreadException runningondifferentthreadexception) { - } catch (RejectedExecutionException rejectedexecutionexception) { -@@ -200,6 +_,7 @@ - if (p_333271_.flow() != this.getReceiving()) { - throw new IllegalStateException("Invalid inbound protocol: " + p_333271_.id()); - } else { -+ this.inboundProtocol = p_333271_; - this.packetListener = p_330962_; - this.disconnectListener = null; - UnconfiguredPipelineHandler.InboundConfigurationTask unconfiguredpipelinehandler$inboundconfigurationtask = UnconfiguredPipelineHandler.setupInboundProtocol( -@@ -223,6 +_,8 @@ - } else { - UnconfiguredPipelineHandler.OutboundConfigurationTask unconfiguredpipelinehandler$outboundconfigurationtask = UnconfiguredPipelineHandler.setupOutboundProtocol( - p_329145_ -+ ).andThen( -+ f -> this.outboundProtocol = p_329145_ - ); - BundlerInfo bundlerinfo = p_329145_.bundlerInfo(); - if (bundlerinfo != null) { -@@ -272,7 +_,8 @@ - this.disconnectListener = p_330656_; - this.runOnceConnected(p_405096_ -> { - this.setupInboundProtocol(p_329827_, p_330656_); -- p_405096_.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), p_300730_, p_300598_, p_297789_), null, true); -+ // TODO: Change this to be a immediately sent login custom payload packet? -+ p_405096_.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), net.minecraftforge.network.NetworkContext.enhanceHostName(p_300730_), p_300598_, p_297789_), null, true); - this.setupOutboundProtocol(p_328134_); - }); +@@ -152,6 +_,7 @@ + + if (packetListener.shouldHandleMessage(packet)) { + try { ++ packetLogger.recv(packet); + genericsFtw(packet, packetListener); + } catch (RunningOnDifferentThreadException var5) { + } catch (RejectedExecutionException ignored) { +@@ -201,6 +_,7 @@ + throw new IllegalStateException("Invalid inbound protocol: " + protocol.id()); } -@@ -317,10 +_,13 @@ - if (p_405953_ != null) { - ChannelFuture channelfuture = p_299937_ ? this.channel.writeAndFlush(p_243260_) : this.channel.write(p_243260_); - channelfuture.addListener(p_405953_); -+ channelfuture.addListener(f -> packetLogger.send(p_243260_)); - } else if (p_299937_) { - this.channel.writeAndFlush(p_243260_, this.channel.voidPromise()); -+ packetLogger.send(p_243260_); + ++ this.inboundProtocol = protocol; + this.packetListener = packetListener; + this.disconnectListener = null; + UnconfiguredPipelineHandler.InboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupInboundProtocol(protocol); +@@ -218,7 +_,7 @@ + throw new IllegalStateException("Invalid outbound protocol: " + protocol.id()); + } + +- UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol); ++ UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol).andThen(_ -> this.outboundProtocol = protocol); + BundlerInfo bundlerInfo = protocol.bundlerInfo(); + if (bundlerInfo != null) { + PacketBundleUnpacker newUnbundler = new PacketBundleUnpacker(bundlerInfo); +@@ -265,7 +_,8 @@ + this.disconnectListener = listener; + this.runOnceConnected(connection -> { + this.setupInboundProtocol(inbound, listener); +- connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), hostName, port, intent), null, true); ++ // TODO: Change this to be a immediately sent login custom payload packet? ++ connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), net.minecraftforge.network.NetworkContext.enhanceHostName(hostName), port, intent), null, true); + this.setupOutboundProtocol(outbound); + }); + } +@@ -309,10 +_,13 @@ + if (listener != null) { + ChannelFuture future = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); + future.addListener(listener); ++ future.addListener(f -> packetLogger.send(packet)); + } else if (flush) { + this.channel.writeAndFlush(packet, this.channel.voidPromise()); ++ packetLogger.send(packet); } else { - this.channel.write(p_243260_, this.channel.voidPromise()); -+ packetLogger.send(p_243260_); + this.channel.write(packet, this.channel.voidPromise()); ++ packetLogger.send(packet); } } -@@ -389,7 +_,7 @@ +@@ -381,7 +_,7 @@ if (this.address == null) { return "local"; } else { -- return p_298740_ ? this.address.toString() : "IP hidden"; -+ return p_298740_ ? net.minecraftforge.network.DualStackUtils.getAddressString(this.address) : "IP hidden"; +- return logIPs ? this.address.toString() : "IP hidden"; ++ return logIPs ? net.minecraftforge.network.DualStackUtils.getAddressString(this.address) : "IP hidden"; } } -@@ -432,7 +_,9 @@ +@@ -426,7 +_,9 @@ } - public static ChannelFuture connect(InetSocketAddress p_290034_, EventLoopGroupHolder p_450865_, final Connection p_290031_) { -- return new Bootstrap().group(p_450865_.eventLoopGroup()).handler(new ChannelInitializer() { -+ net.minecraftforge.network.DualStackUtils.checkIPv6(p_290034_.getAddress()); -+ p_290031_.activationHandler = net.minecraftforge.network.NetworkRegistry::onConnectionStart; -+ return new Bootstrap().group(p_450865_.eventLoopGroup(true)).handler(new ChannelInitializer() { + public static ChannelFuture connect(final InetSocketAddress address, final EventLoopGroupHolder eventLoopGroupHolder, final Connection connection) { +- return new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup()).handler(new ChannelInitializer() { ++ net.minecraftforge.network.DualStackUtils.checkIPv6(address.getAddress()); ++ connection.activationHandler = net.minecraftforge.network.NetworkRegistry::onConnectionStart; ++ return new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup(true)).handler(new ChannelInitializer() { @Override - protected void initChannel(Channel p_129552_) { + protected void initChannel(final Channel channel) { try { -@@ -493,7 +_,8 @@ +@@ -491,7 +_,8 @@ - public static Connection connectToLocalServer(SocketAddress p_129494_) { + public static Connection connectToLocalServer(final SocketAddress address) { final Connection connection = new Connection(PacketFlow.CLIENTBOUND); - new Bootstrap().group(EventLoopGroupHolder.local().eventLoopGroup()).handler(new ChannelInitializer() { + connection.activationHandler = net.minecraftforge.network.NetworkRegistry::onConnectionStart; + new Bootstrap().group(EventLoopGroupHolder.local().eventLoopGroup(true)).handler(new ChannelInitializer() { @Override - protected void initChannel(Channel p_332618_) { - ChannelPipeline channelpipeline = p_332618_.pipeline(); -@@ -584,6 +_,22 @@ + protected void initChannel(final Channel channel) { + ChannelPipeline pipeline = channel.pipeline(); +@@ -590,6 +_,22 @@ public float getAverageSentPackets() { return this.averageSentPackets; @@ -127,4 +127,4 @@ + return this.outboundProtocol; } - public void setBandwidthLogger(LocalSampleLogger p_333554_) { + public void setBandwidthLogger(final LocalSampleLogger bandwidthLogger) { diff --git a/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch b/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch index 936d1064ad..726ecc919e 100644 --- a/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch +++ b/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java -@@ -1637,4 +_,8 @@ - public boolean release(int p_130347_) { - return this.source.release(p_130347_); +@@ -1615,4 +_,8 @@ + public boolean release(final int decrement) { + return this.source.release(decrement); } + + public FriendlyByteBuf wrap(ByteBuf data) { diff --git a/patches/minecraft/net/minecraft/network/RegistryFriendlyByteBuf.java.patch b/patches/minecraft/net/minecraft/network/RegistryFriendlyByteBuf.java.patch index ea99a5b55f..68f9ff5ea9 100644 --- a/patches/minecraft/net/minecraft/network/RegistryFriendlyByteBuf.java.patch +++ b/patches/minecraft/net/minecraft/network/RegistryFriendlyByteBuf.java.patch @@ -9,6 +9,6 @@ + return new RegistryFriendlyByteBuf(data, this.registryAccess); + } + - public static Function decorator(RegistryAccess p_336066_) { - return p_328649_ -> new RegistryFriendlyByteBuf(p_328649_, p_336066_); + public static Function decorator(final RegistryAccess registryAccess) { + return buf -> new RegistryFriendlyByteBuf(buf, registryAccess); } diff --git a/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch b/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch index 1cc54d0150..8b24670454 100644 --- a/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch +++ b/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -137,6 +_,11 @@ - j = l; +@@ -135,6 +_,11 @@ + current = end; } -+ if (j == 0) { ++ if (current == 0) { + // Forge has some special formatting handlers defined in ForgeI18n, use those if no %s replacements present. -+ j = net.minecraftforge.internal.TextComponentMessageFormatHandler.handle(this, p_237517_, this.args, p_237516_); ++ current = net.minecraftforge.internal.TextComponentMessageFormatHandler.handle(this, decomposedParts, this.args, template); + } + - if (j < p_237516_.length()) { - String s3 = p_237516_.substring(j); - if (s3.indexOf(37) != -1) { + if (current < template.length()) { + String tail = template.substring(current); + if (tail.indexOf(37) != -1) { diff --git a/patches/minecraft/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch b/patches/minecraft/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch index 67b03aca63..25d2a2403d 100644 --- a/patches/minecraft/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java -@@ -17,12 +_,12 @@ +@@ -15,12 +_,12 @@ public record ClientboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet { private static final int MAX_PAYLOAD_SIZE = 1048576; public static final StreamCodec GAMEPLAY_STREAM_CODEC = CustomPacketPayload.codec( -- p_448776_ -> DiscardedPayload.codec(p_448776_, 1048576), -+ p_448776_ -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(p_448776_, 1048576), - Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_333496_ -> {}) +- id -> DiscardedPayload.codec(id, 1048576), ++ id -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(id, 1048576), + Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), types -> {}) ) .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); public static final StreamCodec CONFIG_STREAM_CODEC = CustomPacketPayload.codec( -- p_448777_ -> DiscardedPayload.codec(p_448777_, 1048576), -+ p_448777_ -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(p_448777_, 1048576), - List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)) +- id -> DiscardedPayload.codec(id, 1048576), List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)) ++ id -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(id, 1048576), List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)) ) .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); + diff --git a/patches/minecraft/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patches/minecraft/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch index d115bddb2e..2fe3bc9c45 100644 --- a/patches/minecraft/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java -@@ -15,7 +_,7 @@ +@@ -13,7 +_,7 @@ public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet { private static final int MAX_PAYLOAD_SIZE = 32767; public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec( -- p_448778_ -> DiscardedPayload.codec(p_448778_, 32767), -+ p_448778_ -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(p_448778_, 32767), - Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_334419_ -> {}) +- id -> DiscardedPayload.codec(id, 32767), ++ id -> net.minecraftforge.common.ForgeHooks.getCustomPayloadCodec(id, 32767), + Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), types -> {}) ) .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); diff --git a/patches/minecraft/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch b/patches/minecraft/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch index a32a900dec..96d0b9b6e3 100644 --- a/patches/minecraft/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch @@ -3,9 +3,9 @@ @@ -18,7 +_,15 @@ } - static CustomPacketPayload.Type createType(String p_331650_) { -- return new CustomPacketPayload.Type<>(Identifier.withDefaultNamespace(p_331650_)); -+ return new CustomPacketPayload.Type<>(Identifier.parse(p_331650_)); + static CustomPacketPayload.Type createType(final String id) { +- return new CustomPacketPayload.Type<>(Identifier.withDefaultNamespace(id)); ++ return new CustomPacketPayload.Type<>(Identifier.parse(id)); + } + + static CustomPacketPayload.Type createType(String namespace, String path) { diff --git a/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryAnswerPayload.java.patch b/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryAnswerPayload.java.patch index 61030cbb4c..57349fdd30 100644 --- a/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryAnswerPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryAnswerPayload.java.patch @@ -16,11 +16,11 @@ + } + @Override - public void write(FriendlyByteBuf p_299186_) { + public void write(final FriendlyByteBuf output) { + if (this.data != null) { -+ p_299186_.writeBytes(this.data.slice()); ++ output.writeBytes(this.data.slice()); + } else { -+ encoder.accept(p_299186_); ++ encoder.accept(output); + } } } diff --git a/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java.patch b/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java.patch index eb8a8f804e..8a408319d4 100644 --- a/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java +++ b/net/minecraft/network/protocol/login/custom/DiscardedQueryPayload.java -@@ -3,9 +_,21 @@ +@@ -3,8 +_,20 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.Identifier; @@ -14,12 +14,11 @@ + } + @Override - public void write(FriendlyByteBuf p_299949_) { + public void write(final FriendlyByteBuf output) { + if (this.data != null) { -+ p_299949_.writeBytes(this.data.slice()); ++ output.writeBytes(this.data.slice()); + } else { -+ encoder.accept(p_299949_); ++ encoder.accept(output); + } } - - @Override + } diff --git a/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch b/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch index 1dd136c8a6..2188327f6b 100644 --- a/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/protocol/status/ServerStatus.java +++ b/net/minecraft/network/protocol/status/ServerStatus.java -@@ -20,7 +_,8 @@ +@@ -19,7 +_,8 @@ Optional players, Optional version, Optional favicon, @@ -9,8 +9,8 @@ + Optional forgeData ) { public static final Codec CODEC = RecordCodecBuilder.create( - p_326135_ -> p_326135_.group( -@@ -28,7 +_,8 @@ + i -> i.group( +@@ -27,7 +_,8 @@ ServerStatus.Players.CODEC.lenientOptionalFieldOf("players").forGetter(ServerStatus::players), ServerStatus.Version.CODEC.lenientOptionalFieldOf("version").forGetter(ServerStatus::version), ServerStatus.Favicon.CODEC.lenientOptionalFieldOf("favicon").forGetter(ServerStatus::favicon), @@ -18,5 +18,5 @@ + Codec.BOOL.lenientOptionalFieldOf("enforcesSecureChat", false).forGetter(ServerStatus::enforcesSecureChat), + net.minecraftforge.network.ServerStatusPing.CODEC.optionalFieldOf("forgeData").forGetter(ServerStatus::forgeData) ) - .apply(p_326135_, ServerStatus::new) + .apply(i, ServerStatus::new) ); diff --git a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch index bc463772d4..67b68b8513 100644 --- a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch +++ b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -128,15 +_,17 @@ +@@ -146,15 +_,17 @@ public static final EntityDataSerializer HUMANOID_ARM = EntityDataSerializer.forValueType(HumanoidArm.STREAM_CODEC); - public static void registerSerializer(EntityDataSerializer p_135051_) { + public static void registerSerializer(final EntityDataSerializer serializer) { + int id = - SERIALIZERS.add(p_135051_); + SERIALIZERS.add(serializer); + if (id >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); } - public static @Nullable EntityDataSerializer getSerializer(int p_135049_) { -- return SERIALIZERS.byId(p_135049_); -+ return net.minecraftforge.common.ForgeHooks.getSerializer(p_135049_, SERIALIZERS); + public static @Nullable EntityDataSerializer getSerializer(final int id) { +- return SERIALIZERS.byId(id); ++ return net.minecraftforge.common.ForgeHooks.getSerializer(id, SERIALIZERS); } - public static int getSerializedId(EntityDataSerializer p_135053_) { -- return SERIALIZERS.getId(p_135053_); -+ return net.minecraftforge.common.ForgeHooks.getSerializerId(p_135053_, SERIALIZERS); + public static int getSerializedId(final EntityDataSerializer serializer) { +- return SERIALIZERS.getId(serializer); ++ return net.minecraftforge.common.ForgeHooks.getSerializerId(serializer, SERIALIZERS); } private EntityDataSerializers() { diff --git a/patches/minecraft/net/minecraft/network/syncher/SynchedEntityData.java.patch b/patches/minecraft/net/minecraft/network/syncher/SynchedEntityData.java.patch index 6584384f13..92651f5bda 100644 --- a/patches/minecraft/net/minecraft/network/syncher/SynchedEntityData.java.patch +++ b/patches/minecraft/net/minecraft/network/syncher/SynchedEntityData.java.patch @@ -3,16 +3,16 @@ @@ -27,11 +_,13 @@ } - public static EntityDataAccessor defineId(Class p_135354_, EntityDataSerializer p_135355_) { + public static EntityDataAccessor defineId(final Class clazz, final EntityDataSerializer type) { - if (LOGGER.isDebugEnabled()) { + if (true) { // Forge: This is very useful for mods that register keys on classes that are not their own try { - Class oclass = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName()); - if (!oclass.equals(p_135354_)) { -- LOGGER.debug("defineId called for: {} from {}", p_135354_, oclass, new RuntimeException()); + Class aClass = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName()); + if (!aClass.equals(clazz)) { +- LOGGER.debug("defineId called for: {} from {}", clazz, aClass, new RuntimeException()); + // Forge: log at warn, mods should not add to classes that they don't own, and only add stacktrace when in debug is enabled as it is mostly not needed and consumes time -+ if (LOGGER.isDebugEnabled()) LOGGER.warn("defineId called for: {} from {}", p_135354_, oclass, new RuntimeException()); -+ else LOGGER.warn("defineId called for: {} from {}", p_135354_, oclass); ++ if (LOGGER.isDebugEnabled()) LOGGER.warn("defineId called for: {} from {}", clazz, aClass, new RuntimeException()); ++ else LOGGER.warn("defineId called for: {} from {}", clazz, aClass); } - } catch (ClassNotFoundException classnotfoundexception) { + } catch (ClassNotFoundException var3) { } diff --git a/patches/minecraft/net/minecraft/resources/HolderSetCodec.java.patch b/patches/minecraft/net/minecraft/resources/HolderSetCodec.java.patch index b54b7873b5..6ddfba8610 100644 --- a/patches/minecraft/net/minecraft/resources/HolderSetCodec.java.patch +++ b/patches/minecraft/net/minecraft/resources/HolderSetCodec.java.patch @@ -7,54 +7,54 @@ + private final Codec> forgeDispatchCodec; + private final Codec, Either, List>>>> combinedCodec; - private static Codec>> homogenousList(Codec> p_206668_, boolean p_206669_) { - Codec>> codec = p_206668_.listOf().validate(ExtraCodecs.ensureHomogenous(Holder::kind)); -@@ -36,6 +_,10 @@ - this.elementCodec = p_206661_; - this.homogenousListCodec = homogenousList(p_206661_, p_206662_); - this.registryAwareCodec = Codec.either(TagKey.hashedCodec(p_206660_), this.homogenousListCodec); + private static Codec>> homogenousList(final Codec> elementCodec, final boolean alwaysUseList) { + Codec>> listCodec = elementCodec.listOf().validate(ExtraCodecs.ensureHomogenous(Holder::kind)); +@@ -38,6 +_,10 @@ + this.elementCodec = elementCodec; + this.homogenousListCodec = homogenousList(elementCodec, alwaysUseList); + this.registryAwareCodec = Codec.either(TagKey.hashedCodec(registryKey), this.homogenousListCodec); + // FORGE: make registry-specific dispatch codec and make forge-or-vanilla either codec + this.forgeDispatchCodec = Codec.lazyInitialized(() -> net.minecraftforge.registries.ForgeRegistries.HOLDER_SET_TYPES.get().getCodec()) -+ .dispatch(net.minecraftforge.registries.holdersets.ICustomHolderSet::type, type -> type.makeCodec(p_206660_, p_206661_, p_206662_)); ++ .dispatch(net.minecraftforge.registries.holdersets.ICustomHolderSet::type, type -> type.makeCodec(registryKey, elementCodec, alwaysUseList)); + this.combinedCodec = Codec.either(this.forgeDispatchCodec, this.registryAwareCodec); } @Override -@@ -44,14 +_,17 @@ - Optional> optional = registryops.getter(this.registryKey); - if (optional.isPresent()) { - HolderGetter holdergetter = optional.get(); +@@ -46,14 +_,17 @@ + Optional> registryOptional = registryOps.getter(this.registryKey); + if (registryOptional.isPresent()) { + HolderGetter registry = registryOptional.get(); - return this.registryAwareCodec + return this.combinedCodec - .decode(p_206696_, p_206697_) + .decode(ops, input) .flatMap( - p_326147_ -> { - DataResult> dataresult = p_326147_.getFirst() + p -> { + DataResult> result = p.getFirst() + .map(custom -> DataResult.success(custom), + tagOrList -> tagOrList .map( - p_326145_ -> lookupTag(holdergetter, (TagKey)p_326145_), - p_326140_ -> DataResult.success(HolderSet.direct((List>)p_326140_)) + tag -> lookupTag(registry, (TagKey)tag), + values -> DataResult.success(HolderSet.direct((List>)values)) + ) ); - return dataresult.map(p_326149_ -> Pair.of((HolderSet)p_326149_, (T)p_326147_.getSecond())); + return result.map(holders -> Pair.of((HolderSet)holders, (T)p.getSecond())); } -@@ -84,7 +_,7 @@ +@@ -86,7 +_,7 @@ } - private DataResult, T>> decodeWithoutRegistry(DynamicOps p_206671_, T p_206672_) { -- return this.elementCodec.listOf().decode(p_206671_, p_206672_).flatMap(p_206666_ -> { -+ return this.homogenousListCodec.decode(p_206671_, p_206672_).flatMap(p_206666_ -> { // Forge: Match encodeWithoutRegistry's use of the homogenousListCodec - List> list = new ArrayList<>(); + private DataResult, T>> decodeWithoutRegistry(final DynamicOps ops, final T input) { +- return this.elementCodec.listOf().decode(ops, input).flatMap(p -> { ++ return this.homogenousListCodec.decode(ops, input).flatMap(p -> { // Forge: Match encodeWithoutRegistry's use of the homogenousListCodec + List> directHolders = new ArrayList<>(); - for (Holder holder : p_206666_.getFirst()) { -@@ -100,6 +_,9 @@ + for (Holder holder : p.getFirst()) { +@@ -102,6 +_,9 @@ } - private DataResult encodeWithoutRegistry(HolderSet p_206690_, DynamicOps p_206691_, T p_206692_) { + private DataResult encodeWithoutRegistry(final HolderSet input, final DynamicOps ops, final T prefix) { + // FORGE: use the dispatch codec to encode custom holdersets, otherwise fall back to vanilla tag/list -+ if (p_206690_ instanceof net.minecraftforge.registries.holdersets.ICustomHolderSet customHolderSet) -+ return this.forgeDispatchCodec.encode(customHolderSet, p_206691_, p_206692_); - return this.homogenousListCodec.encode(p_206690_.stream().toList(), p_206691_, p_206692_); ++ if (input instanceof net.minecraftforge.registries.holdersets.ICustomHolderSet customHolderSet) ++ return this.forgeDispatchCodec.encode(customHolderSet, ops, prefix); + return this.homogenousListCodec.encode(input.stream().toList(), ops, prefix); } } diff --git a/patches/minecraft/net/minecraft/resources/Identifier.java.patch b/patches/minecraft/net/minecraft/resources/Identifier.java.patch index 2e06a42a49..302c39ded6 100644 --- a/patches/minecraft/net/minecraft/resources/Identifier.java.patch +++ b/patches/minecraft/net/minecraft/resources/Identifier.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/resources/Identifier.java +++ b/net/minecraft/resources/Identifier.java -@@ -269,4 +_,10 @@ - return p_458379_; +@@ -274,4 +_,10 @@ + return path; } } + diff --git a/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch b/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch index 2fa3da37e3..d76a89a96c 100644 --- a/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch +++ b/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java -@@ -91,7 +_,7 @@ - Lifecycle lifecycle = p_326161_.map(KnownPack::isVanilla).map(p_326166_ -> Lifecycle.stable()).orElse(Lifecycle.experimental()); - return new RegistrationInfo(p_326161_, lifecycle); - }); +@@ -81,7 +_,7 @@ + public class RegistryDataLoader { + private static final Logger LOGGER = LogUtils.getLogger(); + private static final Comparator> ERROR_KEY_COMPARATOR = Comparator., Identifier>comparing(ResourceKey::registry).thenComparing(ResourceKey::identifier); - public static final List> WORLDGEN_REGISTRIES = List.of( + public static final List> WORLDGEN_REGISTRIES = net.minecraftforge.registries.DataPackRegistriesHooks.grabWorldgenRegistries( new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), -@@ -134,7 +_,7 @@ +@@ -132,7 +_,7 @@ public static final List> DIMENSION_REGISTRIES = List.of( new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC) ); @@ -18,84 +18,14 @@ new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.NETWORK_CODEC), new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC), -@@ -160,6 +_,10 @@ +@@ -163,6 +_,10 @@ + new RegistryDataLoader.RegistryData<>(Registries.WORLD_CLOCK, WorldClock.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TIMELINE, Timeline.NETWORK_CODEC) ); - ++ + public static java.util.stream.Stream> getWorldGenAndDimensionStream() { + return java.util.stream.Stream.concat(RegistryDataLoader.WORLDGEN_REGISTRIES.stream(), RegistryDataLoader.DIMENSION_REGISTRIES.stream()); + } -+ - public static RegistryAccess.Frozen load( - ResourceManager p_252046_, List> p_250344_, List> p_366741_ - ) { -@@ -276,7 +_,7 @@ - private static void loadElementFromResource( - WritableRegistry p_330991_, -- Decoder p_333909_, -+ Decoder> p_333909_, - RegistryOps p_332135_, - ResourceKey p_332850_, - Resource p_335244_, -@@ -284,7 +_,23 @@ - ) throws IOException { - try (Reader reader = p_335244_.openAsReader()) { - JsonElement jsonelement = StrictJsonParser.parse(reader); -- DataResult dataresult = p_333909_.parse(p_332135_, jsonelement); -+ -+ var result = p_333909_.decode(p_332135_, jsonelement); -+ -+ if (result.isError()) { -+ LOGGER.error("Couldn't parse data file {}: {}", p_332850_, result.error().get().message()); -+ throw new IllegalStateException("Couldn't parse data file " + p_332850_ + ": " + result.error().get().message()); -+ } -+ -+ var mappedResult = result.result().map(a -> a.getFirst()); -+ -+ if (mappedResult.get().isEmpty()) { -+ LOGGER.debug("Skipping {} conditions not met", p_332850_); -+ return; -+ } -+ -+ DataResult dataresult = result.map(p -> p.mapFirst(Optional::get)).map(p -> p.getFirst()); -+ - E e = dataresult.getOrThrow(); - p_330991_.register(p_332850_, e, p_332222_); - } -@@ -299,6 +_,7 @@ - ) { - FileToIdConverter filetoidconverter = FileToIdConverter.registry(p_331358_.key()); - RegistryOps registryops = RegistryOps.create(JsonOps.INSTANCE, p_333035_); -+ Decoder> conditional = net.minecraftforge.common.crafting.conditions.ConditionCodec.wrap(p_329404_); - - for (Entry entry : filetoidconverter.listMatchingResources(p_335634_).entrySet()) { - Identifier identifier = entry.getKey(); -@@ -307,7 +_,7 @@ - RegistrationInfo registrationinfo = REGISTRATION_INFO_CACHE.apply(resource.knownPackInfo()); - - try { -- loadElementFromResource(p_331358_, p_329404_, registryops, resourcekey, resource, registrationinfo); -+ loadElementFromResource(p_331358_, conditional, registryops, resourcekey, resource, registrationinfo); - } catch (Exception exception) { - p_335074_.put( - resourcekey, -@@ -330,7 +_,8 @@ - RegistryDataLoader.NetworkedRegistryData registrydataloader$networkedregistrydata = p_331925_.get(p_332518_.key()); - if (registrydataloader$networkedregistrydata != null) { - RegistryOps registryops = RegistryOps.create(NbtOps.INSTANCE, p_329253_); -- RegistryOps registryops1 = RegistryOps.create(JsonOps.INSTANCE, p_329253_); -+ RegistryOps registryops1 = net.minecraftforge.common.crafting.conditions.ICondition.IContext.TAGS_INVALID.wrap(RegistryOps.create(JsonOps.INSTANCE, p_329253_)); -+ Decoder> conditional = net.minecraftforge.common.crafting.conditions.ConditionCodec.wrap(p_328898_); - FileToIdConverter filetoidconverter = FileToIdConverter.registry(p_332518_.key()); - - for (RegistrySynchronization.PackedRegistryEntry registrysynchronization$packedregistryentry : registrydataloader$networkedregistrydata.elements) { -@@ -352,7 +_,7 @@ - - try { - Resource resource = p_332010_.getResourceOrThrow(identifier); -- loadElementFromResource(p_332518_, p_328898_, registryops1, resourcekey, resource, NETWORK_REGISTRATION_INFO); -+ loadElementFromResource(p_332518_, conditional, registryops1, resourcekey, resource, NETWORK_REGISTRATION_INFO); - } catch (Exception exception1) { - p_335768_.put(resourcekey, new IllegalStateException("Failed to parse local data", exception1)); - } + public static CompletableFuture load( + final ResourceManager resourceManager, diff --git a/patches/minecraft/net/minecraft/resources/RegistryOps.java.patch b/patches/minecraft/net/minecraft/resources/RegistryOps.java.patch index 13a649f606..9ba97434c8 100644 --- a/patches/minecraft/net/minecraft/resources/RegistryOps.java.patch +++ b/patches/minecraft/net/minecraft/resources/RegistryOps.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/resources/RegistryOps.java +++ b/net/minecraft/resources/RegistryOps.java @@ -76,6 +_,22 @@ - .forGetter(p_255526_ -> null); + .forGetter(e -> null); } -+ public static com.mojang.serialization.MapCodec> retrieveRegistryLookup(ResourceKey> resourceKey) { ++ public static com.mojang.serialization.MapCodec> retrieveRegistryLookup(final ResourceKey> resourceKey) { + return ExtraCodecs.retrieveContext(ops -> { + if (!(ops instanceof RegistryOps registryOps)) { + return DataResult.error(() -> "Not a registry ops"); @@ -20,6 +20,6 @@ + }); + } + - public static RecordCodecBuilder> retrieveElement(ResourceKey p_256347_) { - ResourceKey> resourcekey = ResourceKey.createRegistryKey(p_256347_.registry()); + public static RecordCodecBuilder> retrieveElement(final ResourceKey key) { + ResourceKey> registryKey = ResourceKey.createRegistryKey(key.registry()); return ExtraCodecs.retrieveContext( diff --git a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch index cd8b023ff3..5b3820256f 100644 --- a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourceKey.java +++ b/net/minecraft/resources/ResourceKey.java -@@ -9,7 +_,7 @@ +@@ -10,7 +_,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.network.codec.StreamCodec; @@ -9,10 +9,10 @@ private static final ConcurrentMap> VALUES = new MapMaker().weakValues().makeMap(); private final Identifier registryName; private final Identifier identifier; -@@ -67,5 +_,18 @@ +@@ -74,5 +_,18 @@ } - record InternKey(Identifier registry, Identifier identifier) { + private record InternKey(Identifier registry, Identifier identifier) { + } + + @Override diff --git a/patches/minecraft/net/minecraft/resources/ResourceManagerRegistryLoadTask.java.patch b/patches/minecraft/net/minecraft/resources/ResourceManagerRegistryLoadTask.java.patch new file mode 100644 index 0000000000..9db7969690 --- /dev/null +++ b/patches/minecraft/net/minecraft/resources/ResourceManagerRegistryLoadTask.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/resources/ResourceManagerRegistryLoadTask.java ++++ b/net/minecraft/resources/ResourceManagerRegistryLoadTask.java +@@ -21,6 +_,7 @@ + import net.minecraft.util.thread.ParallelMapTransform; + + public class ResourceManagerRegistryLoadTask extends RegistryLoadTask { ++ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); + private static final Function, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize(knownPack -> { + Lifecycle lifecycle = knownPack.map(KnownPack::isVanilla).map(info -> Lifecycle.stable()).orElse(Lifecycle.experimental()); + return new RegistrationInfo(knownPack, lifecycle); +@@ -40,6 +_,7 @@ + @Override + public CompletableFuture load(final RegistryOps.RegistryInfoLookup context, final Executor executor) { + FileToIdConverter lister = FileToIdConverter.registry(this.registryKey()); ++ var optionalCodec = net.minecraftforge.common.crafting.conditions.ConditionCodec.wrap(this.data.elementCodec()); + return CompletableFuture.>supplyAsync(() -> lister.listMatchingResources(this.resourceManager), executor) + .thenCompose( + registryResources -> { +@@ -49,9 +_,18 @@ + (resourceId, thunk) -> { + ResourceKey elementKey = ResourceKey.create(this.registryKey(), lister.fileToId(resourceId)); + RegistrationInfo registrationInfo = REGISTRATION_INFO_CACHE.apply(thunk.knownPackInfo()); ++ // braking types here for smaller patch, its just used for error messages so its fine ++ var result = RegistryLoadTask.PendingRegistration.loadFromResource(optionalCodec, ops, (ResourceKey>)elementKey, thunk); ++ if (!result.right().isPresent()) { // Wasn't an error so check if present ++ var value = result.left().get(); ++ if (value.isEmpty()) { ++ LOGGER.debug("Skipping {} conditions not met", elementKey); ++ return null; ++ } ++ } + return new RegistryLoadTask.PendingRegistration<>( + elementKey, +- RegistryLoadTask.PendingRegistration.loadFromResource(this.data.elementCodec(), ops, elementKey, thunk), ++ result.mapLeft(Optional::get), + registrationInfo + ); + }, diff --git a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch index 5c593f41e2..8392dba490 100644 --- a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -57,6 +_,8 @@ - CauldronInteraction.bootStrap(); - BuiltInRegistries.bootStrap(); - CreativeModeTabs.validate(); -+ 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 - wrapStreams(); - bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); - } +@@ -59,6 +_,8 @@ + CauldronInteractions.bootStrap(); + BuiltInRegistries.bootStrap(); + CreativeModeTabs.validate(); ++ 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 + wrapStreams(); + bootstrapDuration.set(Duration.between(start, Instant.now()).toMillis()); + } @@ -123,7 +_,6 @@ Commands.validate(); } diff --git a/patches/minecraft/net/minecraft/server/Eula.java.patch b/patches/minecraft/net/minecraft/server/Eula.java.patch index 4780bcf07f..6b00b1a1c7 100644 --- a/patches/minecraft/net/minecraft/server/Eula.java.patch +++ b/patches/minecraft/net/minecraft/server/Eula.java.patch @@ -2,8 +2,8 @@ +++ b/net/minecraft/server/Eula.java @@ -17,7 +_,7 @@ - public Eula(Path p_135943_) { - this.file = p_135943_; + public Eula(final Path file) { + this.file = file; - this.agreed = SharedConstants.IS_RUNNING_IN_IDE || this.readFile(); + this.agreed = SharedConstants.IS_RUNNING_IN_IDE || net.minecraftforge.gametest.ForgeGameTestHooks.isGametestServer() || this.readFile(); // Forge: Automatically agree to EULA for gametest servers to aid CI } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index 5eeb7102c3..6bb69fb7f5 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -1,54 +1,53 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -84,6 +_,17 @@ - OptionSpec optionspec13 = optionparser.accepts("jfrProfile"); - OptionSpec optionspec14 = optionparser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); - OptionSpec optionspec15 = optionparser.nonOptions(); -+ optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed -+ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. +@@ -85,6 +_,17 @@ + OptionSpec jfrProfilingOption = parser.accepts("jfrProfile"); + OptionSpec pidFile = parser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); + OptionSpec nonOptions = parser.nonOptions(); ++ parser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed ++ parser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + final OptionSpec spawnPosOpt; + OptionSpec uniqueWorld = null; + boolean gametestEnabled = Boolean.getBoolean("forge.gameTestServer"); + if (gametestEnabled) { -+ spawnPosOpt = optionparser.accepts("spawnPos").withRequiredArg().withValuesConvertedBy(new net.minecraftforge.gametest.BlockPosValueConverter()).defaultsTo(new net.minecraft.core.BlockPos(0, 60, 0)); -+ uniqueWorld = optionparser.accepts("uniqueWorld"); ++ spawnPosOpt = parser.accepts("spawnPos").withRequiredArg().withValuesConvertedBy(new net.minecraftforge.gametest.BlockPosValueConverter()).defaultsTo(new net.minecraft.core.BlockPos(0, 60, 0)); ++ uniqueWorld = parser.accepts("uniqueWorld"); + } else { + spawnPosOpt = null; + } try { - OptionSet optionset = optionparser.parse(p_129699_); -@@ -92,6 +_,14 @@ + OptionSet options = parser.parse(args); +@@ -93,6 +_,14 @@ return; } -+ Path path2 = Paths.get("eula.txt"); -+ Eula eula = new Eula(path2); ++ Path eulaFile = Paths.get("eula.txt"); ++ Eula eula = new Eula(eulaFile); + + if (!eula.hasAgreedToEULA()) { + LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + return; + } + - Path path = optionset.valueOf(optionspec14); - if (path != null) { - writePidFile(path); -@@ -106,24 +_,29 @@ + Path pidFilePath = options.valueOf(pidFile); + if (pidFilePath != null) { + writePidFile(pidFilePath); +@@ -107,26 +_,30 @@ Bootstrap.validate(); Util.startTimerHackThread(); - Path path1 = Paths.get("server.properties"); -+ if (!optionset.has(optionspec1)) { + Path settingsFile = Paths.get("server.properties"); ++ if (!options.has(initSettings)) { + // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param + net.minecraftforge.server.loading.ServerModLoader.load(); + } - DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path1); - dedicatedserversettings.forceSave(); - RegionFileVersion.configure(dedicatedserversettings.getProperties().regionFileComression); -- Path path2 = Paths.get("eula.txt"); -- Eula eula = new Eula(path2); -+ - if (optionset.has(optionspec1)) { - LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath()); + DedicatedServerSettings settings = new DedicatedServerSettings(settingsFile); + settings.forceSave(); + RegionFileVersion.configure(settings.getProperties().regionFileComression); +- Path eulaFile = Paths.get("eula.txt"); +- Eula eula = new Eula(eulaFile); + if (options.has(initSettings)) { + LOGGER.info("Initialized '{}' and '{}'", settingsFile.toAbsolutePath(), eulaFile.toAbsolutePath()); return; } @@ -57,75 +56,54 @@ - return; - } - - File file1 = new File(optionset.valueOf(optionspec9)); - Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file1); - String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName); + File universePath = new File(options.valueOf(universe)); + Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), universePath); + NotificationManager notificationManager = new NotificationManager(); + ManagementServer jsonRpcServer = JsonRpc.create(settings, notificationManager); + String levelName = Optional.ofNullable(options.valueOf(worldName)).orElse(settings.getProperties().levelName); + // Forge: make each gametest use a timestamped world name -+ if (uniqueWorld != null && optionset.has(uniqueWorld)) -+ s = "gametest_world\\" + java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss.SSS").format(java.time.LocalDateTime.now()); -+ if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { -+ LOGGER.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); ++ if (uniqueWorld != null && options.has(uniqueWorld)) ++ levelName = "gametest_world\\" + java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss.SSS").format(java.time.LocalDateTime.now()); ++ if (levelName == null || levelName.isEmpty() || new File(universePath, levelName).getAbsolutePath().equals(new File(levelName).getAbsolutePath())) { ++ LOGGER.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + levelName); + return; + } - LevelStorageSource levelstoragesource = LevelStorageSource.createDefault(file1.toPath()); - LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.validateAndCreateAccess(s); - Dynamic dynamic; -@@ -174,6 +_,10 @@ + LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(universePath.toPath()); + LevelStorageSource.LevelStorageAccess access = levelStorageSource.validateAndCreateAccess(levelName); + Dynamic levelDataTag; +@@ -162,6 +_,10 @@ - PackRepository packrepository = ServerPacksSource.createPackRepository(levelstoragesource$levelstorageaccess); + PackRepository packRepository = ServerPacksSource.createPackRepository(access); -+ if (dynamic != null) { -+ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(levelstoragesource$levelstorageaccess, levelstoragesource$levelstorageaccess.getLevelDirectory()); ++ if (levelDataTag != null) { ++ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(access, access.getLevelDirectory()); + } + - WorldStem worldstem; + WorldStem worldStem; try { - WorldLoader.InitConfig worldloader$initconfig = loadOrCreateConfig(dedicatedserversettings.getProperties(), dynamic1, flag, packrepository); -@@ -222,17 +_,18 @@ - } - - levelstoragesource$levelstorageaccess.saveDataTag(registryaccess$frozen, worlddata); -- final DedicatedServer dedicatedserver = MinecraftServer.spin( -+ final MinecraftServer dedicatedserver = MinecraftServer.spin( - p_421274_ -> { -- DedicatedServer dedicatedserver1 = new DedicatedServer( -+ MinecraftServer dedicatedserver1; -+ dedicatedserver1 = new DedicatedServer( - p_421274_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services - ); - dedicatedserver1.setPort(optionset.valueOf(optionspec11)); - dedicatedserver1.setDemo(optionset.has(optionspec2)); - dedicatedserver1.setId(optionset.valueOf(optionspec12)); - boolean flag2 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec15).contains("nogui"); -- if (flag2 && !GraphicsEnvironment.isHeadless()) { -- dedicatedserver1.showGui(); -+ if (flag2 && !GraphicsEnvironment.isHeadless() && dedicatedserver1 instanceof DedicatedServer ds) { -+ ds.showGui(); - } - - return dedicatedserver1; -@@ -242,6 +_,7 @@ + WorldLoader.InitConfig worldLoadConfig = loadOrCreateConfig(settings.getProperties(), levelDataTag, safeModeEnabled, packRepository); +@@ -233,6 +_,7 @@ @Override public void run() { - dedicatedserver.halt(true); + dedicatedServer.halt(true); + org.apache.logging.log4j.LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. } }; - thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); -@@ -275,6 +_,16 @@ - worldoptions = p_427999_ ? dedicatedserverproperties.worldOptions.withBonusChest(true) : dedicatedserverproperties.worldOptions; - worlddimensions = dedicatedserverproperties.createDimensions(p_423661_.datapackWorldgen()); + shutdownThread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); +@@ -268,6 +_,16 @@ + worldOptions = bonusChest ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; + dimensions = properties.createDimensions(context.datapackWorldgen()); } + + //Forge: Do a write-read-cycle to inject modded dimensions on first start of a dedicated server into its generated world dimensions list. -+ var dynamicops = net.minecraft.resources.RegistryOps.create(net.minecraft.nbt.NbtOps.INSTANCE, p_423661_.datapackWorldgen()); -+ worlddimensions = WorldDimensions.CODEC.encoder() -+ .encodeStart(dynamicops, worlddimensions) ++ var dynamicops = net.minecraft.resources.RegistryOps.create(net.minecraft.nbt.NbtOps.INSTANCE, context.datapackWorldgen()); ++ dimensions = WorldDimensions.CODEC.encoder() ++ .encodeStart(dynamicops, dimensions) + .flatMap((writtenPayloadWithModdedDimensions) -> + WorldDimensions.CODEC.decoder().parse(dynamicops, writtenPayloadWithModdedDimensions) + ) + .resultOrPartial(LOGGER::error) -+ .orElse(worlddimensions); ++ .orElse(dimensions); - WorldDimensions.Complete worlddimensions$complete = worlddimensions.bake(p_422717_); - Lifecycle lifecycle = worlddimensions$complete.lifecycle().add(p_423661_.datapackWorldgen().allRegistriesLifecycle()); + WorldDimensions.Complete finalDimensions = dimensions.bake(datapackDimensions); + Lifecycle lifecycle = finalDimensions.lifecycle().add(context.datapackWorldgen().allRegistriesLifecycle()); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index ace963d40e..f8e85ecfb6 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,47 +1,47 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -284,7 +_,7 @@ +@@ -296,7 +_,7 @@ - public static S spin(Function p_129873_) { - AtomicReference atomicreference = new AtomicReference<>(); -- Thread thread = new Thread(() -> atomicreference.get().runServer(), "Server thread"); -+ Thread thread = new Thread(net.minecraftforge.fml.util.thread.SidedThreadGroups.SERVER, () -> atomicreference.get().runServer(), "Server thread"); - thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> LOGGER.error("Uncaught exception in server thread", p_177910_)); + public static S spin(final Function factory) { + AtomicReference serverReference = new AtomicReference<>(); +- Thread thread = new Thread(() -> serverReference.get().runServer(), "Server thread"); ++ Thread thread = new Thread(net.minecraftforge.fml.util.thread.SidedThreadGroups.SERVER, () -> serverReference.get().runServer(), "Server thread"); + thread.setUncaughtExceptionHandler((t, e) -> LOGGER.error("Uncaught exception in server thread", e)); if (Runtime.getRuntime().availableProcessors() > 4) { thread.setPriority(8); -@@ -407,6 +_,7 @@ - this.scoreboard.load(dimensiondatastorage.computeIfAbsent(ScoreboardSaveData.TYPE).getData()); - this.commandStorage = new CommandStorage(dimensiondatastorage); - this.stopwatches = dimensiondatastorage.computeIfAbsent(Stopwatches.TYPE); +@@ -436,6 +_,7 @@ + this.scoreboard.load(this.savedDataStorage.computeIfAbsent(ScoreboardSaveData.TYPE).getData()); + this.commandStorage = new CommandStorage(this.savedDataStorage); + this.stopwatches = this.savedDataStorage.computeIfAbsent(Stopwatches.TYPE); + net.minecraftforge.event.ForgeEventFactory.onLevelLoad(levels.get(Level.OVERWORLD)); - if (!serverleveldata.isInitialized()) { + if (!levelData.isInitialized()) { try { - setInitialSpawn(serverlevel, serverleveldata, worldoptions.generateBonusChest(), flag, this.levelLoadListener); -@@ -447,6 +_,7 @@ - this, this.executor, this.storageSource, derivedleveldata, resourcekey1, entry.getValue(), flag, j, ImmutableList.of(), false, randomsequences + setInitialSpawn(overworld, levelData, worldOptions.generateBonusChest(), isDebug, this.levelLoadListener); +@@ -470,6 +_,7 @@ + this, this.executor, this.storageSource, derivedLevelData, dimension, entry.getValue(), isDebug, biomeZoomSeed, ImmutableList.of(), false ); - this.levels.put(resourcekey1, serverlevel1); -+ net.minecraftforge.event.ForgeEventFactory.onLevelLoad(serverlevel1); + this.levels.put(dimension, level); ++ net.minecraftforge.event.ForgeEventFactory.onLevelLoad(level); } else { - serverlevel1 = serverlevel; + level = overworld; } @@ -492,6 +_,7 @@ - p_177898_.setSpawn(LevelData.RespawnData.of(p_177897_.dimension(), BlockPos.ZERO.above(80), 0.0F, 0.0F)); + levelData.setSpawn(LevelData.RespawnData.of(level.dimension(), BlockPos.ZERO.above(80), 0.0F, 0.0F)); } else { - ServerChunkCache serverchunkcache = p_177897_.getChunkSource(); -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_177897_, p_177898_)) return; - ChunkPos chunkpos = new ChunkPos(serverchunkcache.randomState().sampler().findSpawnPosition()); - p_431711_.start(LevelLoadListener.Stage.PREPARE_GLOBAL_SPAWN, 0); - p_431711_.updateFocus(p_177897_.dimension(), chunkpos); -@@ -677,6 +_,7 @@ - for (ServerLevel serverlevel2 : this.getAllLevels()) { - if (serverlevel2 != null) { + ServerChunkCache chunkSource = level.getChunkSource(); ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(level, levelData)) return; + ChunkPos spawnChunk = ChunkPos.containing(chunkSource.randomState().sampler().findSpawnPosition()); + levelLoadListener.start(LevelLoadListener.Stage.PREPARE_GLOBAL_SPAWN, 0); + levelLoadListener.updateFocus(level.dimension(), spawnChunk); +@@ -678,6 +_,7 @@ + for (ServerLevel level : this.getAllLevels()) { + if (level != null) { try { -+ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(serverlevel2); - serverlevel2.close(); - } catch (IOException ioexception1) { - LOGGER.error("Exception closing the level", (Throwable)ioexception1); -@@ -723,9 +_,11 @@ ++ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(level); + level.close(); + } catch (IOException e) { + LOGGER.error("Exception closing the level", e); +@@ -725,9 +_,11 @@ throw new IllegalStateException("Failed to initialize server"); } @@ -52,57 +52,57 @@ + resetStatusCache(status); while (this.running) { - long i; -@@ -774,6 +_,8 @@ + long thisTickNanos; +@@ -781,6 +_,8 @@ this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } + net.minecraftforge.server.ServerLifecycleHooks.handleServerStopping(this); + net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // Forge: Has to come before MinecraftServer#onServerCrash to avoid race conditions - } catch (Throwable throwable2) { - LOGGER.error("Encountered an unexpected exception", throwable2); - CrashReport crashreport = constructOrExtractCrashReport(throwable2); -@@ -785,6 +_,7 @@ + } catch (Throwable t) { + LOGGER.error("Encountered an unexpected exception", t); + CrashReport report = constructOrExtractCrashReport(t); +@@ -792,6 +_,7 @@ LOGGER.error("We were unable to save this crash report to disk."); } + net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // Forge: Has to come before MinecraftServer#onServerCrash to avoid race conditions - this.onServerCrash(crashreport); + this.onServerCrash(report); } finally { try { -@@ -793,6 +_,7 @@ - } catch (Throwable throwable) { - LOGGER.error("Exception stopping the server", throwable); +@@ -800,6 +_,7 @@ + } catch (Throwable t) { + LOGGER.error("Exception stopping the server", t); } finally { + net.minecraftforge.server.ServerLifecycleHooks.handleServerStopped(this); this.onServerExit(); } } -@@ -995,12 +_,14 @@ +@@ -980,12 +_,14 @@ } } -+ net.minecraftforge.event.ForgeEventFactory.onPreServerTick(p_129871_, this); ++ net.minecraftforge.event.ForgeEventFactory.onPreServerTick(haveTime, this); this.tickCount++; this.tickRateManager.tick(); - this.tickChildren(p_129871_); - if (i - this.lastServerStatus >= STATUS_EXPIRE_TIME_NANOS) { - this.lastServerStatus = i; + this.tickChildren(haveTime); + if (nano - this.lastServerStatus >= STATUS_EXPIRE_TIME_NANOS) { + this.lastServerStatus = nano; this.status = this.buildServerStatus(); + resetStatusCache(status); } this.ticksUntilAutosave--; -@@ -1018,6 +_,7 @@ - this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)k / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; - this.logTickMethodTime(i); - profilerfiller.pop(); -+ net.minecraftforge.event.ForgeEventFactory.onPostServerTick(p_129871_, this); +@@ -1003,6 +_,7 @@ + this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)tickTime / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; + this.logTickMethodTime(nano); + profiler.pop(); ++ net.minecraftforge.event.ForgeEventFactory.onPostServerTick(haveTime, this); } - public void processPacketsAndTick(boolean p_452829_) { -@@ -1079,7 +_,8 @@ - Optional.of(serverstatus$players), + protected void processPacketsAndTick(final boolean sprinting) { +@@ -1064,7 +_,8 @@ + Optional.of(players), Optional.of(ServerStatus.Version.current()), Optional.ofNullable(this.statusIcon), - this.enforceSecureProfile() @@ -111,80 +111,75 @@ ); } -@@ -1111,7 +_,8 @@ - profilerfiller.popPush("levels"); +@@ -1109,9 +_,11 @@ + profiler.push("levels"); this.updateEffectiveRespawnData(); -- for (ServerLevel serverlevel : this.getAllLevels()) { -+ for (ServerLevel serverlevel : this.getWorldArray()) { +- for (ServerLevel level : this.getAllLevels()) { ++ for (ServerLevel level : this.getWorldArray()) { + long tickStart = Util.getNanos(); - profilerfiller.push(() -> serverlevel + " " + serverlevel.dimension().identifier()); - if (this.tickCount % 20 == 0) { - profilerfiller.push("timeSync"); -@@ -1120,6 +_,7 @@ - } - - profilerfiller.push("tick"); -+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(serverlevel, p_129954_); + profiler.push(() -> level + " " + level.dimension().identifier()); + profiler.push("tick"); ++ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(level, haveTime); try { - serverlevel.tick(p_129954_); -@@ -1128,9 +_,11 @@ - serverlevel.fillReportDetails(crashreport); - throw new ReportedException(crashreport); + level.tick(haveTime); +@@ -1120,9 +_,11 @@ + level.fillReportDetails(report); + throw new ReportedException(report); } -+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(serverlevel, p_129954_); ++ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(level, haveTime); - profilerfiller.pop(); - profilerfiller.pop(); -+ perWorldTickTimes.computeIfAbsent(serverlevel.dimension(), k -> new long[100])[this.tickCount % 100] = Util.getNanos() - tickStart; + profiler.pop(); + profiler.pop(); ++ perWorldTickTimes.computeIfAbsent(level.dimension(), k -> new long[100])[this.tickCount % 100] = Util.getNanos() - tickStart; } - profilerfiller.popPush("connection"); -@@ -1139,7 +_,7 @@ + profiler.popPush("connection"); +@@ -1131,7 +_,7 @@ this.playerList.tick(); - profilerfiller.popPush("debugSubscribers"); + profiler.popPush("debugSubscribers"); this.debugSubscribers.tick(); - if (this.tickRateManager.runsNormally()) { + if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled() && this.tickRateManager.runsNormally()) { - profilerfiller.popPush("gameTests"); + profiler.popPush("gameTests"); GameTestTicker.SINGLETON.tick(); } -@@ -1238,7 +_,7 @@ +@@ -1217,7 +_,7 @@ + } - @DontObfuscate public String getServerModName() { - return "vanilla"; + return net.minecraftforge.internal.BrandingControl.getBranding(); } - public SystemReport fillSystemReport(SystemReport p_177936_) { -@@ -1564,6 +_,7 @@ + public ServerClockManager clockManager() { +@@ -1561,6 +_,7 @@ this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures()); + this.getPlayerList().getPlayers().forEach(this.getPlayerList()::sendPlayerPermissionLevel); //Forge: Fix newly added/modified commands not being sent to the client when commands reload. }, this); if (this.isSameThread()) { - this.managedBlock(completablefuture::isDone); -@@ -1573,12 +_,15 @@ - } - - public static WorldDataConfiguration configurePackRepository(PackRepository p_248681_, WorldDataConfiguration p_331931_, boolean p_249869_, boolean p_330480_) { -+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(p_248681_, false); - DataPackConfig datapackconfig = p_331931_.dataPacks(); - FeatureFlagSet featureflagset = p_249869_ ? FeatureFlagSet.of() : p_331931_.enabledFeatures(); - FeatureFlagSet featureflagset1 = p_249869_ ? FeatureFlags.REGISTRY.allFlags() : p_331931_.enabledFeatures(); - p_248681_.reload(); + this.managedBlock(result::isDone); +@@ -1572,12 +_,15 @@ + public static WorldDataConfiguration configurePackRepository( + final PackRepository packRepository, final WorldDataConfiguration initialDataConfig, final boolean initMode, final boolean safeMode + ) { ++ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(packRepository, false); + DataPackConfig dataPackConfig = initialDataConfig.dataPacks(); + FeatureFlagSet forcedFeatures = initMode ? FeatureFlagSet.of() : initialDataConfig.enabledFeatures(); + FeatureFlagSet allowedFeatures = initMode ? FeatureFlags.REGISTRY.allFlags() : initialDataConfig.enabledFeatures(); + packRepository.reload(); + DataPackConfig.DEFAULT.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); -+ datapackconfig.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); - if (p_330480_) { -- return configureRepositoryWithSelection(p_248681_, List.of("vanilla"), featureflagset, false); -+ return configureRepositoryWithSelection(p_248681_, net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla(), featureflagset, false); - } else { - Set set = Sets.newLinkedHashSet(); ++ dataPackConfig.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); + if (safeMode) { +- return configureRepositoryWithSelection(packRepository, List.of("vanilla"), forcedFeatures, false); ++ return configureRepositoryWithSelection(packRepository, net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla(), forcedFeatures, false); + } -@@ -2172,6 +_,48 @@ + Set selected = Sets.newLinkedHashSet(); +@@ -2226,6 +_,48 @@ public ServerLinks serverLinks() { return ServerLinks.EMPTY; diff --git a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch index 746ad52c8d..bd42a95708 100644 --- a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java @@ -171,6 +_,7 @@ - this.unregisterListeners(p_298135_); - this.progressChanged.add(p_298135_); - flag = true; -+ net.minecraftforge.event.ForgeEventFactory.onAdvancementGrant(this.player, p_298135_, advancementprogress, p_135990_); - if (!flag1 && advancementprogress.isDone()) { - p_298135_.value().rewards().grant(this.player); - p_298135_.value().display().ifPresent(p_448826_ -> { + this.unregisterListeners(holder); + this.progressChanged.add(holder); + result = true; ++ net.minecraftforge.event.ForgeEventFactory.onAdvancementGrant(this.player, holder, progress, criterion); + if (!wasDone && progress.isDone()) { + holder.value().rewards().grant(this.player); + holder.value().display().ifPresent(display -> { @@ -178,6 +_,7 @@ - this.playerList.broadcastSystemMessage(p_448826_.getType().createAnnouncement(p_298135_, this.player), false); + this.playerList.broadcastSystemMessage(display.getType().createAnnouncement(holder, this.player), false); } }); -+ net.minecraftforge.event.ForgeEventFactory.onAdvancementEarned(this.player, p_298135_); ++ net.minecraftforge.event.ForgeEventFactory.onAdvancementEarned(this.player, holder); } } @@ -196,6 +_,7 @@ - this.registerListeners(p_297905_); - this.progressChanged.add(p_297905_); - flag = true; -+ net.minecraftforge.event.ForgeEventFactory.onAdvancementRevoke(this.player, p_297905_, advancementprogress, p_136000_); + this.registerListeners(advancement); + this.progressChanged.add(advancement); + result = true; ++ net.minecraftforge.event.ForgeEventFactory.onAdvancementRevoke(this.player, advancement, progress, criterion); } - if (flag1 && !advancementprogress.isDone()) { + if (wasDone && !progress.isDone()) { diff --git a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch index f85a0fffc9..5715cce8ce 100644 --- a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch +++ b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch @@ -1,43 +1,40 @@ --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java -@@ -27,6 +_,7 @@ - private final ServerAdvancementManager advancements; +@@ -30,6 +_,7 @@ private final ServerFunctionLibrary functionLibrary; private final List> postponedTags; + private final List> newComponents; + private final net.minecraftforge.common.crafting.conditions.ICondition.IContext context; private ReloadableServerResources( - LayeredRegistryAccess p_368059_, -@@ -38,9 +_,11 @@ - ) { - this.fullRegistryHolder = new ReloadableServerRegistries.Holder(p_368059_.compositeAccess()); - this.postponedTags = p_364269_; -- this.recipes = new RecipeManager(p_363207_); - this.commands = new Commands(p_206858_, CommandBuildContext.simple(p_363207_, p_250695_)); -- this.advancements = new ServerAdvancementManager(p_363207_); + final LayeredRegistryAccess fullLayers, +@@ -43,9 +_,11 @@ + this.fullRegistryHolder = new ReloadableServerRegistries.Holder(fullLayers.compositeAccess()); + this.postponedTags = postponedTags; + this.newComponents = newComponents; +- this.recipes = new RecipeManager(loadingContext); + this.commands = new Commands(commandSelection, CommandBuildContext.simple(loadingContext, enabledFeatures)); +- this.advancements = new ServerAdvancementManager(loadingContext); + // Forge: Create context object and pass it to the recipe manager. + this.context = new net.minecraftforge.common.crafting.conditions.ConditionContext(this.postponedTags); -+ this.recipes = new RecipeManager(p_363207_, this.context); -+ this.advancements = new ServerAdvancementManager(p_363207_, this.context); - this.functionLibrary = new ServerFunctionLibrary(p_453006_, this.commands.getDispatcher()); ++ this.recipes = new RecipeManager(loadingContext, this.context); ++ this.advancements = new ServerAdvancementManager(loadingContext, this.context); + this.functionLibrary = new ServerFunctionLibrary(functionCompilationPermissions, this.commands.getDispatcher()); } -@@ -84,8 +_,10 @@ - ReloadableServerResources reloadableserverresources = new ReloadableServerResources( - p_448843_.layers(), p_448843_.lookupWithUpdatedTags(), p_250212_, p_249301_, p_366334_, p_457868_ - ); -+ var listeners = new java.util.ArrayList<>(reloadableserverresources.listeners()); -+ listeners.addAll(net.minecraftforge.event.ForgeEventFactory.onResourceReload(reloadableserverresources, p_448843_.lookupWithUpdatedTags())); - return SimpleReloadInstance.create( -- p_248588_, reloadableserverresources.listeners(), p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() -+ p_248588_, listeners, p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() - ) - .done() - .thenApply(p_214306_ -> reloadableserverresources); -@@ -95,5 +_,14 @@ - - public void updateStaticRegistryTags() { +@@ -101,7 +_,7 @@ + ); + return SimpleReloadInstance.create( + resourceManager, +- result.listeners(), ++ net.minecraftforge.event.ForgeEventFactory.onResourceReload(result, fullRegistries.lookupWithUpdatedTags(), result.listeners()), + backgroundExecutor, + mainThreadExecutor, + DATA_RELOAD_INITIAL_TASK, +@@ -117,5 +_,14 @@ + public void updateComponentsAndStaticRegistryTags() { this.postponedTags.forEach(Registry.PendingTags::apply); + this.newComponents.forEach(DataComponentInitializers.PendingComponents::apply); + } + + /** diff --git a/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch b/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch index 8bd51b0f51..91b0ce308c 100644 --- a/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch @@ -1,15 +1,13 @@ --- a/net/minecraft/server/ServerAdvancementManager.java +++ b/net/minecraft/server/ServerAdvancementManager.java -@@ -26,7 +_,12 @@ - private AdvancementTree tree = new AdvancementTree(); +@@ -27,6 +_,10 @@ private final HolderLookup.Provider registries; -+ /** @deprecated Forge: use {@linkplain ServerAdvancementManager#ServerAdvancementManager(net.minecraftforge.common.crafting.conditions.ICondition.IContext) constructor with context}. */ - public ServerAdvancementManager(HolderLookup.Provider p_336198_) { -+ this(p_336198_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + public ServerAdvancementManager(final HolderLookup.Provider registries) { ++ this(registries, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + } + -+ public ServerAdvancementManager(HolderLookup.Provider p_336198_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { - super(p_336198_, Advancement.CODEC, Registries.ADVANCEMENT); - this.registries = p_336198_; ++ public ServerAdvancementManager(final HolderLookup.Provider registries, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { + super(registries, Advancement.CODEC, Registries.ADVANCEMENT); + this.registries = registries; } diff --git a/patches/minecraft/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java.patch b/patches/minecraft/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java.patch index 7b7cb87c26..cc24e84257 100644 --- a/patches/minecraft/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java +++ b/net/minecraft/server/advancements/AdvancementVisibilityEvaluator.java -@@ -69,6 +_,16 @@ - evaluateVisibility(advancementnode, stack, p_265561_, p_265381_); +@@ -71,6 +_,16 @@ + evaluateVisibility(root, visibilityStack, isDone, output); } + public static boolean isVisible(AdvancementNode advancement, Predicate test) { @@ -16,4 +16,4 @@ + @FunctionalInterface public interface Output { - void accept(AdvancementNode p_298555_, boolean p_265580_); + void accept(AdvancementNode advancement, boolean visible); diff --git a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch index a5e7f8bbcd..c32d931e5c 100644 --- a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/server/commands/SpreadPlayersCommand.java +++ b/net/minecraft/server/commands/SpreadPlayersCommand.java -@@ -257,11 +_,17 @@ - spreadplayerscommand$position = p_138732_[i++]; +@@ -256,11 +_,17 @@ + position = positions[positionIndex++]; } + var event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportSpreadPlayersCommand(entity, -+ (double)Mth.floor(spreadplayerscommand$position.x) + 0.5D, -+ (double)spreadplayerscommand$position.getSpawnY(p_138731_, p_138733_), -+ (double)Mth.floor(spreadplayerscommand$position.z) + 0.5D ++ (double)Mth.floor(position.x) + 0.5D, ++ (double)position.getSpawnY(level, maxHeight), ++ (double)Mth.floor(position.z) + 0.5D + ); + if (event != null) entity.teleportTo( - p_138731_, -- Mth.floor(spreadplayerscommand$position.x) + 0.5, -- spreadplayerscommand$position.getSpawnY(p_138731_, p_138733_), -- Mth.floor(spreadplayerscommand$position.z) + 0.5, + level, +- Mth.floor(position.x) + 0.5, +- position.getSpawnY(level, maxHeight), +- Mth.floor(position.z) + 0.5, + event.getTargetX(), + event.getTargetY(), + event.getTargetZ(), diff --git a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch index 4b3ffe081b..11f9610d5d 100644 --- a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch @@ -1,12 +1,23 @@ --- a/net/minecraft/server/commands/TeleportCommand.java +++ b/net/minecraft/server/commands/TeleportCommand.java -@@ -248,6 +_,9 @@ - float p_139023_, - @Nullable LookAt p_365991_ +@@ -236,14 +_,17 @@ + final CommandSourceStack source, + final Entity victim, + final ServerLevel level, +- final double x, +- final double y, +- final double z, ++ double x, ++ double y, ++ double z, + final Set relatives, + final float yRot, + final float xRot, + final @Nullable LookAt lookAt ) throws CommandSyntaxException { -+ var event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportCommand(p_139016_, p_139018_, p_139019_, p_139020_); ++ var event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportCommand(victim, x, y, z); + if (event == null) return; -+ p_139018_ = event.getTargetX(); p_139019_ = event.getTargetY(); p_139020_ = event.getTargetZ(); - BlockPos blockpos = BlockPos.containing(p_139018_, p_139019_, p_139020_); - if (!Level.isInSpawnableBounds(blockpos)) { ++ x = event.getTargetX(); y = event.getTargetY(); z = event.getTargetZ(); + BlockPos blockPos = BlockPos.containing(x, y, z); + if (!Level.isInSpawnableBounds(blockPos)) { throw INVALID_POSITION.create(); diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 27f0612f62..bf6bdbf01c 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,51 +1,51 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -93,6 +_,7 @@ +@@ -88,6 +_,7 @@ + private final ServerLinks serverLinks; private final Map codeOfConductTexts; - private @Nullable ManagementServer jsonRpcServer; - private long lastHeartbeat; + private final @Nullable ManagementServer jsonRpcServer; + private net.minecraft.client.server.@Nullable LanServerPinger dediLanPinger; public DedicatedServer( - Thread p_214789_, -@@ -189,6 +_,7 @@ - Thread thread1 = new Thread("Server console handler") { + final Thread serverThread, +@@ -167,6 +_,7 @@ + Thread consoleThread = new Thread("Server console handler") { @Override public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); - String s4; -@@ -262,11 +_,13 @@ - this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSubscribers(), RemoteDebugSampleType.TICK_TIME); - long j = Util.getNanos(); - this.services.nameToIdCache().resolveOfflineUsers(!this.usesAuthentication()); -+ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); - this.loadLevel(); - long k = Util.getNanos() - j; - String s3 = String.format(Locale.ROOT, "%.3fs", k / 1.0E9); - LOGGER.info("Done ({})! For help, type \"help\"", s3); -+ this.nextTickTimeNanos = Util.getNanos(); //Forge: Update server time to prevent watchdog/spaming during long load. - if (dedicatedserverproperties.announcePlayerAchievements != null) { - this.worldData.getGameRules().set(GameRules.SHOW_ADVANCEMENT_MESSAGES, dedicatedserverproperties.announcePlayerAchievements, this); - } -@@ -295,7 +_,12 @@ - } - - this.notificationManager().serverStarted(); -- return true; -+ if (net.minecraftforge.common.ForgeConfig.SERVER.advertiseDedicatedServerToLan.get()) { -+ this.dediLanPinger = new net.minecraft.client.server.LanServerPinger(this.getMotd(), String.valueOf(this.getServerPort())); -+ this.dediLanPinger.start(); -+ } -+ -+ return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); + String line; +@@ -241,11 +_,13 @@ + this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSubscribers(), RemoteDebugSampleType.TICK_TIME); + long levelNanoTime = Util.getNanos(); + this.services.nameToIdCache().resolveOfflineUsers(!this.usesAuthentication()); ++ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; + LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); + this.loadLevel(); + long elapsed = Util.getNanos() - levelNanoTime; + String time = String.format(Locale.ROOT, "%.3fs", elapsed / 1.0E9); + LOGGER.info("Done ({})! For help, type \"help\"", time); ++ this.nextTickTimeNanos = Util.getNanos(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (properties.announcePlayerAchievements != null) { + this.getGameRules().set(GameRules.SHOW_ADVANCEMENT_MESSAGES, properties.announcePlayerAchievements, this); } +@@ -274,7 +_,12 @@ + + this.saveEverything(false, true, true); + this.notificationManager().serverStarted(); +- return true; ++ if (net.minecraftforge.common.ForgeConfig.SERVER.advertiseDedicatedServerToLan.get()) { ++ this.dediLanPinger = new net.minecraft.client.server.LanServerPinger(this.getMotd(), String.valueOf(this.getServerPort())); ++ this.dediLanPinger.start(); ++ } ++ ++ return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); } -@@ -436,6 +_,13 @@ - LOGGER.error("Interrupted while stopping the management server", (Throwable)interruptedexception); + @Override +@@ -417,6 +_,13 @@ + LOGGER.error("Interrupted while stopping the management server", e); } } + @@ -54,14 +54,14 @@ + this.dediLanPinger = null; + } + -+ net.minecraftforge.fml.config.ConfigTracker.INSTANCE.forceUnload(); ++ net.minecraftforge.fml.config.ConfigTracker.forceUnload(); } @Override -@@ -717,8 +_,13 @@ +@@ -719,8 +_,13 @@ @Override - public void stopServer() { + protected void stopServer() { + net.minecraftforge.event.GameShuttingDownEvent.BUS.post(new net.minecraftforge.event.GameShuttingDownEvent()); this.notificationManager().serverShuttingDown(); super.stopServer(); diff --git a/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch b/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch index 24d22b6512..ad47d9f1f5 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/dedicated/ServerWatchdog.java +++ b/net/minecraft/server/dedicated/ServerWatchdog.java -@@ -78,7 +_,7 @@ - ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); - ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true); - StringBuilder stringbuilder = new StringBuilder(); -- Error error = new Error("Watchdog"); -+ Error error = new Error(String.format(java.util.Locale.ENGLISH, "ServerHangWatchdog detected that a single server tick took too long")); // Forge: don't just make a crash report with a seemingly-inexplicable Error +@@ -80,7 +_,7 @@ + ThreadInfo[] threadInfos = Util.dumpThreadInfo(); + Arrays.sort(threadInfos, THREAD_INFO_COMPARATOR); + StringBuilder builder = new StringBuilder(); +- Error exception = new Error("Watchdog (" + message + ")"); ++ Error exception = new Error("Watchdog (" + message + ") detected that a single server tick took too long"); // Forge: don't just make a crash report with a seemingly-inexplicable Error - for (ThreadInfo threadinfo : athreadinfo) { - if (threadinfo.getThreadId() == p_368427_) { + for (ThreadInfo threadInfo : threadInfos) { + if (threadInfo.getThreadId() == mainThreadId) { diff --git a/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch b/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch index 92153141c5..fbbfbafb00 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 -@@ -66,7 +_,7 @@ +@@ -58,7 +_,7 @@ - public void store(Path p_139877_) { - try (Writer writer = Files.newBufferedWriter(p_139877_, StandardCharsets.UTF_8)) { -- this.properties.store(writer, "Minecraft server properties"); -+ net.minecraftforge.common.util.SortedProperties.store(this.properties, writer, "Minecraft server properties"); - } catch (IOException ioexception) { - LOGGER.error("Failed to store properties to file: {}", p_139877_); + public void store(final Path output) { + try (Writer os = Files.newBufferedWriter(output, StandardCharsets.UTF_8)) { +- this.properties.store(os, "Minecraft server properties"); ++ net.minecraftforge.common.util.SortedProperties.store(this.properties, os, "Minecraft server properties"); + } catch (IOException e) { + LOGGER.error("Failed to store properties to file: {}", output); } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 7460d11383..b6f29e0aa7 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/gui/MinecraftServerGui.java +++ b/net/minecraft/server/gui/MinecraftServerGui.java -@@ -137,8 +_,10 @@ - return jpanel; +@@ -136,8 +_,10 @@ + return panel; } + private final java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); @@ -11,13 +11,13 @@ } public void close() { -@@ -152,6 +_,9 @@ +@@ -151,6 +_,9 @@ } - public void print(JTextArea p_139915_, JScrollPane p_139916_, String p_139917_) { + public void print(final JTextArea console, final JScrollPane scrollPane, final String line) { + try { + this.latch.await(); + } catch (InterruptedException ignored) {} // Prevent logging until after constructor has ended if (!SwingUtilities.isEventDispatchThread()) { - SwingUtilities.invokeLater(() -> this.print(p_139915_, p_139916_, p_139917_)); + SwingUtilities.invokeLater(() -> this.print(console, scrollPane, line)); } else { diff --git a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch index e4b026bff7..a4cd417234 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch @@ -1,35 +1,35 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -395,6 +_,7 @@ - this.modified = true; - } - -+ net.minecraftforge.event.ForgeEventFactory.fireChunkTicketLevelUpdated(this.level, p_140177_, p_140180_, p_140178_, p_140179_); - return p_140179_; +@@ -392,6 +_,7 @@ + this.modified = true; } + ++ net.minecraftforge.event.ForgeEventFactory.fireChunkTicketLevelUpdated(this.level, node, oldLevel, level, chunk); + return chunk; } -@@ -521,6 +_,7 @@ - if (this.pendingUnloads.remove(p_140182_, p_140183_) && chunkaccess != null) { - if (chunkaccess instanceof LevelChunk levelchunk) { - levelchunk.setLoaded(false); -+ net.minecraftforge.event.ForgeEventFactory.onChunkUnload(chunkaccess); + +@@ -522,6 +_,7 @@ + if (this.pendingUnloads.remove(pos, chunkHolder) && chunk != null) { + if (chunk instanceof LevelChunk levelChunk) { + levelChunk.setLoaded(false); ++ net.minecraftforge.event.ForgeEventFactory.onChunkUnload(chunk); } - this.save(chunkaccess); -@@ -765,6 +_,7 @@ - this.activeChunkWrites.incrementAndGet(); - SerializableChunkData serializablechunkdata = SerializableChunkData.copyOf(this.level, p_140259_); - CompletableFuture completablefuture = CompletableFuture.supplyAsync(serializablechunkdata::write, Util.backgroundExecutor()); -+ net.minecraftforge.event.ForgeEventFactory.onChunkDataSave(p_140259_, p_140259_.getWorldForge() != null ? p_140259_.getWorldForge() : this.level, serializablechunkdata); - this.write(chunkpos, completablefuture::join).handle((p_449138_, p_449139_) -> { - if (p_449139_ != null) { - this.level.getServer().reportChunkSaveFailure(p_449139_, this.storageInfo(), chunkpos); -@@ -1143,7 +_,7 @@ + this.save(chunk); +@@ -767,6 +_,7 @@ + this.activeChunkWrites.incrementAndGet(); + SerializableChunkData data = SerializableChunkData.copyOf(this.level, chunk); + CompletableFuture encodedData = CompletableFuture.supplyAsync(data::write, Util.backgroundExecutor()); ++ net.minecraftforge.event.ForgeEventFactory.onChunkDataSave(chunk, chunk.getWorldForge() != null ? chunk.getWorldForge() : this.level, data); + this.write(pos, encodedData::join).handle((ignored, throwable) -> { + if (throwable != null) { + this.level.getServer().reportChunkSaveFailure(throwable, this.storageInfo(), pos); +@@ -1142,7 +_,7 @@ } - protected void addEntity(Entity p_140200_) { -- if (!(p_140200_ instanceof EnderDragonPart)) { -+ if (!(p_140200_ instanceof net.minecraftforge.entity.PartEntity)) { - EntityType entitytype = p_140200_.getType(); - int i = entitytype.clientTrackingRange() * 16; - if (i != 0) { + protected void addEntity(final Entity entity) { +- if (!(entity instanceof EnderDragonPart)) { ++ if (!(entity instanceof net.minecraftforge.entity.PartEntity)) { + EntityType type = entity.getType(); + int range = type.clientTrackingRange() * 16; + if (range != 0) { diff --git a/patches/minecraft/net/minecraft/server/level/GenerationChunkHolder.java.patch b/patches/minecraft/net/minecraft/server/level/GenerationChunkHolder.java.patch index e6f7132fe8..dd5bbec702 100644 --- a/patches/minecraft/net/minecraft/server/level/GenerationChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/server/level/GenerationChunkHolder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/GenerationChunkHolder.java +++ b/net/minecraft/server/level/GenerationChunkHolder.java -@@ -33,6 +_,9 @@ +@@ -32,6 +_,9 @@ private final AtomicReference<@Nullable ChunkGenerationTask> task = new AtomicReference<>(); private final AtomicInteger generationRefCount = new AtomicInteger(); private volatile CompletableFuture generationSaveSyncFuture = CompletableFuture.completedFuture(null); @@ -8,5 +8,5 @@ + @org.jetbrains.annotations.ApiStatus.Internal + public net.minecraft.world.level.chunk.LevelChunk currentlyLoading; - public GenerationChunkHolder(ChunkPos p_342238_) { - this.pos = p_342238_; + public GenerationChunkHolder(final ChunkPos pos) { + this.pos = pos; diff --git a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch index e893f6db03..c76f6f6747 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch @@ -1,31 +1,14 @@ --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -182,6 +_,10 @@ - if (chunkholder == null) { - return null; - } else { -+ // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. -+ if (chunkholder.currentlyLoading != null) { -+ return chunkholder.currentlyLoading; -+ } - ChunkAccess chunkaccess1 = chunkholder.getChunkIfPresent(ChunkStatus.FULL); - if (chunkaccess1 != null) { - this.storeInCache(i, chunkaccess1, ChunkStatus.FULL); -@@ -616,5 +_,17 @@ - return super.pollTask(); - } +@@ -194,6 +_,11 @@ + return null; } -+ } + ++ // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. ++ if (chunkHolder.currentlyLoading != null) { ++ return chunkHolder.currentlyLoading; ++ } + -+ /** @deprecated Use {@link #addTicketWithRadius(TicketType, ChunkPos, int)} with {@link TicketType#FORCED} */ -+ @Deprecated(forRemoval = true, since = "1.21.5") -+ public void addRegionTicket(TicketType type, ChunkPos pos, int ticketLevel, boolean forceTicks) { -+ this.addTicketWithRadius(forceTicks ? TicketType.FORCED : type, pos, ticketLevel); -+ } -+ -+ /** @deprecated Use {@link #removeTicketWithRadius(TicketType, ChunkPos, int)} with {@link TicketType#FORCED} */ -+ @Deprecated(forRemoval = true, since = "1.21.5") -+ public void removeRegionTicket(TicketType type, ChunkPos pos, int ticketLevel, boolean forceTicks) { -+ this.removeTicketWithRadius(forceTicks ? TicketType.FORCED : type, pos, ticketLevel); - } - } + ChunkAccess chunk = chunkHolder.getChunkIfPresent(ChunkStatus.FULL); + if (chunk != null) { + this.storeInCache(pos, chunk, ChunkStatus.FULL); diff --git a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch index a46a07c1f7..30b21a502a 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -250,6 +_,7 @@ - public void removePairing(ServerPlayer p_8535_) { - this.entity.stopSeenByPlayer(p_8535_); - p_8535_.connection.send(new ClientboundRemoveEntitiesPacket(this.entity.getId())); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.entity, p_8535_); +@@ -262,6 +_,7 @@ + public void removePairing(final ServerPlayer player) { + this.entity.stopSeenByPlayer(player); + player.connection.send(new ClientboundRemoveEntitiesPacket(this.entity.getId())); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.entity, player); } - public void addPairing(ServerPlayer p_8542_) { -@@ -257,6 +_,7 @@ - this.sendPairingData(p_8542_, list::add); - p_8542_.connection.send(new ClientboundBundlePacket(list)); - this.entity.startSeenByPlayer(p_8542_); -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.entity, p_8542_); + public void addPairing(final ServerPlayer player) { +@@ -269,6 +_,7 @@ + this.sendPairingData(player, packets::add); + player.connection.send(new ClientboundBundlePacket(packets)); + this.entity.startSeenByPlayer(player); ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.entity, player); } - public void sendPairingData(ServerPlayer p_289562_, Consumer> p_289563_) { + public void sendPairingData(final ServerPlayer player, final Consumer> broadcast) { diff --git a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch index d89c4486ca..d5e687789e 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch @@ -1,19 +1,18 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -215,11 +_,13 @@ +@@ -217,10 +_,12 @@ private final List customSpawners; - private @Nullable EndDragonFight dragonFight; - final Int2ObjectMap dragonParts = new Int2ObjectOpenHashMap<>(); + private @Nullable EnderDragonFight dragonFight; + private final Int2ObjectMap dragonParts = new Int2ObjectOpenHashMap<>(); + final Int2ObjectMap> partEntities = new Int2ObjectOpenHashMap<>(); private final StructureManager structureManager; private final StructureCheck structureCheck; private final boolean tickTime; - private final RandomSequences randomSequences; - final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this); + private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this); + private net.minecraftforge.common.util.LevelCapabilityData capabilityData; public ServerLevel( - MinecraftServer p_214999_, + final MinecraftServer server, @@ -304,6 +_,18 @@ this.waypointManager = new ServerWaypointManager(); this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build(); @@ -32,35 +31,35 @@ + return getCapabilities(); } - @Deprecated -@@ -350,8 +_,8 @@ - int i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE); - if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { - if (this.getGameRules().get(GameRules.ADVANCE_TIME)) { -- long j = this.levelData.getDayTime() + 24000L; -- this.setDayTime(j - j % 24000L); -+ long j = this.getDayTime() + 24000L; -+ this.setDayTime(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, j - j % 24000L, this.getDayTime())); + @Override +@@ -367,7 +_,9 @@ + if (this.sleepStatus.areEnoughSleeping(percentage) && this.sleepStatus.areEnoughDeepSleeping(percentage, this.players)) { + Optional> defaultClock = this.dimensionType().defaultClock(); + if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) { +- this.server.clockManager().moveToTimeMarker(defaultClock.get(), ClockTimeMarkers.WAKE_UP_FROM_SLEEP); ++ long minTime = this.server.clockManager().getTotalTicks(defaultClock.get()); ++ long newTime = this.server.clockManager().getTimeMarker(defaultClock.get(), ClockTimeMarkers.WAKE_UP_FROM_SLEEP); ++ this.server.clockManager().setTotalTicks(defaultClock.get(), net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, newTime, minTime)); } this.wakeUpAllPlayers(); -@@ -422,6 +_,7 @@ - p_358707_.stopRiding(); - } +@@ -441,6 +_,7 @@ + entity.stopRiding(); + } -+ if (p_358707_.isRemoved() || p_358707_ instanceof net.minecraftforge.entity.PartEntity) return; - profilerfiller.push("tick"); - this.guardEntityTick(this::tickNonPassenger, p_358707_); - profilerfiller.pop(); -@@ -572,6 +_,7 @@ - BlockPos blockpos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, p_300602_); - BlockPos blockpos1 = blockpos.below(); - Biome biome = this.getBiome(blockpos).value(); -+ if (this.isAreaLoaded(blockpos1, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks - if (biome.shouldFreeze(this, blockpos1)) { - this.setBlockAndUpdate(blockpos1, Blocks.ICE.defaultBlockState()); ++ if (entity.isRemoved() || entity instanceof net.minecraftforge.entity.PartEntity) return; + profiler.push("tick"); + this.guardEntityTick(this::tickNonPassenger, entity); + profiler.pop(); +@@ -581,6 +_,7 @@ + BlockPos topPos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); + BlockPos belowPos = topPos.below(); + Biome biome = this.getBiome(topPos).value(); ++ if (this.isAreaLoaded(belowPos, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks + if (biome.shouldFreeze(this, belowPos)) { + this.setBlockAndUpdate(belowPos, Blocks.ICE.defaultBlockState()); } -@@ -769,8 +_,8 @@ +@@ -790,8 +_,8 @@ this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.START_RAINING, 0.0F)); } @@ -71,23 +70,23 @@ } } -@@ -807,6 +_,7 @@ - p_8648_.tickCount++; - profilerfiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_8648_.getType()).toString()); - profilerfiller.incrementCounter("tickNonPassenger"); -+ if (p_8648_.canUpdate()) - p_8648_.tick(); - profilerfiller.pop(); +@@ -829,6 +_,7 @@ + entity.tickCount++; + profiler.push(entity.typeHolder()::getRegisteredName); + profiler.incrementCounter("tickNonPassenger"); ++ if (entity.canUpdate()) + entity.tick(); + profiler.pop(); -@@ -824,6 +_,7 @@ - ProfilerFiller profilerfiller = Profiler.get(); - profilerfiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_8664_.getType()).toString()); - profilerfiller.incrementCounter("tickPassenger"); -+ if (p_8664_.canUpdate()) - p_8664_.rideTick(); - profilerfiller.pop(); +@@ -846,6 +_,7 @@ + ProfilerFiller profiler = Profiler.get(); + profiler.push(entity.typeHolder()::getRegisteredName); + profiler.incrementCounter("tickPassenger"); ++ if (entity.canUpdate()) + entity.rideTick(); + profiler.pop(); -@@ -870,6 +_,7 @@ +@@ -892,6 +_,7 @@ } else { this.entityManager.autoSave(); } @@ -95,31 +94,31 @@ } } -@@ -963,6 +_,7 @@ +@@ -983,6 +_,7 @@ } - private void addPlayer(ServerPlayer p_8854_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel(p_8854_, this)) return; - Entity entity = this.getEntity(p_8854_.getUUID()); - if (entity != null) { - LOGGER.warn("Force-added player with duplicate UUID {}", p_8854_.getUUID()); -@@ -970,7 +_,8 @@ - this.removePlayerImmediately((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); + private void addPlayer(final ServerPlayer player) { ++ if (net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel(player, this)) return; + Entity existing = this.getEntity(player.getUUID()); + if (existing != null) { + LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); +@@ -990,7 +_,8 @@ + this.removePlayerImmediately((ServerPlayer)existing, Entity.RemovalReason.DISCARDED); } -- this.entityManager.addNewEntity(p_8854_); -+ this.entityManager.addNewEntityWithoutEvent(p_8854_); -+ p_8854_.onAddedToWorld(); +- this.entityManager.addNewEntity(player); ++ this.entityManager.addNewEntityWithoutEvent(player); ++ player.onAddedToLevel(); } - private boolean addEntity(Entity p_8873_) { -@@ -978,7 +_,12 @@ - LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityType.getKey(p_8873_.getType())); + private boolean addEntity(final Entity entity) { +@@ -998,7 +_,12 @@ + LOGGER.warn("Tried to add entity {} but it was marked as removed already", entity.typeHolder().getRegisteredName()); return false; } else { -- return this.entityManager.addNewEntity(p_8873_); -+ if (this.entityManager.addNewEntity(p_8873_)) { -+ p_8873_.onAddedToWorld(); +- return this.entityManager.addNewEntity(entity); ++ if (this.entityManager.addNewEntity(entity)) { ++ entity.onAddedToLevel(); + return true; + } else { + return false; @@ -127,82 +126,99 @@ } } -@@ -1027,6 +_,12 @@ - float p_263520_, - long p_263490_ +@@ -1047,6 +_,8 @@ + final float pitch, + final long seed ) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_393402_, p_397340_, p_394643_, p_263491_, p_263542_, p_263530_, p_263520_); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, x, y, z, sound, source, volume, pitch); + if (event == null || event.getSound() == null) return; -+ p_263491_ = event.getSound(); -+ p_263542_ = event.getSource(); -+ p_263530_ = event.getNewVolume(); -+ p_263520_ = event.getNewPitch(); this.server .getPlayerList() .broadcast( -@@ -1044,6 +_,12 @@ - public void playSeededSound( - @Nullable Entity p_392657_, Entity p_394285_, Holder p_263412_, SoundSource p_263338_, float p_263352_, float p_263390_, long p_263403_ +@@ -1054,9 +_,9 @@ + x, + y, + z, +- sound.value().getRange(volume), ++ event.getSound().value().getRange(volume), + this.dimension(), +- new ClientboundSoundPacket(sound, source, x, y, z, volume, pitch, seed) ++ new ClientboundSoundPacket(event.getSound(), event.getSource(), x, y, z, event.getNewVolume(), event.getNewPitch(), seed) + ); + } + +@@ -1070,6 +_,8 @@ + final float pitch, + final long seed ) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_394285_.level(), p_394285_, p_263412_, p_263338_, p_263352_, p_263390_); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(sourceEntity.level(), sourceEntity, sound, source, volume, pitch); + if (event == null || event.getSound() == null) return; -+ p_263412_ = event.getSound(); -+ p_263338_ = event.getSource(); -+ p_263352_ = event.getNewVolume(); -+ p_263390_ = event.getNewPitch(); this.server .getPlayerList() .broadcast( -@@ -1102,6 +_,7 @@ - - @Override - public void gameEvent(Holder p_334475_, Vec3 p_215042_, GameEvent.Context p_215043_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onVanillaGameEvent(this, p_334475_, p_215042_, p_215043_)) return; - this.gameEventDispatcher.post(p_334475_, p_215042_, p_215043_); +@@ -1079,7 +_,7 @@ + sourceEntity.getZ(), + sound.value().getRange(volume), + this.dimension(), +- new ClientboundSoundEntityPacket(sound, source, sourceEntity, volume, pitch, seed) ++ new ClientboundSoundEntityPacket(event.getSound(), event.getSource(), sourceEntity, event.getNewVolume(), event.getNewPitch(), seed) + ); } -@@ -1140,16 +_,24 @@ +@@ -1128,6 +_,7 @@ @Override - public void updateNeighborsAt(BlockPos p_215045_, Block p_215046_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_215045_, this.getBlockState(p_215045_), java.util.EnumSet.allOf(Direction.class), false)) + public void gameEvent(final Holder gameEvent, final Vec3 position, final GameEvent.Context context) { ++ if (net.minecraftforge.event.ForgeEventFactory.onVanillaGameEvent(this, gameEvent, position, context)) return; + this.gameEventDispatcher.post(gameEvent, position, context); + } + +@@ -1166,11 +_,15 @@ + + @Override + public void updateNeighborsAt(final BlockPos pos, final Block sourceBlock) { ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(Direction.class), false)) + return; - this.updateNeighborsAt(p_215045_, p_215046_, ExperimentalRedstoneUtils.initialOrientation(this, null, null)); + this.updateNeighborsAt(pos, sourceBlock, ExperimentalRedstoneUtils.initialOrientation(this, null, null)); } @Override - public void updateNeighborsAt(BlockPos p_362530_, Block p_362552_, @Nullable Orientation p_367766_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_362530_, this.getBlockState(p_362530_), java.util.EnumSet.allOf(Direction.class), false)) + public void updateNeighborsAt(final BlockPos pos, final Block sourceBlock, final @Nullable Orientation orientation) { ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(Direction.class), false)) + return; - this.neighborUpdater.updateNeighborsAtExceptFromFacing(p_362530_, p_362552_, null, p_367766_); + this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, null, orientation); } - @Override - public void updateNeighborsAtExceptFromFacing(BlockPos p_215052_, Block p_215053_, Direction p_215054_, @Nullable Orientation p_370072_) { +@@ -1178,6 +_,10 @@ + public void updateNeighborsAtExceptFromFacing( + final BlockPos pos, final Block blockObject, final Direction skipDirection, final @Nullable Orientation orientation + ) { + var directions = java.util.EnumSet.allOf(Direction.class); -+ directions.remove(p_215054_); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_215052_, this.getBlockState(p_215052_), directions, false)) ++ directions.remove(skipDirection); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions, false)) + return; - this.neighborUpdater.updateNeighborsAtExceptFromFacing(p_215052_, p_215053_, p_215054_, p_370072_); + this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, blockObject, skipDirection, orientation); } -@@ -1196,12 +_,14 @@ - Explosion.BlockInteraction explosion$blockinteraction = switch (p_255827_) { +@@ -1226,7 +_,7 @@ + Explosion.BlockInteraction blockInteraction = switch (interactionType) { case NONE -> Explosion.BlockInteraction.KEEP; case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY); -- case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING) ? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; -+ case MOB -> net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this, p_256039_) ? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; +- case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING) ++ case MOB -> net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this, source) + ? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) + : Explosion.BlockInteraction.KEEP; case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY); - case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; +@@ -1234,6 +_,8 @@ }; - Vec3 vec3 = new Vec3(p_256067_, p_256370_, p_256153_); - ServerExplosion serverexplosion = new ServerExplosion(this, p_256039_, p_255778_, p_256002_, vec3, p_256045_, p_255686_, explosion$blockinteraction); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, serverexplosion)) + Vec3 center = new Vec3(x, y, z); + ServerExplosion explosion = new ServerExplosion(this, source, damageSource, damageCalculator, center, r, fire, blockInteraction); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) + return; - int i = serverexplosion.explode(); - ParticleOptions particleoptions = serverexplosion.isSmall() ? p_310962_ : p_310322_; + int blockCount = explosion.explode(); + ParticleOptions explosionParticle = explosion.isSmall() ? smallExplosionParticles : largeExplosionParticles; -@@ -1846,6 +_,11 @@ +@@ -1894,6 +_,11 @@ return this.getGameRules().get(GameRules.SPAWNER_BLOCKS_WORK); } @@ -211,37 +227,37 @@ + return this.partEntities.values(); + } + - final class EntityCallbacks implements LevelCallback { - public void onCreated(Entity p_143355_) { - if (p_143355_ instanceof WaypointTransmitter waypointtransmitter && waypointtransmitter.isTransmittingWaypoint()) { -@@ -1901,6 +_,12 @@ + private final class EntityCallbacks implements LevelCallback { + public void onCreated(final Entity entity) { + if (entity instanceof WaypointTransmitter waypoint && waypoint.isTransmittingWaypoint()) { +@@ -1949,6 +_,12 @@ } } -+ if (p_143371_.isMultipartEntity()) { -+ for (var part : p_143371_.getParts()) { ++ if (entity.isMultipartEntity()) { ++ for (var part : entity.getParts()) { + ServerLevel.this.partEntities.put(part.getId(), part); + } + } + - p_143371_.updateDynamicGameEventListener(DynamicGameEventListener::add); + entity.updateDynamicGameEventListener(DynamicGameEventListener::add); } -@@ -1929,8 +_,17 @@ +@@ -1977,8 +_,17 @@ } } -+ if (p_143375_.isMultipartEntity()) { -+ for (var part : p_143375_.getParts()) { ++ if (entity.isMultipartEntity()) { ++ for (var part : entity.getParts()) { + ServerLevel.this.partEntities.remove(part.getId()); + } + } + - p_143375_.updateDynamicGameEventListener(DynamicGameEventListener::remove); - ServerLevel.this.debugSynchronizers.dropEntity(p_143375_); + entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); + ServerLevel.this.debugSynchronizers.dropEntity(entity); + -+ p_143375_.onRemovedFromWorld(); -+ net.minecraftforge.event.ForgeEventFactory.onEntityLeaveLevel(p_143375_, ServerLevel.this); ++ entity.onRemovedFromLevel(); ++ net.minecraftforge.event.ForgeEventFactory.onEntityLeaveLevel(entity, ServerLevel.this); } - public void onSectionChange(Entity p_215086_) { + public void onSectionChange(final Entity entity) { diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch index bb85e8aaf1..f9691666ec 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -203,7 +_,8 @@ +@@ -205,7 +_,8 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -10,71 +10,71 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; -@@ -871,6 +_,7 @@ +@@ -881,6 +_,7 @@ @Override - public void die(DamageSource p_9035_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, p_9035_)) return; + public void die(final DamageSource source) { ++ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, source)) return; this.gameEvent(GameEvent.ENTITY_DIE); - boolean flag = this.level().getGameRules().get(GameRules.SHOW_DEATH_MESSAGES); - if (flag) { -@@ -1080,6 +_,7 @@ + boolean showDeathMessage = this.level().getGameRules().get(GameRules.SHOW_DEATH_MESSAGES); + if (showDeathMessage) { +@@ -1093,6 +_,7 @@ } - public @Nullable ServerPlayer teleport(TeleportTransition p_361322_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onTravelToDimension(this, p_361322_.newLevel().dimension())) return null; + public @Nullable ServerPlayer teleport(final TeleportTransition transition) { ++ if (net.minecraftforge.event.ForgeEventFactory.onTravelToDimension(this, transition.newLevel().dimension())) return null; if (this.isRemoved()) { return null; - } else { -@@ -1107,7 +_,7 @@ - PlayerList playerlist = this.server.getPlayerList(); - playerlist.sendPlayerPermissionLevel(this); - serverlevel1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); -- this.unsetRemoved(); -+ this.revive(); - ProfilerFiller profilerfiller = Profiler.get(); - profilerfiller.push("moving"); - if (resourcekey == Level.OVERWORLD && serverlevel.dimension() == Level.NETHER) { -@@ -1132,6 +_,7 @@ - this.lastSentHealth = -1.0F; - this.lastSentFood = -1; - this.teleportSpectators(p_361322_, serverlevel1); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerChangedDimension(this, resourcekey, p_361322_.newLevel().dimension()); - return this; - } } -@@ -1173,10 +_,13 @@ +@@ -1122,7 +_,7 @@ + PlayerList playerList = this.server.getPlayerList(); + playerList.sendPlayerPermissionLevel(this); + oldLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); +- this.unsetRemoved(); ++ this.revive(); + ProfilerFiller profiler = Profiler.get(); + profiler.push("moving"); + if (lastDimension == Level.OVERWORLD && newLevel.dimension() == Level.NETHER) { +@@ -1147,6 +_,7 @@ + this.lastSentHealth = -1.0F; + this.lastSentFood = -1; + this.teleportSpectators(transition, oldLevel); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerChangedDimension(this, lastDimension, transition.newLevel().dimension()); + return this; + } + +@@ -1186,10 +_,13 @@ @Override - public Either startSleepInBed(BlockPos p_9115_) { -+ var optAt = java.util.Optional.of(p_9115_); + public Either startSleepInBed(final BlockPos pos) { ++ var optAt = java.util.Optional.of(pos); + var ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); + if (ret != null) return Either.left(ret); - Direction direction = this.level().getBlockState(p_9115_).getValue(HorizontalDirectionalBlock.FACING); + Direction direction = this.level().getBlockState(pos).getValue(HorizontalDirectionalBlock.FACING); if (!this.isSleeping() && this.isAlive()) { - BedRule bedrule = this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, p_9115_); -- boolean flag = bedrule.canSleep(this.level()); -+ boolean flag = !net.minecraftforge.event.ForgeEventFactory.onSleepingTimeCheck(this, optAt, bedrule); - boolean flag1 = bedrule.canSetSpawn(this.level()); - if (!flag1 && !flag) { - return Either.left(bedrule.asProblem()); -@@ -1243,6 +_,7 @@ + BedRule rule = this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, pos); +- boolean canSleep = rule.canSleep(this.level()); ++ boolean canSleep = net.minecraftforge.event.ForgeEventFactory.onSleepingTimeCheck(this, optAt, rule); + boolean canSetSpawn = rule.canSetSpawn(this.level()); + if (!canSetSpawn && !canSleep) { + return Either.left(rule.asProblem()); +@@ -1250,6 +_,7 @@ } - private boolean bedInRange(BlockPos p_9117_, Direction p_9118_) { -+ if (p_9118_ == null) return false; - return this.isReachableBedBlock(p_9117_) || this.isReachableBedBlock(p_9117_.relative(p_9118_.getOpposite())); + private boolean bedInRange(final BlockPos pos, final Direction direction) { ++ if (direction == null) return false; + return this.isReachableBedBlock(pos) || this.isReachableBedBlock(pos.relative(direction.getOpposite())); } -@@ -1346,6 +_,7 @@ - this.connection.send(new ClientboundOpenScreenPacket(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName())); - this.initMenu(abstractcontainermenu); - this.containerMenu = abstractcontainermenu; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerOpenContainer(this, this.containerMenu); - return OptionalInt.of(this.containerCounter); - } +@@ -1354,6 +_,7 @@ + this.connection.send(new ClientboundOpenScreenPacket(menu.containerId, menu.getType(), provider.getDisplayName())); + this.initMenu(menu); + this.containerMenu = menu; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerOpenContainer(this, this.containerMenu); + return OptionalInt.of(this.containerCounter); } -@@ -1408,6 +_,7 @@ + } +@@ -1422,6 +_,7 @@ public void doCloseContainer() { this.containerMenu.removed(this); this.inventoryMenu.transferState(this.containerMenu); @@ -82,41 +82,44 @@ this.containerMenu = this.inventoryMenu; } -@@ -1630,6 +_,15 @@ - this.setShoulderEntityRight(p_9016_.getShoulderEntityRight()); - this.setLastDeathLocation(p_9016_.getLastDeathLocation()); - this.waypointIcon().copyFrom(p_9016_.waypointIcon()); +@@ -1641,6 +_,15 @@ + this.setShoulderEntityRight(oldPlayer.getShoulderEntityRight()); + this.setLastDeathLocation(oldPlayer.getLastDeathLocation()); + this.waypointIcon().copyFrom(oldPlayer.waypointIcon()); + + //Copy over a section of the Entity Data from the old player. + //Allows mods to specify data that persists after players respawn. -+ var old = p_9016_.getPersistentData(); ++ var old = oldPlayer.getPersistentData(); + if (old.contains(PERSISTED_NBT_TAG)) + getPersistentData().put(PERSISTED_NBT_TAG, old.get(PERSISTED_NBT_TAG)); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_9016_, !p_9017_); -+ this.tabListHeader = p_9016_.tabListHeader; -+ this.tabListFooter = p_9016_.tabListFooter; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !restoreAll); ++ this.tabListHeader = oldPlayer.tabListHeader; ++ this.tabListFooter = oldPlayer.tabListFooter; } - private void transferInventoryXpAndScore(Player p_460820_) { -@@ -1738,6 +_,7 @@ + private void transferInventoryXpAndScore(final Player oldPlayer) { +@@ -1750,8 +_,9 @@ + return (ServerLevel)super.level(); + } - public boolean setGameMode(GameType p_143404_) { - boolean flag = this.isSpectator(); -+ p_143404_ = net.minecraftforge.common.ForgeHooks.onChangeGameType(this, this.gameMode.getGameModeForPlayer(), p_143404_); - if (!this.gameMode.changeGameModeForPlayer(p_143404_)) { +- public boolean setGameMode(final GameType mode) { ++ public boolean setGameMode(GameType mode) { + boolean wasSpectator = this.isSpectator(); ++ mode = net.minecraftforge.common.ForgeHooks.onChangeGameType(this, this.gameMode.getGameModeForPlayer(), mode); + if (!this.gameMode.changeGameModeForPlayer(mode)) { return false; - } else { -@@ -1891,6 +_,9 @@ - public void setCamera(@Nullable Entity p_9214_) { - Entity entity = this.getCamera(); - this.camera = (Entity)(p_9214_ == null ? this : p_9214_); + } +@@ -1935,6 +_,9 @@ + public void setCamera(final @Nullable Entity newCamera) { + Entity oldCamera = this.getCamera(); + this.camera = newCamera == null ? this : newCamera; + while (this.camera instanceof net.minecraftforge.entity.PartEntity partEntity) { + this.camera = partEntity.getParent(); // FORGE: fix MC-46486 + } - if (entity != this.camera) { - if (this.camera.level() instanceof ServerLevel serverlevel) { - this.teleportTo( -@@ -1928,7 +_,11 @@ + if (oldCamera != this.camera) { + if (this.camera.level() instanceof ServerLevel level) { + this.teleportTo(level, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false); +@@ -1961,7 +_,11 @@ } public @Nullable Component getTabListDisplayName() { @@ -129,33 +132,34 @@ } public int getTabListOrder() { -@@ -1962,6 +_,7 @@ +@@ -1995,6 +_,7 @@ } - public void setRespawnPosition(ServerPlayer.@Nullable RespawnConfig p_396560_, boolean p_9162_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_396560_)) return; - if (p_9162_ && p_396560_ != null && !p_396560_.isSamePosition(this.respawnConfig)) { + public void setRespawnPosition(final ServerPlayer.@Nullable RespawnConfig respawnConfig, final boolean showMessage) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, respawnConfig)) return; + if (showMessage && respawnConfig != null && !respawnConfig.isSamePosition(this.respawnConfig)) { this.sendSystemMessage(SPAWN_SET_MESSAGE); } -@@ -2049,13 +_,16 @@ +@@ -2082,6 +_,9 @@ - public void drop(boolean p_182295_) { + public void drop(final boolean all) { Inventory inventory = this.getInventory(); + ItemStack selected = inventory.getSelectedItem(); + if (selected.isEmpty() || !selected.onDroppedByPlayer(this)) return; -+ if (isUsingItem() && getUsedItemHand() == InteractionHand.MAIN_HAND && (p_182295_ || selected.getCount() == 1)) stopUsingItem(); // Forge: fix MC-231097 on the serverside - ItemStack itemstack = inventory.removeFromSelected(p_182295_); - this.containerMenu.findSlot(inventory, inventory.getSelectedSlot()).ifPresent(p_390148_ -> this.containerMenu.setRemoteSlot(p_390148_, inventory.getSelectedItem())); - if (this.useItem.isEmpty()) { ++ if (isUsingItem() && getUsedItemHand() == InteractionHand.MAIN_HAND && (all || selected.getCount() == 1)) stopUsingItem(); // Forge: fix MC-231097 on the serverside + ItemStack removed = inventory.removeFromSelected(all); + this.containerMenu + .findSlot(inventory, inventory.getSelectedSlot()) +@@ -2090,7 +_,7 @@ this.stopUsingItem(); } -- this.drop(itemstack, false, true); -+ net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemstack, true); +- this.drop(removed, false, true); ++ net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, removed, true); } @Override -@@ -2157,6 +_,75 @@ +@@ -2192,6 +_,75 @@ public @Nullable BlockPos getRaidOmenPosition() { return this.raidOmenPosition; diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch index 723a265226..0f23261e57 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -1,91 +1,92 @@ --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -149,6 +_,10 @@ - } - - public void handleBlockBreakAction(BlockPos p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(player, p_215120_, p_215122_, p_215121_); +@@ -150,6 +_,10 @@ + public void handleBlockBreakAction( + final BlockPos pos, final ServerboundPlayerActionPacket.Action action, final Direction direction, final int maxY, final int sequence + ) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(player, pos, direction, action); + if (event == null) { + return; + } - if (!this.player.isWithinBlockInteractionRange(p_215120_, 1.0)) { - this.debugLogging(p_215120_, false, p_215124_, "too far"); - } else if (p_215120_.getY() > p_215123_) { -@@ -177,6 +_,7 @@ - float f = 1.0F; - BlockState blockstate = this.level.getBlockState(p_215120_); - if (!blockstate.isAir()) { + if (!this.player.isWithinBlockInteractionRange(pos, 1.0)) { + this.debugLogging(pos, false, sequence, "too far"); + } else if (pos.getY() > maxY) { +@@ -184,6 +_,7 @@ + float progress = 1.0F; + BlockState blockState = this.level.getBlockState(pos); + if (!blockState.isAir()) { + if (!event.getUseBlock().isDenied()) { EnchantmentHelper.onHitBlock( this.level, this.player.getMainHandItem(), -@@ -188,6 +_,7 @@ - p_343810_ -> this.player.onEquippedItemBroken(p_343810_, EquipmentSlot.MAINHAND) +@@ -195,6 +_,7 @@ + item -> this.player.onEquippedItemBroken(item, EquipmentSlot.MAINHAND) ); - blockstate.attack(this.level, p_215120_, this.player); + blockState.attack(this.level, pos, this.player); + } - f = blockstate.getDestroyProgress(this.player, this.player.level(), p_215120_); + progress = blockState.getDestroyProgress(this.player, this.player.level(), pos); } -@@ -254,7 +_,8 @@ +@@ -261,7 +_,8 @@ - public boolean destroyBlock(BlockPos p_9281_) { - BlockState blockstate1 = this.level.getBlockState(p_9281_); -- if (!this.player.getMainHandItem().canDestroyBlock(blockstate1, this.level, p_9281_, this.player)) { -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(level, gameModeForPlayer, player, p_9281_); + public boolean destroyBlock(final BlockPos pos) { + BlockState state = this.level.getBlockState(pos); +- if (!this.player.getMainHandItem().canDestroyBlock(state, this.level, pos, this.player)) { ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(level, gameModeForPlayer, player, pos); + if (exp == -1) { return false; - } else { - BlockEntity blockentity = this.level.getBlockEntity(p_9281_); -@@ -262,34 +_,50 @@ - if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { - this.level.sendBlockUpdated(p_9281_, blockstate1, blockstate1, 3); - return false; -+ } else if (player.getMainHandItem().onBlockStartBreak(p_9281_, player)) { -+ return false; - } else if (this.player.blockActionRestricted(this.level, p_9281_, this.gameModeForPlayer)) { - return false; - } else { -- BlockState blockstate = block.playerWillDestroy(this.level, p_9281_, blockstate1, this.player); -- boolean flag1 = this.level.removeBlock(p_9281_, false); -- if (SharedConstants.DEBUG_BLOCK_BREAK) { -- LOGGER.info("server broke {} {} -> {}", p_9281_, blockstate, this.level.getBlockState(p_9281_)); -- } -- -- if (flag1) { -- block.destroy(this.level, p_9281_, blockstate); -- } -- -+ BlockState blockstate = blockstate1; - if (this.player.preventsBlockDrops()) { -+ removeBlock(p_9281_, false); - return true; - } else { - ItemStack itemstack = this.player.getMainHandItem(); - ItemStack itemstack1 = itemstack.copy(); -- boolean flag = this.player.hasCorrectToolForDrops(blockstate); -+ boolean flag = blockstate.canHarvestBlock(this.level, p_9281_, this.player); // previously player.hasCorrectToolForDrops(blockstate) - itemstack.mineBlock(this.level, blockstate, p_9281_, this.player); -+ -+ if (itemstack.isEmpty() && !itemstack1.isEmpty()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, itemstack1, InteractionHand.MAIN_HAND); -+ } -+ boolean flag1 = removeBlock(p_9281_, flag); -+ - if (flag1 && flag) { - block.playerDestroy(this.level, this.player, p_9281_, blockstate, blockentity, itemstack1); - } - -+ if (flag && exp > 0) { -+ blockstate1.getBlock().popExperience(level, p_9281_, exp); -+ } -+ - return true; - } - } } -+ } + +@@ -272,35 +_,53 @@ + return false; + } + ++ if (player.getMainHandItem().onBlockStartBreak(pos, player)) { ++ return false; ++ } + + if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { + return false; + } + +- BlockState adjustedState = block.playerWillDestroy(this.level, pos, state, this.player); +- boolean changed = this.level.removeBlock(pos, false); +- if (SharedConstants.DEBUG_BLOCK_BREAK) { +- LOGGER.info("server broke {} {} -> {}", pos, adjustedState, this.level.getBlockState(pos)); +- } +- +- if (changed) { +- block.destroy(this.level, pos, adjustedState); +- } +- ++ BlockState adjustedState = state; + if (this.player.preventsBlockDrops()) { ++ removeBlock(pos, false); + return true; + } + + ItemStack itemStack = this.player.getMainHandItem(); + ItemStack destroyedWith = itemStack.copy(); +- boolean canDestroy = this.player.hasCorrectToolForDrops(adjustedState); ++ boolean canDestroy = adjustedState.canHarvestBlock(this.level, pos, this.player); // previously player.hasCorrectToolForDrops(blockstate) + itemStack.mineBlock(this.level, adjustedState, pos, this.player); ++ ++ if (itemStack.isEmpty() && !destroyedWith.isEmpty()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, destroyedWith, InteractionHand.MAIN_HAND); ++ } ++ boolean changed = removeBlock(pos, canDestroy); ++ + if (changed && canDestroy) { + block.playerDestroy(this.level, this.player, pos, adjustedState, blockEntity, destroyedWith); + } + ++ if (canDestroy && exp > 0) { ++ state.getBlock().popExperience(level, pos, exp); ++ } ++ + return true; + } + + private boolean removeBlock(BlockPos pos, boolean canHarvest) { + BlockState state = this.level.getBlockState(pos); + boolean removed = state.onDestroyedByPlayer(this.level, pos, this.player, canHarvest, this.level.getFluidState(pos)); @@ -96,56 +97,55 @@ + state.getBlock().destroy(this.level, pos, state); + } + return removed; - } - - public InteractionResult useItem(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) { -@@ -298,6 +_,8 @@ - } else if (p_9262_.getCooldowns().isOnCooldown(p_9264_)) { - return InteractionResult.PASS; - } else { -+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_9262_, p_9265_); -+ if (cancelResult != null) return cancelResult; - int i = p_9264_.getCount(); - int j = p_9264_.getDamageValue(); - InteractionResult interactionresult = p_9264_.use(p_9263_, p_9262_, p_9265_); -@@ -336,6 +_,11 @@ - if (!blockstate.getBlock().isEnabled(p_9267_.enabledFeatures())) { - return InteractionResult.FAIL; - } else if (this.gameModeForPlayer == GameType.SPECTATOR) { -+ } ++ } + -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(p_9266_, p_9269_, blockpos, p_9270_); + public InteractionResult useItem(final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand) { + if (this.gameModeForPlayer == GameType.SPECTATOR) { + return InteractionResult.PASS; +@@ -310,6 +_,8 @@ + return InteractionResult.PASS; + } + ++ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(player, hand); ++ if (cancelResult != null) return cancelResult; + int oldCount = itemStack.getCount(); + int oldDamage = itemStack.getDamageValue(); + InteractionResult result = itemStack.use(level, player, hand); +@@ -355,6 +_,8 @@ + return InteractionResult.FAIL; + } + ++ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(player, hand, pos, hitResult); + if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock.BUS.post(event)) return event.getCancellationResult(); -+ if (this.gameModeForPlayer == GameType.SPECTATOR) { - MenuProvider menuprovider = blockstate.getMenuProvider(p_9267_, blockpos); - if (menuprovider != null) { - p_9266_.openMenu(menuprovider); -@@ -344,10 +_,16 @@ + if (this.gameModeForPlayer == GameType.SPECTATOR) { + MenuProvider menuProvider = state.getMenuProvider(level, pos); + if (menuProvider != null) { +@@ -364,10 +_,16 @@ return InteractionResult.PASS; } } else { -+ UseOnContext useoncontext = new UseOnContext(p_9266_, p_9269_, p_9270_); ++ UseOnContext context = new UseOnContext(player, hand, hitResult); + if (!event.getUseItem().isDenied()) { -+ InteractionResult result = p_9268_.onItemUseFirst(useoncontext); ++ InteractionResult result = itemStack.onItemUseFirst(context); + if (result != InteractionResult.PASS) return result; + } - boolean flag = !p_9266_.getMainHandItem().isEmpty() || !p_9266_.getOffhandItem().isEmpty(); - boolean flag1 = p_9266_.isSecondaryUseActive() && flag; -+ flag1 &= !(p_9266_.getMainHandItem().doesSneakBypassUse(p_9267_, blockpos, p_9266_) && p_9266_.getOffhandItem().doesSneakBypassUse(p_9267_, blockpos, p_9266_)); - ItemStack itemstack = p_9268_.copy(); -- if (!flag1) { -+ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !flag1)) { - InteractionResult interactionresult = blockstate.useItemOn(p_9266_.getItemInHand(p_9269_), p_9267_, p_9266_, p_9269_, p_9270_); - if (interactionresult.consumesAction()) { - CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(p_9266_, blockpos, itemstack); -@@ -363,8 +_,8 @@ + boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty(); + boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands; ++ suppressUsingBlock &= !(player.getMainHandItem().doesSneakBypassUse(level, pos, player) && player.getOffhandItem().doesSneakBypassUse(level, pos, player)); + ItemStack usedItemStack = itemStack.copy(); +- if (!suppressUsingBlock) { ++ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !suppressUsingBlock)) { + InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); + if (itemUse.consumesAction()) { + CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack); +@@ -383,8 +_,8 @@ } } -- if (!p_9268_.isEmpty() && !p_9266_.getCooldowns().isOnCooldown(p_9268_)) { -- UseOnContext useoncontext = new UseOnContext(p_9266_, p_9269_, p_9270_); -+ if (event.getUseItem().isAllowed() || (!p_9268_.isEmpty() && !p_9266_.getCooldowns().isOnCooldown(p_9268_))) { +- if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack)) { +- UseOnContext context = new UseOnContext(player, hand, hitResult); ++ if (event.getUseItem().isAllowed() || (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack))) { + if (event.getUseItem().isDenied()) return InteractionResult.PASS; - InteractionResult interactionresult2; - if (p_9266_.hasInfiniteMaterials()) { - int i = p_9268_.getCount(); + InteractionResult success; + if (player.hasInfiniteMaterials()) { + int count = itemStack.getCount(); diff --git a/patches/minecraft/net/minecraft/server/level/ThreadedLevelLightEngine.java.patch b/patches/minecraft/net/minecraft/server/level/ThreadedLevelLightEngine.java.patch index 106618b1e4..f78bae86a7 100644 --- a/patches/minecraft/net/minecraft/server/level/ThreadedLevelLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ThreadedLevelLightEngine.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/net/minecraft/server/level/ThreadedLevelLightEngine.java -@@ -176,6 +_,7 @@ - }, () -> "lightChunk " + chunkpos + " " + p_9355_)); +@@ -175,6 +_,7 @@ + }, () -> "lightChunk " + pos + " " + lighted)); return CompletableFuture.supplyAsync(() -> { - p_9354_.setLightCorrect(true); -+ net.minecraftforge.common.ForgeHooks.fireLightingCalculatedEvent(p_9354_); - return p_9354_; - }, p_280982_ -> this.addTask(chunkpos.x, chunkpos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, p_280982_)); + centerChunk.setLightCorrect(true); ++ net.minecraftforge.common.ForgeHooks.fireLightingCalculatedEvent(centerChunk); + return centerChunk; + }, r -> this.addTask(pos.x(), pos.z(), ThreadedLevelLightEngine.TaskType.POST_UPDATE, r)); } diff --git a/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch index 8edd68c597..267dd699cc 100644 --- a/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java -@@ -314,6 +_,7 @@ +@@ -341,6 +_,7 @@ @Override - public boolean addFreshEntity(Entity p_9580_) { -+ if (p_9580_ instanceof net.minecraft.world.entity.Mob mob && mob.isSpawnCancelled()) return false; - int i = SectionPos.blockToSectionCoord(p_9580_.getBlockX()); - int j = SectionPos.blockToSectionCoord(p_9580_.getBlockZ()); - this.getChunk(i, j).addEntity(p_9580_); + public boolean addFreshEntity(final Entity entity) { ++ if (entity instanceof net.minecraft.world.entity.Mob mob && mob.isSpawnCancelled()) return false; + int xc = SectionPos.blockToSectionCoord(entity.getBlockX()); + int zc = SectionPos.blockToSectionCoord(entity.getBlockZ()); + this.getChunk(xc, zc).addEntity(entity); diff --git a/patches/minecraft/net/minecraft/server/network/ConfigurationTask.java.patch b/patches/minecraft/net/minecraft/server/network/ConfigurationTask.java.patch index 03ccb6d590..12c0c8c03d 100644 --- a/patches/minecraft/net/minecraft/server/network/ConfigurationTask.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ConfigurationTask.java.patch @@ -8,6 +8,6 @@ + start(ctx::send); + } + - void start(Consumer> p_299398_); + void start(Consumer> connection); default boolean tick() { diff --git a/patches/minecraft/net/minecraft/server/network/EventLoopGroupHolder.java.patch b/patches/minecraft/net/minecraft/server/network/EventLoopGroupHolder.java.patch index dd2fe2fc5c..d6585479fe 100644 --- a/patches/minecraft/net/minecraft/server/network/EventLoopGroupHolder.java.patch +++ b/patches/minecraft/net/minecraft/server/network/EventLoopGroupHolder.java.patch @@ -6,10 +6,10 @@ private volatile @Nullable EventLoopGroup group; + private volatile @Nullable EventLoopGroup groupClient; - public static EventLoopGroupHolder remote(boolean p_453425_) { - if (p_453425_) { + public static EventLoopGroupHolder remote(final boolean allowNativeTransport) { + if (allowNativeTransport) { @@ -77,24 +_,31 @@ - this.serverChannelCls = p_455144_; + this.serverChannelCls = serverChannelCls; } - private ThreadFactory createThreadFactory() { @@ -27,24 +27,24 @@ } public EventLoopGroup eventLoopGroup() { -- EventLoopGroup eventloopgroup = this.group; +- EventLoopGroup result = this.group; + return eventLoopGroup(false); + } + + public EventLoopGroup eventLoopGroup(boolean client) { -+ EventLoopGroup eventloopgroup = client ? this.groupClient : this.group; - if (eventloopgroup == null) { ++ EventLoopGroup result = client ? this.groupClient : this.group; + if (result == null) { synchronized (this) { -- eventloopgroup = this.group; -+ eventloopgroup = client ? this.groupClient : this.group; - if (eventloopgroup == null) { -- eventloopgroup = this.createEventLoopGroup(); -- this.group = eventloopgroup; -+ eventloopgroup = this.createEventLoopGroup(client); +- result = this.group; ++ result = client ? this.groupClient : this.group; + if (result == null) { +- result = this.createEventLoopGroup(); +- this.group = result; ++ result = this.createEventLoopGroup(client); + if (client) -+ this.groupClient = eventloopgroup; ++ this.groupClient = result; + else -+ this.group = eventloopgroup; ++ this.group = result; } } } diff --git a/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch index 2fb993558c..6458aa4e0c 100644 --- a/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch @@ -3,8 +3,8 @@ @@ -19,6 +_,7 @@ @Override - public void handleIntention(ClientIntentionPacket p_9697_) { -+ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(p_9697_, this.connection)) return; - if (p_9697_.intention() != ClientIntent.LOGIN) { - throw new UnsupportedOperationException("Invalid intention " + p_9697_.intention()); - } else { + public void handleIntention(final ClientIntentionPacket packet) { ++ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(packet, this.connection)) return; + if (packet.intention() != ClientIntent.LOGIN) { + throw new UnsupportedOperationException("Invalid intention " + packet.intention()); + } diff --git a/patches/minecraft/net/minecraft/server/network/PlayerChunkSender.java.patch b/patches/minecraft/net/minecraft/server/network/PlayerChunkSender.java.patch index 28b9533f0f..2da35ea530 100644 --- a/patches/minecraft/net/minecraft/server/network/PlayerChunkSender.java.patch +++ b/patches/minecraft/net/minecraft/server/network/PlayerChunkSender.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/server/network/PlayerChunkSender.java +++ b/net/minecraft/server/network/PlayerChunkSender.java @@ -44,6 +_,7 @@ - public void dropChunk(ServerPlayer p_298166_, ChunkPos p_300687_) { - if (!this.pendingChunks.remove(p_300687_.toLong()) && p_298166_.isAlive()) { - p_298166_.connection.send(new ClientboundForgetLevelChunkPacket(p_300687_)); -+ net.minecraftforge.event.ForgeEventFactory.fireChunkUnWatch(p_298166_, p_300687_, (ServerLevel) p_298166_.level()); + public void dropChunk(final ServerPlayer player, final ChunkPos pos) { + if (!this.pendingChunks.remove(pos.pack()) && player.isAlive()) { + player.connection.send(new ClientboundForgetLevelChunkPacket(pos)); ++ net.minecraftforge.event.ForgeEventFactory.fireChunkUnWatch(player, pos, (ServerLevel)player.level()); } } @@ -81,6 +_,7 @@ } - p_298120_.debugSynchronizers().startTrackingChunk(p_299748_.player, p_297712_.getPos()); -+ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_299748_.player, p_297712_, p_298120_); + level.debugSynchronizers().startTrackingChunk(connection.player, chunk.getPos()); ++ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(connection.player, chunk, level); } - private List collectChunksToSend(ChunkMap p_298180_, ChunkPos p_298514_) { + private List collectChunksToSend(final ChunkMap chunkMap, final ChunkPos playerPos) { diff --git a/patches/minecraft/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch index 8c96fcb402..8038b1e326 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch @@ -3,15 +3,15 @@ @@ -93,6 +_,7 @@ @Override - public void handleCustomPayload(ServerboundCustomPayloadPacket p_300164_) { -+ net.minecraftforge.common.ForgeHooks.onCustomPayload(p_300164_.payload(), this.connection); + public void handleCustomPayload(final ServerboundCustomPayloadPacket packet) { ++ net.minecraftforge.common.ForgeHooks.onCustomPayload(packet.payload(), this.connection); } @Override -@@ -202,5 +_,9 @@ +@@ -201,5 +_,9 @@ - protected CommonListenerCookie createCookie(ClientInformation p_297318_) { - return new CommonListenerCookie(this.playerProfile(), this.latency, p_297318_, this.transferred); + protected CommonListenerCookie createCookie(final ClientInformation clientInformation) { + return new CommonListenerCookie(this.playerProfile(), this.latency, clientInformation, this.transferred); + } + + public Connection getConnection() { diff --git a/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch index 211489b6f0..002bd84c0c 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java -@@ -47,17 +_,20 @@ +@@ -46,17 +_,20 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final Component DISCONNECT_REASON_INVALID_DATA = Component.translatable("multiplayer.disconnect.invalid_player_data"); private static final Component DISCONNECT_REASON_CONFIGURATION_ERROR = Component.translatable("multiplayer.disconnect.configuration_error"); @@ -13,24 +13,24 @@ private @Nullable PrepareSpawnTask prepareSpawnTask; + private final net.minecraftforge.network.config.ConfigurationTaskContext taskContext; - public ServerConfigurationPacketListenerImpl(MinecraftServer p_301415_, Connection p_298106_, CommonListenerCookie p_301309_) { - super(p_301415_, p_298106_, p_301309_); - this.gameProfile = p_301309_.gameProfile(); - this.clientInformation = p_301309_.clientInformation(); -+ this.taskContext = new net.minecraftforge.network.config.ConfigurationTaskContext(p_298106_, this::send, this::finishCurrentTask); + public ServerConfigurationPacketListenerImpl(final MinecraftServer server, final Connection connection, final CommonListenerCookie cookie) { + super(server, connection, cookie); + this.gameProfile = cookie.gameProfile(); + this.clientInformation = cookie.clientInformation(); ++ this.taskContext = new net.minecraftforge.network.config.ConfigurationTaskContext(connection, this::send, this::finishCurrentTask); } @Override -@@ -81,18 +_,23 @@ +@@ -80,22 +_,27 @@ return this.connection.isConnected(); } - public void startConfiguration() { + public void vanillaStart() { this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName()))); - ServerLinks serverlinks = this.server.serverLinks(); - if (!serverlinks.isEmpty()) { - this.send(new ClientboundServerLinksPacket(serverlinks.untrust())); + ServerLinks serverLinks = this.server.serverLinks(); + if (!serverLinks.isEmpty()) { + this.send(new ClientboundServerLinksPacket(serverLinks.untrust())); } + this.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(this.server.getWorldData().enabledFeatures()))); @@ -38,21 +38,25 @@ + + public void startConfiguration() { + net.minecraftforge.event.ForgeEventFactory.gatherLoginConfigTasks(this.connection, this.configurationTasks::add); - LayeredRegistryAccess layeredregistryaccess = this.server.registries(); - List list = this.server.getResourceManager().listPacks().flatMap(p_326454_ -> p_326454_.location().knownPackInfo().stream()).toList(); + LayeredRegistryAccess registries = this.server.registries(); + List knownPacks = this.server + .getResourceManager() + .listPacks() + .flatMap(packResources -> packResources.location().knownPackInfo().stream()) + .toList(); - this.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(this.server.getWorldData().enabledFeatures()))); - this.synchronizeRegistriesTask = new SynchronizeRegistriesTask(list, layeredregistryaccess); + this.synchronizeRegistriesTask = new SynchronizeRegistriesTask(knownPacks, registries); this.configurationTasks.add(this.synchronizeRegistriesTask); + this.configurationTasks.add(new net.minecraftforge.network.config.SimpleConfigurationTask(VANILLA_START, this::vanillaStart)); this.addOptionalTasks(); this.returnToWorld(); } -@@ -208,7 +_,7 @@ - this.currentTask = configurationtask; +@@ -213,7 +_,7 @@ + this.currentTask = task; try { -- configurationtask.start(this::send); -+ configurationtask.start(this.taskContext); - } catch (Exception exception) { - LOGGER.error("Failed to start configuration task {}", configurationtask.type(), exception); +- task.start(this::send); ++ task.start(this.taskContext); + } catch (Exception e) { + LOGGER.error("Failed to start configuration task {}", task.type(), e); this.disconnect(DISCONNECT_REASON_CONFIGURATION_ERROR); diff --git a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch index 6a617e090e..3e7eab4ee0 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -1,28 +1,37 @@ --- a/net/minecraft/server/network/ServerConnectionListener.java +++ b/net/minecraft/server/network/ServerConnectionListener.java -@@ -37,6 +_,7 @@ +@@ -40,6 +_,7 @@ import org.slf4j.Logger; public class ServerConnectionListener { + private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30")); private static final Logger LOGGER = LogUtils.getLogger(); - final MinecraftServer server; + private final MinecraftServer server; public volatile boolean running; -@@ -49,6 +_,8 @@ +@@ -53,6 +_,8 @@ } - public void startTcpServerListener(@Nullable InetAddress p_9712_, int p_9713_) throws IOException { -+ if (p_9712_ == null) p_9712_ = new java.net.InetSocketAddress(p_9713_).getAddress(); -+ net.minecraftforge.network.DualStackUtils.checkIPv6(p_9712_); + public void startTcpServerListener(final @Nullable InetAddress address, final int port) throws IOException { ++ var fixedAddress = address != null ? address : new java.net.InetSocketAddress(port).getAddress(); ++ net.minecraftforge.network.DualStackUtils.checkIPv6(fixedAddress); synchronized (this.channels) { - EventLoopGroupHolder eventloopgroupholder = EventLoopGroupHolder.remote(this.server.useNativeTransport()); - this.channels.add(new ServerBootstrap().channel(eventloopgroupholder.serverChannelCls()).childHandler(new ChannelInitializer() { -@@ -59,7 +_,7 @@ - } catch (ChannelException channelexception) { - } + EventLoopGroupHolder eventLoopGroupHolder = EventLoopGroupHolder.remote(this.server.useNativeTransport()); + this.channels +@@ -68,7 +_,7 @@ + } catch (ChannelException var5) { + } -- ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)); -+ ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)); - if (ServerConnectionListener.this.server.repliesToStatus()) { - channelpipeline.addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); - } +- ChannelPipeline pipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)); ++ ChannelPipeline pipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)); + if (ServerConnectionListener.this.server.repliesToStatus()) { + pipeline.addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); + } +@@ -87,7 +_,7 @@ + } + ) + .group(eventLoopGroupHolder.eventLoopGroup()) +- .localAddress(address, port) ++ .localAddress(fixedAddress, port) + .bind() + .syncUninterruptibly() + ); diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 694cede4fd..41650457d9 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1213,9 +_,10 @@ +@@ -1297,9 +_,10 @@ } case SWAP_ITEM_WITH_OFFHAND: if (!this.player.isSpectator()) { -- ItemStack itemstack1 = this.player.getItemInHand(InteractionHand.OFF_HAND); +- ItemStack swap = this.player.getItemInHand(InteractionHand.OFF_HAND); - this.player.setItemInHand(InteractionHand.OFF_HAND, this.player.getItemInHand(InteractionHand.MAIN_HAND)); -- this.player.setItemInHand(InteractionHand.MAIN_HAND, itemstack1); +- this.player.setItemInHand(InteractionHand.MAIN_HAND, swap); + var event = net.minecraftforge.event.ForgeEventFactory.onLivingSwapHandItems(this.player); + if (event == null) return; + this.player.setItemInHand(InteractionHand.OFF_HAND, event.getItemSwappedToOffHand()); @@ -14,31 +14,22 @@ this.player.stopUsingItem(); } -@@ -1414,8 +_,9 @@ +@@ -1515,8 +_,9 @@ } - CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -- Component component = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); -+ Component component = net.minecraftforge.common.ForgeHooks.onServerChatSubmittedEvent(this.player, playerchatmessage.decoratedContent()); - this.chatMessageChain.append(completablefuture, p_296589_ -> { -+ if (component == null) return; - PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_296589_.mask()); - this.broadcastChatMessage(playerchatmessage1); + CompletableFuture filteredFuture = this.filterTextPacket(signedMessage.signedContent()); +- Component decorated = this.server.getChatDecorator().decorate(this.player, signedMessage.decoratedContent()); ++ Component decorated = net.minecraftforge.common.ForgeHooks.onServerChatSubmittedEvent(this.player, signedMessage.decoratedContent()); + this.chatMessageChain.append(filteredFuture, filtered -> { ++ if (decorated == null) return; + PlayerChatMessage filteredMessage = signedMessage.withUnsignedContent(decorated).filter(filtered.mask()); + this.broadcastChatMessage(filteredMessage); }); -@@ -1745,7 +_,7 @@ - - @Override - public void onInteraction(InteractionHand p_143682_, Vec3 p_143683_) { -- this.performInteraction(p_143682_, (p_143686_, p_143687_, p_143688_) -> p_143687_.interactAt(p_143686_, p_143683_, p_143688_)); -+ this.performInteraction(p_143682_, (p_143686_, p_143687_, p_143688_) -> net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_143687_, p_143686_, p_143683_, p_143688_)); - } - - @Override -@@ -2063,6 +_,7 @@ +@@ -2195,6 +_,7 @@ @Override - public void handleCustomPayload(ServerboundCustomPayloadPacket p_329963_) { -+ net.minecraftforge.common.ForgeHooks.onCustomPayload(p_329963_.payload(), this.connection); + public void handleCustomPayload(final ServerboundCustomPayloadPacket packet) { ++ net.minecraftforge.common.ForgeHooks.onCustomPayload(packet.payload(), this.connection); } @Override diff --git a/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch index d23abc591e..fc5b14c68f 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch @@ -3,17 +3,17 @@ @@ -24,6 +_,7 @@ @Override - public void handleIntention(ClientIntentionPacket p_9975_) { -+ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(p_9975_, this.connection)) return; - switch (p_9975_.intention()) { + public void handleIntention(final ClientIntentionPacket packet) { ++ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(packet, this.connection)) return; + switch (packet.intention()) { case LOGIN: - this.beginLogin(p_9975_, false); + this.beginLogin(packet, false); @@ -32,7 +_,7 @@ - ServerStatus serverstatus = this.server.getStatus(); + ServerStatus status = this.server.getStatus(); this.connection.setupOutboundProtocol(StatusProtocols.CLIENTBOUND); - if (this.server.repliesToStatus() && serverstatus != null) { -- this.connection.setupInboundProtocol(StatusProtocols.SERVERBOUND, new ServerStatusPacketListenerImpl(serverstatus, this.connection)); -+ this.connection.setupInboundProtocol(StatusProtocols.SERVERBOUND, new ServerStatusPacketListenerImpl(serverstatus, this.connection, this.server.getStatusJson())); + if (this.server.repliesToStatus() && status != null) { +- this.connection.setupInboundProtocol(StatusProtocols.SERVERBOUND, new ServerStatusPacketListenerImpl(status, this.connection)); ++ this.connection.setupInboundProtocol(StatusProtocols.SERVERBOUND, new ServerStatusPacketListenerImpl(status, this.connection, this.server.getStatusJson())); } else { this.connection.disconnect(IGNORE_STATUS_REASON); } diff --git a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch index e0f4fc0e39..7d3d662689 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -185,7 +_,7 @@ - throw new IllegalStateException("Protocol error", cryptexception); +@@ -188,7 +_,7 @@ + throw new IllegalStateException("Protocol error", e); } - Thread thread = new Thread("User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { + Thread thread = new Thread(net.minecraftforge.fml.util.thread.SidedThreadGroups.SERVER, "User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { @Override public void run() { - String s1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); -@@ -228,6 +_,7 @@ + String name = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); +@@ -234,6 +_,7 @@ @Override - public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket p_297965_) { -+ if (!net.minecraftforge.common.ForgeHooks.onCustomPayload(p_297965_, this.connection)) + public void handleCustomQueryPacket(final ServerboundCustomQueryAnswerPacket packet) { ++ if (!net.minecraftforge.common.ForgeHooks.onCustomPayload(packet, this.connection)) this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); } -@@ -252,6 +_,11 @@ +@@ -256,6 +_,11 @@ @Override - public void handleCookieResponse(ServerboundCookieResponsePacket p_333672_) { + public void handleCookieResponse(final ServerboundCookieResponsePacket packet) { this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); + } + @@ -28,4 +28,4 @@ + return this.authenticatedProfile; } - static enum State { + private enum State { diff --git a/patches/minecraft/net/minecraft/server/network/ServerStatusPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerStatusPacketListenerImpl.java.patch index c44dab44cc..c195b8822d 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerStatusPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerStatusPacketListenerImpl.java.patch @@ -8,13 +8,13 @@ private final Connection connection; private boolean hasRequestedStatus; - public ServerStatusPacketListenerImpl(ServerStatus p_272864_, Connection p_273586_) { -+ this(p_272864_, p_273586_, null); + public ServerStatusPacketListenerImpl(final ServerStatus status, final Connection connection) { ++ this(status, connection, null); + } + -+ public ServerStatusPacketListenerImpl(ServerStatus p_272864_, Connection p_273586_, @org.jetbrains.annotations.Nullable String statusCache) { - this.status = p_272864_; - this.connection = p_273586_; ++ public ServerStatusPacketListenerImpl(ServerStatus status, Connection connection, @org.jetbrains.annotations.Nullable String statusCache) { + this.status = status; + this.connection = connection; + this.statusCache = statusCache; } diff --git a/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch b/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch index b65bb874c4..f23dea503a 100644 --- a/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch +++ b/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/network/config/PrepareSpawnTask.java +++ b/net/minecraft/server/network/config/PrepareSpawnTask.java -@@ -181,6 +_,7 @@ +@@ -180,6 +_,7 @@ .loadPlayerData(PrepareSpawnTask.this.nameAndId) - .map(p_423730_ -> TagValueInput.create(problemreporter$scopedcollector, PrepareSpawnTask.this.server.registryAccess(), p_423730_)); - optional.ifPresent(serverplayer::load); -+ optional.ifPresent(v -> net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(serverplayer, PrepareSpawnTask.this.server.getPlayerList().getPlayerIo().getPlayerDataFolder(), PrepareSpawnTask.this.nameAndId.id().toString())); - serverplayer.snapTo(this.spawnPosition, this.spawnAngle.x, this.spawnAngle.y); - PrepareSpawnTask.this.server.getPlayerList().placeNewPlayer(p_429818_, serverplayer, p_430225_); - optional.ifPresent(p_422988_ -> { + .map(tag -> TagValueInput.create(reporter, PrepareSpawnTask.this.server.registryAccess(), tag)); + input.ifPresent(player::load); ++ input.ifPresent(v -> net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(player, PrepareSpawnTask.this.server.getPlayerList().getPlayerIo().getPlayerDataFolder(), PrepareSpawnTask.this.nameAndId.id().toString())); + player.snapTo(this.spawnPosition, this.spawnAngle.x, this.spawnAngle.y); + PrepareSpawnTask.this.server.getPlayerList().placeNewPlayer(connection, player, cookie); + input.ifPresent(tag -> { diff --git a/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch b/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch index 843689eee5..2a159a9ae9 100644 --- a/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/AbstractPackResources.java +++ b/net/minecraft/server/packs/AbstractPackResources.java -@@ -60,4 +_,9 @@ +@@ -39,4 +_,9 @@ public PackLocationInfo location() { return this.location; } diff --git a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch index 80cef14587..b30611ce73 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/server/packs/repository/Pack.java +++ b/net/minecraft/server/packs/repository/Pack.java -@@ -23,6 +_,7 @@ +@@ -24,6 +_,7 @@ private final Pack.ResourcesSupplier resources; private final Pack.Metadata metadata; private final PackSelectionConfig selectionConfig; + private final boolean hidden; // Forge: Allow packs to be hidden from the UI entirely - public static @Nullable Pack readMetaAndCreate(PackLocationInfo p_333251_, Pack.ResourcesSupplier p_252210_, PackType p_250595_, PackSelectionConfig p_334202_) { - PackFormat packformat = SharedConstants.getCurrentVersion().packVersion(p_250595_); -@@ -35,6 +_,7 @@ - this.resources = p_249377_; - this.metadata = p_330761_; - this.selectionConfig = p_334769_; -+ this.hidden = p_330761_.isHidden(); + public static @Nullable Pack readMetaAndCreate( + final PackLocationInfo location, final Pack.ResourcesSupplier resources, final PackType packType, final PackSelectionConfig selectionConfig +@@ -40,6 +_,7 @@ + this.resources = resources; + this.metadata = metadata; + this.selectionConfig = selectionConfig; ++ this.hidden = metadata.isHidden(); } - public static Pack.@Nullable Metadata readPackMetadata(PackLocationInfo p_330799_, Pack.ResourcesSupplier p_331172_, PackFormat p_425340_, PackType p_426910_) { -@@ -56,7 +_,7 @@ - PackCompatibility packcompatibility = PackCompatibility.forVersion(packmetadatasection.supportedFormats(), p_425340_); - OverlayMetadataSection overlaymetadatasection = packresources.getMetadataSection(OverlayMetadataSection.forPackType(p_426910_)); - List list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_425340_) : List.of(); -- pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list); -+ pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); + public static Pack.@Nullable Metadata readPackMetadata( +@@ -63,7 +_,7 @@ + PackCompatibility packCompatibility = PackCompatibility.forVersion(meta.supportedFormats(), currentPackVersion); + OverlayMetadataSection overlays = pack.getMetadataSection(OverlayMetadataSection.forPackType(type)); + List overlaySet = overlays != null ? overlays.overlaysForVersion(currentPackVersion) : List.of(); +- return new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet); ++ return new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet, pack.isHidden()); } - - return pack$metadata; -@@ -118,6 +_,10 @@ + } catch (Exception e) { + LOGGER.warn("Failed to read pack {} metadata", location.id(), e); +@@ -123,6 +_,10 @@ return this.location.source(); } @@ -34,17 +34,17 @@ + } + @Override - public boolean equals(Object p_10448_) { - if (this == p_10448_) { -@@ -132,7 +_,10 @@ + public boolean equals(final Object o) { + if (this == o) { +@@ -137,7 +_,10 @@ return this.location.hashCode(); } - public record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { -+ public static record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { ++ public record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { + public Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { + this(description, compatibility, requestedFeatures, overlays, false); + } } - public static enum Position { + public enum Position { diff --git a/patches/minecraft/net/minecraft/server/packs/repository/PackDetector.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/PackDetector.java.patch index 926ea645a2..5f54eb5932 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/PackDetector.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/PackDetector.java.patch @@ -3,25 +3,25 @@ @@ -19,6 +_,10 @@ } - public @Nullable T detectPackResources(Path p_298083_, List p_297322_) throws IOException { -+ return detectPackResources(p_298083_, p_297322_, true); + public @Nullable T detectPackResources(final Path content, final List issues) throws IOException { ++ return detectPackResources(content, issues, true); + } + @Nullable -+ public T detectPackResources(Path p_298083_, List p_297322_, boolean requireMeta) throws IOException { - Path path = p_298083_; ++ public T detectPackResources(Path content, List issues, boolean requireMeta) throws IOException { + Path targetContext = content; - BasicFileAttributes basicfileattributes; + BasicFileAttributes attributes; @@ -43,10 +_,11 @@ - if (!p_297322_.isEmpty()) { + if (!issues.isEmpty()) { return null; } else { -- return !Files.isRegularFile(path.resolve("pack.mcmeta")) ? null : this.createDirectoryPack(path); -+ return !Files.isRegularFile(path.resolve("pack.mcmeta")) && requireMeta ? null : this.createDirectoryPack(path); +- return !Files.isRegularFile(targetContext.resolve("pack.mcmeta")) ? null : this.createDirectoryPack(targetContext); ++ return !Files.isRegularFile(targetContext.resolve("pack.mcmeta")) && requireMeta ? null : this.createDirectoryPack(targetContext); } } else { -- return basicfileattributes.isRegularFile() && path.getFileName().toString().endsWith(".zip") ? this.createZipPack(path) : null; -+ var name = path.getFileName().toString(); -+ return basicfileattributes.isRegularFile() && (name.endsWith(".zip") || name.endsWith(".jar")) ? this.createZipPack(path) : null; +- return attributes.isRegularFile() && targetContext.getFileName().toString().endsWith(".zip") ? this.createZipPack(targetContext) : null; ++ var name = targetContext.getFileName().toString(); ++ return attributes.isRegularFile() && (name.endsWith(".zip") || name.endsWith(".jar")) ? this.createZipPack(targetContext) : null; } } diff --git a/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch index bd59447637..d9d01a57c6 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch @@ -3,20 +3,20 @@ @@ -23,7 +_,7 @@ private List selected = ImmutableList.of(); - public PackRepository(RepositorySource... p_251886_) { -- this.sources = ImmutableSet.copyOf(p_251886_); -+ this.sources = new java.util.LinkedHashSet<>(List.of(p_251886_)); //Forge: This needs to be a mutable set, so that we can add to it later on. + public PackRepository(final RepositorySource... sources) { +- this.sources = ImmutableSet.copyOf(sources); ++ this.sources = new java.util.LinkedHashSet<>(List.of(sources)); //Forge: This needs to be a mutable set, so that we can add to it later on. } - public static String displayPackList(Collection p_331712_) { -@@ -119,6 +_,10 @@ + public static String displayPackList(final Collection packs) { +@@ -117,6 +_,10 @@ - public @Nullable Pack getPack(String p_10508_) { - return this.available.get(p_10508_); + public @Nullable Pack getPack(final String id) { + return this.available.get(id); + } + + public synchronized void addPackFinder(RepositorySource packFinder) { + this.sources.add(packFinder); } - public boolean isAvailable(String p_10516_) { + public boolean isAvailable(final String id) { diff --git a/patches/minecraft/net/minecraft/server/packs/repository/ServerPacksSource.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/ServerPacksSource.java.patch index 79d34a47b0..0c0f43f683 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/ServerPacksSource.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/ServerPacksSource.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -65,7 +_,9 @@ +@@ -70,7 +_,9 @@ } - public static PackRepository createPackRepository(Path p_251569_, DirectoryValidator p_300268_) { -- return new PackRepository(new ServerPacksSource(p_300268_), new FolderRepositorySource(p_251569_, PackType.SERVER_DATA, PackSource.WORLD, p_300268_)); -+ var ret = new PackRepository(new ServerPacksSource(p_300268_), new FolderRepositorySource(p_251569_, PackType.SERVER_DATA, PackSource.WORLD, p_300268_)); + public static PackRepository createPackRepository(final Path datapackDir, final DirectoryValidator validator) { +- return new PackRepository(new ServerPacksSource(validator), new FolderRepositorySource(datapackDir, PackType.SERVER_DATA, PackSource.WORLD, validator)); ++ var ret = new PackRepository(new ServerPacksSource(validator), new FolderRepositorySource(datapackDir, PackType.SERVER_DATA, PackSource.WORLD, validator)); + net.minecraftforge.event.AddPackFindersEvent.BUS.post(new net.minecraftforge.event.AddPackFindersEvent(PackType.SERVER_DATA, ret::addPackFinder)); + return ret; } diff --git a/patches/minecraft/net/minecraft/server/packs/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/server/packs/resources/FallbackResourceManager.java.patch index c0e602a546..a807929241 100644 --- a/patches/minecraft/net/minecraft/server/packs/resources/FallbackResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/resources/FallbackResourceManager.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/server/packs/resources/FallbackResourceManager.java +++ b/net/minecraft/server/packs/resources/FallbackResourceManager.java -@@ -101,8 +_,11 @@ +@@ -103,8 +_,11 @@ for (int i = this.fallbacks.size() - 1; i >= 0; i--) { - FallbackResourceManager.PackEntry fallbackresourcemanager$packentry = this.fallbacks.get(i); -- PackResources packresources = fallbackresourcemanager$packentry.resources; -- if (packresources != null) { -+ PackResources pack = fallbackresourcemanager$packentry.resources; + FallbackResourceManager.PackEntry entry = this.fallbacks.get(i); +- PackResources fileSource = entry.resources; +- if (fileSource != null) { ++ PackResources pack = entry.resources; + if (pack != null) { + var children = pack.getChildren(); + var packs = children == null ? List.of(pack) : children; -+ for (final PackResources packresources : packs) { - IoSupplier iosupplier = packresources.getResource(this.type, p_458089_); - if (iosupplier != null) { - IoSupplier iosupplier1; -@@ -116,6 +_,7 @@ ++ for (final PackResources fileSource : packs) { + IoSupplier resource = fileSource.getResource(this.type, location); + if (resource != null) { + IoSupplier metadataGetter; +@@ -118,6 +_,7 @@ } - list.add(new Resource(packresources, iosupplier, iosupplier1)); + result.add(new Resource(fileSource, resource, metadataGetter)); + } } } diff --git a/patches/minecraft/net/minecraft/server/packs/resources/ReloadableResourceManager.java.patch b/patches/minecraft/net/minecraft/server/packs/resources/ReloadableResourceManager.java.patch index ab858a6705..105d3b9dd5 100644 --- a/patches/minecraft/net/minecraft/server/packs/resources/ReloadableResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/resources/ReloadableResourceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/resources/ReloadableResourceManager.java +++ b/net/minecraft/server/packs/resources/ReloadableResourceManager.java -@@ -73,4 +_,10 @@ +@@ -78,4 +_,10 @@ public Stream listPacks() { return this.resources.listPacks(); } 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 94801e6047..83fe9b302e 100644 --- a/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -31,6 +_,10 @@ - this(p_378826_.createSerializationContext(JsonOps.INSTANCE), p_361980_, FileToIdConverter.registry(p_376437_)); +@@ -32,6 +_,10 @@ + this(registries.createSerializationContext(JsonOps.INSTANCE), codec, FileToIdConverter.registry(registryKey)); } -+ protected SimpleJsonResourceReloadListener(HolderLookup.Provider p_378826_, Codec p_361980_, ResourceKey> p_376437_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { -+ this(context.wrap(p_378826_.createSerializationContext(JsonOps.INSTANCE)), p_361980_, FileToIdConverter.registry(p_376437_)); ++ protected SimpleJsonResourceReloadListener(final HolderLookup.Provider registries, final Codec codec, final ResourceKey> registryKey, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { ++ this(context.wrap(registries.createSerializationContext(JsonOps.INSTANCE)), codec, FileToIdConverter.registry(registryKey)); + } + - protected SimpleJsonResourceReloadListener(Codec p_370137_, FileToIdConverter p_375758_) { - this(JsonOps.INSTANCE, p_370137_, p_375758_); + protected SimpleJsonResourceReloadListener(final Codec codec, final FileToIdConverter lister) { + this(JsonOps.INSTANCE, codec, lister); } -@@ -65,7 +_,15 @@ - Identifier identifier1 = p_377980_.fileToId(identifier); +@@ -66,7 +_,15 @@ + Identifier id = lister.fileToId(location); try (Reader reader = entry.getValue().openAsReader()) { -- p_376362_.parse(p_378080_, StrictJsonParser.parse(reader)).ifSuccess(p_370131_ -> { +- codec.parse(ops, StrictJsonParser.parse(reader)).ifSuccess(parsed -> { + var json = StrictJsonParser.parse(reader); -+ json = net.minecraftforge.common.ForgeHooks.readConditional(p_378080_, json); ++ json = net.minecraftforge.common.ForgeHooks.readConditional(ops, json); + if (json == null) { -+ LOGGER.debug("Skipping loading {} as its conditions were not met", identifier); ++ LOGGER.debug("Skipping loading {} as its conditions were not met", location); + continue; + } -+ p_376362_.parse(p_378080_, json).ifSuccess(p_370131_ -> { -+ p_370131_ = net.minecraftforge.common.ForgeHooks.onJsonDataParsed(p_376362_, identifier1, p_370131_); -+ if (p_370131_ == null) return; - if (p_377922_.putIfAbsent(identifier1, (T)p_370131_) != null) { - throw new IllegalStateException("Duplicate data file ignored with ID " + identifier1); ++ codec.parse(ops, json).ifSuccess(parsed -> { ++ parsed = net.minecraftforge.common.ForgeHooks.onJsonDataParsed(codec, id, parsed); ++ if (parsed == null) return; + if (result.putIfAbsent(id, (T)parsed) != null) { + throw new IllegalStateException("Duplicate data file ignored with ID " + id); } diff --git a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch index d2758334cc..b5c17dc1d1 100644 --- a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch @@ -1,70 +1,71 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -127,6 +_,7 @@ +@@ -126,6 +_,8 @@ private int simulationDistance; private boolean allowCommandsForAllPlayers; private int sendAllPlayerInfoIn; + private final List playersView = java.util.Collections.unmodifiableList(players); ++ private final Map playersByUUIDView = java.util.Collections.unmodifiableMap(this.playersByUUID); - public PlayerList(MinecraftServer p_203842_, LayeredRegistryAccess p_251844_, PlayerDataStorage p_203844_, NotificationService p_425184_) { - this.server = p_203842_; -@@ -185,6 +_,7 @@ - servergamepacketlistenerimpl.send(new ClientboundPlayerAbilitiesPacket(p_11263_.getAbilities())); - servergamepacketlistenerimpl.send(new ClientboundSetHeldSlotPacket(p_11263_.getInventory().getSelectedSlot())); - RecipeManager recipemanager = this.server.getRecipeManager(); -+ net.minecraftforge.event.OnDatapackSyncEvent.BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, p_11263_)); - servergamepacketlistenerimpl.send(new ClientboundUpdateRecipesPacket(recipemanager.getSynchronizedItemProperties(), recipemanager.getSynchronizedStonecutterRecipes())); - this.sendPlayerPermissionLevel(p_11263_); - p_11263_.getStats().markAllDirty(); -@@ -216,6 +_,7 @@ - p_11263_.initInventoryMenu(); - this.server.notificationManager().playerJoined(p_11263_); - servergamepacketlistenerimpl.resumeFlushing(); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedIn(p_11263_); + public PlayerList( + final MinecraftServer server, +@@ -189,6 +_,7 @@ + playerConnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); + playerConnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().getSelectedSlot())); + RecipeManager recipeManager = this.server.getRecipeManager(); ++ net.minecraftforge.event.OnDatapackSyncEvent.BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, player)); + playerConnection.send( + new ClientboundUpdateRecipesPacket(recipeManager.getSynchronizedItemProperties(), recipeManager.getSynchronizedStonecutterRecipes()) + ); +@@ -222,6 +_,7 @@ + player.initInventoryMenu(); + this.server.notificationManager().playerJoined(player); + playerConnection.resumeFlushing(); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedIn(player); } - protected void updateEntireScoreboard(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -285,6 +_,7 @@ + protected void updateEntireScoreboard(final ServerScoreboard scoreboard, final ServerPlayer player) { +@@ -291,6 +_,7 @@ } - protected void save(ServerPlayer p_11277_) { -+ if (p_11277_.connection == null) return; // Not sure if still needed -Paint_Ninja - this.playerIo.save(p_11277_); - ServerStatsCounter serverstatscounter = this.stats.get(p_11277_.getUUID()); - if (serverstatscounter != null) { -@@ -298,6 +_,7 @@ + protected void save(final ServerPlayer player) { ++ if (player.connection == null) return; // Not sure if still needed -Paint_Ninja + this.playerIo.save(player); + ServerStatsCounter stats = this.stats.get(player.getUUID()); + if (stats != null) { +@@ -304,6 +_,7 @@ } - public void remove(ServerPlayer p_11287_) { -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedOut(p_11287_); - ServerLevel serverlevel = p_11287_.level(); - p_11287_.awardStat(Stats.LEAVE_GAME); - this.save(p_11287_); -@@ -418,6 +_,7 @@ - this.playersByUUID.put(serverplayer.getUUID(), serverplayer); - serverplayer.initInventoryMenu(); - serverplayer.setHealth(serverplayer.getHealth()); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerRespawnEvent(serverplayer, p_11238_); - ServerPlayer.RespawnConfig serverplayer$respawnconfig = serverplayer.getRespawnConfig(); - if (!p_11238_ && serverplayer$respawnconfig != null) { - LevelData.RespawnData leveldata$respawndata = serverplayer$respawnconfig.respawnData(); -@@ -531,6 +_,7 @@ + public void remove(final ServerPlayer player) { ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedOut(player); + ServerLevel level = player.level(); + player.awardStat(Stats.LEAVE_GAME); + this.save(player); +@@ -429,6 +_,7 @@ + this.playersByUUID.put(player.getUUID(), player); + player.initInventoryMenu(); + player.setHealth(player.getHealth()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerRespawnEvent(player, keepAllPlayerData); + ServerPlayer.RespawnConfig respawnConfig = player.getRespawnConfig(); + if (!keepAllPlayerData && respawnConfig != null) { + LevelData.RespawnData respawnData = respawnConfig.respawnData(); +@@ -542,6 +_,7 @@ } - public void op(NameAndId p_425211_, Optional p_427477_, Optional p_426308_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPermissionChanged(p_425211_, p_427477_.orElse(this.server.operatorUserPermissions()), this)) return; + public void op(final NameAndId nameAndId, final Optional permissions, final Optional canBypassPlayerLimit) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPermissionChanged(nameAndId, permissions.orElse(this.server.operatorUserPermissions()), this)) return; this.ops - .add(new ServerOpListEntry(p_425211_, p_427477_.orElse(this.server.operatorUserPermissions()), p_426308_.orElse(this.ops.canBypassPlayerLimit(p_425211_)))); - ServerPlayer serverplayer = this.getPlayer(p_425211_.id()); -@@ -540,6 +_,7 @@ + .add( + new ServerOpListEntry( +@@ -555,6 +_,7 @@ } - public void deop(NameAndId p_428113_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPermissionChanged(p_428113_, null, this)) return; - if (this.ops.remove(p_428113_)) { - ServerPlayer serverplayer = this.getPlayer(p_428113_.id()); - if (serverplayer != null) { -@@ -804,7 +_,7 @@ + public void deop(final NameAndId nameAndId) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPermissionChanged(nameAndId, null, this)) return; + if (this.ops.remove(nameAndId)) { + ServerPlayer player = this.getPlayer(nameAndId.id()); + if (player != null) { +@@ -826,11 +_,11 @@ } public List getPlayers() { @@ -72,16 +73,21 @@ + return this.playersView; //Unmodifiable view, we don't want people removing things without us knowing. } - public @Nullable ServerPlayer getPlayer(UUID p_11260_) { -@@ -830,6 +_,7 @@ - playeradvancements.reload(this.server.getAdvancements()); + public Map getPlayersByUUID() { +- return this.playersByUUID; ++ return this.playersByUUIDView; //Unmodifiable view, we don't want people removing things without us knowing. + } + + public @Nullable ServerPlayer getPlayer(final UUID uuid) { +@@ -856,6 +_,7 @@ + advancements.reload(this.server.getAdvancements()); } + net.minecraftforge.event.OnDatapackSyncEvent.BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, null)); this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); - RecipeManager recipemanager = this.server.getRecipeManager(); - ClientboundUpdateRecipesPacket clientboundupdaterecipespacket = new ClientboundUpdateRecipesPacket(recipemanager.getSynchronizedItemProperties(), recipemanager.getSynchronizedStonecutterRecipes()); -@@ -842,5 +_,9 @@ + RecipeManager recipeManager = this.server.getRecipeManager(); + ClientboundUpdateRecipesPacket recipes = new ClientboundUpdateRecipesPacket( +@@ -870,5 +_,9 @@ public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; diff --git a/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch b/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch index 5ab640d010..02501c8b05 100644 --- a/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch +++ b/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch @@ -3,9 +3,9 @@ @@ -44,7 +_,7 @@ @Override - public void sendSystemMessage(Component p_215653_) { -- this.buffer.append(p_215653_.getString()); -+ this.buffer.append(p_215653_.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output + public void sendSystemMessage(final Component message) { +- this.buffer.append(message.getString()); ++ this.buffer.append(message.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output } @Override diff --git a/patches/minecraft/net/minecraft/server/rcon/thread/RconClient.java.patch b/patches/minecraft/net/minecraft/server/rcon/thread/RconClient.java.patch index a55e85704e..04cc437302 100644 --- a/patches/minecraft/net/minecraft/server/rcon/thread/RconClient.java.patch +++ b/patches/minecraft/net/minecraft/server/rcon/thread/RconClient.java.patch @@ -3,19 +3,19 @@ @@ -123,14 +_,11 @@ } - private void sendCmdResponse(int p_11595_, String p_11596_) throws IOException { -- int i = p_11596_.length(); + private void sendCmdResponse(final int requestid, String response) throws IOException { +- int len = response.length(); - - do { -- int j = 4096 <= i ? 4096 : i; -- this.send(p_11595_, 0, p_11596_.substring(0, j)); -- p_11596_ = p_11596_.substring(j); -- i = p_11596_.length(); -- } while (0 != i); +- int dataLen = 4096 <= len ? 4096 : len; +- this.send(requestid, 0, response.substring(0, dataLen)); +- response = response.substring(dataLen); +- len = response.length(); +- } while (0 != len); + // Forge: Actually convert to UTF8 and process bytes accordingly. Why do we do this? UTF8 should be single byte per character -+ byte[] data = p_11596_.getBytes(StandardCharsets.UTF_8); ++ byte[] data = response.getBytes(StandardCharsets.UTF_8); + for (int x = 0; x < data.length; x += 4096) { -+ this.send(p_11595_, 0, new String(data, x, Math.min(4096, data.length - x), StandardCharsets.UTF_8)); ++ this.send(requestid, 0, new String(data, x, Math.min(4096, data.length - x), StandardCharsets.UTF_8)); + } } diff --git a/patches/minecraft/net/minecraft/stats/RecipeBookSettings.java.patch b/patches/minecraft/net/minecraft/stats/RecipeBookSettings.java.patch index 193fe7c77e..47a0e6e6d6 100644 --- a/patches/minecraft/net/minecraft/stats/RecipeBookSettings.java.patch +++ b/patches/minecraft/net/minecraft/stats/RecipeBookSettings.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/stats/RecipeBookSettings.java +++ b/net/minecraft/stats/RecipeBookSettings.java -@@ -12,6 +_,7 @@ +@@ -11,6 +_,7 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.inventory.RecipeBookType; @@ -8,8 +8,8 @@ public final class RecipeBookSettings { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( RecipeBookSettings.TypeSettings.STREAM_CODEC, -@@ -148,5 +_,13 @@ - .apply(p_407394_, RecipeBookSettings.TypeSettings::new) +@@ -149,5 +_,13 @@ + .apply(i, RecipeBookSettings.TypeSettings::new) ); } + } diff --git a/patches/minecraft/net/minecraft/tags/BannerPatternTags.java.patch b/patches/minecraft/net/minecraft/tags/BannerPatternTags.java.patch index 4ad4faaf66..af517b953c 100644 --- a/patches/minecraft/net/minecraft/tags/BannerPatternTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BannerPatternTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/BannerPatternTags.java +++ b/net/minecraft/tags/BannerPatternTags.java @@ -23,4 +_,12 @@ - private static TagKey create(String p_215798_) { - return TagKey.create(Registries.BANNER_PATTERN, Identifier.withDefaultNamespace(p_215798_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.BANNER_PATTERN, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/BiomeTags.java.patch b/patches/minecraft/net/minecraft/tags/BiomeTags.java.patch index c94bcb4ef6..77b1e4196c 100644 --- a/patches/minecraft/net/minecraft/tags/BiomeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BiomeTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/BiomeTags.java +++ b/net/minecraft/tags/BiomeTags.java @@ -80,4 +_,12 @@ - private static TagKey create(String p_207631_) { - return TagKey.create(Registries.BIOME, Identifier.withDefaultNamespace(p_207631_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.BIOME, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index d269b6c8b5..328c87ba12 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -216,4 +_,12 @@ - private static TagKey create(String p_203847_) { - return TagKey.create(Registries.BLOCK, Identifier.withDefaultNamespace(p_203847_)); +@@ -260,4 +_,12 @@ + private static TagKey create(final String name) { + return TagKey.create(Registries.BLOCK, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch index 027b3570e0..de766c6d43 100644 --- a/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/DamageTypeTags.java +++ b/net/minecraft/tags/DamageTypeTags.java -@@ -43,4 +_,12 @@ - private static TagKey create(String p_270635_) { - return TagKey.create(Registries.DAMAGE_TYPE, Identifier.withDefaultNamespace(p_270635_)); +@@ -44,4 +_,12 @@ + private static TagKey create(final String name) { + return TagKey.create(Registries.DAMAGE_TYPE, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/EnchantmentTags.java.patch b/patches/minecraft/net/minecraft/tags/EnchantmentTags.java.patch index fa03a20896..f95df822a0 100644 --- a/patches/minecraft/net/minecraft/tags/EnchantmentTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/EnchantmentTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/EnchantmentTags.java +++ b/net/minecraft/tags/EnchantmentTags.java -@@ -45,4 +_,12 @@ - private static TagKey create(String p_334094_) { - return TagKey.create(Registries.ENCHANTMENT, Identifier.withDefaultNamespace(p_334094_)); +@@ -38,4 +_,12 @@ + private static TagKey create(final String name) { + return TagKey.create(Registries.ENCHANTMENT, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch index f1fa21f7e2..deef29fb0b 100644 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/EntityTypeTags.java +++ b/net/minecraft/tags/EntityTypeTags.java -@@ -55,4 +_,12 @@ - private static TagKey> create(String p_203849_) { - return TagKey.create(Registries.ENTITY_TYPE, Identifier.withDefaultNamespace(p_203849_)); +@@ -57,4 +_,12 @@ + private static TagKey> create(final String name) { + return TagKey.create(Registries.ENTITY_TYPE, Identifier.withDefaultNamespace(name)); } + + public static TagKey> create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/FlatLevelGeneratorPresetTags.java.patch b/patches/minecraft/net/minecraft/tags/FlatLevelGeneratorPresetTags.java.patch index 059dd8d140..960fb2d27c 100644 --- a/patches/minecraft/net/minecraft/tags/FlatLevelGeneratorPresetTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/FlatLevelGeneratorPresetTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/FlatLevelGeneratorPresetTags.java +++ b/net/minecraft/tags/FlatLevelGeneratorPresetTags.java @@ -13,4 +_,12 @@ - private static TagKey create(String p_215852_) { - return TagKey.create(Registries.FLAT_LEVEL_GENERATOR_PRESET, Identifier.withDefaultNamespace(p_215852_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.FLAT_LEVEL_GENERATOR_PRESET, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch index 4cae59aac5..f6b87402d3 100644 --- a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/FluidTags.java +++ b/net/minecraft/tags/FluidTags.java -@@ -14,4 +_,12 @@ - private static TagKey create(String p_203851_) { - return TagKey.create(Registries.FLUID, Identifier.withDefaultNamespace(p_203851_)); +@@ -18,4 +_,12 @@ + private static TagKey create(final String name) { + return TagKey.create(Registries.FLUID, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch b/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch index 9650379723..53e30af796 100644 --- a/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/GameEventTags.java +++ b/net/minecraft/tags/GameEventTags.java @@ -14,4 +_,12 @@ - private static TagKey create(String p_203853_) { - return TagKey.create(Registries.GAME_EVENT, Identifier.withDefaultNamespace(p_203853_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.GAME_EVENT, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/InstrumentTags.java.patch b/patches/minecraft/net/minecraft/tags/InstrumentTags.java.patch index 809d68b6b8..f50afdff56 100644 --- a/patches/minecraft/net/minecraft/tags/InstrumentTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/InstrumentTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/InstrumentTags.java +++ b/net/minecraft/tags/InstrumentTags.java @@ -12,4 +_,12 @@ - private static TagKey create(String p_215861_) { - return TagKey.create(Registries.INSTRUMENT, Identifier.withDefaultNamespace(p_215861_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.INSTRUMENT, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index acb7871b5e..508c67264a 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -210,4 +_,12 @@ - private static TagKey bind(String p_203855_) { - return TagKey.create(Registries.ITEM, Identifier.withDefaultNamespace(p_203855_)); +@@ -220,4 +_,12 @@ + private static TagKey bind(final String name) { + return TagKey.create(Registries.ITEM, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/PaintingVariantTags.java.patch b/patches/minecraft/net/minecraft/tags/PaintingVariantTags.java.patch index 4074eb74c0..f1c717fea3 100644 --- a/patches/minecraft/net/minecraft/tags/PaintingVariantTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/PaintingVariantTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/PaintingVariantTags.java +++ b/net/minecraft/tags/PaintingVariantTags.java @@ -13,4 +_,12 @@ - private static TagKey create(String p_215874_) { - return TagKey.create(Registries.PAINTING_VARIANT, Identifier.withDefaultNamespace(p_215874_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.PAINTING_VARIANT, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/PoiTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/PoiTypeTags.java.patch index 649fc995b4..cd8d58776b 100644 --- a/patches/minecraft/net/minecraft/tags/PoiTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/PoiTypeTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/PoiTypeTags.java +++ b/net/minecraft/tags/PoiTypeTags.java @@ -15,4 +_,12 @@ - private static TagKey create(String p_215881_) { - return TagKey.create(Registries.POINT_OF_INTEREST_TYPE, Identifier.withDefaultNamespace(p_215881_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.POINT_OF_INTEREST_TYPE, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/StructureTags.java.patch b/patches/minecraft/net/minecraft/tags/StructureTags.java.patch index eb0fcad6c1..6461e1f5ad 100644 --- a/patches/minecraft/net/minecraft/tags/StructureTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/StructureTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/StructureTags.java +++ b/net/minecraft/tags/StructureTags.java @@ -29,4 +_,12 @@ - private static TagKey create(String p_215896_) { - return TagKey.create(Registries.STRUCTURE, Identifier.withDefaultNamespace(p_215896_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.STRUCTURE, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch b/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch index 5868bcf216..ccf8244c5b 100644 --- a/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch @@ -7,17 +7,16 @@ -public class TagBuilder { +public class TagBuilder implements net.minecraftforge.common.extensions.IForgeRawTagBuilder { private final List entries = new ArrayList<>(); + private boolean replace = false; - public static TagBuilder create() { -@@ -34,5 +_,30 @@ +@@ -44,5 +_,18 @@ - public TagBuilder addOptionalTag(Identifier p_458048_) { - return this.add(TagEntry.optionalTag(p_458048_)); + public TagBuilder addOptionalTag(final Identifier id) { + return this.add(TagEntry.optionalTag(id)); + } + + /** Forge: Used for datagen */ + private final List removeEntries = new ArrayList<>(); -+ private boolean replace = false; + + public java.util.stream.Stream getRemoveEntries() { // should this return the List instead? Might end up with mem leaks from unterminated streams otherwise -Paint_Ninja + return this.removeEntries.stream(); @@ -27,16 +26,5 @@ + public TagBuilder remove(TagEntry entry) { + this.removeEntries.add(entry); + return this; -+ } -+ -+ /** Forge: Set the replace property of this tag */ -+ public TagBuilder replace(boolean value) { -+ this.replace = value; -+ return this; -+ } -+ -+ /** Forge: Is this tag set to replace or not? */ -+ public boolean isReplace() { -+ return this.replace; } } diff --git a/patches/minecraft/net/minecraft/tags/TagEntry.java.patch b/patches/minecraft/net/minecraft/tags/TagEntry.java.patch index 6ef8504735..a329bd19e0 100644 --- a/patches/minecraft/net/minecraft/tags/TagEntry.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagEntry.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/TagEntry.java +++ b/net/minecraft/tags/TagEntry.java -@@ -111,6 +_,18 @@ - return stringbuilder.toString(); +@@ -107,6 +_,18 @@ + return result.toString(); } + public Identifier getId() { @@ -17,5 +17,5 @@ + } + public interface Lookup { - @Nullable T element(Identifier p_459727_, boolean p_362986_); + @Nullable T element(Identifier key, boolean required); diff --git a/patches/minecraft/net/minecraft/tags/TagFile.java.patch b/patches/minecraft/net/minecraft/tags/TagFile.java.patch index e2cedd49cb..1e7f9fbbd6 100644 --- a/patches/minecraft/net/minecraft/tags/TagFile.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagFile.java.patch @@ -1,19 +1,18 @@ --- a/net/minecraft/tags/TagFile.java +++ b/net/minecraft/tags/TagFile.java -@@ -5,12 +_,17 @@ - import com.mojang.serialization.codecs.RecordCodecBuilder.Instance; +@@ -4,11 +_,16 @@ + import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; -public record TagFile(List entries, boolean replace) { +public record TagFile(List entries, boolean replace, List remove) { public static final Codec CODEC = RecordCodecBuilder.create( - p_215967_ -> p_215967_.group( - TagEntry.CODEC.listOf().fieldOf("values").forGetter(TagFile::entries), -- Codec.BOOL.optionalFieldOf("replace", false).forGetter(TagFile::replace) -+ Codec.BOOL.optionalFieldOf("replace", false).forGetter(TagFile::replace), + i -> i.group( +- TagEntry.CODEC.listOf().fieldOf("values").forGetter(TagFile::entries), Codec.BOOL.optionalFieldOf("replace", false).forGetter(TagFile::replace) ++ TagEntry.CODEC.listOf().fieldOf("values").forGetter(TagFile::entries), Codec.BOOL.optionalFieldOf("replace", false).forGetter(TagFile::replace), + TagEntry.CODEC.listOf().optionalFieldOf("remove", List.of()).forGetter(TagFile::remove) ) - .apply(p_215967_, TagFile::new) + .apply(i, TagFile::new) ); + + public TagFile(List entries, boolean replace) { diff --git a/patches/minecraft/net/minecraft/tags/TagKey.java.patch b/patches/minecraft/net/minecraft/tags/TagKey.java.patch index 2a7984115b..9ae3dab205 100644 --- a/patches/minecraft/net/minecraft/tags/TagKey.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagKey.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/tags/TagKey.java +++ b/net/minecraft/tags/TagKey.java -@@ -42,6 +_,10 @@ - return (TagKey)VALUES.intern(new TagKey<>(p_203883_, p_451670_)); +@@ -38,6 +_,10 @@ + return (TagKey)VALUES.intern(new TagKey<>(registry, location)); } + public static TagKey create(ResourceKey> registry, String namespace, String path) { + return create(registry, Identifier.fromNamespaceAndPath(namespace, path)); + } + - public boolean isFor(ResourceKey> p_207646_) { - return this.registry == p_207646_; + public boolean isFor(final ResourceKey> registry) { + return this.registry == registry; } diff --git a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch index 6aeaa0e28b..f086720b23 100644 --- a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch @@ -2,43 +2,43 @@ +++ b/net/minecraft/tags/TagLoader.java @@ -64,6 +_,7 @@ - String s = resource.sourcePackId(); - tagfile.entries().forEach(p_215997_ -> list.add(new TagLoader.EntryWithSource(p_215997_, s))); -+ tagfile.remove().forEach(e -> list.add(new TagLoader.EntryWithSource(e, s, true))); - } catch (Exception exception) { - LOGGER.error("Couldn't read tag list {} from {} in data pack {}", identifier1, identifier, resource.sourcePackId(), exception); + String sourceId = resource.sourcePackId(); + parsedContents.entries().forEach(ex -> tagContents.add(new TagLoader.EntryWithSource(ex, sourceId))); ++ parsedContents.remove().forEach(e -> tagContents.add(new TagLoader.EntryWithSource(e, sourceId, true))); + } catch (Exception e) { + LOGGER.error("Couldn't read tag list {} from {} in data pack {}", id, location, resource.sourcePackId(), e); } @@ -74,16 +_,17 @@ } - private Either, List> tryBuildTag(TagEntry.Lookup p_215979_, List p_215980_) { -- SequencedSet sequencedset = new LinkedHashSet<>(); + private Either, List> tryBuildTag(final TagEntry.Lookup lookup, final List entries) { +- SequencedSet values = new LinkedHashSet<>(); + var builder = new java.util.LinkedHashSet(); // Order is important, as ImmutableSet is ordered and some people rely on that. https://github.com/MinecraftForge/MinecraftForge/issues/9774 - List list = new ArrayList<>(); + List missingElements = new ArrayList<>(); - for (TagLoader.EntryWithSource tagloader$entrywithsource : p_215980_) { -- if (!tagloader$entrywithsource.entry().build(p_215979_, sequencedset::add)) { -+ if (!tagloader$entrywithsource.entry().build(p_215979_, tagloader$entrywithsource.remove() ? builder::remove : builder::add)) { -+ if (!tagloader$entrywithsource.remove()) // Treat all removals as optional at runtime. If it was missing, then it could of never been added. - list.add(tagloader$entrywithsource); + for (TagLoader.EntryWithSource entry : entries) { +- if (!entry.entry().build(lookup, values::add)) { ++ if (!entry.entry().build(lookup, entry.remove() ? builder::remove : builder::add)) { ++ if (!entry.remove()) // Treat all removals as optional at runtime. If it was missing, then it could of never been added. + missingElements.add(entry); } } -- return list.isEmpty() ? Either.right(List.copyOf(sequencedset)) : Either.left(list); -+ return list.isEmpty() ? Either.right(List.copyOf(builder)) : Either.left(list); +- return missingElements.isEmpty() ? Either.right(List.copyOf(values)) : Either.left(missingElements); ++ return missingElements.isEmpty() ? Either.right(List.copyOf(builder)) : Either.left(missingElements); } - public Map> build(Map> p_203899_) { -@@ -109,7 +_,7 @@ - p_358772_ -> LOGGER.error( + public Map> build(final Map> builders) { +@@ -107,7 +_,7 @@ + missing -> LOGGER.error( "Couldn't load tag {} as it is missing following references: {}", - p_450305_, -- p_358772_.stream().map(Objects::toString).collect(Collectors.joining(", ")) -+ p_358772_.stream().map(Objects::toString).collect(Collectors.joining(", \n\t")) + id, +- missing.stream().map(Objects::toString).collect(Collectors.joining(", ")) ++ missing.stream().map(Objects::toString).collect(Collectors.joining(", \n\t")) ) ) - .ifRight(p_369415_ -> map.put(p_450305_, (List)p_369415_)) -@@ -185,7 +_,11 @@ + .ifRight(tag -> newTags.put(id, (List)tag)) +@@ -188,7 +_,11 @@ } } diff --git a/patches/minecraft/net/minecraft/tags/WorldPresetTags.java.patch b/patches/minecraft/net/minecraft/tags/WorldPresetTags.java.patch index 891560fe92..fc01a75d1f 100644 --- a/patches/minecraft/net/minecraft/tags/WorldPresetTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/WorldPresetTags.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/tags/WorldPresetTags.java +++ b/net/minecraft/tags/WorldPresetTags.java @@ -14,4 +_,12 @@ - private static TagKey create(String p_216058_) { - return TagKey.create(Registries.WORLD_PRESET, Identifier.withDefaultNamespace(p_216058_)); + private static TagKey create(final String name) { + return TagKey.create(Registries.WORLD_PRESET, Identifier.withDefaultNamespace(name)); } + + public static TagKey create(String namepsace, String path) { diff --git a/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch b/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch new file mode 100644 index 0000000000..353e0d4a23 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/util/LightCoordsUtil.java ++++ b/net/minecraft/util/LightCoordsUtil.java +@@ -15,7 +_,7 @@ + } + + public static int block(final int packed) { +- return packed >> 4 & 15; ++ return (packed & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806 + } + + public static int sky(final int packed) { +@@ -115,7 +_,7 @@ + + int packedBrightness = brightnessGetter.packedBrightness(level, pos); + int block = block(packedBrightness); +- int blockSelfEmission = state.getLightEmission(); ++ int blockSelfEmission = state.getLightEmission(level, pos); + return block < blockSelfEmission ? withBlock(packedBrightness, blockSelfEmission) : packedBrightness; + } + diff --git a/patches/minecraft/net/minecraft/util/SpawnUtil.java.patch b/patches/minecraft/net/minecraft/util/SpawnUtil.java.patch index 11a7ba2411..f55901cfa1 100644 --- a/patches/minecraft/net/minecraft/util/SpawnUtil.java.patch +++ b/patches/minecraft/net/minecraft/util/SpawnUtil.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/util/SpawnUtil.java +++ b/net/minecraft/util/SpawnUtil.java -@@ -45,7 +_,7 @@ - )) { - T t = (T)p_216404_.create(p_216406_, null, blockpos$mutableblockpos, p_369127_, false, false); - if (t != null) { -- if (t.checkSpawnRules(p_216406_, p_369127_) && t.checkSpawnObstruction(p_216406_)) { -+ if (net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(t, p_216406_, p_369127_)) { - p_216406_.addFreshEntityWithPassengers(t); - t.playAmbientSound(); - return Optional.of(t); +@@ -39,7 +_,7 @@ + && (!checkCollisions || level.noCollision(entityType.getSpawnAABB(searchPos.getX() + 0.5, searchPos.getY(), searchPos.getZ() + 0.5)))) { + T mob = (T)entityType.create(level, null, searchPos, spawnReason, false, false); + if (mob != null) { +- if (mob.checkSpawnRules(level, spawnReason) && mob.checkSpawnObstruction(level)) { ++ if (net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(mob, level, spawnReason)) { + level.addFreshEntityWithPassengers(mob); + mob.playAmbientSound(); + return Optional.of(mob); diff --git a/patches/minecraft/net/minecraft/util/Util.java.patch b/patches/minecraft/net/minecraft/util/Util.java.patch index 37d8763388..51be679f5f 100644 --- a/patches/minecraft/net/minecraft/util/Util.java.patch +++ b/patches/minecraft/net/minecraft/util/Util.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/util/Util.java +++ b/net/minecraft/util/Util.java -@@ -268,7 +_,7 @@ +@@ -313,7 +_,7 @@ .getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().dataVersion().version())) - .getChoiceType(p_457223_, p_460132_); - } catch (IllegalArgumentException illegalargumentexception) { -- LOGGER.error("No data fixer registered for {}", p_460132_); -+ LOGGER.debug("No data fixer registered for {}", p_460132_); + .getChoiceType(reference, name); + } catch (IllegalArgumentException e) { +- LOGGER.error("No data fixer registered for {}", name); ++ LOGGER.debug("No data fixer registered for {}", name); if (SharedConstants.IS_RUNNING_IN_IDE) { - throw illegalargumentexception; + throw e; } diff --git a/patches/minecraft/net/minecraft/util/context/ContextMap.java.patch b/patches/minecraft/net/minecraft/util/context/ContextMap.java.patch index 70f74240d8..72e02cadf8 100644 --- a/patches/minecraft/net/minecraft/util/context/ContextMap.java.patch +++ b/patches/minecraft/net/minecraft/util/context/ContextMap.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/util/context/ContextMap.java +++ b/net/minecraft/util/context/ContextMap.java @@ -37,6 +_,10 @@ - return (T)this.params.getOrDefault(p_368195_, p_368521_); + return (T)this.params.getOrDefault(param, _default); } + public Set> keySet() { diff --git a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch index 7db9d9934c..3ac8a74494 100644 --- a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch @@ -1,21 +1,20 @@ --- a/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java +++ b/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java -@@ -179,7 +_,17 @@ - String s = p_207725_.asString("UNKNOWN").toLowerCase(Locale.ROOT); - StructuresBecomeConfiguredFix.Conversion structuresbecomeconfiguredfix$conversion = CONVERSION_MAP.get(s); - if (structuresbecomeconfiguredfix$conversion == null) { +@@ -178,7 +_,16 @@ + String key = dynamicKey.asString("UNKNOWN").toLowerCase(Locale.ROOT); + StructuresBecomeConfiguredFix.Conversion conversion = CONVERSION_MAP.get(key); + if (conversion == null) { - return null; + // Forge: hook for mods to register conversions through RegisterStructureConversionsEvent -+ structuresbecomeconfiguredfix$conversion = net.minecraftforge.common.ForgeHooks.getStructureConversion(s); ++ conversion = net.minecraftforge.common.ForgeHooks.getStructureConversion(key); + } -+ if (structuresbecomeconfiguredfix$conversion == null) { -+ -+ if (net.minecraftforge.common.ForgeHooks.checkStructureNamespace(s)) { ++ if (conversion == null) { ++ if (net.minecraftforge.common.ForgeHooks.checkStructureNamespace(key)) { + // Forge: pass-through structure IDs which have a non-"minecraft" namespace -+ return p_329413_.createString(s); ++ return chunk.createString(key); + } + // Forge: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data -+ return p_329413_.createString("unknown." + s); - } else { - String s1 = structuresbecomeconfiguredfix$conversion.fallback; - if (!structuresbecomeconfiguredfix$conversion.biomeMapping().isEmpty()) { ++ return chunk.createString("unknown." + key); + } + + String resultingId = conversion.fallback; 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 755a1e5d2f..280844a0f7 100644 --- a/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/datafix/schemas/V2832.java +++ b/net/minecraft/util/datafix/schemas/V2832.java -@@ -52,7 +_,7 @@ +@@ -54,7 +_,7 @@ DSL.constType(namespacedString()), DSL.fields( "generator", @@ -9,7 +9,7 @@ "type", DSL.string(), ImmutableMap.of( -@@ -97,7 +_,7 @@ +@@ -94,7 +_,7 @@ ) ) ) diff --git a/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch b/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch index 37b93c017d..4ed55e4c00 100644 --- a/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch +++ b/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch @@ -9,12 +9,12 @@ private static final int FLAT_THRESHOLD = 64; private final int totalWeight; private final List> items; -@@ -132,7 +_,7 @@ - return 31 * i + this.items.hashCode(); +@@ -153,7 +_,7 @@ + return 31 * result + this.items.hashCode(); } - public static class Builder { + public static class Builder implements net.minecraftforge.common.extensions.IForgeWeightedList.Builder { private final ImmutableList.Builder> result = ImmutableList.builder(); - public WeightedList.Builder add(E p_395636_) { + public WeightedList.Builder add(final E item) { diff --git a/patches/minecraft/net/minecraft/world/clock/ServerClockManager.java.patch b/patches/minecraft/net/minecraft/world/clock/ServerClockManager.java.patch new file mode 100644 index 0000000000..1295489d46 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/clock/ServerClockManager.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/clock/ServerClockManager.java ++++ b/net/minecraft/world/clock/ServerClockManager.java +@@ -97,6 +_,12 @@ + return set.booleanValue(); + } + ++ public long getTimeMarker(final Holder clock, final ResourceKey timeMarkerId) { ++ var instance = this.getInstance(clock); ++ var marker = instance.timeMarkers.get(timeMarkerId); ++ return marker == null ? -1 : marker.resolveTimeToMoveTo(instance.totalTicks); ++ } ++ + public void addTicks(final Holder clock, final int ticks) { + this.modifyClock(clock, instance -> instance.totalTicks = Math.max(instance.totalTicks + ticks, 0L)); + } diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch index c1d2031c4d..44c3932444 100644 --- a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch +++ b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch @@ -11,32 +11,28 @@ public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.MOB_EFFECT); private static final int AMBIENT_ALPHA = Mth.floor(38.25F); @@ -58,12 +_,14 @@ - int i = p_358853_.isAmbient() ? AMBIENT_ALPHA : 255; - return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, ARGB.color(i, p_19452_)); + int alpha = effectInstance.isAmbient() ? AMBIENT_ALPHA : 255; + return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, ARGB.color(alpha, color)); }; + initClient(); } - protected MobEffect(MobEffectCategory p_335432_, int p_334901_, ParticleOptions p_331136_) { - this.category = p_335432_; - this.color = p_334901_; - this.particleFactory = p_326745_ -> p_331136_; + protected MobEffect(final MobEffectCategory category, final int color, final ParticleOptions particleOptions) { + this.category = category; + this.color = color; + this.particleFactory = ignored -> particleOptions; + initClient(); } public int getBlendInDurationTicks() { -@@ -202,4 +_,28 @@ - return new AttributeModifier(this.id, this.amount * (p_332230_ + 1), this.operation); +@@ -207,5 +_,23 @@ + public AttributeModifier create(final int amplifier) { + return new AttributeModifier(this.id, this.amount * (amplifier + 1), this.operation); } - } ++ } + -+ // FORGE START + private Object effectRenderer; -+ -+ /* -+ DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE -+ Call RenderProperties.getEffectRenderer instead -+ */ ++ @org.jetbrains.annotations.ApiStatus.Internal + public Object getEffectRendererInternal() { + return effectRenderer; + } @@ -51,6 +47,5 @@ + } + + public void initializeClient(java.util.function.Consumer consumer) { -+ } -+ // END FORGE + } } diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index ab003568f7..902b817cac 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -1,59 +1,41 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -153,7 +_,7 @@ - import org.jspecify.annotations.Nullable; +@@ -156,7 +_,9 @@ import org.slf4j.Logger; --public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, SlotProvider, EntityAccess, ScoreHolder, DataComponentGetter { -+public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider.Entities implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, SlotProvider, EntityAccess, ScoreHolder, DataComponentGetter, net.minecraftforge.common.extensions.IForgeEntity { - public static final Logger LOGGER = LogUtils.getLogger(); - public static final String TAG_ID = "id"; - public static final String TAG_UUID = "UUID"; -@@ -191,6 +_,7 @@ + public abstract class Entity ++ extends net.minecraftforge.common.capabilities.CapabilityProvider.Entities + implements Nameable, ++ net.minecraftforge.common.extensions.IForgeEntity, + EntityAccess, + ScoreHolder, + SyncedDataHolder, +@@ -205,6 +_,7 @@ private static final int MAX_BLOCK_ITERATIONS_ALONG_TRAVEL_PER_TICK = 16; private static final double MAX_MOVEMENT_RESETTING_TRACE_DISTANCE = 8.0; private static double viewScale = 1.0; + @Deprecated // Forge: Use the getter to allow overriding in mods private final EntityType type; private boolean requiresPrecisePosition; - private int id = ENTITY_COUNTER.incrementAndGet(); -@@ -233,8 +_,10 @@ - public int tickCount; - private int remainingFireTicks; - protected boolean wasTouchingWater; -+ @Deprecated // Forge: Use forgeFluidTypeHeight instead - protected Object2DoubleMap> fluidHeight = new Object2DoubleArrayMap<>(2); - protected boolean wasEyeInWater; -+ @Deprecated // Forge: Use forgeFluidTypeOnEyes instead - private final Set> fluidOnEyes = new HashSet<>(); - public int invulnerableTime; - protected boolean firstTick = true; -@@ -286,6 +_,7 @@ - private CustomData customData = CustomData.EMPTY; - - public Entity(EntityType p_19870_, Level p_19871_) { -+ super(); - this.type = p_19870_; - this.level = p_19871_; - this.dimensions = p_19870_.getDimensions(); -@@ -305,6 +_,8 @@ - this.entityData = synchedentitydata$builder.build(); + private int id = 0; +@@ -322,6 +_,8 @@ + this.entityData = entityDataBuilder.build(); this.setPos(0.0, 0.0, 0.0); this.eyeHeight = this.dimensions.eyeHeight(); + net.minecraftforge.event.ForgeEventFactory.onEntityConstructing(this); + this.gatherCapabilities(); } - public boolean isColliding(BlockPos p_20040_, BlockState p_20041_) { -@@ -403,6 +_,7 @@ + public boolean isColliding(final BlockPos pos, final BlockState state) { +@@ -429,6 +_,7 @@ - public void remove(Entity.RemovalReason p_146834_) { - this.setRemoved(p_146834_); + public void remove(final Entity.RemovalReason reason) { + this.setRemoved(reason); + this.invalidateCaps(); } public void onClientRemoval() { -@@ -522,7 +_,7 @@ +@@ -548,7 +_,7 @@ } if (this.isInLava()) { @@ -62,44 +44,44 @@ } this.checkBelowWorld(); -@@ -977,9 +_,7 @@ - return blockpos; - } else { - BlockState blockstate = this.level().getBlockState(blockpos); -- return (!(p_216987_ <= 0.5) || !blockstate.is(BlockTags.FENCES)) -- && !blockstate.is(BlockTags.WALLS) -- && !(blockstate.getBlock() instanceof FenceGateBlock) -+ return (!((double)p_216987_ <= 0.5) || !blockstate.collisionExtendsVertically(this.level(), blockpos, this)) - ? blockpos.atY(Mth.floor(this.position.y - p_216987_)) - : blockpos; +@@ -1064,9 +_,7 @@ } -@@ -1323,19 +_,19 @@ - return !blockstate.is(BlockTags.INSIDE_STEP_SOUND_BLOCKS) && !blockstate.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS) ? p_278049_ : blockpos; + + BlockState belowState = this.level().getBlockState(getOnPos); +- return (!(offset <= 0.5) || !belowState.is(BlockTags.FENCES)) +- && !belowState.is(BlockTags.WALLS) +- && !(belowState.getBlock() instanceof FenceGateBlock) ++ return (!((double)offset <= 0.5) || !belowState.collisionExtendsVertically(this.level(), getOnPos, this)) + ? getOnPos.atY(Mth.floor(this.position.y - offset)) + : getOnPos; + } else { +@@ -1447,19 +_,19 @@ + return !aboveState.is(BlockTags.INSIDE_STEP_SOUND_BLOCKS) && !aboveState.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS) ? affectingPos : abovePos; } -- protected void playCombinationStepSounds(BlockState p_277472_, BlockState p_277630_) { -- SoundType soundtype = p_277472_.getSoundType(); -+ protected void playCombinationStepSounds(BlockState p_277472_, BlockState p_277630_, BlockPos primaryPos, BlockPos secondaryPos) { -+ SoundType soundtype = p_277472_.getSoundType(this.level(), primaryPos, this); - this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch()); -- this.playMuffledStepSound(p_277630_); -+ this.playMuffledStepSound(p_277630_, secondaryPos); +- protected void playCombinationStepSounds(final BlockState primaryStepSound, final BlockState secondaryStepSound) { +- SoundType primaryStepSoundType = primaryStepSound.getSoundType(); ++ protected void playCombinationStepSounds(final BlockState primaryStepSound, final BlockState secondaryStepSound, final BlockPos primaryPos, final BlockPos secondaryPos) { ++ SoundType primaryStepSoundType = primaryStepSound.getSoundType(this.level(), primaryPos, this); + this.playSound(primaryStepSoundType.getStepSound(), primaryStepSoundType.getVolume() * 0.15F, primaryStepSoundType.getPitch()); +- this.playMuffledStepSound(secondaryStepSound); ++ this.playMuffledStepSound(secondaryStepSound, secondaryPos); } -- protected void playMuffledStepSound(BlockState p_283110_) { -- SoundType soundtype = p_283110_.getSoundType(); -+ protected void playMuffledStepSound(BlockState p_283110_, BlockPos pos) { -+ SoundType soundtype = p_283110_.getSoundType(this.level(), pos, this); - this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.05F, soundtype.getPitch() * 0.8F); +- protected void playMuffledStepSound(final BlockState blockState) { +- SoundType secondaryStepSoundType = blockState.getSoundType(); ++ protected void playMuffledStepSound(final BlockState blockState, final BlockPos pos) { ++ SoundType secondaryStepSoundType = blockState.getSoundType(this.level(), pos, this); + this.playSound(secondaryStepSoundType.getStepSound(), secondaryStepSoundType.getVolume() * 0.05F, secondaryStepSoundType.getPitch() * 0.8F); } - protected void playStepSound(BlockPos p_20135_, BlockState p_20136_) { -- SoundType soundtype = p_20136_.getSoundType(); -+ SoundType soundtype = p_20136_.getSoundType(this.level(), p_20135_, this); - this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch()); + protected void playStepSound(final BlockPos pos, final BlockState blockState) { +- SoundType soundType = blockState.getSoundType(); ++ SoundType soundType = blockState.getSoundType(this.level(), pos, this); + this.playSound(soundType.getStepSound(), soundType.getVolume() * 0.15F, soundType.getPitch()); } -@@ -1468,6 +_,10 @@ +@@ -1598,6 +_,10 @@ return this.wasTouchingWater; } @@ -107,67 +89,41 @@ + return this.isInWater() || isInFluidType((fluidType, height) -> canSwimInFluidType(fluidType)); + } + - boolean isInRain() { - BlockPos blockpos = this.blockPosition(); - return this.level().isRainingAt(blockpos) -@@ -1506,24 +_,32 @@ + private boolean isInRain() { + BlockPos pos = this.blockPosition(); + return this.level().isRainingAt(pos) || this.level().isRainingAt(BlockPos.containing(pos.getX(), this.getBoundingBox().maxY, pos.getZ())); +@@ -1635,10 +_,10 @@ public void updateSwimming() { if (this.isSwimming()) { - this.setSwimming(this.isSprinting() && this.isInWater() && !this.isPassenger()); + this.setSwimming(this.isSprinting() && this.isInWaterOrSwimmable() && !this.isPassenger()); } else { -- this.setSwimming(this.isSprinting() && this.isUnderWater() && !this.isPassenger() && this.level().getFluidState(this.blockPosition).is(FluidTags.WATER)); -+ this.setSwimming(this.isSprinting() && (this.isUnderWater() || this.canStartSwimming()) && !this.isPassenger()); + this.setSwimming( +- this.isSprinting() && this.isUnderWater() && !this.isPassenger() && this.level().getFluidState(this.blockPosition).is(FluidTags.WATER) ++ this.isSprinting() && (this.isUnderWater() || this.canStartSwimming()) && !this.isPassenger() + ); } } - - protected boolean updateInWaterStateAndDoFluidPushing() { - this.fluidHeight.clear(); -+ this.forgeFluidTypeHeight.clear(); - this.updateInWaterStateAndDoWaterCurrentPushing(); -- double d0 = this.level.environmentAttributes().getDimensionValue(EnvironmentAttributes.FAST_LAVA) ? 0.007 : 0.0023333333333333335; -- boolean flag = this.updateFluidHeightAndDoFluidPushing(FluidTags.LAVA, d0); -- return this.isInWater() || flag; -+ if (!(this.getVehicle() instanceof AbstractBoat)) { -+ this.fallDistance *= this.forgeFluidTypeHeight.object2DoubleEntrySet().stream().filter(e -> !e.getKey().isAir() && !e.getKey().isVanilla()).map(e -> this.getFluidFallDistanceModifier(e.getKey())).min(Float::compare).orElse(1F); -+ if (this.isInFluidType((fluidType, height) -> !fluidType.isAir() && !fluidType.isVanilla() && this.canFluidExtinguish(fluidType))) this.clearFire(); -+ } -+ return this.isInFluidType(); - } - - void updateInWaterStateAndDoWaterCurrentPushing() { -+ java.util.function.BooleanSupplier updateFluidHeight = () -> this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014D); - if (this.getVehicle() instanceof AbstractBoat abstractboat && !abstractboat.isUnderWater()) { -- this.wasTouchingWater = false; -- } else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) { -+ updateFluidHeight = () -> { -+ this.updateFluidHeightAndDoFluidPushing(state -> this.shouldUpdateFluidWhileBoating(state, abstractboat)); -+ return false; -+ }; -+ } -+ if (updateFluidHeight.getAsBoolean()) { - if (!this.wasTouchingWater && !this.firstTick) { - this.doWaterSplashEffect(); - } -@@ -1538,6 +_,7 @@ - private void updateFluidOnEyes() { - this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER); - this.fluidOnEyes.clear(); -+ this.forgeFluidTypeOnEyes = net.minecraftforge.common.ForgeMod.EMPTY_TYPE.get(); - double d0 = this.getEyeY(); - if (!( - this.getVehicle() instanceof AbstractBoat abstractboat -@@ -1549,7 +_,7 @@ - FluidState fluidstate = this.level().getFluidState(blockpos); - double d1 = blockpos.getY() + fluidstate.getHeight(this.level(), blockpos); - if (d1 > d0) { -- fluidstate.getTags().forEach(this.fluidOnEyes::add); -+ this.forgeFluidTypeOnEyes = fluidstate.getFluidType(); - } +@@ -1655,16 +_,7 @@ } + + this.wasTouchingWater = inWater; +- if (this.isPushedByFluid()) { +- if (inWater) { +- this.fluidInteraction.applyCurrentTo(FluidTags.WATER, this, 0.014); +- } +- +- if (inLava) { +- double lavaFlowScale = this.level.environmentAttributes().getDimensionValue(EnvironmentAttributes.FAST_LAVA) ? 0.007 : 0.0023333333333333335; +- this.fluidInteraction.applyCurrentTo(FluidTags.LAVA, this, lavaFlowScale); +- } +- } ++ this.fluidInteraction.applyCurrentTo(this); + + return inWater || inLava; } -@@ -1603,12 +_,13 @@ +@@ -1712,12 +_,13 @@ } public boolean canSpawnSprintParticle() { @@ -176,83 +132,66 @@ } protected void spawnSprintParticle() { - BlockPos blockpos = this.getOnPosLegacy(); - BlockState blockstate = this.level().getBlockState(blockpos); -+ if (!blockstate.addRunningEffects(level, blockpos, this)) - if (blockstate.getRenderShape() != RenderShape.INVISIBLE) { - Vec3 vec3 = this.getDeltaMovement(); - BlockPos blockpos1 = this.blockPosition(); -@@ -1624,7 +_,7 @@ + BlockPos pos = this.getOnPosLegacy(); + BlockState blockState = this.level().getBlockState(pos); ++ if (!blockState.addRunningEffects(level, pos, this)) + if (blockState.getRenderShape() != RenderShape.INVISIBLE) { + Vec3 movement = this.getDeltaMovement(); + BlockPos entityPosition = this.blockPosition(); +@@ -1732,7 +_,7 @@ + } this.level() - .addParticle( -- new BlockParticleOption(ParticleTypes.BLOCK, blockstate), -+ new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(blockpos), - d0, - this.getY() + 0.1, - d1, -@@ -1635,12 +_,15 @@ +- .addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), x, this.getY() + 0.1, z, movement.x * -4.0, 1.5, movement.z * -4.0); ++ .addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState).setPos(pos), x, this.getY() + 0.1, z, movement.x * -4.0, 1.5, movement.z * -4.0); } } -+ @Deprecated // Forge: Use isEyeInFluidType instead - public boolean isEyeInFluid(TagKey p_204030_) { -+ if (p_204030_ == FluidTags.WATER) return this.isEyeInFluidType(net.minecraftforge.common.ForgeMod.WATER_TYPE.get()); -+ else if (p_204030_ == FluidTags.LAVA) return this.isEyeInFluidType(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get()); - return this.fluidOnEyes.contains(p_204030_); - } - - public boolean isInLava() { -- return !this.firstTick && this.fluidHeight.getDouble(FluidTags.LAVA) > 0.0; -+ return !this.firstTick && this.forgeFluidTypeHeight.getDouble(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get()) > 0.0; - } - - public void moveRelative(float p_19921_, Vec3 p_19922_) { -@@ -2009,6 +_,10 @@ - p_409187_.putBoolean("HasVisualFire", this.hasVisualFire); +@@ -2113,6 +_,10 @@ + output.putBoolean("HasVisualFire", this.hasVisualFire); } -+ p_409187_.putBoolean("CanUpdate", canUpdate); -+ p_409187_.storeNullable("ForgeCaps", net.minecraft.nbt.CompoundTag.CODEC, serializeCaps(this.registryAccess())); -+ p_409187_.storeNullable("ForgeData", net.minecraft.nbt.CompoundTag.CODEC, persistentData); ++ output.putBoolean("CanUpdate", canUpdate); ++ output.storeNullable("ForgeCaps", net.minecraft.nbt.CompoundTag.CODEC, serializeCaps(this.registryAccess())); ++ output.storeNullable("ForgeData", net.minecraft.nbt.CompoundTag.CODEC, persistentData); + if (!this.tags.isEmpty()) { - p_409187_.store("Tags", TAG_LIST_CODEC, List.copyOf(this.tags)); + output.store("Tags", TAG_LIST_CODEC, List.copyOf(this.tags)); } -@@ -2084,6 +_,9 @@ - this.setGlowingTag(p_408698_.getBooleanOr("Glowing", false)); - this.setTicksFrozen(p_408698_.getIntOr("TicksFrozen", 0)); - this.hasVisualFire = p_408698_.getBooleanOr("HasVisualFire", false); -+ this.canUpdate(p_408698_.getBooleanOr("CanUpdate", true)); -+ this.persistentData = p_408698_.read("ForgeData", net.minecraft.nbt.CompoundTag.CODEC).orElse(null); -+ p_408698_.read("ForgeCaps", net.minecraft.nbt.CompoundTag.CODEC).ifPresent(caps -> this.deserializeCaps(this.registryAccess(), caps)); - this.customData = p_408698_.read("data", CustomData.CODEC).orElse(CustomData.EMPTY); +@@ -2184,6 +_,9 @@ + this.setGlowingTag(input.getBooleanOr("Glowing", false)); + this.setTicksFrozen(input.getIntOr("TicksFrozen", 0)); + this.hasVisualFire = input.getBooleanOr("HasVisualFire", false); ++ this.canUpdate(input.getBooleanOr("CanUpdate", true)); ++ this.persistentData = input.read("ForgeData", net.minecraft.nbt.CompoundTag.CODEC).orElse(null); ++ input.read("ForgeCaps", net.minecraft.nbt.CompoundTag.CODEC).ifPresent(caps -> this.deserializeCaps(this.registryAccess(), caps)); + this.customData = input.read("data", CustomData.CODEC).orElse(CustomData.EMPTY); this.tags.clear(); - p_408698_.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll); -@@ -2132,6 +_,8 @@ - p_409579_, this.getX() + p_408228_.x, this.getY() + p_408228_.y, this.getZ() + p_408228_.z, p_407826_ - ); - itementity.setDefaultPickUpDelay(); -+ if (captureDrops() != null) captureDrops().add(itementity); -+ else - p_409579_.addFreshEntity(itementity); - return itementity; - } -@@ -2190,11 +_,11 @@ + input.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll); +@@ -2234,6 +_,8 @@ + + ItemEntity entity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, itemStack); + entity.setDefaultPickUpDelay(); ++ if (captureDrops() != null) captureDrops().add(entity); ++ else + level.addFreshEntity(entity); + return entity; + } +@@ -2291,11 +_,11 @@ } - ItemStack itemstack = p_19978_.getItemInHand(p_19979_); -- if (itemstack.is(Items.SHEARS) && this.shearOffAllLeashConnections(p_19978_)) { -+ if (itemstack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.shearOffAllLeashConnections(p_19978_)) { - itemstack.hurtAndBreak(1, p_19978_, p_19979_); + ItemStack heldItem = player.getItemInHand(hand); +- if (heldItem.is(Items.SHEARS) && this.shearOffAllLeashConnections(player)) { ++ if (heldItem.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.shearOffAllLeashConnections(player)) { + heldItem.hurtAndBreak(1, player, hand); return InteractionResult.SUCCESS; - } else if (this instanceof Mob mob -- && itemstack.is(Items.SHEARS) -+ && itemstack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) - && mob.canShearEquipment(p_19978_) - && !p_19978_.isSecondaryUseActive() - && this.attemptToShearEquipment(p_19978_, p_19979_, itemstack, mob)) { -@@ -2302,6 +_,7 @@ + } else if (this instanceof Mob target +- && heldItem.is(Items.SHEARS) ++ && heldItem.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) + && target.canShearEquipment(player) + && !player.isSecondaryUseActive() + && target.attemptToShearEquipment(player, hand, heldItem)) { +@@ -2379,6 +_,7 @@ public void rideTick() { this.setDeltaMovement(Vec3.ZERO); @@ -260,23 +199,23 @@ this.tick(); if (this.isPassenger()) { this.getVehicle().positionRider(this); -@@ -2362,6 +_,7 @@ - } +@@ -2444,6 +_,7 @@ } + } -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_19966_, true)) return false; - if (p_19967_ || this.canRide(p_19966_) && p_19966_.canAddPassenger(this)) { - if (this.isPassenger()) { - this.stopRiding(); -@@ -2397,6 +_,7 @@ ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityToRide, true)) return false; + if (force || this.canRide(entityToRide) && entityToRide.canAddPassenger(this)) { + if (this.isPassenger()) { + this.stopRiding(); +@@ -2478,6 +_,7 @@ public void removeVehicle() { if (this.vehicle != null) { - Entity entity = this.vehicle; -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; + Entity oldVehicle = this.vehicle; ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, oldVehicle, false)) return; this.vehicle = null; - entity.removePassenger(this); - Entity.RemovalReason entity$removalreason = this.getRemovalReason(); -@@ -2447,6 +_,8 @@ + oldVehicle.removePassenger(this); + Entity.RemovalReason removalReason = this.getRemovalReason(); +@@ -2528,6 +_,8 @@ return this.passengers.isEmpty(); } @@ -285,7 +224,7 @@ protected boolean couldAcceptPassenger() { return true; } -@@ -2646,7 +_,7 @@ +@@ -2724,7 +_,7 @@ } public boolean isVisuallyCrawling() { @@ -293,17 +232,17 @@ + return this.isVisuallySwimming() && !this.isInWaterOrSwimmable(); } - public void setSwimming(boolean p_20283_) { -@@ -2762,7 +_,7 @@ + public void setSwimming(final boolean swimming) { +@@ -2840,7 +_,7 @@ this.igniteForSeconds(8.0F); } -- this.hurtServer(p_19927_, this.damageSources().lightningBolt(), 5.0F); -+ this.hurtServer(p_19927_, this.damageSources().lightningBolt(), p_19928_.getDamage()); +- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F); ++ this.hurtServer(level, this.damageSources().lightningBolt(), lightningBolt.getDamage()); } - public void onAboveBubbleColumn(boolean p_392709_, BlockPos p_391902_) { -@@ -2895,7 +_,7 @@ + public void onAboveBubbleColumn(final boolean dragDown, final BlockPos pos) { +@@ -2959,7 +_,7 @@ } protected Component getTypeName() { @@ -311,146 +250,52 @@ + return this.getType().getDescription(); // Forge: Use getter to allow overriding by mods; } - public boolean is(Entity p_20356_) { -@@ -3206,6 +_,7 @@ + public boolean is(final Entity other) { +@@ -3272,6 +_,7 @@ return this.stringUUID; } -+ @Deprecated // Forge: Use FluidType sensitive version ++ @Deprecated // Forge: Use FluidTag sensitive version public boolean isPushedByFluid() { return true; } -@@ -3594,9 +_,17 @@ - return Mth.lerp(p_344421_, this.yRotO, this.yRot); +@@ -3682,6 +_,10 @@ + return this.fluidInteraction.getFluidHeight(type); } -+ @Deprecated // Forge: Use predicate version instead, only for vanilla Tags - public boolean updateFluidHeightAndDoFluidPushing(TagKey p_204032_, double p_204033_) { -+ this.updateFluidHeightAndDoFluidPushing(com.google.common.base.Predicates.alwaysTrue()); -+ if(p_204032_ == FluidTags.WATER) return this.isInFluidType(net.minecraftforge.common.ForgeMod.WATER_TYPE.get()); -+ else if (p_204032_ == FluidTags.LAVA) return this.isInFluidType(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get()); -+ else return false; -+ } ++ public EntityFluidInteraction getFluidInteraction() { ++ return this.fluidInteraction; ++ } + -+ public void updateFluidHeightAndDoFluidPushing(Predicate shouldUpdate) { - if (this.touchingUnloadedChunk()) { -- return false; -+ return; - } else { - AABB aabb = this.getBoundingBox().deflate(0.001); - int i = Mth.floor(aabb.minX); -@@ -3611,25 +_,28 @@ - Vec3 vec3 = Vec3.ZERO; - int k1 = 0; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); -+ var interimCalcs = new it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap>(net.minecraftforge.fluids.FluidType.SIZE.get() - 1); - - for (int l1 = i; l1 < j; l1++) { - for (int i2 = k; i2 < l; i2++) { - for (int j2 = i1; j2 < j1; j2++) { - blockpos$mutableblockpos.set(l1, i2, j2); - FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); -- if (fluidstate.is(p_204032_)) { -+ net.minecraftforge.fluids.FluidType fluidType = fluidstate.getFluidType(); -+ if (!fluidType.isAir() && shouldUpdate.test(fluidstate)) { - double d1 = i2 + fluidstate.getHeight(this.level(), blockpos$mutableblockpos); - if (d1 >= aabb.minY) { - flag1 = true; -- d0 = Math.max(d1 - aabb.minY, d0); -- if (flag) { -+ var interim = interimCalcs.computeIfAbsent(fluidType, t -> org.apache.commons.lang3.tuple.MutableTriple.of(0.0D, Vec3.ZERO, 0)); -+ interim.setLeft(Math.max(d1 - aabb.minY, interim.getLeft())); -+ if (this.isPushedByFluid(fluidType)) { - Vec3 vec31 = fluidstate.getFlow(this.level(), blockpos$mutableblockpos); -- if (d0 < 0.4) { -- vec31 = vec31.scale(d0); -+ if (interim.getLeft() < 0.4D) { -+ vec31 = vec31.scale(interim.getLeft()); - } - -- vec3 = vec3.add(vec31); -- k1++; -+ interim.setMiddle(interim.getMiddle().add(vec31)); -+ interim.setRight(interim.getRight() + 1); - } - } - } -@@ -3637,27 +_,28 @@ - } - } - -- if (vec3.length() > 0.0) { -- if (k1 > 0) { -- vec3 = vec3.scale(1.0 / k1); -+ interimCalcs.forEach((fluidType, interim) -> { -+ if (interim.getMiddle().length() > 0.0D) { -+ if (interim.getRight() > 0) { -+ interim.setMiddle(interim.getMiddle().scale(1.0D / (double)interim.getRight())); - } - - if (!(this instanceof Player)) { -- vec3 = vec3.normalize(); -+ interim.setMiddle(interim.getMiddle().normalize()); - } - - Vec3 vec32 = this.getDeltaMovement(); -- vec3 = vec3.scale(p_204033_); -+ interim.setMiddle(interim.getMiddle().scale(this.getFluidMotionScale(fluidType))); - double d2 = 0.003; -- if (Math.abs(vec32.x) < 0.003 && Math.abs(vec32.z) < 0.003 && vec3.length() < 0.0045000000000000005) { -- vec3 = vec3.normalize().scale(0.0045000000000000005); -+ if (Math.abs(vec32.x) < 0.003 && Math.abs(vec32.z) < 0.003 && interim.getMiddle().length() < 0.0045000000000000005) { -+ interim.setMiddle(interim.getMiddle().normalize().scale(0.0045000000000000005)); - } - -- this.setDeltaMovement(this.getDeltaMovement().add(vec3)); -+ this.setDeltaMovement(this.getDeltaMovement().add(interim.getMiddle())); - } - -- this.fluidHeight.put(p_204032_, d0); -- return flag1; -+ this.setFluidTypeHeight(fluidType, interim.getLeft()); -+ }); - } + public double getFluidJumpThreshold() { + return this.getEyeHeight() < 0.4 ? 0.0 : 0.4; } - -@@ -3670,7 +_,10 @@ - return !this.level().hasChunksAt(i, k, j, l); - } - -+ @Deprecated // Forge: Use getFluidTypeHeight instead - public double getFluidHeight(TagKey p_204037_) { -+ if (p_204037_ == FluidTags.WATER) return getFluidTypeHeight(net.minecraftforge.common.ForgeMod.WATER_TYPE.get()); -+ else if (p_204037_ == FluidTags.LAVA) return getFluidTypeHeight(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get()); - return this.fluidHeight.getDouble(p_204037_); - } - -@@ -3686,7 +_,9 @@ +@@ -3694,7 +_,9 @@ return this.dimensions.height(); } + private boolean hasExtraSpawnData = this instanceof net.minecraftforge.entity.IEntityAdditionalSpawnData; - public Packet getAddEntityPacket(ServerEntity p_344981_) { + public Packet getAddEntityPacket(final ServerEntity serverEntity) { + if (hasExtraSpawnData) return net.minecraftforge.common.ForgeHooks.getEntitySpawnPacket(this); - return new ClientboundAddEntityPacket(this, p_344981_); + return new ClientboundAddEntityPacket(this, serverEntity); } -@@ -3821,6 +_,11 @@ +@@ -3833,6 +_,11 @@ } } } + + // Forge - ensure target chunk is loaded. -+ if (this.isAddedToWorld() && !this.level.isClientSide() && !this.isRemoved()) { -+ this.level.getChunk((int) Math.floor(p_20344_) >> 4, (int) Math.floor(p_20346_) >> 4); ++ if (this.isAddedToLevel() && !this.level.isClientSide() && !this.isRemoved()) { ++ this.level.getChunk((int)Math.floor(x) >> 4, (int)Math.floor(z) >> 4); + } } public void checkDespawn() { -@@ -3993,6 +_,100 @@ - float f1 = (float)Mth.lerp(d0, this.getXRot(), p_298926_); - this.setPos(d1, d2, d3); - this.setRot(f, f1); +@@ -4007,6 +_,83 @@ + float xRot = (float)Mth.lerp(alpha, this.getXRot(), targetXRot); + this.setPos(x, y, z); + this.setRot(yRot, xRot); + } + + private boolean canUpdate = true; @@ -487,7 +332,7 @@ + + @Override + public boolean canTrample(ServerLevel level, BlockState state, BlockPos pos, double fallDistance) { -+ return level.random.nextFloat() < fallDistance - 0.5F ++ return level.getRandom().nextFloat() < fallDistance - 0.5F + && this instanceof LivingEntity + && (this instanceof Player || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, this)) + && this.getBbWidth() * this.getBbWidth() * this.getBbHeight() > 0.512F; @@ -501,13 +346,13 @@ + private boolean isAddedToWorld; + + @Override -+ public final boolean isAddedToWorld() { return this.isAddedToWorld; } ++ public final boolean isAddedToLevel() { return this.isAddedToWorld; } + + @Override -+ public void onAddedToWorld() { this.isAddedToWorld = true; } ++ public void onAddedToLevel() { this.isAddedToWorld = true; } + + @Override -+ public void onRemovedFromWorld() { this.isAddedToWorld = false; } ++ public void onRemovedFromLevel() { this.isAddedToWorld = false; } + + @Override + public void revive() { @@ -515,36 +360,19 @@ + this.reviveCaps(); + } + -+ protected Object2DoubleMap forgeFluidTypeHeight = new Object2DoubleArrayMap<>(net.minecraftforge.fluids.FluidType.SIZE.get()); -+ private net.minecraftforge.fluids.FluidType forgeFluidTypeOnEyes = net.minecraftforge.common.ForgeMod.EMPTY_TYPE.get(); -+ protected final void setFluidTypeHeight(net.minecraftforge.fluids.FluidType type, double height) { -+ this.forgeFluidTypeHeight.put(type, height); -+ } -+ + @Override -+ public final double getFluidTypeHeight(net.minecraftforge.fluids.FluidType type) { -+ return this.forgeFluidTypeHeight.getDouble(type); -+ } -+ -+ @Override -+ public final boolean isInFluidType(java.util.function.BiPredicate predicate, boolean forAllTypes) { -+ return forAllTypes ? this.forgeFluidTypeHeight.object2DoubleEntrySet().stream().allMatch(e -> predicate.test(e.getKey(), e.getDoubleValue())) -+ : this.forgeFluidTypeHeight.object2DoubleEntrySet().stream().anyMatch(e -> predicate.test(e.getKey(), e.getDoubleValue())); -+ } -+ -+ @Override -+ public final boolean isInFluidType() { -+ return this.forgeFluidTypeHeight.size() > 0; ++ public boolean isInFluidType() { ++ return this.fluidInteraction.isInFluid(); + } + + @Override + public final net.minecraftforge.fluids.FluidType getEyeInFluidType() { -+ return forgeFluidTypeOnEyes; ++ return this.fluidInteraction.getEyeFluid(); + } + + @Override -+ public net.minecraftforge.fluids.FluidType getMaxHeightFluidType() { -+ return this.forgeFluidTypeHeight.object2DoubleEntrySet().stream().max(java.util.Comparator.comparingDouble(Object2DoubleMap.Entry::getDoubleValue)).map(Object2DoubleMap.Entry::getKey).orElseGet(net.minecraftforge.common.ForgeMod.EMPTY_TYPE); ++ public final boolean isInFluidType(java.util.function.BiPredicate predicate, boolean forAllTypes) { ++ return this.fluidInteraction.isInFluid(predicate, forAllTypes); } public RandomSource getRandom() { diff --git a/patches/minecraft/net/minecraft/world/entity/EntityEquipment.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityEquipment.java.patch index 09f8a9cd02..98afa9846c 100644 --- a/patches/minecraft/net/minecraft/world/entity/EntityEquipment.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/EntityEquipment.java.patch @@ -2,17 +2,17 @@ +++ b/net/minecraft/world/entity/EntityEquipment.java @@ -49,7 +_,7 @@ for (Entry entry : this.items.entrySet()) { - ItemStack itemstack = entry.getValue(); - if (!itemstack.isEmpty()) { -- itemstack.inventoryTick(p_394224_.level(), p_394224_, entry.getKey()); -+ itemstack.inventoryTick(p_394224_.level(), p_394224_, entry.getKey(), -1); + ItemStack item = entry.getValue(); + if (!item.isEmpty()) { +- item.inventoryTick(owner.level(), owner, entry.getKey()); ++ item.inventoryTick(owner.level(), owner, entry.getKey(), -1); } } } @@ -69,5 +_,9 @@ public void clear() { - this.items.replaceAll((p_393205_, p_394162_) -> ItemStack.EMPTY); + this.items.replaceAll((s, v) -> ItemStack.EMPTY); + } + + public int size() { diff --git a/patches/minecraft/net/minecraft/world/entity/EntityFluidInteraction.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityFluidInteraction.java.patch new file mode 100644 index 0000000000..54d1aa113e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/EntityFluidInteraction.java.patch @@ -0,0 +1,179 @@ +--- a/net/minecraft/world/entity/EntityFluidInteraction.java ++++ b/net/minecraft/world/entity/EntityFluidInteraction.java +@@ -21,16 +_,39 @@ + import org.jspecify.annotations.Nullable; + + public class EntityFluidInteraction { ++ private static final Map, java.util.function.Supplier> MODDED_TYPES = new java.util.HashMap<>(); ++ public static void register(final TagKey fluid) { ++ register(fluid, EntityFluidInteraction.Tracker::new); ++ } ++ public static void register(final TagKey fluid, final java.util.function.Supplier factory) { ++ register(fluid, factory); ++ } ++ + private final Map, EntityFluidInteraction.Tracker> trackerByFluid = new Reference2ObjectArrayMap<>(); ++ private final Map trackerByFluidType = new Reference2ObjectArrayMap(); ++ private boolean isInFluid = false; ++ private net.minecraftforge.fluids.FluidType eyeFluid = net.minecraftforge.common.ForgeMod.EMPTY_TYPE.get(); + + public EntityFluidInteraction(final Set> fluids) { + for (TagKey fluid : fluids) { + this.trackerByFluid.put(fluid, new EntityFluidInteraction.Tracker()); + } ++ for (var entry : MODDED_TYPES.entrySet()) { ++ if (!fluids.contains(entry.getKey())) ++ this.trackerByFluid.put(entry.getKey(), entry.getValue().get()); ++ } ++ } ++ ++ public EntityFluidInteraction.@Nullable Tracker getTracker(final TagKey fluid) { ++ return this.trackerByFluid.get(fluid); + } + + public void update(final Entity entity, final boolean ignoreCurrent) { + this.trackerByFluid.values().forEach(EntityFluidInteraction.Tracker::reset); ++ this.trackerByFluidType.values().forEach(EntityFluidInteraction.Tracker::reset); ++ this.isInFluid = false; ++ this.eyeFluid = net.minecraftforge.common.ForgeMod.EMPTY_TYPE.get(); ++ + AABB box = entity.getFluidInteractionBox(); + if (box != null) { + int x0 = Mth.floor(box.minX); +@@ -45,7 +_,7 @@ + double eyeY = entity.getEyeY(); + int eyeBlockZ = entity.getBlockZ(); + Fluid lastFluidType = null; +- EntityFluidInteraction.Tracker tracker = null; ++ EntityFluidInteraction.Tracker[] trackers = null; + BlockGetter level = entity.level(); + BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); + +@@ -55,23 +_,26 @@ + mutablePos.set(x, y, z); + FluidState fluidState = level.getFluidState(mutablePos); + if (!fluidState.isEmpty()) { ++ isInFluid = true; + double fluidBottom = mutablePos.getY(); + double fluidTop = fluidBottom + fluidState.getHeight(level, mutablePos); + if (!(fluidTop < box.minY)) { + Fluid fluidType = fluidState.getType(); + if (fluidType != lastFluidType) { + lastFluidType = fluidType; +- tracker = this.getTrackerFor(fluidType); ++ trackers = this.getTrackersFor(fluidType); + } + +- if (tracker != null) { ++ for (var tracker : trackers) { + if (x == eyeBlockX && z == eyeBlockZ && eyeY >= fluidBottom && eyeY <= fluidTop) { + tracker.eyesInside = true; ++ this.eyeFluid = lastFluidType.getFluidType(); + } + + tracker.height = Math.max(fluidTop - entityY, tracker.height); +- if (!ignoreCurrent) { +- Vec3 flow = fluidState.getFlow(level, mutablePos); ++ if (!ignoreCurrent || !fluidState.getType().getFluidType().canPushEntity(entity)) { ++ Vec3 flow = fluidState.getFlow(level, mutablePos, entity); ++ + if (tracker.height < 0.4) { + flow = flow.scale(tracker.height); + } +@@ -118,15 +_,27 @@ + return hasFluid; + } + +- private EntityFluidInteraction.@Nullable Tracker getTrackerFor(final Fluid fluid) { ++ private final EntityFluidInteraction.Tracker[] NONE = new EntityFluidInteraction.Tracker[0]; ++ ++ private EntityFluidInteraction.@Nullable Tracker[] getTrackersFor(final Fluid fluid) { ++ var ret = new java.util.ArrayList(1); + for (Entry, EntityFluidInteraction.Tracker> entry : this.trackerByFluid.entrySet()) { + TagKey tag = entry.getKey(); + if (fluid.is(tag)) { +- return entry.getValue(); ++ ret.add(entry.getValue()); + } + } + +- return null; ++ ret.add(this.trackerByFluidType.computeIfAbsent(fluid.getFluidType(), k -> new EntityFluidInteraction.Tracker())); ++ return ret.isEmpty() ? NONE : ret.toArray(EntityFluidInteraction.Tracker[]::new); ++ } ++ ++ public void applyCurrentTo(final Entity entity) { ++ for (var entry : this.trackerByFluidType.entrySet()) { ++ if (!entity.isPushedByFluid(entry.getKey())) ++ continue; ++ entry.getValue().applyCurrentTo(entity, entity.getFluidMotionScale(entry.getKey())); ++ } + } + + public void applyCurrentTo(final TagKey fluid, final Entity entity, final double scale) { +@@ -141,6 +_,19 @@ + return tracker != null ? tracker.height : 0.0; + } + ++ public double getFluidHeight(final Fluid fluid) { ++ return getFluidHeight(fluid.getFluidType()); ++ } ++ ++ public double getFluidHeight(final net.minecraftforge.fluids.FluidType fluid) { ++ var tracker = this.trackerByFluidType.get(fluid); ++ return tracker == null ? 0 : tracker.height; ++ } ++ ++ public boolean isInFluid() { ++ return this.isInFluid; ++ } ++ + public boolean isInFluid(final TagKey fluid) { + return this.getFluidHeight(fluid) > 0.0; + } +@@ -148,6 +_,45 @@ + public boolean isEyeInFluid(final TagKey fluid) { + EntityFluidInteraction.Tracker tracker = this.trackerByFluid.get(fluid); + return tracker != null && tracker.eyesInside; ++ } ++ ++ public boolean isEyeInFluid(final Fluid fluid) { ++ return isEyeInFluid(fluid.getFluidType()); ++ } ++ ++ public boolean isEyeInFluid(final net.minecraftforge.fluids.FluidType fluid) { ++ var tracker = this.trackerByFluidType.get(fluid); ++ return tracker != null && tracker.eyesInside; ++ } ++ ++ public net.minecraftforge.fluids.FluidType getEyeFluid() { ++ return this.eyeFluid; ++ } ++ ++ public net.minecraftforge.fluids.FluidType getMaxHeightFluid() { ++ var ret = net.minecraftforge.common.ForgeMod.EMPTY_TYPE.get(); ++ double height = 0; ++ EntityFluidInteraction.Tracker max = null; ++ for (var entry : this.trackerByFluidType.entrySet()) { ++ if (entry.getValue().height > height) { ++ height = entry.getValue().height; ++ ret = entry.getKey(); ++ } ++ } ++ return ret; ++ } ++ ++ public final boolean isInFluid(java.util.function.BiPredicate predicate, boolean forAllTypes) { ++ boolean match = false; ++ for (var entry : this.trackerByFluidType.entrySet()) { ++ if (entry.getValue().height > 0 && predicate.test(entry.getKey(), entry.getValue().height)) { ++ match = true; ++ if (!forAllTypes) ++ return true; ++ } else if (forAllTypes) ++ return false; ++ } ++ return match; + } + + private static class Tracker { diff --git a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch index 860403373e..1289ce6c6c 100644 --- a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -979,6 +_,11 @@ +@@ -73,6 +_,11 @@ private final FeatureFlagSet requiredFeatures; private final boolean allowedInPeaceful; @@ -9,23 +9,23 @@ + private final java.util.function.ToIntFunction> updateIntervalSupplier; + private final java.util.function.BiFunction customClientFactory; + - private static EntityType register(ResourceKey> p_368406_, EntityType.Builder p_363129_) { - return Registry.register(BuiltInRegistries.ENTITY_TYPE, p_368406_, p_363129_.build(p_368406_)); + public static Identifier getKey(final EntityType type) { + return BuiltInRegistries.ENTITY_TYPE.getKey(type); } -@@ -1014,7 +_,8 @@ - String p_367006_, - Optional> p_364691_, - FeatureFlagSet p_273518_, -- boolean p_430684_ -+ boolean p_430684_, -+ Builder builder +@@ -92,7 +_,8 @@ + final String descriptionId, + final Optional> lootTable, + final FeatureFlagSet requiredFeatures, +- final boolean allowedInPeaceful ++ final boolean allowedInPeaceful, ++ final Builder builder ) { - this.factory = p_273268_; - this.category = p_272918_; -@@ -1031,6 +_,10 @@ - this.lootTable = p_364691_; - this.requiredFeatures = p_273518_; - this.allowedInPeaceful = p_430684_; + this.factory = factory; + this.category = category; +@@ -109,6 +_,10 @@ + this.lootTable = lootTable; + this.requiredFeatures = requiredFeatures; + this.allowedInPeaceful = allowedInPeaceful; + this.velocityUpdateSupplier = builder == null || builder.velocityUpdateSupplier == null ? EntityType::defaultVelocitySupplier : builder.velocityUpdateSupplier; + this.trackingRangeSupplier = builder == null || builder.trackingRangeSupplier == null ? EntityType::defaultTrackingRangeSupplier : builder.trackingRangeSupplier; + this.updateIntervalSupplier = builder == null || builder.updateIntervalSupplier == null ? EntityType::defaultUpdateIntervalSupplier : builder.updateIntervalSupplier; @@ -33,7 +33,7 @@ } public @Nullable T spawn( -@@ -1325,14 +_,26 @@ +@@ -424,14 +_,26 @@ } public int clientTrackingRange() { @@ -57,34 +57,37 @@ + } + + private boolean defaultVelocitySupplier() { - return this != PLAYER - && this != LLAMA_SPIT - && this != WITHER -@@ -1391,6 +_,12 @@ - return OP_ONLY_CUSTOM_DATA.contains(this); + return this != EntityTypes.PLAYER + && this != EntityTypes.LLAMA_SPIT + && this != EntityTypes.WITHER +@@ -466,6 +_,15 @@ + return EntityTypes.OP_ONLY_CUSTOM_DATA.contains(this); } + public T customClientSpawn(net.minecraftforge.network.packets.SpawnEntity packet, Level world) { + if (customClientFactory == null) return this.create(world, EntitySpawnReason.LOAD); + return customClientFactory.apply(packet, world); + } -+ public Stream>> getTags() {return this.builtInRegistryHolder().tags();} ++ ++ public Stream>> getTags() { ++ return this.builtInRegistryHolder().tags(); ++ } + public static class Builder { private final EntityType.EntityFactory factory; private final MobCategory category; -@@ -1410,6 +_,10 @@ +@@ -485,6 +_,10 @@ ); - private final DependantName, String> descriptionId = p_449414_ -> Util.makeDescriptionId("entity", p_449414_.identifier()); + private final DependantName, String> descriptionId = id -> Util.makeDescriptionId("entity", id.identifier()); private boolean allowedInPeaceful = true; + private java.util.function.Predicate> velocityUpdateSupplier = EntityType::defaultVelocitySupplier; + private java.util.function.ToIntFunction> trackingRangeSupplier = EntityType::defaultTrackingRangeSupplier; + private java.util.function.ToIntFunction> updateIntervalSupplier = EntityType::defaultUpdateIntervalSupplier; + private java.util.function.BiFunction customClientFactory; - private Builder(EntityType.EntityFactory p_20696_, MobCategory p_20697_) { - this.factory = p_20696_; -@@ -1528,6 +_,30 @@ + private Builder(final EntityType.EntityFactory factory, final MobCategory category) { + this.factory = factory; +@@ -603,6 +_,30 @@ return this; } @@ -112,12 +115,12 @@ + return this; + } + - public EntityType build(ResourceKey> p_369693_) { + public EntityType build(final ResourceKey> name) { if (this.serialize) { - Util.fetchChoiceType(References.ENTITY_TREE, p_369693_.identifier().toString()); -@@ -1548,7 +_,8 @@ - this.descriptionId.get(p_369693_), - this.lootTable.get(p_369693_), + Util.fetchChoiceType(References.ENTITY_TREE, name.identifier().toString()); +@@ -623,7 +_,8 @@ + this.descriptionId.get(name), + this.lootTable.get(name), this.requiredFeatures, - this.allowedInPeaceful + this.allowedInPeaceful, diff --git a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch index cb00ebf379..8ae1b260d8 100644 --- a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/world/entity/ExperienceOrb.java @@ -136,7 +_,8 @@ this.applyEffectsFromBlocks(); - float f = 0.98F; + float friction = this.getAirDrag(); if (this.onGround()) { -- f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- friction *= this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction(); + BlockPos pos = getBlockPosBelowThatAffectsMyMovement(); -+ f = this.level().getBlockState(pos).getFriction(this.level(), pos, this) * 0.98F; ++ friction *= this.level().getBlockState(pos).getFriction(this.level(), pos, this) * 0.98F; } - this.setDeltaMovement(this.getDeltaMovement().scale(f)); -@@ -278,6 +_,7 @@ - public void playerTouch(Player p_20792_) { - if (p_20792_ instanceof ServerPlayer serverplayer) { - if (p_20792_.takeXpDelay == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerPickupXp(p_20792_, this)) return; - p_20792_.takeXpDelay = 2; - p_20792_.take(this, 1); - int i = this.repairPlayerItems(serverplayer, this.getValue()); + this.setDeltaMovement(this.getDeltaMovement().scale(friction)); +@@ -282,6 +_,7 @@ + public void playerTouch(final Player player) { + if (player instanceof ServerPlayer serverPlayer) { + if (player.takeXpDelay == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerPickupXp(player, this)) return; + player.takeXpDelay = 2; + player.take(this, 1); + int remaining = this.repairPlayerItems(serverPlayer, this.getValue()); diff --git a/patches/minecraft/net/minecraft/world/entity/Leashable.java.patch b/patches/minecraft/net/minecraft/world/entity/Leashable.java.patch index f23634428e..7a967bd49e 100644 --- a/patches/minecraft/net/minecraft/world/entity/Leashable.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Leashable.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/Leashable.java +++ b/net/minecraft/world/entity/Leashable.java -@@ -185,7 +_,8 @@ +@@ -188,7 +_,8 @@ - static float angularFriction(E p_408063_) { - if (p_408063_.onGround()) { -- return p_408063_.level().getBlockState(p_408063_.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F; -+ var pos = p_408063_.getBlockPosBelowThatAffectsMyMovement(); -+ return p_408063_.level().getBlockState(pos).getFriction(p_408063_.level(), pos, p_408063_) * 0.91F; + static float angularFriction(final E entity) { + if (entity.onGround()) { +- return entity.level().getBlockState(entity.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F; ++ var pos = entity.getBlockPosBelowThatAffectsMyMovement(); ++ return entity.level().getBlockState(pos).getFriction(entity.level(), pos, entity) * 0.91F; } else { - return p_408063_.isInLiquid() ? 0.8F : 0.91F; + return entity.isInLiquid() ? 0.8F : 0.91F; } diff --git a/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch b/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch index 150c1feeb4..2312813865 100644 --- a/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/LightningBolt.java +++ b/net/minecraft/world/entity/LightningBolt.java -@@ -38,6 +_,7 @@ +@@ -39,6 +_,7 @@ private @Nullable ServerPlayer cause; private final Set hitEntities = Sets.newHashSet(); private int blocksSetOnFire; + private float damage = 5.0F; - public LightningBolt(EntityType p_20865_, Level p_20866_) { - super(p_20865_, p_20866_); -@@ -63,6 +_,14 @@ - this.cause = p_20880_; + public LightningBolt(final EntityType type, final Level level) { + super(type, level); +@@ -64,6 +_,14 @@ + this.cause = cause; } + public void setDamage(float damage) { @@ -21,12 +21,12 @@ + } + private void powerLightningRod() { - BlockPos blockpos = this.getStrikePosition(); - BlockState blockstate = this.level().getBlockState(blockpos); -@@ -161,6 +_,7 @@ + BlockPos strikePosition = this.getStrikePosition(); + BlockState stateBelow = this.level().getBlockState(strikePosition); +@@ -150,6 +_,7 @@ ); - for (Entity entity : list1) { + for (Entity entity : entities) { + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) entity.thunderHit((ServerLevel)this.level(), this); } diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index 6adcbacc7d..903f63c21f 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 -@@ -143,7 +_,7 @@ +@@ -138,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,339 +9,356 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_ACTIVE_EFFECTS = "active_effects"; public static final String TAG_ATTRIBUTES = "attributes"; -@@ -189,6 +_,8 @@ - public static final float EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT = 0.5F; - public static final float DEFAULT_BABY_SCALE = 0.5F; - private static final float WATER_FLOAT_IMPULSE = 0.04F; +@@ -209,6 +_,8 @@ + public static final float ELYTRA_VERTICAL_AIR_DRAG = 0.98F; + public static final float BASE_SWIM_SPEED = 0.02F; + private int currentImpulseContextResetGraceTime = 0; + /** Forge: Use a variant that calls {@link ItemStack#isMonsterDisguise(Player, net.minecraft.world.entity.monster.Monster)} and {@link net.minecraftforge.event.entity.living.MonsterDisguiseEvent} */ + @Deprecated - public static final Predicate PLAYER_NOT_WEARING_DISGUISE_ITEM = p_390518_ -> { - if (p_390518_ instanceof Player player) { - ItemStack itemstack = player.getItemBySlot(EquipmentSlot.HEAD); -@@ -270,7 +_,7 @@ + public static final Predicate PLAYER_NOT_WEARING_DISGUISE_ITEM = livingEntity -> { + if (livingEntity instanceof Player player) { + ItemStack helmet = player.getItemBySlot(EquipmentSlot.HEAD); +@@ -292,7 +_,7 @@ this.reapplyPosition(); this.setYRot(this.random.nextFloat() * (float) (Math.PI * 2)); this.yHeadRot = this.getYRot(); -- this.brain = this.makeBrain(EMPTY_BRAIN); -+ this.brain = net.minecraftforge.common.ForgeHooks.onLivingMakeBrain(this, this.makeBrain(EMPTY_BRAIN), EMPTY_BRAIN); +- this.brain = this.makeBrain(Brain.Packed.EMPTY); ++ this.brain = net.minecraftforge.common.ForgeHooks.onLivingMakeBrain(this, this.makeBrain(Brain.Packed.EMPTY), Brain.Packed.EMPTY); } @Override -@@ -334,9 +_,10 @@ - .add(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE) - .add(Attributes.WATER_MOVEMENT_EFFICIENCY) - .add(Attributes.MOVEMENT_EFFICIENCY) -- .add(Attributes.ATTACK_KNOCKBACK) - .add(Attributes.CAMERA_DISTANCE) -- .add(Attributes.WAYPOINT_TRANSMIT_RANGE); -+ .add(Attributes.ATTACK_KNOCKBACK) -+ .add(Attributes.WAYPOINT_TRANSMIT_RANGE) +@@ -356,7 +_,8 @@ + .add(Attributes.AIR_DRAG_MODIFIER) + .add(Attributes.FRICTION_MODIFIER) + .add(Attributes.NAME_TAG_DISTANCE) +- .add(Attributes.BELOW_NAME_DISTANCE); ++ .add(Attributes.BELOW_NAME_DISTANCE) + .add(Attributes.JUMP_STRENGTH); } @Override -@@ -363,7 +_,8 @@ +@@ -383,7 +_,8 @@ - double d7 = Math.min(0.2F + d6 / 15.0, 2.5); - int i = (int)(150.0 * d7); -- serverlevel.sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_), d0, d1, d2, i, 0.0, 0.0, 0.0, 0.15F); -+ if (!p_20992_.addLandingEffects((ServerLevel) this.level(), p_20993_, p_20992_, this, i)) -+ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_).setPos(p_20993_), d0, d1, d2, i, 0.0, 0.0, 0.0, 0.15F); + double scale = Math.min(0.2F + power / 15.0, 2.5); + int particles = (int)(150.0 * scale); +- level.sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, onState), x, y, z, particles, 0.0, 0.0, 0.0, 0.15F); ++ if (!onState.addLandingEffects((ServerLevel) this.level(), pos, onState, this, particles)) ++ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, onState).setPos(pos), x, y, z, particles, 0.0, 0.0, 0.0, 0.15F); } } -@@ -373,6 +_,7 @@ +@@ -393,6 +_,7 @@ } } -+ @Deprecated //FORGE: Use canDrownInFluidType instead ++ @Deprecated //FORGE: Use canDrownInFluid instead public boolean canBreatheUnderwater() { - return this.getType().is(EntityTypeTags.CAN_BREATHE_UNDER_WATER); + return this.is(EntityTypeTags.CAN_BREATHE_UNDER_WATER); } -@@ -413,6 +_,10 @@ +@@ -433,6 +_,9 @@ } } -+ + int airSupply = this.getAirSupply(); + net.minecraftforge.common.ForgeHooks.onLivingBreathe(this, airSupply - decreaseAirSupply(airSupply), increaseAirSupply(airSupply) - airSupply); + if (false) // Forge: Handled in ForgeHooks#onLivingBreathe(LivingEntity, int, int) if (this.isEyeInFluid(FluidTags.WATER) - && !serverlevel1.getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) { - boolean flag1 = !this.canBreatheUnderwater() && !MobEffectUtil.hasWaterBreathing(this) && (!flag || !((Player)this).getAbilities().invulnerable); -@@ -759,6 +_,9 @@ - } else { - ItemEntity itementity = this.createItemStackToDrop(p_395943_, p_393118_, p_392158_); - if (itementity != null) { -+ if (captureDrops() != null) -+ captureDrops().add(itementity); -+ else - this.level().addFreshEntity(itementity); - } + && !level.getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) { + boolean canDrownInWater = !this.canBreatheUnderwater() +@@ -788,6 +_,9 @@ -@@ -801,7 +_,7 @@ - this.setPosToBed(p_390515_); + ItemEntity entity = this.createItemStackToDrop(itemStack, randomly, thrownFromHand); + if (entity != null) { ++ if (captureDrops() != null) ++ captureDrops().add(entity); ++ else + this.level().addFreshEntity(entity); + } + +@@ -828,7 +_,7 @@ + this.setPosToBed(sleepingPos); } }, this::clearSleepingPos); -- p_406679_.read("Brain", Codec.PASSTHROUGH).ifPresent(p_405289_ -> this.brain = this.makeBrain((Dynamic)p_405289_)); -+ p_406679_.read("Brain", Codec.PASSTHROUGH).ifPresent(p_405289_ -> this.brain = net.minecraftforge.common.ForgeHooks.onLivingMakeBrain(this, this.makeBrain((Dynamic)p_405289_), (Dynamic)p_405289_)); - this.lastHurtByPlayer = EntityReference.read(p_406679_, "last_hurt_by_player"); - this.lastHurtByPlayerMemoryTime = p_406679_.getIntOr("last_hurt_by_player_memory_time", 0); - this.lastHurtByMob = EntityReference.read(p_406679_, "last_hurt_by_mob"); -@@ -825,8 +_,10 @@ - Holder holder = iterator.next(); - MobEffectInstance mobeffectinstance = this.activeEffects.get(holder); - if (!mobeffectinstance.tickServer(serverlevel, this, () -> this.onEffectUpdated(mobeffectinstance, true, null))) { -+ if (!net.minecraftforge.event.ForgeEventFactory.onLivingEffectExpire(this, mobeffectinstance)) { +- input.read("Brain", Brain.Packed.CODEC).ifPresent(packedBrain -> this.brain = this.makeBrain(packedBrain)); ++ input.read("Brain", Brain.Packed.CODEC).ifPresent(packedBrain -> this.brain = net.minecraftforge.common.ForgeHooks.onLivingMakeBrain(this, this.makeBrain(packedBrain), packedBrain)); + this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player"); + this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0); + this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob"); +@@ -854,8 +_,10 @@ + Holder mobEffect = iterator.next(); + MobEffectInstance effect = this.activeEffects.get(mobEffect); + if (!effect.tickServer(serverLevel, this, () -> this.onEffectUpdated(effect, true, null))) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onLivingEffectExpire(this, effect)) { iterator.remove(); - this.onEffectsRemoved(List.of(mobeffectinstance)); + this.onEffectsRemoved(List.of(effect)); + } - } else if (mobeffectinstance.getDuration() % 600 == 0) { - this.onEffectUpdated(mobeffectinstance, false, null); + } else if (effect.getDuration() % 600 == 0) { + this.onEffectUpdated(effect, false, null); } -@@ -908,6 +_,7 @@ +@@ -942,6 +_,7 @@ } } -+ d0 = net.minecraftforge.common.ForgeHooks.getEntityVisibilityMultiplier(this, p_20969_, d0); - return d0; ++ visibilityPercent = net.minecraftforge.common.ForgeHooks.getEntityVisibilityMultiplier(this, targetingEntity, visibilityPercent); + return visibilityPercent; } -@@ -981,6 +_,7 @@ - } else { - MobEffectInstance mobeffectinstance = this.activeEffects.get(p_147208_.getEffect()); - boolean flag = false; -+ net.minecraftforge.event.ForgeEventFactory.onLivingEffectAdd(this, mobeffectinstance, p_147208_, p_147209_); - if (mobeffectinstance == null) { - this.activeEffects.put(p_147208_.getEffect(), p_147208_); - this.onEffectAdded(p_147208_, p_147209_); -@@ -997,6 +_,10 @@ +@@ -1018,6 +_,7 @@ + + MobEffectInstance effect = this.activeEffects.get(newEffect.getEffect()); + boolean changed = false; ++ net.minecraftforge.event.ForgeEventFactory.onLivingEffectAdd(this, effect, newEffect, source); + if (effect == null) { + this.activeEffects.put(newEffect.getEffect(), newEffect); + this.onEffectAdded(newEffect, source); +@@ -1033,6 +_,10 @@ } - public boolean canBeAffected(MobEffectInstance p_21197_) { -+ var eventResult = net.minecraftforge.event.ForgeEventFactory.onLivingEffectCanApply(this, p_21197_).getResult(); + public boolean canBeAffected(final MobEffectInstance newEffect) { ++ var eventResult = net.minecraftforge.event.ForgeEventFactory.onLivingEffectCanApply(this, newEffect).getResult(); + if (!eventResult.isDefault()) { + return eventResult.isAllowed(); + } - if (this.getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) { - return !p_21197_.is(MobEffects.INFESTED); - } else if (this.getType().is(EntityTypeTags.IMMUNE_TO_OOZING)) { -@@ -1029,6 +_,9 @@ + if (this.is(EntityTypeTags.IMMUNE_TO_INFESTED)) { + return !newEffect.is(MobEffects.INFESTED); + } else if (this.is(EntityTypeTags.IMMUNE_TO_OOZING)) { +@@ -1063,6 +_,9 @@ } - public boolean removeEffect(Holder p_335910_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onLivingEffectRemove(this, p_335910_.get())) { + public boolean removeEffect(final Holder effect) { ++ if (net.minecraftforge.event.ForgeEventFactory.onLivingEffectRemove(this, effect.get())) { + return false; + } - MobEffectInstance mobeffectinstance = this.removeEffectNoUpdate(p_335910_); - if (mobeffectinstance != null) { - this.onEffectsRemoved(List.of(mobeffectinstance)); -@@ -1073,6 +_,9 @@ + MobEffectInstance effectInstance = this.removeEffectNoUpdate(effect); + if (effectInstance != null) { + this.onEffectsRemoved(List.of(effectInstance)); +@@ -1107,6 +_,9 @@ this.effectsDirty = true; - for (MobEffectInstance mobeffectinstance : p_364717_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onLivingEffectRemove(this, mobeffectinstance)) { + for (MobEffectInstance effect : effects) { ++ if (net.minecraftforge.event.ForgeEventFactory.onLivingEffectRemove(this, effect)) { + continue; + } - mobeffectinstance.getEffect().value().removeAttributeModifiers(this.getAttributes()); + effect.getEffect().value().removeAttributeModifiers(this.getAttributes()); - for (Entity entity : this.getPassengers()) { -@@ -1120,6 +_,10 @@ + for (Entity passenger : this.getPassengers()) { +@@ -1154,9 +_,13 @@ } - public void heal(float p_21116_) { -+ p_21116_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_21116_); -+ if (p_21116_ <= 0) { + public void heal(final float heal) { ++ var ammount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, heal); ++ if (ammount <= 0) { + return; + } - float f = this.getHealth(); - if (f > 0.0F) { - this.setHealth(f + p_21116_); -@@ -1140,6 +_,9 @@ + float health = this.getHealth(); + if (health > 0.0F) { +- this.setHealth(health + heal); ++ this.setHealth(health + ammount); + } + } + +@@ -1174,6 +_,9 @@ @Override - public boolean hurtServer(ServerLevel p_361743_, DamageSource p_361865_, float p_365677_) { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_361865_, p_365677_)) { + public boolean hurtServer(final ServerLevel level, final DamageSource source, float damage) { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, damage)) { + return false; + } - if (this.isInvulnerableTo(p_361743_, p_361865_)) { + if (this.isInvulnerableTo(level, source)) { return false; - } else if (this.isDeadOrDying()) { -@@ -1287,6 +_,10 @@ - } + } +@@ -1332,6 +_,10 @@ + } - float f = blocksattacks.resolveBlockedDamage(p_392511_, p_394545_, d0); -+ var ev = net.minecraftforge.event.ForgeEventFactory.onShieldBlock(this, p_392511_, f, itemstack); -+ if (ev == null) return 0.0F; -+ f = ev.getBlockedDamage(); -+ if (ev.shieldTakesDamage()) - blocksattacks.hurtBlockingItem(this.level(), itemstack, this, this.getUsedItemHand(), f); - if (f > 0.0F && !p_392511_.is(DamageTypeTags.IS_PROJECTILE) && p_392511_.getDirectEntity() instanceof LivingEntity livingentity) { - this.blockUsingItem(p_396198_, livingentity); -@@ -1320,7 +_,7 @@ - Entity entity = p_378258_.getEntity(); - if (entity instanceof Player player) { - this.setLastHurtByPlayer(player, 100); -- } else if (entity instanceof Wolf wolf && wolf.isTame()) { -+ } else if (entity instanceof net.minecraft.world.entity.TamableAnimal wolf && wolf.isTame()) { + float damageBlocked = blocksAttacks.resolveBlockedDamage(source, damage, angle); ++ var ev = net.minecraftforge.event.ForgeEventFactory.onShieldBlock(this, source, damageBlocked, blockingWith); ++ if (ev == null) return 0.0F; ++ damageBlocked = ev.getBlockedDamage(); ++ if (ev.shieldTakesDamage()) + blocksAttacks.hurtBlockingItem(this.level(), blockingWith, this, this.getUsedItemHand(), damageBlocked); + if (damageBlocked > 0.0F && !source.is(DamageTypeTags.IS_PROJECTILE) && source.getDirectEntity() instanceof LivingEntity livingEntity) { + this.blockUsingItem(level, livingEntity, source, damage); +@@ -1363,7 +_,7 @@ + Entity sourceEntity = source.getEntity(); + if (sourceEntity instanceof Player playerSource) { + this.setLastHurtByPlayer(playerSource, 100); +- } else if (sourceEntity instanceof Wolf wolf && wolf.isTame()) { ++ } else if (sourceEntity instanceof net.minecraft.world.entity.TamableAnimal wolf && wolf.isTame()) { if (wolf.getOwnerReference() != null) { this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), 100); } else { -@@ -1350,7 +_,7 @@ - for (InteractionHand interactionhand : InteractionHand.values()) { - ItemStack itemstack1 = this.getItemInHand(interactionhand); - deathprotection = itemstack1.get(DataComponents.DEATH_PROTECTION); -- if (deathprotection != null) { -+ if (deathprotection != null && net.minecraftforge.common.ForgeHooks.onLivingUseTotem(this, p_21263_, itemstack1, interactionhand)) { - itemstack = itemstack1.copy(); - itemstack1.shrink(1); - break; -@@ -1413,6 +_,7 @@ +@@ -1394,7 +_,7 @@ + for (InteractionHand hand : InteractionHand.values()) { + ItemStack itemStack = this.getItemInHand(hand); + protection = itemStack.get(DataComponents.DEATH_PROTECTION); +- if (protection != null) { ++ if (protection != null && net.minecraftforge.common.ForgeHooks.onLivingUseTotem(this, killingDamage, itemStack, hand)) { + protectionItem = itemStack.copy(); + itemStack.shrink(1); + break; +@@ -1449,6 +_,7 @@ } - public void die(DamageSource p_21014_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, p_21014_)) return; + public void die(final DamageSource source) { ++ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, source)) return; if (!this.isRemoved() && !this.dead) { - Entity entity = p_21014_.getEntity(); - LivingEntity livingentity = this.getKillCredit(); -@@ -1449,10 +_,10 @@ - if (this.level() instanceof ServerLevel serverlevel) { - boolean flag = false; - if (p_21269_ instanceof WitherBoss) { -- if (serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, p_21269_)) { - BlockPos blockpos = this.blockPosition(); - BlockState blockstate = Blocks.WITHER_ROSE.defaultBlockState(); -- if (this.level().getBlockState(blockpos).isAir() && blockstate.canSurvive(this.level(), blockpos)) { -+ if (this.level().isEmptyBlock(blockpos) && blockstate.canSurvive(this.level(), blockpos)) { - this.level().setBlock(blockpos, blockstate, 3); - flag = true; + Entity sourceEntity = source.getEntity(); + LivingEntity killer = this.getKillCredit(); +@@ -1489,10 +_,10 @@ + if (this.level() instanceof ServerLevel serverLevel) { + boolean var6 = false; + if (killer instanceof WitherBoss) { +- if (serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, killer)) { + BlockPos pos = this.blockPosition(); + BlockState state = Blocks.WITHER_ROSE.defaultBlockState(); +- if (this.level().getBlockState(pos).isAir() && state.canSurvive(this.level(), pos)) { ++ if (this.level().isEmptyBlock(pos) && state.canSurvive(this.level(), pos)) { + this.level().setBlock(pos, state, 3); + var6 = true; } -@@ -1467,6 +_,7 @@ +@@ -1507,6 +_,7 @@ } - protected void dropAllDeathLoot(ServerLevel p_342160_, DamageSource p_21192_) { + protected void dropAllDeathLoot(final ServerLevel level, final DamageSource source) { + this.captureDrops(new java.util.ArrayList<>()); - boolean flag = this.lastHurtByPlayerMemoryTime > 0; - if (this.shouldDropLoot(p_342160_)) { - this.dropFromLootTable(p_342160_, p_21192_, flag); -@@ -1475,6 +_,11 @@ + boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0; + if (this.shouldDropLoot(level)) { + this.dropFromLootTable(level, source, playerKilled); +@@ -1515,6 +_,11 @@ - this.dropEquipment(p_342160_); - this.dropExperience(p_342160_, p_21192_.getEntity()); + this.dropEquipment(level); + this.dropExperience(level, source.getEntity()); + + var drops = captureDrops(null); -+ if (!net.minecraftforge.event.ForgeEventFactory.onLivingDrops(this, p_21192_, drops, flag)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onLivingDrops(this, source, drops, playerKilled)) { + drops.forEach(e -> level().addFreshEntity(e)); + } } - protected void dropEquipment(ServerLevel p_365823_) { -@@ -1482,7 +_,8 @@ - - protected void dropExperience(ServerLevel p_370040_, @Nullable Entity p_342525_) { - if (!this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && p_370040_.getGameRules().get(GameRules.MOB_DROPS))) { -- ExperienceOrb.award(p_370040_, this.position(), this.getExperienceReward(p_370040_, p_342525_)); -+ int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getLastHurtByPlayer(), this.getExperienceReward(p_370040_, p_342525_)); -+ ExperienceOrb.award(p_370040_, this.position(), reward); + protected void dropEquipment(final ServerLevel level) { +@@ -1526,7 +_,8 @@ + this.isAlwaysExperienceDropper() + || this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && level.getGameRules().get(GameRules.MOB_DROPS) + )) { +- ExperienceOrb.award(level, this.position(), this.getExperienceReward(level, killer)); ++ int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getLastHurtByPlayer(), this.getExperienceReward(level, killer)); ++ ExperienceOrb.award(level, this.position(), reward); } } -@@ -1583,6 +_,11 @@ +@@ -1639,6 +_,11 @@ } - public void knockback(double p_147241_, double p_147242_, double p_147243_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onLivingKnockBack(this, (float) p_147241_, p_147242_, p_147243_); + public void knockback(double power, double xd, double zd, final DamageSource source, final float damage, final boolean comesFromEffect) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onLivingKnockBack(this, (float)power, xd, zd); + if (event == null) return; -+ p_147241_ = event.getStrength(); -+ p_147242_ = event.getRatioX(); -+ p_147243_ = event.getRatioZ(); - p_147241_ *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); - if (!(p_147241_ <= 0.0)) { ++ power = event.getStrength(); ++ xd = event.getRatioX(); ++ zd = event.getRatioZ(); + power *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); + if (!(power <= 0.0)) { this.needsSync = true; -@@ -1664,6 +_,13 @@ +@@ -1724,6 +_,13 @@ } else { - BlockPos blockpos = this.blockPosition(); - BlockState blockstate = this.getInBlockState(); -+ var ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, level(), blockpos, this); + BlockPos ladderCheckPos = this.blockPosition(); + BlockState state = this.getInBlockState(); ++ var ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadder(state, level(), ladderCheckPos, this); + if (ladderPos.isPresent()) { + this.lastClimbablePos = ladderPos; + return true; + } else if (ladderPos != null) { + return false; + } - if (this.isFallFlying() && blockstate.is(BlockTags.CAN_GLIDE_THROUGH)) { + if (this.isFallFlying() && state.is(BlockTags.CAN_GLIDE_THROUGH)) { return false; - } else if (blockstate.is(BlockTags.CLIMBABLE)) { -@@ -1720,6 +_,10 @@ + } else if (state.is(BlockTags.CLIMBABLE)) { +@@ -1788,9 +_,11 @@ @Override - public boolean causeFallDamage(double p_393354_, float p_147187_, DamageSource p_147189_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, p_393354_, p_147187_); + public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, fallDistance, damageModifier); + if (event == null) return false; -+ p_393354_ = event.getDistance(); -+ p_147187_ = event.getDamageMultiplier(); - boolean flag = super.causeFallDamage(p_393354_, p_147187_, p_147189_); - int i = this.calculateFallDamage(p_393354_, p_147187_); - if (i > 0) { -@@ -1750,9 +_,10 @@ - int i = Mth.floor(this.getX()); - int j = Mth.floor(this.getY() - 0.2F); - int k = Mth.floor(this.getZ()); -- BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); -+ BlockPos pos = new BlockPos(i, j, k); -+ BlockState blockstate = this.level().getBlockState(pos); - if (!blockstate.isAir()) { -- SoundType soundtype = blockstate.getSoundType(); -+ SoundType soundtype = blockstate.getSoundType(level(), pos, this); - this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F); + double effectiveFallDistance; + if (this.isIgnoringFallDamageFromCurrentImpulse()) { +- effectiveFallDistance = Math.min(fallDistance, this.currentImpulseImpactPos.y - this.getY()); ++ effectiveFallDistance = Math.min(event.getDistance(), this.currentImpulseImpactPos.y - this.getY()); + boolean hasLandedAboveCurrentImpulseImpactPosY = effectiveFallDistance <= 0.0; + if (hasLandedAboveCurrentImpulseImpactPosY) { + this.resetCurrentImpulseContext(); +@@ -1798,11 +_,11 @@ + this.tryResetCurrentImpulseContext(); + } + } else { +- effectiveFallDistance = fallDistance; ++ effectiveFallDistance = event.getDistance(); + } + +- boolean damaged = super.causeFallDamage(effectiveFallDistance, damageModifier, damageSource); +- int dmg = this.calculateFallDamage(effectiveFallDistance, damageModifier); ++ boolean damaged = super.causeFallDamage(effectiveFallDistance, event.getDamageMultiplier(), damageSource); ++ int dmg = this.calculateFallDamage(effectiveFallDistance, event.getDamageMultiplier()); + if (dmg > 0) { + this.resetCurrentImpulseContext(); + this.playSound(this.getFallDamageSound(dmg), 1.0F, 1.0F); +@@ -1864,9 +_,10 @@ + int xx = Mth.floor(this.getX()); + int yy = Mth.floor(this.getY() - 0.2F); + int zz = Mth.floor(this.getZ()); +- BlockState state = this.level().getBlockState(new BlockPos(xx, yy, zz)); ++ BlockPos pos = new BlockPos(xx, yy, zz); ++ BlockState state = this.level().getBlockState(pos); + if (!state.isAir()) { +- SoundType soundType = state.getSoundType(); ++ SoundType soundType = state.getSoundType(level(), pos, this); + this.playSound(soundType.getFallSound(), soundType.getVolume() * 0.5F, soundType.getPitch() * 0.75F); } } -@@ -1810,9 +_,9 @@ - float f2 = f1 - p_21194_; - if (f2 > 0.0F && f2 < 3.4028235E37F) { - if (this instanceof ServerPlayer) { -- ((ServerPlayer)this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f2 * 10.0F)); -+ ((ServerPlayer)this).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_RESISTED), Math.round(f2 * 10.0F)); - } else if (p_21193_.getEntity() instanceof ServerPlayer) { -- ((ServerPlayer)p_21193_.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f2 * 10.0F)); -+ ((ServerPlayer)p_21193_.getEntity()).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_DEALT_RESISTED), Math.round(f2 * 10.0F)); - } +@@ -1927,9 +_,9 @@ + float damageResisted = oldDamage - damage; + if (damageResisted > 0.0F && damageResisted < 3.4028235E37F) { + if (this instanceof ServerPlayer serverPlayer) { +- serverPlayer.awardStat(Stats.DAMAGE_RESISTED, Math.round(damageResisted * 10.0F)); ++ serverPlayer.awardStat(Stats.CUSTOM.get(Stats.DAMAGE_RESISTED), Math.round(damageResisted * 10.0F)); + } else if (damageSource.getEntity() instanceof ServerPlayer) { +- ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(damageResisted * 10.0F)); ++ ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_DEALT_RESISTED), Math.round(damageResisted * 10.0F)); } } -@@ -1840,6 +_,8 @@ + } +@@ -1958,6 +_,8 @@ - protected void actuallyHurt(ServerLevel p_365124_, DamageSource p_21240_, float p_21241_) { - if (!this.isInvulnerableTo(p_365124_, p_21240_)) { -+ p_21241_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_21240_, p_21241_); -+ if (p_21241_ <= 0) return; - p_21241_ = this.getDamageAfterArmorAbsorb(p_21240_, p_21241_); - p_21241_ = this.getDamageAfterMagicAbsorb(p_21240_, p_21241_); - float f1 = Math.max(p_21241_ - this.getAbsorptionAmount(), 0.0F); -@@ -1849,6 +_,7 @@ - serverplayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f * 10.0F)); + protected void actuallyHurt(final ServerLevel level, final DamageSource source, float dmg) { + if (!this.isInvulnerableTo(level, source)) { ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, source, dmg); ++ if (dmg <= 0) return; + dmg = this.getDamageAfterArmorAbsorb(source, dmg); + dmg = this.getDamageAfterMagicAbsorb(source, dmg); + float originalDamage = dmg; +@@ -1968,6 +_,7 @@ + serverPlayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(absorbedDamage * 10.0F)); } -+ f1 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_21240_, f1); - if (f1 != 0.0F) { - this.getCombatTracker().recordDamage(p_21240_, f1); - this.setHealth(this.getHealth() - f1); -@@ -1909,6 +_,8 @@ ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, dmg); + if (dmg != 0.0F) { + this.getCombatTracker().recordDamage(source, dmg); + this.setHealth(this.getHealth() - dmg); +@@ -2031,6 +_,8 @@ } - public void swing(InteractionHand p_21012_, boolean p_21013_) { -+ ItemStack stack = this.getItemInHand(p_21012_); + public void swing(final InteractionHand hand, final boolean sendToSwingingEntity) { ++ ItemStack stack = this.getItemInHand(hand); + if (!stack.isEmpty() && stack.onEntitySwing(this)) return; if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) { this.swingTime = -1; this.swinging = true; -@@ -2050,9 +_,10 @@ +@@ -2172,9 +_,10 @@ } private void swapHandItems() { -- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.OFFHAND); +- ItemStack tmp = this.getItemBySlot(EquipmentSlot.OFFHAND); - this.setItemSlot(EquipmentSlot.OFFHAND, this.getItemBySlot(EquipmentSlot.MAINHAND)); -- this.setItemSlot(EquipmentSlot.MAINHAND, itemstack); +- this.setItemSlot(EquipmentSlot.MAINHAND, tmp); + var event = net.minecraftforge.event.ForgeEventFactory.onLivingSwapHandItems(this); + if (event == null) return; + this.setItemSlot(EquipmentSlot.OFFHAND, event.getItemSwappedToOffHand()); @@ -349,7 +366,7 @@ } @Override -@@ -2265,15 +_,18 @@ +@@ -2396,15 +_,18 @@ } this.needsSync = true; @@ -364,80 +381,80 @@ } + @Deprecated // FORGE: use jumpInFluid instead - protected void jumpInLiquid(TagKey p_204043_) { + protected void jumpInLiquid(final TagKey type) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.04F, 0.0)); + this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.04F * this.getAttributeValue(net.minecraftforge.common.ForgeMod.SWIM_SPEED.getHolder().get()), 0.0)); } protected float getWaterSlowDown() { -@@ -2295,8 +_,9 @@ +@@ -2427,8 +_,9 @@ } - public void travel(Vec3 p_21280_) { + public void travel(final Vec3 input) { - if (this.shouldTravelInFluid(this.level().getFluidState(this.blockPosition()))) { -- this.travelInFluid(p_21280_); +- this.travelInFluid(input); + var fluidstate = this.level().getFluidState(this.blockPosition()); + if (this.shouldTravelInFluid(fluidstate)) { -+ this.travelInFluid(p_21280_, fluidstate); ++ this.travelInFluid(input, fluidstate); } else if (this.isFallFlying()) { - this.travelFallFlying(p_21280_); + this.travelFallFlying(input); } else { -@@ -2305,7 +_,7 @@ +@@ -2441,7 +_,7 @@ } - protected boolean shouldTravelInFluid(FluidState p_453099_) { -- return (this.isInWater() || this.isInLava()) && this.isAffectedByFluids() && !this.canStandOnFluid(p_453099_); -+ return (this.isInWater() || this.isInLava() || this.isInFluidType(p_453099_)) && this.isAffectedByFluids() && !this.canStandOnFluid(p_453099_); + protected boolean shouldTravelInFluid(final FluidState fluidState) { +- return (this.isInWater() || this.isInLava()) && this.isAffectedByFluids() && !this.canStandOnFluid(fluidState); ++ return (this.isInWater() || this.isInLava() || this.isInFluidType(fluidState)) && this.isAffectedByFluids() && !this.canStandOnFluid(fluidState); } - protected void travelFlying(Vec3 p_407126_, float p_407105_) { -@@ -2330,7 +_,7 @@ - - private void travelInAir(Vec3 p_362087_) { - BlockPos blockpos = this.getBlockPosBelowThatAffectsMyMovement(); -- float f = this.onGround() ? this.level().getBlockState(blockpos).getBlock().getFriction() : 1.0F; -+ float f = this.onGround() ? this.level().getBlockState(blockpos).getFriction(level(), blockpos, this) : 1.0F; - float f1 = f * 0.91F; - Vec3 vec3 = this.handleRelativeFrictionAndCalculateMovement(p_362087_, f); - double d0 = vec3.y; -@@ -2353,10 +_,18 @@ - } + protected void travelFlying(final Vec3 input, final float speed) { +@@ -2468,7 +_,7 @@ + BlockPos posBelow = this.getBlockPosBelowThatAffectsMyMovement(); + float blockFriction = this.onGround() + ? computeModifiedFriction( +- this.level().getBlockState(posBelow).getBlock().getFriction(), (float)this.getAttributeValue(Attributes.FRICTION_MODIFIER) ++ this.level().getBlockState(posBelow).getFriction(level(), posBelow, this), (float)this.getAttributeValue(Attributes.FRICTION_MODIFIER) + ) + : 1.0F; + Vec3 movement = this.handleRelativeFrictionAndCalculateMovement(input, blockFriction); +@@ -2500,10 +_,18 @@ + return computeModifiedFriction(this.omnidirectionalAirMover() ? 0.91F : 0.98F, (float)this.getAttributeValue(Attributes.AIR_DRAG_MODIFIER)); } -- private void travelInFluid(Vec3 p_362114_) { +- protected void travelInFluid(final Vec3 input) { + @Deprecated // FORGE: Use the version that takes a FluidState -+ private void travelInFluid(Vec3 p_365480_) { -+ this.travelInFluid(p_365480_, net.minecraft.world.level.material.Fluids.WATER.defaultFluidState()); ++ protected void travelInFluid(Vec3 input) { ++ this.travelInFluid(input, net.minecraft.world.level.material.Fluids.WATER.defaultFluidState()); + } + -+ private void travelInFluid(Vec3 p_362114_, FluidState fluidstate) { - boolean flag = this.getDeltaMovement().y <= 0.0; - double d0 = this.getY(); - double d1 = this.getEffectiveGravity(); -+ if (this.isInFluidType(fluidstate) && this.moveInFluid(fluidstate, p_362114_, d0)) { ++ protected void travelInFluid(Vec3 input, FluidState fluidstate) { + boolean isFalling = this.getDeltaMovement().y <= 0.0; + double oldY = this.getY(); + double baseGravity = this.getEffectiveGravity(); ++ if (this.isInFluidType(fluidstate) && this.moveInFluid(fluidstate, input, oldY)) { + // Modded fluid handled it + } else if (this.isInWater()) { - this.travelInWater(p_362114_, d1, flag, d0); + this.travelInWater(input, baseGravity, isFalling, oldY); this.floatInWaterWhileRidden(); -@@ -2382,6 +_,7 @@ - f = 0.96F; +@@ -2529,6 +_,7 @@ + slowDown = 0.96F; } -+ f1 *= this.getAttributeValue(net.minecraftforge.common.ForgeMod.SWIM_SPEED.getHolder().get()); - this.moveRelative(f1, p_451732_); ++ speed *= this.getAttributeValue(net.minecraftforge.common.ForgeMod.SWIM_SPEED.getHolder().get()); + this.moveRelative(speed, input); this.move(MoverType.SELF, this.getDeltaMovement()); - Vec3 vec3 = this.getDeltaMovement(); -@@ -2553,7 +_,7 @@ - double d0 = Mth.clamp(p_21298_.x, -0.15F, 0.15F); - double d1 = Mth.clamp(p_21298_.z, -0.15F, 0.15F); - double d2 = Math.max(p_21298_.y, -0.15F); -- if (d2 < 0.0 && !this.getInBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { -+ if (d2 < 0.0 && !this.getInBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { - d2 = 0.0; + Vec3 movement = this.getDeltaMovement(); +@@ -2706,7 +_,7 @@ + double xd = Mth.clamp(delta.x, -0.15F, 0.15F); + double zd = Mth.clamp(delta.z, -0.15F, 0.15F); + double yd = Math.max(delta.y, -0.15F); +- if (yd < 0.0 && !this.getInBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { ++ if (yd < 0.0 && !this.getInBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { + yd = 0.0; } -@@ -2598,6 +_,7 @@ +@@ -2762,6 +_,7 @@ @Override public void tick() { @@ -445,31 +462,31 @@ super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2786,6 +_,7 @@ - ItemStack itemstack = this.lastEquipmentItems.get(equipmentslot); - ItemStack itemstack1 = this.getItemBySlot(equipmentslot); - if (this.equipmentHasChanged(itemstack, itemstack1)) { -+ net.minecraftforge.event.ForgeEventFactory.onLivingEquipmentChange(this, equipmentslot, itemstack, itemstack1); - if (map == null) { - map = Maps.newEnumMap(EquipmentSlot.class); +@@ -2962,6 +_,7 @@ + ItemStack previous = lastEquipmentItems.get(slot); + ItemStack current = this.getItemBySlot(slot); + if (this.equipmentHasChanged(previous, current)) { ++ net.minecraftforge.event.ForgeEventFactory.onLivingEquipmentChange(this, slot, previous, current); + if (changedItems == null) { + changedItems = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2921,6 +_,10 @@ - profilerfiller.push("jump"); +@@ -3097,6 +_,10 @@ + profiler.push("jump"); if (this.jumping && this.isAffectedByFluids()) { - double d3; + double fluidHeight; + var fluidType = this.getMaxHeightFluidType(); + if (!fluidType.isAir()) { -+ d3 = this.getFluidTypeHeight(fluidType); ++ fluidHeight = this.getFluidTypeHeight(fluidType); + } else if (this.isInLava()) { - d3 = this.getFluidHeight(FluidTags.LAVA); + fluidHeight = this.getFluidHeight(FluidTags.LAVA); } else { -@@ -2931,15 +_,22 @@ - double d4 = this.getFluidJumpThreshold(); - if (!flag || this.onGround() && !(d3 > d4)) { - if (!this.isInLava() || this.onGround() && !(d3 > d4)) { -+ if (fluidType.isAir() || this.onGround() && !(d3 > d4)) { - if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) { +@@ -3107,15 +_,19 @@ + double fluidJumpThreshold = this.getFluidJumpThreshold(); + if (!inWaterAndHasFluidHeight || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { + if (!this.isInLava() || this.onGround() && this.isInShallowFluid(FluidTags.LAVA)) { ++ if (fluidType.isAir() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { + if ((this.onGround() || inWaterAndHasFluidHeight && fluidHeight <= fluidJumpThreshold) && this.noJumpDelay == 0) { this.jumpFromGround(); this.noJumpDelay = 10; } @@ -478,10 +495,7 @@ + } } else { - this.jumpInLiquid(FluidTags.LAVA); -+ var old = this.getDeltaMovement(); + this.jumpInFluid(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get()); -+ if (this instanceof Player) -+ System.out.println(old + " " + this.getDeltaMovement()); } } else { - this.jumpInLiquid(FluidTags.WATER); @@ -489,7 +503,7 @@ } } else { this.noJumpDelay = 0; -@@ -3255,8 +_,11 @@ +@@ -3434,8 +_,11 @@ private void updatingUsingItem() { if (this.isUsingItem()) { @@ -502,56 +516,56 @@ this.updateUsingItem(this.useItem); } else { this.stopUsingItem(); -@@ -3299,8 +_,12 @@ +@@ -3478,8 +_,12 @@ } - protected void updateUsingItem(ItemStack p_147201_) { -+ if (!p_147201_.isEmpty()) { -+ this.useItemRemaining = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, p_147201_, this.getUseItemRemainingTicks()); + protected void updateUsingItem(final ItemStack useItem) { ++ if (!useItem.isEmpty()) { ++ this.useItemRemaining = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, useItem, this.getUseItemRemainingTicks()); + } + if (this.getUseItemRemainingTicks() > 0) - p_147201_.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); -- if (--this.useItemRemaining == 0 && !this.level().isClientSide() && !p_147201_.useOnRelease()) { -+ if (--this.useItemRemaining <= 0 && !this.level().isClientSide() && !p_147201_.useOnRelease()) { + useItem.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); +- if (--this.useItemRemaining == 0 && !this.level().isClientSide() && !useItem.useOnRelease()) { ++ if (--this.useItemRemaining <= 0 && !this.level().isClientSide() && !useItem.useOnRelease()) { this.completeUsingItem(); } } -@@ -3328,8 +_,10 @@ - public void startUsingItem(InteractionHand p_21159_) { - ItemStack itemstack = this.getItemInHand(p_21159_); - if (!itemstack.isEmpty() && !this.isUsingItem()) { -+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getUseDuration(this)); +@@ -3507,8 +_,10 @@ + public void startUsingItem(final InteractionHand hand) { + ItemStack itemStack = this.getItemInHand(hand); + if (!itemStack.isEmpty() && !this.isUsingItem()) { ++ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemStack, itemStack.getUseDuration(this)); + if (duration < 0) return; - this.useItem = itemstack; -- this.useItemRemaining = itemstack.getUseDuration(this); + this.useItem = itemStack; +- this.useItemRemaining = itemStack.getUseDuration(this); + this.useItemRemaining = duration; if (!this.level().isClientSide()) { this.setLivingEntityFlag(1, true); - this.setLivingEntityFlag(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -3384,6 +_,9 @@ - vec31 = vec31.xRot(-this.getXRot() * (float) (Math.PI / 180.0)); - vec31 = vec31.yRot(-this.getYRot() * (float) (Math.PI / 180.0)); - vec31 = vec31.add(this.getX(), this.getEyeY(), this.getZ()); -+ if (this.level() instanceof ServerLevel serverLevel) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant -+ serverLevel.sendParticles(new ItemParticleOption(ParticleTypes.ITEM, p_21061_), vec31.x, vec31.y, vec31.z, 1, vec3.x, vec3.y + 0.05D, vec3.z, 0.0D); -+ else - this.level() - .addParticle( - new ItemParticleOption(ParticleTypes.ITEM, p_21061_), -@@ -3404,7 +_,9 @@ + this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); +@@ -3566,6 +_,9 @@ + p = p.xRot(-this.getXRot() * (float) (Math.PI / 180.0)); + p = p.yRot(-this.getYRot() * (float) (Math.PI / 180.0)); + p = p.add(this.getX(), this.getEyeY(), this.getZ()); ++ if (this.level() instanceof ServerLevel serverLevel) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant ++ serverLevel.sendParticles(breakParticle, p.x, p.y, p.z, 1, d.x, d.y + 0.05D, d.z, 0.0D); ++ else + this.level().addParticle(breakParticle, p.x, p.y, p.z, d.x, d.y + 0.05, d.z); + } + } +@@ -3578,7 +_,9 @@ this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { + ItemStack copy = this.useItem.copy(); - ItemStack itemstack = this.useItem.finishUsingItem(this.level(), this); -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, getUseItemRemainingTicks(), itemstack); - if (itemstack != this.useItem) { - this.setItemInHand(interactionhand, itemstack); + ItemStack result = this.useItem.finishUsingItem(this.level(), this); ++ result = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, getUseItemRemainingTicks(), result); + if (result != this.useItem) { + this.setItemInHand(hand, result); } -@@ -3438,7 +_,13 @@ - ItemStack itemstack = this.getItemInHand(this.getUsedItemHand()); - if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemstack, this.useItem)) { - this.useItem = itemstack; +@@ -3612,7 +_,13 @@ + ItemStack itemInUsedHand = this.getItemInHand(this.getUsedItemHand()); + if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInUsedHand, this.useItem)) { + this.useItem = itemInUsedHand; + if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, useItem, this.getUseItemRemainingTicks())) { + ItemStack copy = this instanceof Player ? useItem.copy() : null; this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks()); @@ -562,74 +576,74 @@ if (this.useItem.useOnRelease()) { this.updatingUsingItem(); } -@@ -3448,6 +_,7 @@ +@@ -3622,6 +_,7 @@ } public void stopUsingItem() { + if (this.isUsingItem() && !this.useItem.isEmpty()) this.useItem.onStopUsing(this, useItemRemaining); if (!this.level().isClientSide()) { - boolean flag = this.isUsingItem(); + boolean wasUsingItem = this.isUsingItem(); this.recentKineticEnemies = null; -@@ -3616,8 +_,8 @@ +@@ -3783,8 +_,8 @@ } - BlockState blockstate = this.level().getBlockState(p_21141_); -- if (blockstate.getBlock() instanceof BedBlock) { -- this.level().setBlock(p_21141_, blockstate.setValue(BedBlock.OCCUPIED, true), 3); -+ if (blockstate.isBed(level(), p_21141_, this)) { -+ blockstate.setBedOccupied(level(), p_21141_, this, true); + BlockState blockState = this.level().getBlockState(bedPosition); +- if (blockState.getBlock() instanceof BedBlock) { +- this.level().setBlock(bedPosition, blockState.setValue(BedBlock.OCCUPIED, true), 3); ++ if (blockState.isBed(level(), bedPosition, this)) { ++ blockState.setBedOccupied(level(), bedPosition, this, true); } this.setPose(Pose.SLEEPING); -@@ -3632,15 +_,15 @@ +@@ -3799,15 +_,15 @@ } private boolean checkBedExists() { -- return this.getSleepingPos().map(p_449422_ -> this.level().getBlockState(p_449422_).getBlock() instanceof BedBlock).orElse(false); -+ return this.getSleepingPos().map(p_449422_ -> net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_449422_)).orElse(false); +- return this.getSleepingPos().map(bedPosition -> this.level().getBlockState(bedPosition).getBlock() instanceof BedBlock).orElse(false); ++ return this.getSleepingPos().map(bedPosition -> net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, bedPosition)).orElse(false); } public void stopSleeping() { - this.getSleepingPos().filter(this.level()::hasChunkAt).ifPresent(p_261435_ -> { - BlockState blockstate = this.level().getBlockState(p_261435_); -- if (blockstate.getBlock() instanceof BedBlock) { -+ if (blockstate.isBed(level(), p_261435_, this)) { - Direction direction = blockstate.getValue(BedBlock.FACING); -- this.level().setBlock(p_261435_, blockstate.setValue(BedBlock.OCCUPIED, false), 3); -+ blockstate.setBedOccupied(level(), p_261435_, this, false); - Vec3 vec31 = BedBlock.findStandUpPosition(this.getType(), this.level(), p_261435_, direction, this.getYRot()).orElseGet(() -> { - BlockPos blockpos = p_261435_.above(); - return new Vec3(blockpos.getX() + 0.5, blockpos.getY() + 0.1, blockpos.getZ() + 0.5); -@@ -3660,7 +_,9 @@ + this.getSleepingPos().filter(this.level()::hasChunkAt).ifPresent(bedPosition -> { + BlockState state = this.level().getBlockState(bedPosition); +- if (state.getBlock() instanceof BedBlock) { ++ if (state.isBed(level(), bedPosition, this)) { + Direction facing = state.getValue(BedBlock.FACING); +- this.level().setBlock(bedPosition, state.setValue(BedBlock.OCCUPIED, false), 3); ++ state.setBedOccupied(level(), bedPosition, this, false); + Vec3 standUp = BedBlock.findStandUpPosition(this.getType(), this.level(), bedPosition, facing, this.getYRot()).orElseGet(() -> { + BlockPos above = bedPosition.above(); + return new Vec3(above.getX() + 0.5, above.getY() + 0.1, above.getZ() + 0.5); +@@ -3827,7 +_,9 @@ public @Nullable Direction getBedOrientation() { - BlockPos blockpos = this.getSleepingPos().orElse(null); -- return blockpos != null ? BedBlock.getBedOrientation(this.level(), blockpos) : null; -+ if (blockpos == null) return Direction.UP; -+ BlockState state = this.level().getBlockState(blockpos); -+ return !state.isBed(level(), blockpos, this) ? Direction.UP : state.getBedDirection(level(), blockpos); + BlockPos bedPos = this.getSleepingPos().orElse(null); +- return bedPos != null ? BedBlock.getBedOrientation(this.level(), bedPos) : null; ++ if (bedPos == null) return Direction.UP; ++ BlockState state = this.level().getBlockState(bedPos); ++ return !state.isBed(level(), bedPos, this) ? Direction.UP : state.getBedDirection(level(), bedPos); } @Override -@@ -3669,7 +_,7 @@ +@@ -3836,7 +_,7 @@ } - public ItemStack getProjectile(ItemStack p_21272_) { + public ItemStack getProjectile(final ItemStack heldWeapon) { - return ItemStack.EMPTY; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_21272_, ItemStack.EMPTY); ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, ItemStack.EMPTY); } - private static byte entityEventForEquipmentBreak(EquipmentSlot p_21267_) { -@@ -3721,6 +_,8 @@ + private static byte entityEventForEquipmentBreak(final EquipmentSlot equipmentSlot) { +@@ -3888,6 +_,8 @@ } - public final EquipmentSlot getEquipmentSlotForItem(ItemStack p_147234_) { -+ final EquipmentSlot slot = p_147234_.getEquipmentSlot(); + public EquipmentSlot getEquipmentSlotForItem(final ItemStack itemStack) { ++ final EquipmentSlot slot = itemStack.getEquipmentSlot(); + if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item - Equippable equippable = p_147234_.get(DataComponents.EQUIPPABLE); + Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); return equippable != null && this.canUseSlot(equippable.slot()) ? equippable.slot() : EquipmentSlot.MAINHAND; } -@@ -3884,5 +_,42 @@ +@@ -4055,5 +_,42 @@ } public record Fallsounds(SoundEvent small, SoundEvent big) { diff --git a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch index c817e1f203..0c49a6994b 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 -@@ -137,6 +_,9 @@ +@@ -144,6 +_,9 @@ private Leashable.@Nullable LeashData leashData; private BlockPos homePosition = BlockPos.ZERO; private int homeRadius = -1; @@ -8,37 +8,37 @@ + private EntitySpawnReason spawnReason; + private boolean spawnCancelled = false; - protected Mob(EntityType p_21368_, Level p_21369_) { - super(p_21368_, p_21369_); -@@ -230,7 +_,10 @@ + protected Mob(final EntityType type, final Level level) { + super(type, level); +@@ -249,7 +_,10 @@ } - public void setTarget(@Nullable LivingEntity p_21544_) { -- this.target = p_21544_; -+ var event = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetMob(this, p_21544_); + public void setTarget(final @Nullable LivingEntity target) { +- this.target = this.asValidTarget(target); ++ var event = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetMob(this, target); + if (event != null) { + this.target = event.getNewTarget(); + } } @Override -@@ -369,6 +_,10 @@ +@@ -388,6 +_,10 @@ if (this.isNoAi()) { - p_409238_.putBoolean("NoAI", this.isNoAi()); + output.putBoolean("NoAI", this.isNoAi()); } + + if (this.spawnReason != null) { -+ p_409238_.putString("forge:spawn_type", this.spawnReason.name()); ++ output.putString("forge:spawn_type", this.spawnReason.name()); + } } @Override -@@ -387,6 +_,13 @@ - this.lootTable = p_408489_.read("DeathLootTable", LootTable.KEY_CODEC); - this.lootTableSeed = p_408489_.getLongOr("DeathLootTableSeed", 0L); - this.setNoAi(p_408489_.getBooleanOr("NoAI", false)); +@@ -406,6 +_,13 @@ + this.lootTable = input.read("DeathLootTable", LootTable.KEY_CODEC); + this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L); + this.setNoAi(input.getBooleanOr("NoAI", false)); + -+ p_408489_.getString("forge:spawn_type").ifPresent(type -> { ++ input.getString("forge:spawn_type").ifPresent(type -> { + try { + this.spawnReason = EntitySpawnReason.valueOf(type); + } catch (Exception ex) { @@ -47,31 +47,31 @@ } @Override -@@ -445,7 +_,7 @@ +@@ -464,7 +_,7 @@ && this.canPickUpLoot() && this.isAlive() && !this.dead -- && serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, this)) { - Vec3i vec3i = this.getPickupReach(); +- && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, this)) { + Vec3i pickupReach = this.getPickupReach(); - for (ItemEntity itementity : this.level() -@@ -641,6 +_,14 @@ + for (ItemEntity entity : this.level() +@@ -691,6 +_,14 @@ this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { - Entity entity = this.level().getNearestPlayer(this, -1.0); + Entity player = this.level().getNearestPlayer(this, -1.0); + var result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this, (ServerLevel)this.level()); + if (result.isDenied()) { + noActionTime = 0; -+ entity = null; ++ player = null; + } else if (result.isAllowed()) { + this.discard(); -+ entity = null; ++ player = null; + } - if (entity != null) { - double d0 = entity.distanceToSqr(this); - int i = this.getType().getCategory().getDespawnDistance(); -@@ -1032,6 +_,16 @@ + if (player != null) { + double distSqr = player.distanceToSqr(this); + int instantDespawnDistance = this.getType().getCategory().getDespawnDistance(); +@@ -1084,6 +_,16 @@ } } @@ -86,29 +86,29 @@ + @Deprecated + @org.jetbrains.annotations.ApiStatus.OverrideOnly public @Nullable SpawnGroupData finalizeSpawn( - ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, EntitySpawnReason p_369316_, @Nullable SpawnGroupData p_21437_ + final ServerLevelAccessor level, final DifficultyInstance difficulty, final EntitySpawnReason spawnReason, final @Nullable SpawnGroupData groupData ) { -@@ -1044,6 +_,7 @@ +@@ -1096,6 +_,7 @@ } - this.setLeftHanded(randomsource.nextFloat() < 0.05F); -+ this.spawnReason = p_369316_; - return p_21437_; + this.setLeftHanded(random.nextFloat() < 0.05F); ++ this.spawnReason = spawnReason; + return groupData; } -@@ -1350,15 +_,25 @@ - return flag; +@@ -1409,15 +_,25 @@ + return wasHurt; } + @Deprecated // FORGE: use jumpInFluid instead @Override - protected void jumpInLiquid(TagKey p_204045_) { -+ this.jumpInLiquidInternal(() -> super.jumpInLiquid(p_204045_)); + protected void jumpInLiquid(final TagKey type) { ++ this.jumpInLiquidInternal(() -> super.jumpInLiquid(type)); + } + + private void jumpInLiquidInternal(Runnable onSuper) { if (this.getNavigation().canFloat()) { -- super.jumpInLiquid(p_204045_); +- super.jumpInLiquid(type); + onSuper.run(); } else { this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.3, 0.0)); @@ -122,11 +122,11 @@ + @VisibleForTesting public void removeFreeWill() { - this.removeAllGoals(p_341273_ -> true); -@@ -1385,6 +_,41 @@ + this.removeAllGoals(goal -> true); +@@ -1449,6 +_,41 @@ + @Override public @Nullable ItemStack getPickResult() { - SpawnEggItem spawneggitem = SpawnEggItem.byId(this.getType()); - return spawneggitem == null ? null : new ItemStack(spawneggitem); + return SpawnEggItem.byId(this.getType()).map(ItemStack::new).orElse(null); + } + + /** @@ -153,12 +153,12 @@ + + /** + * 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#isAddedToLevel() added to the world}. + * @apiNote Not public-facing API. + */ + @org.jetbrains.annotations.ApiStatus.Internal + public final void setSpawnCancelled(boolean cancel) { -+ if (this.isAddedToWorld()) { ++ if (this.isAddedToLevel()) { + throw new UnsupportedOperationException("Late invocations of Mob#setSpawnCancelled are not permitted."); + } + this.spawnCancelled = cancel; diff --git a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch index 3d512b3d11..23e7943d2c 100644 --- a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch @@ -6,12 +6,12 @@ -public enum MobCategory implements StringRepresentable { +public enum MobCategory implements StringRepresentable, net.minecraftforge.common.IExtensibleEnum { - MONSTER("monster", 70, false, false, 128), - CREATURE("creature", 10, true, true, 128), - AMBIENT("ambient", 15, true, false, 128), + MONSTER("monster", "MO", 70, false, false, 128), + CREATURE("creature", "C", 10, true, true, 128), + AMBIENT("ambient", "AM", 15, true, false, 128), @@ -13,7 +_,8 @@ - WATER_AMBIENT("water_ambient", 20, true, false, 64), - MISC("misc", -1, true, true, 128); + WATER_AMBIENT("water_ambient", "WA", 20, true, false, 64), + MISC("misc", "MI", -1, true, true, 128); - public static final Codec CODEC = StringRepresentable.fromEnum(MobCategory::values); + public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(MobCategory::values, MobCategory::byName); @@ -19,13 +19,13 @@ private final int max; private final boolean isFriendly; private final boolean isPersistent; -@@ -56,5 +_,20 @@ +@@ -64,5 +_,20 @@ public int getNoDespawnDistance() { return 32; + } + -+ public static MobCategory create(String name, String id, int maxNumberOfCreatureIn, boolean isPeacefulCreatureIn, boolean isAnimalIn, int despawnDistance) { ++ public static MobCategory create(String name, String id, String debugAbbreviation, int max, boolean isFriendly, boolean isPersistent, int despawnDistance) { + throw new IllegalStateException("Enum not extended"); + } + diff --git a/patches/minecraft/net/minecraft/world/entity/Shearable.java.patch b/patches/minecraft/net/minecraft/world/entity/Shearable.java.patch index 050d4b581c..5dcb3d2016 100644 --- a/patches/minecraft/net/minecraft/world/entity/Shearable.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Shearable.java.patch @@ -1,18 +1,20 @@ --- a/net/minecraft/world/entity/Shearable.java +++ b/net/minecraft/world/entity/Shearable.java -@@ -4,8 +_,14 @@ - import net.minecraft.sounds.SoundSource; - import net.minecraft.world.item.ItemStack; +@@ -8,4 +_,17 @@ + void shear(ServerLevel level, SoundSource soundSource, ItemStack tool); --public interface Shearable { -+public interface Shearable extends net.minecraftforge.common.IForgeShearable { -+ /** @deprecated Use {@link net.minecraftforge.common.IForgeShearable#onSheared} */ - void shear(ServerLevel p_368224_, SoundSource p_21749_, ItemStack p_362173_); - -+ /** @deprecated Use {@link net.minecraftforge.common.IForgeShearable#isShearable} */ boolean readyForShearing(); + -+ default boolean isShearable(net.minecraft.world.item.ItemStack item, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) { -+ return readyForShearing(); ++ /** Equivalent to {@link shear} but returns a list of ItemStacks without actually spawning the entity into the world */ ++ default java.util.List shearItems(ServerLevel level, SoundSource soundSource, ItemStack tool) { ++ var self = (Entity)this; ++ var entities = new java.util.ArrayList(); ++ self.captureDrops(entities); ++ shear(level, soundSource, tool); ++ self.captureDrops(null); ++ var items = new java.util.ArrayList(entities.size()); ++ for (var entity : entities) ++ items.add(entity.getItem()); ++ return items; + } } diff --git a/patches/minecraft/net/minecraft/world/entity/SpawnPlacementTypes.java.patch b/patches/minecraft/net/minecraft/world/entity/SpawnPlacementTypes.java.patch index 15661214f4..c210084862 100644 --- a/patches/minecraft/net/minecraft/world/entity/SpawnPlacementTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/SpawnPlacementTypes.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/SpawnPlacementTypes.java +++ b/net/minecraft/world/entity/SpawnPlacementTypes.java @@ -28,7 +_,7 @@ - BlockPos blockpos = p_332749_.above(); - BlockPos blockpos1 = p_332749_.below(); - BlockState blockstate = p_328923_.getBlockState(blockpos1); -- return !blockstate.isValidSpawn(p_328923_, blockpos1, p_334188_) -+ return !blockstate.isValidSpawn(p_328923_, blockpos1, this, p_334188_) + BlockPos above = blockPos.above(); + BlockPos below = blockPos.below(); + BlockState belowState = level.getBlockState(below); +- return !belowState.isValidSpawn(level, below, type) ++ return !belowState.isValidSpawn(level, below, this, type) ? false - : this.isValidEmptySpawnBlock(p_328923_, p_332749_, p_334188_) && this.isValidEmptySpawnBlock(p_328923_, blockpos, p_334188_); + : this.isValidEmptySpawnBlock(level, blockPos, type) && this.isValidEmptySpawnBlock(level, above, type); } else { diff --git a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch index 8a13eec47e..50ecf121cf 100644 --- a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java -@@ -48,6 +_,7 @@ +@@ -50,6 +_,7 @@ public class SpawnPlacements { private static final Map, SpawnPlacements.Data> DATA_BY_TYPE = Maps.newHashMap(); + /** @deprecated FORGE: use SpawnPlacementRegisterEvent to register and modify spawn placements */ private static void register( - EntityType p_21755_, SpawnPlacementType p_331557_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate p_21758_ - ) { -@@ -75,7 +_,8 @@ - EntityType p_217075_, ServerLevelAccessor p_217076_, EntitySpawnReason p_369208_, BlockPos p_217078_, RandomSource p_217079_ - ) { - SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.get(p_217075_); -- return spawnplacements$data == null || spawnplacements$data.predicate.test((EntityType)p_217075_, p_217076_, p_369208_, p_217078_, p_217079_); -+ boolean vanillaResult = spawnplacements$data == null || spawnplacements$data.predicate.test((EntityType)p_217075_, p_217076_, p_369208_, p_217078_, p_217079_); -+ return net.minecraftforge.event.ForgeEventFactory.checkSpawnPlacements(p_217075_, p_217076_, p_369208_, p_217078_, p_217079_, vanillaResult); + final EntityType type, + final SpawnPlacementType placementType, +@@ -84,7 +_,8 @@ + } + + SpawnPlacements.Data data = DATA_BY_TYPE.get(type); +- return data == null || data.predicate.test((EntityType)type, level, spawnReason, pos, random); ++ boolean vanillaResult = data == null || data.predicate.test((EntityType)type, level, spawnReason, pos, random); ++ return net.minecraftforge.event.ForgeEventFactory.checkSpawnPlacements(type, level, spawnReason, pos, random, vanillaResult); } static { -@@ -169,5 +_,13 @@ +@@ -200,5 +_,13 @@ @FunctionalInterface public interface SpawnPredicate { - boolean test(EntityType p_217081_, ServerLevelAccessor p_217082_, EntitySpawnReason p_365908_, BlockPos p_217084_, RandomSource p_217085_); + boolean test(EntityType type, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random); + } + + // ******* FORGE START. INTERNAL USE ONLY! ****** // diff --git a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch index a7004f7c2a..4f22b12555 100644 --- a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch @@ -1,22 +1,33 @@ --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java -@@ -210,13 +_,16 @@ +@@ -134,9 +_,9 @@ + + protected void feed(final Player player, final InteractionHand hand, final ItemStack itemStack, final float healingFactor, final float defaultHeal) { + FoodProperties foodProperties = itemStack.get(DataComponents.FOOD); +- this.usePlayerItem(player, hand, itemStack); + this.heal(foodProperties != null ? healingFactor * foodProperties.nutrition() : defaultHeal); + this.playEatingSound(); ++ this.usePlayerItem(player, hand, itemStack); + } + + public boolean isInSittingPose() { +@@ -221,13 +_,16 @@ @Override - public void die(DamageSource p_21809_) { + public void die(final DamageSource source) { + // FORGE: Super moved to top so that death message would be cancelled properly + var deathMessage = this.getCombatTracker().getDeathMessage(); -+ super.die(p_21809_); ++ super.die(source); + + if (this.dead) - if (this.level() instanceof ServerLevel serverlevel - && serverlevel.getGameRules().get(GameRules.SHOW_DEATH_MESSAGES) - && this.getOwner() instanceof ServerPlayer serverplayer) { -- serverplayer.sendSystemMessage(this.getCombatTracker().getDeathMessage()); -+ serverplayer.sendSystemMessage(deathMessage); + if (this.level() instanceof ServerLevel serverLevel + && serverLevel.getGameRules().get(GameRules.SHOW_DEATH_MESSAGES) + && this.getOwner() instanceof ServerPlayer serverPlayer) { +- serverPlayer.sendSystemMessage(this.getCombatTracker().getDeathMessage()); ++ serverPlayer.sendSystemMessage(deathMessage); } - -- super.die(p_21809_); +- super.die(source); } public boolean isOrderedToSit() { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch index 66f661d21d..c03cfea791 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java -@@ -232,6 +_,10 @@ - this.schedule = p_455227_; +@@ -252,6 +_,10 @@ + this.schedule = schedule; } + public EnvironmentAttribute getSchedule() { + return this.schedule; + } + - public void setCoreActivities(Set p_21931_) { - this.coreActivities = p_21931_; + public void setCoreActivities(final Set activities) { + this.coreActivities = activities; } -@@ -493,6 +_,30 @@ +@@ -453,6 +_,31 @@ public boolean isBrainDead() { return this.memories.isEmpty() && this.sensors.isEmpty() && this.availableBehaviorsByPriority.isEmpty(); @@ -32,6 +32,7 @@ + } + + public void copyFromBuilder(net.minecraftforge.common.util.BrainBuilder builder) { ++ builder.getMemoryTypes().forEach(this::registerMemory); + builder.addAvailableBehaviorsByPriorityTo(this.availableBehaviorsByPriority); + this.setSchedule(builder.getSchedule()); + builder.addActivityRequirementsTo(this.activityRequirements); @@ -41,4 +42,4 @@ + this.activeActivities.addAll(builder.getActiveActivites()); } - static final class MemoryValue { + @FunctionalInterface diff --git a/patches/minecraft/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch index be2f1cbdab..7568317e51 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch @@ -24,8 +24,8 @@ + return this.builder.containsKey(attribute); + } - private AttributeInstance create(Holder p_334904_) { - AttributeInstance attributeinstance = new AttributeInstance(p_334904_, p_326800_ -> { + private AttributeInstance create(final Holder attribute) { + AttributeInstance result = new AttributeInstance(attribute, attributeInstance -> { @@ -91,7 +_,8 @@ public AttributeSupplier build() { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch index 8fd8ba9f24..7f65824749 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -188,11 +_,12 @@ +@@ -190,11 +_,12 @@ .build(); - public static AttributeSupplier getSupplier(EntityType p_22298_) { -- return SUPPLIERS.get(p_22298_); -+ AttributeSupplier supplier = net.minecraftforge.common.ForgeHooks.getAttributesView().get(p_22298_); -+ return supplier != null ? supplier : SUPPLIERS.get(p_22298_); + public static AttributeSupplier getSupplier(final EntityType type) { +- return SUPPLIERS.get(type); ++ AttributeSupplier supplier = net.minecraftforge.common.ForgeHooks.getAttributesView().get(type); ++ return supplier != null ? supplier : SUPPLIERS.get(type); } - public static boolean hasSupplier(EntityType p_22302_) { -- return SUPPLIERS.containsKey(p_22302_); -+ return SUPPLIERS.containsKey(p_22302_) || net.minecraftforge.common.ForgeHooks.getAttributesView().containsKey(p_22302_); + public static boolean hasSupplier(final EntityType type) { +- return SUPPLIERS.containsKey(type); ++ return SUPPLIERS.containsKey(type) || net.minecraftforge.common.ForgeHooks.getAttributesView().containsKey(type); } public static void validate() { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch index c09c20c210..fbefd3402b 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch @@ -2,28 +2,28 @@ +++ b/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java @@ -25,7 +_,7 @@ - protected boolean checkExtraStartConditions(ServerLevel p_22778_, E p_22779_) { - LivingEntity livingentity = getAttackTarget(p_22779_); -- return p_22779_.isHolding(Items.CROSSBOW) && BehaviorUtils.canSee(p_22779_, livingentity) && BehaviorUtils.isWithinAttackRange(p_22779_, livingentity, 0); -+ return p_22779_.isHolding(is -> is.getItem() instanceof CrossbowItem) && BehaviorUtils.canSee(p_22779_, livingentity) && BehaviorUtils.isWithinAttackRange(p_22779_, livingentity, 0); + protected boolean checkExtraStartConditions(final ServerLevel level, final E body) { + LivingEntity attackTarget = getAttackTarget(body); +- return body.isHolding(Items.CROSSBOW) && BehaviorUtils.canSee(body, attackTarget) && BehaviorUtils.isWithinAttackRange(body, attackTarget, 0); ++ return body.isHolding(is -> is.getItem() instanceof CrossbowItem) && BehaviorUtils.canSee(body, attackTarget) && BehaviorUtils.isWithinAttackRange(body, attackTarget, 0); } - protected boolean canStillUse(ServerLevel p_22781_, E p_22782_, long p_22783_) { + protected boolean canStillUse(final ServerLevel level, final E body, final long timestamp) { @@ -43,7 +_,7 @@ - p_22806_.stopUsingItem(); + body.stopUsingItem(); } -- if (p_22806_.isHolding(Items.CROSSBOW)) { -+ if (p_22806_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { - p_22806_.setChargingCrossbow(false); - p_22806_.getUseItem().set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); +- if (body.isHolding(Items.CROSSBOW)) { ++ if (body.isHolding(is -> is.getItem() instanceof CrossbowItem)) { + body.setChargingCrossbow(false); + body.getUseItem().set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); } @@ -51,7 +_,7 @@ - private void crossbowAttack(E p_22787_, LivingEntity p_22788_) { + private void crossbowAttack(final E body, final LivingEntity target) { if (this.crossbowState == CrossbowAttack.CrossbowState.UNCHARGED) { -- p_22787_.startUsingItem(ProjectileUtil.getWeaponHoldingHand(p_22787_, Items.CROSSBOW)); -+ p_22787_.startUsingItem(ProjectileUtil.getWeaponHoldingHand(p_22787_, item -> item instanceof CrossbowItem)); +- body.startUsingItem(ProjectileUtil.getWeaponHoldingHand(body, Items.CROSSBOW)); ++ body.startUsingItem(ProjectileUtil.getWeaponHoldingHand(body, item -> item instanceof CrossbowItem)); this.crossbowState = CrossbowAttack.CrossbowState.CHARGING; - p_22787_.setChargingCrossbow(true); + body.setChargingCrossbow(true); } else if (this.crossbowState == CrossbowAttack.CrossbowState.CHARGING) { 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 36dcf3b93f..7082259ede 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 @@ -3,21 +3,21 @@ @@ -46,7 +_,7 @@ } - protected boolean checkExtraStartConditions(ServerLevel p_23174_, Villager p_460921_) { -- if (!p_23174_.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_23174_, p_460921_)) { + protected boolean checkExtraStartConditions(final ServerLevel level, final Villager body) { +- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, body)) { return false; - } else if (!p_460921_.getVillagerData().profession().is(VillagerProfession.FARMER)) { - return false; -@@ -116,6 +_,11 @@ - p_23196_.setBlockAndUpdate(this.aboveFarmlandPos, blockstate1); - p_23196_.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(p_457898_, blockstate1)); - flag = true; -+ } else if (itemstack.getItem() instanceof net.minecraftforge.common.IPlantable) { -+ if (((net.minecraftforge.common.IPlantable) itemstack.getItem()).getPlantType(p_23196_, aboveFarmlandPos) == net.minecraftforge.common.PlantType.CROP) { -+ p_23196_.setBlock(aboveFarmlandPos, ((net.minecraftforge.common.IPlantable) itemstack.getItem()).getPlant(p_23196_, aboveFarmlandPos), 3); -+ flag = true; + } + +@@ -120,6 +_,11 @@ + level.setBlockAndUpdate(this.aboveFarmlandPos, place); + level.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(body, place)); + ok = true; ++ } else if (itemStack.getItem() instanceof net.minecraftforge.common.IPlantable) { ++ if (((net.minecraftforge.common.IPlantable) itemStack.getItem()).getPlantType(level, aboveFarmlandPos) == net.minecraftforge.common.PlantType.CROP) { ++ level.setBlock(aboveFarmlandPos, ((net.minecraftforge.common.IPlantable) itemStack.getItem()).getPlant(level, aboveFarmlandPos), 3); ++ ok = true; + } } - if (flag) { + if (ok) { 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 05a22cd977..f329ae56a8 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,15 +1,14 @@ --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java -@@ -28,7 +_,11 @@ - if (!p_359049_.canAttack(livingentity)) { - return false; - } else { -- p_258778_.set(livingentity); -+ var changeTargetEvent = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetBehavior(p_359049_, livingentity); -+ if (changeTargetEvent == null) -+ return false; +@@ -32,6 +_,11 @@ + return false; + } + ++ var changeTargetEvent = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetBehavior(body, targetEntity); ++ if (changeTargetEvent == null) ++ return false; ++ targetEntity = changeTargetEvent.getNewTarget(); + -+ p_258778_.set(changeTargetEvent.getNewTarget()); - p_258779_.erase(); - return true; - } + attackTarget.set(targetEntity); + cantReachSince.erase(); + return true; diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/Swim.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/Swim.java.patch index 088cae90ad..62c54642c5 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/Swim.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/Swim.java.patch @@ -3,9 +3,9 @@ @@ -14,7 +_,7 @@ } - public static boolean shouldSwim(T p_327994_) { -- return p_327994_.isInWater() && p_327994_.getFluidHeight(FluidTags.WATER) > p_327994_.getFluidJumpThreshold() || p_327994_.isInLava(); -+ return p_327994_.isInWater() &&p_327994_.getFluidHeight(FluidTags.WATER) > p_327994_.getFluidJumpThreshold() || p_327994_.isInLava() || p_327994_.isInFluidType((fluidType, height) -> p_327994_.canSwimInFluidType(fluidType) && height > p_327994_.getFluidJumpThreshold()); + public static boolean shouldSwim(final T mob) { +- return mob.isInWater() && mob.getFluidHeight(FluidTags.WATER) > mob.getFluidJumpThreshold() || mob.isInLava(); ++ return mob.isInWater() && mob.getFluidHeight(FluidTags.WATER) > mob.getFluidJumpThreshold() || mob.isInLava() || mob.isInFluidType((fluidType, height) -> mob.canSwimInFluidType(fluidType) && height > mob.getFluidJumpThreshold()); } - protected boolean checkExtraStartConditions(ServerLevel p_24388_, Mob p_24389_) { + protected boolean checkExtraStartConditions(final ServerLevel level, final Mob body) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch index 74cd9f288c..8774cdbd17 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java @@ -61,7 +_,7 @@ if (this.eatAnimationTick == this.adjustedTickDelay(4)) { - BlockPos blockpos = this.mob.blockPosition(); - if (IS_EDIBLE.test(this.level.getBlockState(blockpos))) { + BlockPos pos = this.mob.blockPosition(); + if (IS_EDIBLE.test(this.level.getBlockState(pos))) { - if (getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.level), this.mob)) { - this.level.destroyBlock(blockpos, false); + this.level.destroyBlock(pos, false); } @@ -69,7 +_,7 @@ } else { - BlockPos blockpos1 = blockpos.below(); - if (this.level.getBlockState(blockpos1).is(Blocks.GRASS_BLOCK)) { + BlockPos below = pos.below(); + if (this.level.getBlockState(below).is(Blocks.GRASS_BLOCK)) { - if (getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.level), this.mob)) { - this.level.levelEvent(2001, blockpos1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); - this.level.setBlock(blockpos1, Blocks.DIRT.defaultBlockState(), 2); + this.level.levelEvent(2001, below, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); + this.level.setBlock(below, Blocks.DIRT.defaultBlockState(), 2); } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch index 20e1bfa81e..ae288af77b 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch @@ -7,33 +7,34 @@ + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; - public MeleeAttackGoal(PathfinderMob p_25552_, double p_25553_, boolean p_25554_) { - this.mob = p_25552_; -@@ -42,6 +_,15 @@ - } else if (!livingentity.isAlive()) { - return false; - } else { -+ if (canPenalize) { -+ if (--this.ticksUntilNextPathRecalculation <= 0) { -+ this.path = this.mob.getNavigation().createPath(livingentity, 0); -+ this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); -+ return this.path != null; -+ } else { -+ return true; -+ } -+ } - this.path = this.mob.getNavigation().createPath(livingentity, 0); - return this.path != null ? true : this.mob.isWithinMeleeAttackRange(livingentity); - } + public MeleeAttackGoal(final PathfinderMob mob, final double speedModifier, final boolean followingTargetEvenIfNotSeen) { + this.mob = mob; +@@ -46,6 +_,16 @@ + return false; + } + ++ if (canPenalize) { ++ if (--this.ticksUntilNextPathRecalculation <= 0) { ++ this.path = this.mob.getNavigation().createPath(target, 0); ++ this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); ++ return this.path != null? true : this.mob.isWithinMeleeAttackRange(target); ++ } else { ++ return true; ++ } ++ } ++ + this.path = this.mob.getNavigation().createPath(target, 0); + return this.path != null ? true : this.mob.isWithinMeleeAttackRange(target); + } @@ -106,6 +_,18 @@ - this.pathedTargetZ = livingentity.getZ(); + this.pathedTargetZ = target.getZ(); this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); - double d0 = this.mob.distanceToSqr(livingentity); + double targetDistanceSqr = this.mob.distanceToSqr(target); + if (this.canPenalize) { + this.ticksUntilNextPathRecalculation += failedPathFindingPenalty; + if (this.mob.getNavigation().getPath() != null) { -+ net.minecraft.world.level.pathfinder.Node finalPathPoint = this.mob.getNavigation().getPath().getEndNode(); -+ if (finalPathPoint != null && livingentity.distanceToSqr(finalPathPoint.x, finalPathPoint.y, finalPathPoint.z) < 1) ++ var finalPathPoint = this.mob.getNavigation().getPath().getEndNode(); ++ if (finalPathPoint != null && target.distanceToSqr(finalPathPoint.x, finalPathPoint.y, finalPathPoint.z) < 1) + failedPathFindingPenalty = 0; + else + failedPathFindingPenalty += 10; @@ -41,6 +42,6 @@ + failedPathFindingPenalty += 10; + } + } - if (d0 > 1024.0) { + if (targetDistanceSqr > 1024.0) { this.ticksUntilNextPathRecalculation += 10; - } else if (d0 > 256.0) { + } else if (targetDistanceSqr > 256.0) { 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 cb4b11de24..65e29e3ae3 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 @@ -17,9 +17,9 @@ + this((T)p_25792_, p_25793_, p_25794_, p_25795_); + } + - public RangedBowAttackGoal(T p_25792_, double p_25793_, int p_25794_, float p_25795_) { - this.mob = p_25792_; - this.speedModifier = p_25793_; + public RangedBowAttackGoal(final T mob, final double speedModifier, final int attackIntervalMin, final float attackRadius) { + this.mob = mob; + this.speedModifier = speedModifier; @@ -38,7 +_,7 @@ } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch index 556a92b1da..986b766ffa 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch @@ -10,9 +10,9 @@ @Override @@ -99,7 +_,7 @@ - this.mob.getLookControl().setLookAt(livingentity, 30.0F, 30.0F); + this.mob.getLookControl().setLookAt(target, 30.0F, 30.0F); if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.UNCHARGED) { - if (!flag2) { + if (!needsToMove) { - this.mob.startUsingItem(ProjectileUtil.getWeaponHoldingHand(this.mob, Items.CROSSBOW)); + this.mob.startUsingItem(ProjectileUtil.getWeaponHoldingHand(this.mob, item -> item instanceof CrossbowItem)); this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.CHARGING; 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 719ac84f55..cd49045c6c 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 @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -@@ -35,7 +_,7 @@ +@@ -34,7 +_,7 @@ @Override public boolean canUse() { @@ -9,13 +9,11 @@ return false; } else if (this.nextStartTick > 0) { this.nextStartTick--; -@@ -149,7 +_,8 @@ - ); - return chunkaccess == null +@@ -139,6 +_,6 @@ + ChunkAccess chunk = level.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()), ChunkStatus.FULL, false); + return chunk == null ? false -- : chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) -+ : !chunkaccess.getBlockState(p_25851_).canEntityDestroy(p_25850_, p_25851_, this.removerMob) ? false -+ : chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) - && chunkaccess.getBlockState(p_25851_.above()).isAir() - && chunkaccess.getBlockState(p_25851_.above(2)).isAir(); +- : chunk.getBlockState(pos).is(this.blockToRemove) && chunk.getBlockState(pos.above()).isAir() && chunk.getBlockState(pos.above(2)).isAir(); ++ : chunk.getBlockState(pos).canEntityDestroy(level, pos, this.removerMob) && chunk.getBlockState(pos).is(this.blockToRemove) && chunk.getBlockState(pos.above()).isAir() && chunk.getBlockState(pos.above(2)).isAir(); } + } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch index f716a1089b..771a960db6 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java +++ b/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java @@ -58,7 +_,7 @@ - if (entity instanceof Player player) { - int i = this.horse.getTemper(); - int j = this.horse.getMaxTemper(); -- if (j > 0 && this.horse.getRandom().nextInt(j) < i) { -+ if (j > 0 && this.horse.getRandom().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(horse, (Player)entity)) { + if (passenger instanceof Player player) { + int temper = this.horse.getTemper(); + int maxTemper = this.horse.getMaxTemper(); +- if (maxTemper > 0 && this.horse.getRandom().nextInt(maxTemper) < temper) { ++ if (maxTemper > 0 && this.horse.getRandom().nextInt(maxTemper) < temper && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(horse, player)) { this.horse.tameWithName(player); return; } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch index a91e71107a..ca4da7708f 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch @@ -3,11 +3,11 @@ @@ -83,6 +_,10 @@ } - mob = (Mob)iterator.next(); + other = (Mob)var5.next(); + // Fix NPE if modders do things vanilla doesn't expect. https://github.com/MinecraftForge/MinecraftForge/issues/7853 + if (this.mob.getLastHurtByMob() == null) + return; + - if (this.mob != mob - && mob.getTarget() == null - && (!(this.mob instanceof TamableAnimal) || ((TamableAnimal)this.mob).getOwner() == ((TamableAnimal)mob).getOwner()) + if (this.mob != other + && other.getTarget() == null + && (!(this.mob instanceof TamableAnimal tamableAnimal) || tamableAnimal.getOwner() == ((TamableAnimal)other).getOwner()) diff --git a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch index 7b8b634eb4..2864829c1b 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch @@ -1,16 +1,21 @@ --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -245,10 +_,10 @@ - Vec3 vec3 = this.getTempMobPos(); +@@ -248,12 +_,13 @@ + Vec3 mobPos = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; - Vec3i vec3i = this.path.getNextNodePos(); -- double d0 = Math.abs(this.mob.getX() - (vec3i.getX() + 0.5)); -+ double d0 = Math.abs(this.mob.getX() - ((double)vec3i.getX() + (this.mob.getBbWidth() + 1) / 2D)); //Forge: Fix MC-94054 - double d1 = Math.abs(this.mob.getY() - vec3i.getY()); -- double d2 = Math.abs(this.mob.getZ() - (vec3i.getZ() + 0.5)); -- boolean flag = d0 < this.maxDistanceToWaypoint && d2 < this.maxDistanceToWaypoint && d1 < 1.0; -+ double d2 = Math.abs(this.mob.getZ() - ((double)vec3i.getZ() + (this.mob.getBbWidth() + 1) / 2D)); //Forge: Fix MC-94054 -+ boolean flag = d0 <= (double)this.maxDistanceToWaypoint && d2 <= (double)this.maxDistanceToWaypoint && d1 < 1.0D; //Forge: Fix MC-94054 - if (flag || this.canCutCorner(this.path.getNextNode().type) && this.shouldTargetNextNodeInDirection(vec3)) { + Vec3i currentNodePos = this.path.getNextNodePos(); +- double xDistance = Math.abs(this.mob.getX() - (currentNodePos.getX() + 0.5)); ++ //Forge: Fix MC-94054 make so jvm doesn't down grade to float math by casting to doubles ++ double xDistance = Math.abs(this.mob.getX() - ((double)currentNodePos.getX() + (this.mob.getBbWidth() + 1) / 2D)); + double yDistance = Math.abs(this.mob.getY() - currentNodePos.getY()); +- double zDistance = Math.abs(this.mob.getZ() - (currentNodePos.getZ() + 0.5)); +- boolean isCloseEnoughToCurrentNode = xDistance < this.maxDistanceToWaypoint +- && zDistance < this.maxDistanceToWaypoint +- && yDistance < this.getMaxVerticalDistanceToWaypoint(); ++ double zDistance = Math.abs(this.mob.getZ() - ((double)currentNodePos.getZ() + (this.mob.getBbWidth() + 1) / 2D)); ++ boolean isCloseEnoughToCurrentNode = xDistance <= (double)this.maxDistanceToWaypoint ++ && zDistance <= (double)this.maxDistanceToWaypoint ++ && yDistance < (double)this.getMaxVerticalDistanceToWaypoint(); + if (isCloseEnoughToCurrentNode || this.canCutCorner(this.path.getNextNode().type) && this.shouldTargetNextNodeInDirection(mobPos)) { this.path.advance(); } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch index cae1e4fe1d..40c1a64042 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch @@ -12,6 +12,6 @@ - )) { + // FORGE: Fix MC-94054 + if (!this.pathToPosition.closerToCenterThan(this.mob.position(), Math.max((double)this.mob.getBbWidth(), 1.0D)) && (!(this.mob.getY() > (double)this.pathToPosition.getY()) || !(BlockPos.containing((double)this.pathToPosition.getX(), this.mob.getY(), (double)this.pathToPosition.getZ())).closerToCenterThan(this.mob.position(), Math.max((double)this.mob.getBbWidth(), 1.0D)))) { - this.mob.getMoveControl().setWantedPosition(this.pathToPosition.getX(), this.pathToPosition.getY(), this.pathToPosition.getZ(), this.speedModifier); - } else { - this.pathToPosition = null; + this.mob + .getMoveControl() + .setWantedPosition(this.pathToPosition.getX(), this.pathToPosition.getY(), this.pathToPosition.getZ(), this.speedModifier); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch index 5220b57966..e39a203133 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/world/entity/ai/village/VillageSiege.java +++ b/net/minecraft/world/entity/ai/village/VillageSiege.java -@@ -71,7 +_,10 @@ - this.spawnX = blockpos.getX() + Mth.floor(Mth.cos(f) * 32.0F); - this.spawnY = blockpos.getY(); - this.spawnZ = blockpos.getZ() + Mth.floor(Mth.sin(f) * 32.0F); -- if (this.findRandomSpawnPos(p_27008_, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)) != null) { -+ Vec3 siegeLocation = this.findRandomSpawnPos(p_27008_, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)); +@@ -78,7 +_,10 @@ + this.spawnX = center.getX() + Mth.floor(Mth.cos(angle) * 32.0F); + this.spawnY = center.getY(); + this.spawnZ = center.getZ() + Mth.floor(Mth.sin(angle) * 32.0F); +- if (this.findRandomSpawnPos(level, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)) != null) { ++ Vec3 siegeLocation = this.findRandomSpawnPos(level, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)); + if (siegeLocation != null) { -+ if (net.minecraftforge.event.village.VillageSiegeEvent.BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, p_27008_, player, siegeLocation))) ++ if (net.minecraftforge.event.village.VillageSiegeEvent.BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, level, player, siegeLocation))) + return false; this.nextSpawnTime = 0; this.zombiesToSpawn = 20; break; -@@ -91,7 +_,7 @@ - if (vec3 != null) { +@@ -98,7 +_,7 @@ + if (spawnPos != null) { Zombie zombie; try { -- zombie = new Zombie(p_27017_); -+ zombie = EntityType.ZOMBIE.create(p_27017_, EntitySpawnReason.EVENT); //Forge: Direct Initialization is deprecated, use EntityType. - zombie.finalizeSpawn(p_27017_, p_27017_.getCurrentDifficultyAt(zombie.blockPosition()), EntitySpawnReason.EVENT, null); - } catch (Exception exception) { - LOGGER.warn("Failed to create zombie for village siege at {}", vec3, exception); +- zombie = new Zombie(level); ++ zombie = EntityTypes.ZOMBIE.create(level, EntitySpawnReason.EVENT); //Forge: Direct Initialization is deprecated, use EntityType. + zombie.finalizeSpawn(level, level.getCurrentDifficultyAt(zombie.blockPosition()), EntitySpawnReason.EVENT, null); + } catch (Exception e) { + LOGGER.warn("Failed to create zombie for village siege at {}", spawnPos, e); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch index cda058566e..7fe4a5237d 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/entity/ai/village/poi/PoiTypes.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiTypes.java -@@ -73,7 +_,7 @@ +@@ -56,7 +_,7 @@ .stream() - .flatMap(p_421797_ -> p_421797_.getStateDefinition().getPossibleStates().stream()) + .flatMap(block -> block.getStateDefinition().getPossibleStates().stream()) .collect(ImmutableSet.toImmutableSet()); - private static final Map> TYPE_BY_STATE = Maps.newHashMap(); + private static final Map> TYPE_BY_STATE = net.minecraftforge.registries.GameData.PoiTypeCallbacks.getStateToPoi(); - private static Set getBlockStates(Block p_218074_) { - return ImmutableSet.copyOf(p_218074_.getStateDefinition().getPossibleStates()); -@@ -86,7 +_,6 @@ - private static PoiType register(Registry p_218085_, ResourceKey p_218086_, Set p_218087_, int p_218088_, int p_218089_) { - PoiType poitype = new PoiType(p_218087_, p_218088_, p_218089_); - Registry.register(p_218085_, p_218086_, poitype); -- registerBlockStates(p_218085_.getOrThrow(p_218086_), p_218087_); - return poitype; + private static Set getBlockStates(final Block block) { + return ImmutableSet.copyOf(block.getStateDefinition().getPossibleStates()); +@@ -71,7 +_,6 @@ + ) { + PoiType value = new PoiType(matchingStates, maxTickets, validRange); + Registry.register(registry, id, value); +- registerBlockStates(registry.getOrThrow(id), matchingStates); + return value; } 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 a84ce982bc..62dbc2071d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/world/entity/animal/Animal.java @@ -208,6 +_,17 @@ - public void spawnChildFromBreeding(ServerLevel p_27564_, Animal p_27565_) { - AgeableMob ageablemob = this.getBreedOffspring(p_27564_, p_27565_); -+ final var event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(this, p_27565_, ageablemob); + public void spawnChildFromBreeding(final ServerLevel level, final Animal partner) { + AgeableMob offspring = this.getBreedOffspring(level, partner); ++ final var event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(this, partner, offspring); + final boolean cancelled = net.minecraftforge.event.entity.living.BabyEntitySpawnEvent.BUS.post(event); -+ ageablemob = event.getChild(); ++ offspring = event.getChild(); + if (cancelled) { + //Reset the "inLove" state for the animals + this.setAge(6000); -+ p_27565_.setAge(6000); ++ partner.setAge(6000); + this.resetLove(); -+ p_27565_.resetLove(); ++ partner.resetLove(); + return; + } - if (ageablemob != null) { - ageablemob.setBaby(true); - ageablemob.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); + if (offspring != null) { + offspring.setBaby(true); + offspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); 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 520b623335..1b8ffb5728 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 -@@ -352,7 +_,7 @@ - public boolean wantsToPickUp(ServerLevel p_363882_, ItemStack p_218387_) { - ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); - return !itemstack.isEmpty() -- && p_363882_.getGameRules().get(GameRules.MOB_GRIEFING) -+ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_363882_, this) - && this.inventory.canAddItem(p_218387_) - && this.allayConsidersItemEqual(itemstack, p_218387_); +@@ -341,7 +_,7 @@ + public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) { + ItemStack itemInHand = this.getItemInHand(InteractionHand.MAIN_HAND); + return !itemInHand.isEmpty() +- && level.getGameRules().get(GameRules.MOB_GRIEFING) ++ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, this) + && this.inventory.canAddItem(itemStack) + && this.allayConsidersItemEqual(itemInHand, itemStack); } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch index a4b47ed9ab..c9f7edb036 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/world/entity/animal/bee/Bee.java +++ b/net/minecraft/world/entity/animal/bee/Bee.java -@@ -492,7 +_,9 @@ +@@ -473,7 +_,9 @@ if (this.hivePos == null) { return null; } else { -- return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); +- return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityTypes.BEEHIVE).orElse(null); + if (!this.isTooFarAway(this.hivePos) && this.level().getBlockEntity(this.hivePos) instanceof BeehiveBlockEntity hiveEntity) + return hiveEntity; + return null; } } -@@ -654,13 +_,22 @@ +@@ -639,13 +_,22 @@ } @Override -- protected void jumpInLiquid(TagKey p_453030_) { +- protected void jumpInLiquid(final TagKey type) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.01, 0.0)); - } - @@ -38,4 +38,4 @@ + this.jumpInLiquidInternal(); } - boolean closerThan(BlockPos p_459558_, int p_453557_) { + private boolean closerThan(final BlockPos targetPos, final int distance) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch index e6df583fb1..929afa8956 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -351,7 +_,7 @@ +@@ -365,7 +_,7 @@ @Override - protected void playStepSound(BlockPos p_252056_, BlockState p_251457_) { -- if (p_251457_.is(BlockTags.CAMEL_SAND_STEP_SOUND_BLOCKS)) { -+ if (p_251457_.getSoundType(level(), p_252056_, this) == net.minecraft.world.level.block.SoundType.SAND) { + protected void playStepSound(final BlockPos pos, final BlockState blockState) { +- if (blockState.is(BlockTags.CAMEL_SAND_STEP_SOUND_BLOCKS)) { ++ if (blockState.getSoundType(level(), pos, this) == net.minecraft.world.level.block.SoundType.SAND) { this.playSound(SoundEvents.CAMEL_STEP_SAND, 1.0F, 1.0F); } else { this.playSound(SoundEvents.CAMEL_STEP, 1.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch index c2298b3999..9bb7975d6a 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch @@ -1,57 +1,28 @@ --- a/net/minecraft/world/entity/animal/cow/MushroomCow.java +++ b/net/minecraft/world/entity/animal/cow/MushroomCow.java -@@ -114,7 +_,7 @@ +@@ -122,7 +_,7 @@ - this.playSound(soundevent, 1.0F, 1.0F); + this.playSound(milkSound, 1.0F, 1.0F); return InteractionResult.SUCCESS; -- } else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { -+ } else if (false && itemstack.is(Items.SHEARS) && this.readyForShearing()) { - if (this.level() instanceof ServerLevel serverlevel) { - this.shear(serverlevel, SoundSource.PLAYERS, itemstack); - this.gameEvent(GameEvent.SHEAR, p_454203_); -@@ -170,15 +_,26 @@ +- } else if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { ++ } else if (itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.readyForShearing()) { + if (this.level() instanceof ServerLevel level) { + this.shear(level, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); +@@ -178,6 +_,8 @@ @Override - public void shear(ServerLevel p_454992_, SoundSource p_460786_, ItemStack p_454795_) { -+ for (var stack : shearInternal(p_454992_, p_460786_, p_454795_)) { -+ for (int i = 0; i < stack.getCount(); i++) { -+ this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), stack.copyWithCount(1))); -+ } -+ } -+ } -+ -+ private java.util.List shearInternal(ServerLevel p_454992_, SoundSource p_460786_, ItemStack p_454795_) { -+ var ret = new java.util.ArrayList(); -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.COW, time -> {})) -+ return ret; - p_454992_.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, p_460786_, 1.0F, 1.0F); - this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), p_458024_ -> { - p_454992_.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); - this.dropFromShearingLootTable(p_454992_, BuiltInLootTables.SHEAR_MOOSHROOM, p_454795_, (p_460709_, p_451895_) -> { -- for (int i = 0; i < p_451895_.getCount(); i++) { -- p_460709_.addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), p_451895_.copyWithCount(1))); -- } -+ ret.add(p_451895_); + public void shear(final ServerLevel level, final SoundSource soundSource, final ItemStack tool) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.COW, time -> {})) ++ return; + level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F); + this.convertTo(EntityTypes.COW, ConversionParams.single(this, false, false), cow -> { + level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); +@@ -186,6 +_,7 @@ + l.addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), drop.copyWithCount(1))); + } }); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_458024_); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, cow); }); -+ return ret; } - @Override -@@ -254,6 +_,15 @@ - } - - return mushroomcow$variant2; -+ } -+ -+ @Override -+ public java.util.List onSheared(@org.jetbrains.annotations.Nullable Player player, @org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos, int fortune) { -+ if (world instanceof ServerLevel server) { -+ this.gameEvent(GameEvent.SHEAR, player); -+ return shearInternal(server, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, item); -+ } -+ return java.util.Collections.emptyList(); - } - - public static enum Variant implements StringRepresentable { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch index e61dec3c31..de0805d2b9 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/equine/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/equine/AbstractHorse.java -@@ -140,6 +_,7 @@ +@@ -142,6 +_,7 @@ } this.addBehaviourGoals(); @@ -8,42 +8,54 @@ } protected void addBehaviourGoals() { -@@ -274,6 +_,11 @@ +@@ -277,17 +_,20 @@ @Override - public boolean causeFallDamage(double p_454114_, float p_458836_, DamageSource p_450439_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, p_454114_, p_458836_); + public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { +- if (fallDistance > 1.0) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, fallDistance, damageModifier); + if (event == null) return false; -+ p_454114_ = event.getDistance(); -+ p_458836_ = event.getDamageMultiplier(); + - if (p_454114_ > 1.0) { - this.playSound(SoundEvents.HORSE_LAND, 0.4F, 1.0F); ++ if (event.getDistance() > 1.0) { + this.playSound(this.isBaby() ? SoundEvents.HORSE_LAND_BABY : SoundEvents.HORSE_LAND, 0.4F, 1.0F); } -@@ -339,9 +_,9 @@ - protected void playStepSound(BlockPos p_457686_, BlockState p_459257_) { - if (!p_459257_.liquid()) { - BlockState blockstate = this.level().getBlockState(p_457686_.above()); -- SoundType soundtype = p_459257_.getSoundType(); -+ SoundType soundtype = p_459257_.getSoundType(level(), p_457686_, this); - if (blockstate.is(Blocks.SNOW)) { -- soundtype = blockstate.getSoundType(); -+ soundtype = blockstate.getSoundType(level(), p_457686_.above(), this); + +- int dmg = this.calculateFallDamage(fallDistance, damageModifier); ++ int dmg = this.calculateFallDamage(event.getDistance(), event.getDamageMultiplier()); + if (dmg <= 0) { + return false; + } + + this.hurt(damageSource, dmg); +- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); ++ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); + this.playBlockFallSound(); + return true; + } +@@ -342,9 +_,9 @@ + protected void playStepSound(final BlockPos pos, final BlockState blockState) { + if (!blockState.liquid()) { + BlockState aboveState = this.level().getBlockState(pos.above()); +- SoundType soundType = blockState.getSoundType(); ++ SoundType soundType = blockState.getSoundType(level(), pos, this); + if (aboveState.is(Blocks.SNOW)) { +- soundType = aboveState.getSoundType(); ++ soundType = aboveState.getSoundType(level(), pos.above(), this); } if (this.isVehicle() && this.canGallop) { -@@ -773,6 +_,7 @@ - float f1 = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); - this.setDeltaMovement(this.getDeltaMovement().add(-0.4F * f * p_452386_, 0.0, 0.4F * f1 * p_452386_)); +@@ -778,6 +_,7 @@ + float cos = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); + this.setDeltaMovement(this.getDeltaMovement().add(-0.4F * sin * amount, 0.0, 0.4F * cos * amount)); } + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } protected void playJumpSound() { -@@ -1013,6 +_,26 @@ +@@ -1028,6 +_,26 @@ - public boolean hasInventoryChanged(Container p_457588_) { - return this.inventory != p_457588_; + public boolean hasInventoryChanged(final Container oldInventory) { + return this.inventory != oldInventory; + } + + private net.minecraftforge.common.util.LazyOptional itemHandler = null; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch index 217f52ceec..14b2350f5e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch @@ -1,13 +1,22 @@ --- a/net/minecraft/world/entity/animal/equine/Llama.java +++ b/net/minecraft/world/entity/animal/equine/Llama.java -@@ -370,6 +_,10 @@ +@@ -370,14 +_,16 @@ @Override - public boolean causeFallDamage(double p_455330_, float p_456237_, DamageSource p_451412_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, p_455330_, p_456237_); + public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { +- int dmg = this.calculateFallDamage(fallDistance, damageModifier); ++ var event = net.minecraftforge.event.ForgeEventFactory.onLivingFall(this, fallDistance, damageModifier); + if (event == null) return false; -+ p_455330_ = event.getDistance(); -+ p_456237_ = event.getDamageMultiplier(); - int i = this.calculateFallDamage(p_455330_, p_456237_); - if (i <= 0) { ++ int dmg = this.calculateFallDamage(event.getDistance(), event.getDamageMultiplier()); + if (dmg <= 0) { return false; + } + +- if (fallDistance >= 6.0) { ++ if (event.getDistance() >= 6.0) { + this.hurt(damageSource, dmg); +- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); ++ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); + } + + this.playBlockFallSound(); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java.patch index 09b0dbd893..8fed45b75d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java.patch @@ -3,14 +3,14 @@ @@ -31,6 +_,13 @@ @Override public void tick() { - ServerLevel serverlevel = (ServerLevel)this.horse.level(); + ServerLevel level = (ServerLevel)this.horse.level(); + // Forge: Trigger the trap in a tick task to avoid crashes when mods add goals to skeleton horses + // (MC-206338/Forge PR #7509) -+ serverlevel.getServer().schedule(serverlevel.getServer().wrapRunnable(() -> this.convert(serverlevel))); ++ level.getServer().schedule(level.getServer().wrapRunnable(() -> this.convert(level))); + } + -+ private void convert(ServerLevel serverlevel) { ++ private void convert(ServerLevel level) { + if (!this.horse.isAlive()) return; - DifficultyInstance difficultyinstance = serverlevel.getCurrentDifficultyAt(this.horse.blockPosition()); + DifficultyInstance difficulty = level.getCurrentDifficultyAt(this.horse.blockPosition()); this.horse.setTrap(false); this.horse.setTamed(true); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch index cb8fd80ef2..cb68fc763b 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch @@ -1,23 +1,11 @@ --- a/net/minecraft/world/entity/animal/feline/Cat.java +++ b/net/minecraft/world/entity/animal/feline/Cat.java -@@ -385,10 +_,10 @@ - } - } else if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { - if (!this.level().isClientSide()) { -- this.usePlayerItem(p_460113_, p_450900_, itemstack); - FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); - this.heal(foodproperties != null ? foodproperties.nutrition() : 1.0F); - this.playEatingSound(); -+ this.usePlayerItem(p_460113_, p_450900_, itemstack); - } - - return InteractionResult.SUCCESS; -@@ -449,7 +_,7 @@ +@@ -485,7 +_,7 @@ } - private void tryToTame(Player p_451247_) { + private void tryToTame(final Player player) { - if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_451247_)) { - this.tame(p_451247_); ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) { + this.tame(player); this.setOrderedToSit(true); this.level().broadcastEntityEvent(this, (byte)7); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch index b4cc899f23..a7507eaadc 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/feline/Ocelot.java +++ b/net/minecraft/world/entity/animal/feline/Ocelot.java -@@ -161,7 +_,7 @@ - if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && p_454842_.distanceToSqr(this) < 9.0) { - this.usePlayerItem(p_454842_, p_450856_, itemstack); +@@ -168,7 +_,7 @@ + if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemStack) && player.distanceToSqr(this) < 9.0) { + this.usePlayerItem(player, hand, itemStack); if (!this.level().isClientSide()) { - if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_454842_)) { ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) { this.setTrusting(true); this.spawnTrustingParticles(true); this.level().broadcastEntityEvent(this, (byte)41); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch index 2f19bdfa0c..fd188324e4 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/animal/fox/Fox.java +++ b/net/minecraft/world/entity/animal/fox/Fox.java -@@ -861,6 +_,17 @@ +@@ -872,6 +_,17 @@ @Override protected void breed() { - Fox fox = (Fox)this.animal.getBreedOffspring(this.level, this.partner); -+ var event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(animal, partner, fox); + Fox offspring = (Fox)this.animal.getBreedOffspring(this.level, this.partner); ++ var event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(animal, partner, offspring); + var eventWasCancelled = net.minecraftforge.event.entity.living.BabyEntitySpawnEvent.BUS.post(event); -+ fox = (Fox)event.getChild(); ++ offspring = (Fox)event.getChild(); + if (eventWasCancelled) { + //Reset the "inLove" state for the animals + this.animal.setAge(6000); @@ -15,19 +15,19 @@ + this.partner.resetLove(); + return; + } - if (fox != null) { - ServerPlayer serverplayer = this.animal.getLoveCause(); - ServerPlayer serverplayer1 = this.partner.getLoveCause(); -@@ -944,7 +_,7 @@ + if (offspring != null) { + ServerPlayer animalLoveCause = this.animal.getLoveCause(); + ServerPlayer partnerLoveCause = this.partner.getLoveCause(); +@@ -949,7 +_,7 @@ } protected void onReachedTarget() { - if (getServerLevel(Fox.this.level()).getGameRules().get(GameRules.MOB_GRIEFING)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(Fox.this.level()), Fox.this)) { - BlockState blockstate = Fox.this.level().getBlockState(this.blockPos); - if (blockstate.is(Blocks.SWEET_BERRY_BUSH)) { - this.pickSweetBerries(blockstate); -@@ -1003,7 +_,7 @@ + BlockState state = Fox.this.level().getBlockState(this.blockPos); + if (state.is(Blocks.SWEET_BERRY_BUSH)) { + this.pickSweetBerries(state); +@@ -1008,7 +_,7 @@ @Override public boolean canUse() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch index 0db0866f67..4c1a2e6a52 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch @@ -1,30 +1,11 @@ --- a/net/minecraft/world/entity/animal/golem/CopperGolem.java +++ b/net/minecraft/world/entity/animal/golem/CopperGolem.java -@@ -213,7 +_,7 @@ +@@ -214,7 +_,7 @@ } Level level = this.level(); -- if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { -+ if (false && itemstack.is(Items.SHEARS) && this.readyForShearing()) { // Forge: Moved to onSheared - if (level instanceof ServerLevel serverlevel) { - this.shear(serverlevel, SoundSource.PLAYERS, itemstack); - this.gameEvent(GameEvent.SHEAR, p_458561_); -@@ -427,6 +_,18 @@ - ItemStack itemstack = this.getItemBySlot(EQUIPMENT_SLOT_ANTENNA); - this.setItemSlot(EQUIPMENT_SLOT_ANTENNA, ItemStack.EMPTY); - this.spawnAtLocation(p_459970_, itemstack, 1.5F); -+ } -+ -+ @Override -+ public java.util.List onSheared(@Nullable Player player, ItemStack item, Level world, net.minecraft.core.BlockPos pos, int fortune) { -+ if (world instanceof ServerLevel server) { -+ server.playSound(null, this, SoundEvents.COPPER_GOLEM_SHEAR, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F); -+ var ret = new java.util.ArrayList(); -+ ret.add(this.getItemBySlot(EQUIPMENT_SLOT_ANTENNA)); -+ this.setItemSlot(EQUIPMENT_SLOT_ANTENNA, ItemStack.EMPTY); -+ return ret; -+ } -+ return java.util.Collections.emptyList(); - } - - @Override +- if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { ++ if (itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.readyForShearing()) { + if (level instanceof ServerLevel serverLevel) { + this.shear(serverLevel, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/golem/SnowGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/golem/SnowGolem.java.patch index 97d5aa552e..cf1375a26d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/golem/SnowGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/golem/SnowGolem.java.patch @@ -1,56 +1,29 @@ --- a/net/minecraft/world/entity/animal/golem/SnowGolem.java +++ b/net/minecraft/world/entity/animal/golem/SnowGolem.java -@@ -42,7 +_,7 @@ - import net.minecraft.world.phys.Vec3; - import org.jspecify.annotations.Nullable; - --public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob { -+public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob, net.minecraftforge.common.IForgeShearable { - private static final EntityDataAccessor DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE); - private static final byte PUMPKIN_FLAG = 16; - private static final boolean DEFAULT_PUMPKIN = true; @@ -95,7 +_,7 @@ - this.hurtServer(serverlevel, this.damageSources().onFire(), 1.0F); + this.hurtServer(serverLevel, this.damageSources().onFire(), 1.0F); } -- if (!serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, this)) { +- if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, this)) { return; } @@ -106,7 +_,7 @@ - int k = Mth.floor(this.getY()); - int l = Mth.floor(this.getZ() + (i / 2 % 2 * 2 - 1) * 0.25F); - BlockPos blockpos = new BlockPos(j, k, l); -- if (this.level().getBlockState(blockpos).isAir() && blockstate.canSurvive(this.level(), blockpos)) { -+ if (this.level().isEmptyBlock(blockpos) && blockstate.canSurvive(this.level(), blockpos)) { - this.level().setBlockAndUpdate(blockpos, blockstate); - this.level().gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(this, blockstate)); + int yy = Mth.floor(this.getY()); + int zz = Mth.floor(this.getZ() + (i / 2 % 2 * 2 - 1) * 0.25F); + BlockPos snowPos = new BlockPos(xx, yy, zz); +- if (this.level().getBlockState(snowPos).isAir() && snow.canSurvive(this.level(), snowPos)) { ++ if (this.level().isEmptyBlock(snowPos) && snow.canSurvive(this.level(), snowPos)) { + this.level().setBlockAndUpdate(snowPos, snow); + this.level().gameEvent(GameEvent.BLOCK_PLACE, snowPos, GameEvent.Context.of(this, snow)); } @@ -136,7 +_,7 @@ @Override - protected InteractionResult mobInteract(Player p_458095_, InteractionHand p_457948_) { - ItemStack itemstack = p_458095_.getItemInHand(p_457948_); -- if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { -+ if (false && itemstack.is(Items.SHEARS) && this.readyForShearing()) { //Forge: Moved to onSheared - if (this.level() instanceof ServerLevel serverlevel) { - this.shear(serverlevel, SoundSource.PLAYERS, itemstack); - this.gameEvent(GameEvent.SHEAR, p_458095_); -@@ -193,4 +_,17 @@ - public Vec3 getLeashOffset() { - return new Vec3(0.0, 0.75F * this.getEyeHeight(), this.getBbWidth() * 0.4F); - } -+ -+ @Override -+ public java.util.@org.jspecify.annotations.NonNull List onSheared(@Nullable Player player, @org.jspecify.annotations.NonNull ItemStack item, Level world, BlockPos pos, int fortune) { -+ world.playSound(null, this, SoundEvents.SNOW_GOLEM_SHEAR, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F); -+ this.gameEvent(GameEvent.SHEAR, player); -+ if (!world.isClientSide() && world instanceof ServerLevel server) { -+ setPumpkin(false); -+ var ret = new java.util.ArrayList(); -+ this.dropFromShearingLootTable(server, BuiltInLootTables.SHEAR_SNOW_GOLEM, item, (slevel, stack) -> ret.add(stack)); -+ return ret; -+ } -+ return java.util.Collections.emptyList(); -+ } - } + protected InteractionResult mobInteract(final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); +- if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { ++ if (itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.readyForShearing()) { + if (this.level() instanceof ServerLevel level) { + this.shear(level, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/parrot/Parrot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/parrot/Parrot.java.patch index d83d5a27f0..ae308792f5 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/parrot/Parrot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/parrot/Parrot.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/parrot/Parrot.java +++ b/net/minecraft/world/entity/animal/parrot/Parrot.java -@@ -277,7 +_,7 @@ +@@ -268,7 +_,7 @@ } if (!this.level().isClientSide()) { - if (this.random.nextInt(10) == 0) { -+ if (this.random.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_453025_)) { - this.tame(p_453025_); ++ if (this.random.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) { + this.tame(player); this.level().broadcastEntityEvent(this, (byte)7); } else { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch index e5df2dd490..53549b8944 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/animal/pig/Pig.java +++ b/net/minecraft/world/entity/animal/pig/Pig.java -@@ -172,10 +_,11 @@ +@@ -200,10 +_,11 @@ @Override - public void thunderHit(ServerLevel p_452901_, LightningBolt p_454063_) { -- if (p_452901_.getDifficulty() != Difficulty.PEACEFUL) { -+ if (p_452901_.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIFIED_PIGLIN, (timer) -> {})) { - ZombifiedPiglin zombifiedpiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), p_456410_ -> { - p_456410_.populateDefaultEquipmentSlots(this.getRandom(), p_452901_.getCurrentDifficultyAt(this.blockPosition())); - p_456410_.setPersistenceRequired(); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_456410_); + public void thunderHit(final ServerLevel level, final LightningBolt lightningBolt) { +- if (level.getDifficulty() != Difficulty.PEACEFUL) { ++ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIFIED_PIGLIN, (timer) -> {})) { + ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), zp -> { + zp.populateDefaultEquipmentSlots(this.getRandom(), level.getCurrentDifficultyAt(this.blockPosition())); + zp.setPersistenceRequired(); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zp); }); - if (zombifiedpiglin == null) { - super.thunderHit(p_452901_, p_454063_); + if (zombifiedPiglin == null) { + super.thunderHit(level, lightningBolt); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch index 4634f3740d..a855468db0 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java +++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java -@@ -555,7 +_,7 @@ +@@ -603,7 +_,7 @@ @Override public boolean canUse() { if (this.nextStartTick <= 0) { @@ -9,12 +9,12 @@ return false; } -@@ -604,7 +_,7 @@ +@@ -652,7 +_,7 @@ @Override - protected boolean isValidTarget(LevelReader p_457725_, BlockPos p_456006_) { - BlockState blockstate = p_457725_.getBlockState(p_456006_); -- if (blockstate.is(Blocks.FARMLAND) && this.wantsToRaid && !this.canRaid) { -+ if (blockstate.getBlock() instanceof net.minecraft.world.level.block.FarmBlock && this.wantsToRaid && !this.canRaid) { - blockstate = p_457725_.getBlockState(p_456006_.above()); - if (blockstate.getBlock() instanceof CarrotBlock && ((CarrotBlock)blockstate.getBlock()).isMaxAge(blockstate)) { + protected boolean isValidTarget(final LevelReader level, final BlockPos pos) { + BlockState state = level.getBlockState(pos); +- if (state.is(BlockTags.SUPPORTS_CROPS) && this.wantsToRaid && !this.canRaid) { ++ if ((state.is(BlockTags.SUPPORTS_CROPS) || state.getBlock() instanceof net.minecraft.world.level.block.FarmlandBlock) && this.wantsToRaid && !this.canRaid) { + state = level.getBlockState(pos.above()); + if (state.getBlock() instanceof CarrotBlock carrotBlock && carrotBlock.isMaxAge(state)) { this.canRaid = true; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch index 6b6472eea2..7d90cbab8d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch @@ -1,56 +1,11 @@ --- a/net/minecraft/world/entity/animal/sheep/Sheep.java +++ b/net/minecraft/world/entity/animal/sheep/Sheep.java -@@ -137,7 +_,7 @@ - @Override - public InteractionResult mobInteract(Player p_397056_, InteractionHand p_391211_) { - ItemStack itemstack = p_397056_.getItemInHand(p_391211_); -- if (itemstack.is(Items.SHEARS)) { -+ if (false && itemstack.is(Items.SHEARS)) { // Forge: Moved to onSheared - if (this.level() instanceof ServerLevel serverlevel && this.readyForShearing()) { - this.shear(serverlevel, SoundSource.PLAYERS, itemstack); - this.gameEvent(GameEvent.SHEAR, p_397056_); -@@ -153,12 +_,27 @@ - - @Override - public void shear(ServerLevel p_397708_, SoundSource p_395553_, ItemStack p_396000_) { -+ dropItems(p_397708_, shearInternal(p_397708_, p_395553_, p_396000_)); -+ } -+ -+ private java.util.List shearInternal(ServerLevel p_397708_, SoundSource p_395553_, ItemStack p_396000_) { -+ var ret = new java.util.ArrayList(); - p_397708_.playSound(null, this, SoundEvents.SHEEP_SHEAR, p_395553_, 1.0F, 1.0F); - this.dropFromShearingLootTable( - p_397708_, - BuiltInLootTables.SHEAR_SHEEP, - p_396000_, - (p_397779_, p_393350_) -> { -+ ret.add(p_393350_); -+ } -+ ); -+ this.setSheared(true); -+ return ret; -+ } -+ -+ private void dropItems(ServerLevel p_397779_, java.util.Collection items) { -+ // double indented to make the patch look nicer -+ for (var p_393350_ : items) { - for (int i = 0; i < p_393350_.getCount(); i++) { - ItemEntity itementity = this.spawnAtLocation(p_397779_, p_393350_.copyWithCount(1), 1.0F); - if (itementity != null) { -@@ -173,8 +_,14 @@ - } - } - } -- ); -- this.setSheared(true); -+ } -+ -+ @Override -+ public java.util.List onSheared(@Nullable Player player, ItemStack item, Level level, BlockPos pos, int fortune) { -+ if (level instanceof ServerLevel server) { -+ return shearInternal(server, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, item); -+ } -+ return java.util.Collections.emptyList(); - } - +@@ -145,7 +_,7 @@ @Override + public InteractionResult mobInteract(final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); +- if (itemStack.is(Items.SHEARS)) { ++ if (itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { + if (this.level() instanceof ServerLevel level && this.readyForShearing()) { + this.shear(level, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch index b67df9220e..588a18f224 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -297,7 +_,7 @@ - +@@ -308,7 +_,7 @@ if (this.tickCount % 10 == 0) { this.level() -- .playLocalSound(this.getX(), this.getY(), this.getZ(), blockstate.getSoundType().getHitSound(), this.getSoundSource(), 0.5F, 0.5F, false); -+ .playLocalSound(this.getX(), this.getY(), this.getZ(), blockstate.getSoundType(level(), blockpos.below(), this).getHitSound(), this.getSoundSource(), 0.5F, 0.5F, false); + .playLocalSound( +- this.getX(), this.getY(), this.getZ(), stateBelow.getSoundType().getHitSound(), this.getSoundSource(), 0.5F, 0.5F, false ++ this.getX(), this.getY(), this.getZ(), stateBelow.getSoundType(level(), head.below(), this).getHitSound(), this.getSoundSource(), 0.5F, 0.5F, false + ); } } - } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch index 1551ac29e7..735cb4dd6e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/wolf/Wolf.java +++ b/net/minecraft/world/entity/animal/wolf/Wolf.java -@@ -502,7 +_,7 @@ +@@ -506,7 +_,7 @@ } - private void tryToTame(Player p_397321_) { + private void tryToTame(final Player player) { - if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_397321_)) { - this.tame(p_397321_); ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) { + this.tame(player); this.navigation.stop(); this.setTarget(null); 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 2af7337ff7..3d2e4e1e57 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,23 +1,7 @@ --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -102,6 +_,15 @@ - this.setHealth(this.getMaxHealth()); - this.noPhysics = true; - this.phaseManager = new EnderDragonPhaseManager(this); -+ this.setId(ENTITY_COUNTER.getAndAdd(this.subEntities.length + 1) + 1); // Forge: Fix MC-158205: Make sure part ids are successors of parent mob id -+ } -+ -+ @Override -+ public void setId(int p_20235_) { -+ super.setId(p_20235_); -+ for (int i = 0; i < this.subEntities.length; i++) { // Forge: Fix MC-158205: Set part ids to successors of parent mob id -+ this.subEntities[i].setId(p_20235_ + i + 1); -+ } - } - - public void setDragonFight(EndDragonFight p_287736_) { @@ -150,8 +_,26 @@ - p_330342_.define(DATA_PHASE, EnderDragonPhase.HOVERING.getId()); + entityData.define(DATA_PHASE, EnderDragonPhase.HOVERING.getId()); } + private net.minecraft.world.entity.@Nullable EntityReference unlimitedLastHurtByPlayer = null; @@ -43,46 +27,38 @@ this.processFlappingMovement(); if (this.level().isClientSide()) { this.setHealth(this.getHealth()); -@@ -438,7 +_,7 @@ - BlockPos blockpos = new BlockPos(k1, l1, i2); - BlockState blockstate = p_363273_.getBlockState(blockpos); - if (!blockstate.isAir() && !blockstate.is(BlockTags.DRAGON_TRANSPARENT)) { -- if (p_363273_.getGameRules().get(GameRules.MOB_GRIEFING) && !blockstate.is(BlockTags.DRAGON_IMMUNE)) { -+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(p_363273_, blockpos, this) && !blockstate.is(BlockTags.DRAGON_IMMUNE)) { - flag1 = p_363273_.removeBlock(blockpos, false) || flag1; +@@ -436,7 +_,7 @@ + BlockPos blockPos = new BlockPos(x, y, z); + BlockState state = level.getBlockState(blockPos); + if (!state.isAir() && !state.is(BlockTags.DRAGON_TRANSPARENT)) { +- if (level.getGameRules().get(GameRules.MOB_GRIEFING) && !state.is(BlockTags.DRAGON_IMMUNE)) { ++ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(level, blockPos, this) && !state.is(BlockTags.DRAGON_IMMUNE)) { + destroyedBlock = level.removeBlock(blockPos, false) || destroyedBlock; } else { - flag = true; -@@ -532,7 +_,8 @@ + hitWall = true; +@@ -540,7 +_,8 @@ - if (this.level() instanceof ServerLevel serverlevel) { - if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && serverlevel.getGameRules().get(GameRules.MOB_DROPS)) { -- ExperienceOrb.award(serverlevel, this.position(), Mth.floor(i * 0.08F)); -+ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getUnlimitedLastHurtByPlayer(), Mth.floor((float)i * 0.08F)); -+ ExperienceOrb.award(serverlevel, this.position(), award); + if (this.level() instanceof ServerLevel level) { + if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && level.getGameRules().get(GameRules.MOB_DROPS)) { +- ExperienceOrb.award(level, this.position(), Mth.floor(xpCount * 0.08F)); ++ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getUnlimitedLastHurtByPlayer(), Mth.floor((float)xpCount * 0.08F)); ++ ExperienceOrb.award(level, this.position(), award); } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -550,7 +_,8 @@ +@@ -558,7 +_,8 @@ - if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverlevel1) { - if (serverlevel1.getGameRules().get(GameRules.MOB_DROPS)) { -- ExperienceOrb.award(serverlevel1, this.position(), Mth.floor(i * 0.2F)); -+ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getUnlimitedLastHurtByPlayer(), Mth.floor((float)i * 0.2F)); -+ ExperienceOrb.award(serverlevel1, this.position(), award); + if (this.dragonDeathTime >= 200 && this.level() instanceof ServerLevel level) { + if (level.getGameRules().get(GameRules.MOB_DROPS)) { +- ExperienceOrb.award(level, this.position(), Mth.floor(xpCount * 0.2F)); ++ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.getUnlimitedLastHurtByPlayer(), Mth.floor((float)xpCount * 0.2F)); ++ ExperienceOrb.award(level, this.position(), award); } if (this.dragonFight != null) { -@@ -856,6 +_,7 @@ +@@ -884,5 +_,15 @@ @Override - public void recreateFromPacket(ClientboundAddEntityPacket p_218825_) { - super.recreateFromPacket(p_218825_); -+ if (true) return; // Forge: Fix MC-158205: Moved into setId() - EnderDragonPart[] aenderdragonpart = this.getSubEntities(); - - for (int i = 0; i < aenderdragonpart.length; i++) { -@@ -871,5 +_,15 @@ - @Override - protected float sanitizeScale(float p_333905_) { + protected float sanitizeScale(final float scale) { return 1.0F; + } + diff --git a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragonPart.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragonPart.java.patch index 35f83b43b5..e20028217a 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragonPart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragonPart.java.patch @@ -10,9 +10,9 @@ public final String name; private final EntityDimensions size; - public EnderDragonPart(EnderDragon p_450227_, String p_453842_, float p_460816_, float p_454700_) { -- super(p_450227_.getType(), p_450227_.level()); -+ super(p_450227_); - this.size = EntityDimensions.scalable(p_460816_, p_454700_); + public EnderDragonPart(final EnderDragon parentMob, final String name, final float w, final float h) { +- super(parentMob.getType(), parentMob.level()); ++ super(parentMob); + this.size = EntityDimensions.scalable(w, h); this.refreshDimensions(); - this.parentMob = p_450227_; + this.parentMob = parentMob; 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 334415faa9..e4c3d2af8c 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 @@ -1,24 +1,24 @@ --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -316,7 +_,7 @@ +@@ -319,7 +_,7 @@ if (this.destroyBlocksTick > 0) { this.destroyBlocksTick--; -- if (this.destroyBlocksTick == 0 && p_363567_.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (this.destroyBlocksTick == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_363567_, this)) { - boolean flag = false; - int l = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); - int i1 = Mth.floor(this.getBbHeight()); -@@ -325,7 +_,7 @@ - this.getBlockX() - l, this.getBlockY(), this.getBlockZ() - l, this.getBlockX() + l, this.getBlockY() + i1, this.getBlockZ() + l +- if (this.destroyBlocksTick == 0 && level.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (this.destroyBlocksTick == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, this)) { + boolean destroyed = false; + int width = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); + int height = Mth.floor(this.getBbHeight()); +@@ -333,7 +_,7 @@ + this.getBlockZ() + width )) { - BlockState blockstate = p_363567_.getBlockState(blockpos); -- if (canDestroy(blockstate)) { -+ if (blockstate.canEntityDestroy(p_363567_, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = p_363567_.destroyBlock(blockpos, true, this) || flag; + BlockState state = level.getBlockState(blockPos); +- if (canDestroy(state)) { ++ if (state.canEntityDestroy(level, blockPos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockPos, state)) { + destroyed = level.destroyBlock(blockPos, true, this) || destroyed; } } -@@ -344,6 +_,10 @@ +@@ -352,6 +_,10 @@ } } @@ -26,6 +26,6 @@ + * @deprecated Forge: Use {@link BlockState#canEntityDestroy(net.minecraft.world.level.BlockGetter, BlockPos, Entity)} instead. + */ + @Deprecated - public static boolean canDestroy(BlockState p_31492_) { - return !p_31492_.isAir() && !p_31492_.is(BlockTags.WITHER_IMMUNE); + public static boolean canDestroy(final BlockState state) { + return !state.isAir() && !state.is(BlockTags.WITHER_IMMUNE); } 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 b5044da5c6..50e6838a1e 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -85,6 +_,8 @@ - } else { - boolean flag = BlockPos.betweenClosedStream(this.calculateSupportBox()).allMatch(p_449679_ -> { - BlockState blockstate = this.level().getBlockState(p_449679_); -+ if (net.minecraft.world.level.block.Block.canSupportCenter(this.level(), p_449679_, this.getDirection())) -+ return true; - return blockstate.isSolid() || DiodeBlock.isDiode(blockstate); - }); - return flag && this.canCoexist(false); +@@ -86,6 +_,8 @@ + + boolean isSupported = BlockPos.betweenClosedStream(this.calculateSupportBox()).allMatch(pos -> { + BlockState state = this.level().getBlockState(pos); ++ if (net.minecraft.world.level.block.Block.canSupportCenter(this.level(), pos, this.getDirection())) ++ return true; + return state.isSolid() || DiodeBlock.isDiode(state); + }); + return isSupported && this.canCoexist(false); diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch index ecf675540e..1a5d3a15d5 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -@@ -72,7 +_,7 @@ - if (this.level().isClientSide()) { +@@ -77,7 +_,7 @@ return InteractionResult.SUCCESS; - } else { -- if (p_31842_.getItemInHand(p_31843_).is(Items.SHEARS)) { -+ if (p_31842_.getItemInHand(p_31843_).canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { - InteractionResult interactionresult = super.interact(p_31842_, p_31843_); - if (interactionresult instanceof InteractionResult.Success interactionresult$success && interactionresult$success.wasItemInteraction()) { - return interactionresult; + } + +- if (player.getItemInHand(hand).is(Items.SHEARS)) { ++ if (player.getItemInHand(hand).canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { + InteractionResult result = super.interact(player, hand, location); + if (result instanceof InteractionResult.Success success && success.wasItemInteraction()) { + return result; 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 e44ece6bb3..9db3602906 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -158,7 +_,7 @@ - if (this.level() instanceof ServerLevel serverlevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { - BlockPos blockpos = this.blockPosition(); - boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; -- boolean flag1 = flag && this.level().getFluidState(blockpos).is(FluidTags.WATER); -+ boolean flag1 = flag && this.blockState.canBeHydrated(this.level(), blockpos, this.level().getFluidState(blockpos), blockpos); - double d0 = this.getDeltaMovement().lengthSqr(); - if (flag && d0 > 1.0) { - BlockHitResult blockhitresult = this.level() -@@ -171,7 +_,7 @@ - this + if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { + BlockPos pos = this.blockPosition(); + boolean isConcrete = this.blockState.getBlock() instanceof ConcretePowderBlock; +- boolean isStuckInWater = isConcrete && this.level().getFluidState(pos).is(FluidTags.WATER); ++ boolean isStuckInWater = isConcrete && this.blockState.canBeHydrated(this.level(), pos, this.level().getFluidState(pos), pos); + double moveVec = this.getDeltaMovement().lengthSqr(); + if (isConcrete && moveVec > 1.0) { + BlockHitResult clip = this.level() +@@ -167,7 +_,7 @@ + new Vec3(this.xo, this.yo, this.zo), this.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this ) ); -- if (blockhitresult.getType() != HitResult.Type.MISS && this.level().getFluidState(blockhitresult.getBlockPos()).is(FluidTags.WATER)) { -+ if (blockhitresult.getType() != HitResult.Type.MISS && this.blockState.canBeHydrated(this.level(), blockpos, this.level().getFluidState(blockhitresult.getBlockPos()), blockhitresult.getBlockPos())) { - blockpos = blockhitresult.getBlockPos(); - flag1 = true; +- if (clip.getType() != HitResult.Type.MISS && this.level().getFluidState(clip.getBlockPos()).is(FluidTags.WATER)) { ++ if (clip.getType() != HitResult.Type.MISS && this.blockState.canBeHydrated(this.level(), pos, this.level().getFluidState(clip.getBlockPos()), clip.getBlockPos())) { + pos = clip.getBlockPos(); + isStuckInWater = 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 1013d2a63e..8098c345f0 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -51,6 +_,10 @@ +@@ -52,6 +_,10 @@ private @Nullable EntityReference thrower; private @Nullable UUID target; public final float bobOffs = this.random.nextFloat() * (float) Math.PI * 2.0F; @@ -9,17 +9,17 @@ + */ + public int lifespan = ItemEntity.LIFETIME; - public ItemEntity(EntityType p_31991_, Level p_31992_) { - super(p_31991_, p_31992_); -@@ -68,6 +_,7 @@ - this.setPos(p_149664_, p_149665_, p_149666_); - this.setDeltaMovement(p_149668_, p_149669_, p_149670_); - this.setItem(p_149667_); -+ this.lifespan = (p_149667_.getItem() == null ? ItemEntity.LIFETIME : p_149667_.getEntityLifespan(p_149663_)); + public ItemEntity(final EntityType type, final Level level) { + super(type, level); +@@ -79,6 +_,7 @@ + this.setPos(x, y, z); + this.setItem(itemStack); + this.setDeltaMovement(deltaX, deltaY, deltaZ); ++ this.lifespan = (itemStack.getItem() == null ? ItemEntity.LIFETIME : itemStack.getEntityLifespan(level)); } @Override -@@ -105,6 +_,7 @@ +@@ -116,6 +_,7 @@ @Override public void tick() { @@ -27,10 +27,10 @@ if (this.getItem().isEmpty()) { this.discard(); } else { -@@ -117,6 +_,10 @@ +@@ -128,6 +_,10 @@ this.yo = this.getY(); this.zo = this.getZ(); - Vec3 vec3 = this.getDeltaMovement(); + Vec3 oldMovement = this.getDeltaMovement(); + var fluidType = this.getMaxHeightFluidType(); + if (!fluidType.isAir() && !fluidType.isVanilla() && this.getFluidTypeHeight(fluidType) > 0.1F) { + fluidType.setItemMovement(this); @@ -38,17 +38,17 @@ if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > 0.1F) { this.setUnderwaterMovement(); } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > 0.1F) { -@@ -139,7 +_,8 @@ - this.applyEffectsFromBlocks(); - float f = 0.98F; +@@ -153,7 +_,8 @@ + float airDrag = this.getAirDrag(); + float groundFriction = airDrag; if (this.onGround()) { -- f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- groundFriction *= this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction(); + BlockPos groundPos = getBlockPosBelowThatAffectsMyMovement(); -+ f = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; ++ groundFriction *= this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; } - this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.98, f)); -@@ -171,7 +_,16 @@ + this.setDeltaMovement(this.getDeltaMovement().multiply(groundFriction, airDrag, groundFriction)); +@@ -185,7 +_,16 @@ } } @@ -66,51 +66,51 @@ this.discard(); } } -@@ -279,7 +_,7 @@ - this.health = (int)(this.health - p_362683_); - this.gameEvent(GameEvent.ENTITY_DAMAGE, p_364841_.getEntity()); - if (this.health <= 0) { -- this.getItem().onDestroyed(this); -+ this.getItem().onDestroyed(this, p_364841_); - this.discard(); - } +@@ -300,7 +_,7 @@ + this.health = (int)(this.health - damage); + this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + if (this.health <= 0) { +- this.getItem().onDestroyed(this); ++ this.getItem().onDestroyed(this, source); + this.discard(); + } -@@ -297,6 +_,7 @@ - p_408006_.putShort("Health", (short)this.health); - p_408006_.putShort("Age", (short)this.age); - p_408006_.putShort("PickupDelay", (short)this.pickupDelay); -+ p_408006_.putInt("Lifespan", this.lifespan); - EntityReference.store(this.thrower, p_408006_, "Thrower"); - p_408006_.storeNullable("Owner", UUIDUtil.CODEC, this.target); +@@ -317,6 +_,7 @@ + output.putShort("Health", (short)this.health); + output.putShort("Age", (short)this.age); + output.putShort("PickupDelay", (short)this.pickupDelay); ++ output.putInt("Lifespan", this.lifespan); + EntityReference.store(this.thrower, output, "Thrower"); + output.storeNullable("Owner", UUIDUtil.CODEC, this.target); if (!this.getItem().isEmpty()) { -@@ -309,6 +_,7 @@ - this.health = p_408031_.getShortOr("Health", (short)5); - this.age = p_408031_.getShortOr("Age", (short)0); - this.pickupDelay = p_408031_.getShortOr("PickupDelay", (short)0); -+ this.lifespan = p_408031_.getIntOr("Lifespan", this.lifespan); - this.target = p_408031_.read("Owner", UUIDUtil.CODEC).orElse(null); - this.thrower = EntityReference.read(p_408031_, "Thrower"); - this.setItem(p_408031_.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY)); -@@ -320,10 +_,17 @@ +@@ -329,6 +_,7 @@ + this.health = input.getShortOr("Health", (short)5); + this.age = input.getShortOr("Age", (short)0); + this.pickupDelay = input.getShortOr("PickupDelay", (short)0); ++ this.lifespan = input.getIntOr("Lifespan", this.lifespan); + this.target = input.read("Owner", UUIDUtil.CODEC).orElse(null); + this.thrower = EntityReference.read(input, "Thrower"); + this.setItem(input.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY)); +@@ -340,10 +_,17 @@ @Override - public void playerTouch(Player p_32040_) { + public void playerTouch(final Player player) { if (!this.level().isClientSide()) { + if (this.pickupDelay > 0) return; - ItemStack itemstack = this.getItem(); - Item item = itemstack.getItem(); - int i = itemstack.getCount(); -- if (this.pickupDelay == 0 && (this.target == null || this.target.equals(p_32040_.getUUID())) && p_32040_.getInventory().add(itemstack)) { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_32040_); + ItemStack itemStack = this.getItem(); + Item item = itemStack.getItem(); + int orgCount = itemStack.getCount(); +- if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemStack)) { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, player); + if (hook < 0) return; -+ ItemStack copy = itemstack.copy(); -+ if (this.pickupDelay == 0 && (this.target == null || this.target.equals(p_32040_.getUUID())) && (hook == 1 || i <= 0 || p_32040_.getInventory().add(itemstack))) { -+ i = copy.getCount() - itemstack.getCount(); -+ copy.setCount(i); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerItemPickupEvent(p_32040_, this, copy); - p_32040_.take(this, i); - if (itemstack.isEmpty()) { ++ ItemStack copy = itemStack.copy(); ++ if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && (hook == 1 || orgCount <= 0 || player.getInventory().add(itemStack))) { ++ orgCount = copy.getCount() - itemStack.getCount(); ++ copy.setCount(orgCount); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerItemPickupEvent(player, this, copy); + player.take(this, orgCount); + if (itemStack.isEmpty()) { this.discard(); -@@ -415,7 +_,7 @@ +@@ -427,7 +_,7 @@ public void makeFakeItem() { this.setNeverPickUp(); @@ -118,4 +118,4 @@ + this.age = getItem().getEntityLifespan(this.level()) - 1; } - public static float getSpin(float p_32009_, float p_369793_) { + public static float getSpin(final float ageInTicks, final float bobOffset) { 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 51619b7261..dd11a4d067 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch @@ -3,13 +3,13 @@ @@ -16,9 +_,10 @@ void onCrossbowAttackPerformed(); - default void performCrossbowAttack(LivingEntity p_32337_, float p_32338_) { -- InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, Items.CROSSBOW); -+ InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, item -> item instanceof CrossbowItem); - ItemStack itemstack = p_32337_.getItemInHand(interactionhand); -- if (itemstack.getItem() instanceof CrossbowItem crossbowitem) { -+ if (p_32337_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { -+ var crossbowitem = (CrossbowItem) itemstack.getItem(); - crossbowitem.performShooting( - p_32337_.level(), p_32337_, interactionhand, itemstack, p_32338_, 14 - p_32337_.level().getDifficulty().getId() * 4, this.getTarget() - ); + default void performCrossbowAttack(final LivingEntity body, final float crossbowPower) { +- InteractionHand hand = ProjectileUtil.getWeaponHoldingHand(body, Items.CROSSBOW); ++ InteractionHand hand = ProjectileUtil.getWeaponHoldingHand(body, item -> item instanceof CrossbowItem); + ItemStack usedItem = body.getItemInHand(hand); +- if (usedItem.getItem() instanceof CrossbowItem crossbow) { ++ if (body.isHolding(is -> is.getItem() instanceof CrossbowItem)) { ++ var crossbow = (CrossbowItem) usedItem.getItem(); + crossbow.performShooting(body.level(), body, hand, usedItem, crossbowPower, 14 - body.level().getDifficulty().getId() * 4, this.getTarget()); + } + 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 673cfc7942..f905ee625d 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -1,74 +1,74 @@ --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java -@@ -117,7 +_,6 @@ +@@ -121,7 +_,6 @@ @Override - public void setTarget(@Nullable LivingEntity p_32537_) { -- super.setTarget(p_32537_); - AttributeInstance attributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); - if (p_32537_ == null) { + public void setTarget(final @Nullable LivingEntity target) { +- super.setTarget(target); + AttributeInstance movementSpeed = this.getAttribute(Attributes.MOVEMENT_SPEED); + if (target == null) { this.targetChangeTime = 0; -@@ -131,6 +_,7 @@ - attributeinstance.addTransientModifier(SPEED_MODIFIER_ATTACKING); +@@ -135,6 +_,7 @@ + movementSpeed.addTransientModifier(SPEED_MODIFIER_ATTACKING); } } -+ super.setTarget(p_32537_); //Forge: Moved down to allow event handlers to write data manager values. ++ super.setTarget(target); //Forge: Moved down to allow event handlers to write data manager values. } @Override -@@ -203,7 +_,7 @@ +@@ -207,7 +_,7 @@ } - boolean isBeingStaredBy(Player p_368759_) { -- return !LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(p_368759_) ? false : this.isLookingAtMe(p_368759_, 0.025, true, false, this.getEyeY()); -+ return !net.minecraftforge.common.ForgeHooks.isNotDisguised(this).test(p_368759_) ? false : this.isLookingAtMe(p_368759_, 0.025, true, false, this.getEyeY()); + private boolean isBeingStaredBy(final Player player) { +- return !LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player) ? false : this.isLookingAtMe(player, 0.025, true, false, this.getEyeY()); ++ return !net.minecraftforge.common.ForgeHooks.isNotDisguised(this).test(player) ? false : this.isLookingAtMe(player, 0.025, true, false, this.getEyeY()); } @Override -@@ -281,8 +_,10 @@ - boolean flag = blockstate.blocksMotion(); - boolean flag1 = blockstate.getFluidState().is(FluidTags.WATER); - if (flag && !flag1) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onEnderManTeleport(this, p_32544_, p_32545_, p_32546_); +@@ -285,8 +_,10 @@ + boolean couldStandOn = blockState.blocksMotion(); + boolean isWet = blockState.getFluidState().is(FluidTags.WATER); + if (couldStandOn && !isWet) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onEnderManTeleport(this, x, y, z); + if (event == null) return false; - Vec3 vec3 = this.position(); -- boolean flag2 = this.randomTeleport(p_32544_, p_32545_, p_32546_, true); -+ boolean flag2 = this.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); - if (flag2) { - this.level().gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of(this)); + Vec3 oldPos = this.position(); +- boolean result = this.randomTeleport(x, y, z, true); ++ boolean result = this.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); + if (result) { + this.level().gameEvent(GameEvent.TELEPORT, oldPos, GameEvent.Context.of(this)); if (!this.isSilent()) { -@@ -435,7 +_,7 @@ +@@ -441,7 +_,7 @@ if (this.enderman.getCarriedBlock() == null) { return false; } else { -- return !getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; -+ return !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.enderman), this.enderman) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; +- return !getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING) ++ return !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.enderman), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; } - } - -@@ -453,7 +_,7 @@ - BlockState blockstate2 = this.enderman.getCarriedBlock(); - if (blockstate2 != null) { - blockstate2 = Block.updateFromNeighbourShapes(blockstate2, this.enderman.level(), blockpos); -- if (this.canPlaceBlock(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { -+ if (this.canPlaceBlock(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(enderman, net.minecraftforge.common.util.BlockSnapshot.create(level.dimension(), level, blockpos1), net.minecraft.core.Direction.UP)) { - level.setBlock(blockpos, blockstate2, 3); - level.gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(this.enderman, blockstate2)); +@@ -461,7 +_,7 @@ + BlockState carried = this.enderman.getCarriedBlock(); + if (carried != null) { + carried = Block.updateFromNeighbourShapes(carried, this.enderman.level(), pos); +- if (this.canPlaceBlock(level, pos, carried, targetState, belowState, below)) { ++ if (this.canPlaceBlock(level, pos, carried, targetState, belowState, below) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(enderman, net.minecraftforge.common.util.BlockSnapshot.create(level.dimension(), level, below), net.minecraft.core.Direction.UP)) { + level.setBlock(pos, carried, 3); + level.gameEvent(GameEvent.BLOCK_PLACE, pos, GameEvent.Context.of(this.enderman, carried)); this.enderman.setCarriedBlock(null); -@@ -465,6 +_,7 @@ - return p_32562_.isAir() - && !p_32563_.isAir() - && !p_32563_.is(Blocks.BEDROCK) -+ && !p_32563_.is(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) - && p_32563_.isCollisionShapeFullBlock(p_32559_, p_32564_) - && p_32561_.canSurvive(p_32559_, p_32560_) - && p_32559_.getEntities(this.enderman, AABB.unitCubeFromLowerCorner(Vec3.atLowerCornerOf(p_32560_))).isEmpty(); -@@ -573,7 +_,7 @@ +@@ -475,6 +_,7 @@ + return targetState.isAir() + && !belowState.isAir() + && !belowState.is(Blocks.BEDROCK) ++ && !belowState.is(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) + && belowState.isCollisionShapeFullBlock(level, below) + && carried.canSurvive(level, pos) + && level.getEntities(this.enderman, AABB.unitCubeFromLowerCorner(Vec3.atLowerCornerOf(pos))).isEmpty(); +@@ -585,7 +_,7 @@ if (this.enderman.getCarriedBlock() != null) { return false; } else { -- return !getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; -+ return !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.enderman), this.enderman) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; +- return !getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING) ++ return !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.enderman), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; } - } - diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch index 00e83fbd78..80686f0291 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/monster/Monster.java +++ b/net/minecraft/world/entity/monster/Monster.java -@@ -141,9 +_,9 @@ - if (p_33038_.getItem() instanceof ProjectileWeaponItem) { - Predicate predicate = ((ProjectileWeaponItem)p_33038_.getItem()).getSupportedHeldProjectiles(); - ItemStack itemstack = ProjectileWeaponItem.getHeldProjectile(this, predicate); -- return itemstack.isEmpty() ? new ItemStack(Items.ARROW) : itemstack; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_33038_, itemstack.isEmpty() ? new ItemStack(Items.ARROW) : itemstack); +@@ -147,9 +_,9 @@ + if (heldWeapon.getItem() instanceof ProjectileWeaponItem) { + Predicate supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getSupportedHeldProjectiles(); + ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedProjectiles); +- return heldProjectile.isEmpty() ? new ItemStack(Items.ARROW) : heldProjectile; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, heldProjectile.isEmpty() ? new ItemStack(Items.ARROW) : heldProjectile); } else { - return ItemStack.EMPTY; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_33038_, ItemStack.EMPTY); ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, ItemStack.EMPTY); } } } 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 782b6329a8..1e737394b4 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java -@@ -141,7 +_,7 @@ - this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, d1, d0)); +@@ -143,7 +_,7 @@ + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, baseValue, maxSpeed)); } -- if (this.level() instanceof ServerLevel serverlevel && this.horizontalCollision && serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (this.level() instanceof ServerLevel serverlevel && this.horizontalCollision && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, this)) { - boolean flag = false; - AABB aabb = this.getBoundingBox().inflate(0.2); +- if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, this)) { + boolean destroyedBlock = false; + AABB bb = this.getBoundingBox().inflate(0.2); 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 e3bb41e013..512ab3dd79 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java -@@ -381,6 +_,12 @@ - && this.level().noCollision(this, new AABB(blockpos1).deflate(1.0E-6))) { - Direction direction = this.findAttachableSurface(blockpos1); - if (direction != null) { -+ var event = new net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity(this, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()); -+ if (net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity.BUS.post(event)) direction = null; -+ blockpos1 = BlockPos.containing(event.getTargetX(), event.getTargetY(), event.getTargetZ()); +@@ -401,6 +_,12 @@ + && this.level().noCollision(this, new AABB(target).deflate(1.0E-6))) { + Direction attachmentDirection = this.findAttachableSurface(target); + if (attachmentDirection != null) { ++ var event = new net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity(this, target.getX(), target.getY(), target.getZ()); ++ if (net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity.BUS.post(event)) attachmentDirection = null; ++ target = BlockPos.containing(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + } + -+ if (direction != null) { ++ if (attachmentDirection != null) { this.unRide(); - this.setAttachFace(direction); + this.setAttachFace(attachmentDirection); this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F); 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 a0e2a28d16..589b3c0372 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/entity/monster/Silverfish.java +++ b/net/minecraft/world/entity/monster/Silverfish.java -@@ -139,7 +_,7 @@ - return false; - } else { - RandomSource randomsource = this.mob.getRandom(); -- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && randomsource.nextInt(reducedTickDelay(10)) == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.mob.level()), this.mob) && randomsource.nextInt(reducedTickDelay(10)) == 0) { - this.selectedDirection = Direction.getRandom(randomsource); - BlockPos blockpos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()) - .relative(this.selectedDirection); +@@ -143,7 +_,7 @@ + } + + RandomSource random = this.mob.getRandom(); +- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.mob.level()), this.mob) && random.nextInt(reducedTickDelay(10)) == 0) { + this.selectedDirection = Direction.getRandom(random); + BlockPos pos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); + BlockState blockState = this.mob.level().getBlockState(pos); @@ -212,7 +_,7 @@ - BlockState blockstate = level.getBlockState(blockpos1); - Block block = blockstate.getBlock(); - if (block instanceof InfestedBlock) { + BlockPos testPos = basePos.offset(xOff, yOff, zOff); + BlockState blockState = level.getBlockState(testPos); + if (blockState.getBlock() instanceof InfestedBlock infestedBlock) { - if (getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(level), this.silverfish)) { - level.destroyBlock(blockpos1, true, this.silverfish); + level.destroyBlock(testPos, true, this.silverfish); } else { - level.setBlock(blockpos1, ((InfestedBlock)block).hostStateByInfested(level.getBlockState(blockpos1)), 3); + level.setBlock(testPos, infestedBlock.hostStateByInfested(level.getBlockState(testPos)), 3); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch deleted file mode 100644 index 52b737e116..0000000000 --- a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/world/entity/monster/Slime.java -+++ b/net/minecraft/world/entity/monster/Slime.java -@@ -144,13 +_,15 @@ - float f = this.getDimensions(this.getPose()).width() * 2.0F; - float f1 = f / 2.0F; - -- for (int i = 0; i < f * 16.0F; i++) { -- float f2 = this.random.nextFloat() * (float) (Math.PI * 2); -- float f3 = this.random.nextFloat() * 0.5F + 0.5F; -- float f4 = Mth.sin(f2) * f1 * f3; -- float f5 = Mth.cos(f2) * f1 * f3; -- this.level().addParticle(this.getParticleType(), this.getX() + f4, this.getY(), this.getZ() + f5, 0.0, 0.0, 0.0); -- } -+ // Forge: Don't spawn particles if it's handled by the implementation itself -+ if (!spawnCustomParticles()) -+ for (int i = 0; (float)i < f * 16.0F; i++) { -+ float f2 = this.random.nextFloat() * (float) (Math.PI * 2); -+ float f3 = this.random.nextFloat() * 0.5F + 0.5F; -+ float f4 = Mth.sin(f2) * f1 * f3; -+ float f5 = Mth.cos(f2) * f1 * f3; -+ this.level().addParticle(this.getParticleType(), this.getX() + (double)f4, this.getY(), this.getZ() + (double)f5, 0.0, 0.0, 0.0); -+ } - - this.playSound(this.getSquishSound(), this.getSoundVolume(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); - this.targetSquish = -0.5F; -@@ -161,6 +_,12 @@ - this.wasOnGround = this.onGround(); - this.decreaseSquish(); - } -+ -+ /** -+ * Called when the slime spawns particles on landing, see onUpdate. -+ * Return true to prevent the spawning of the default particles. -+ */ -+ protected boolean spawnCustomParticles() { return false; } - - protected void decreaseSquish() { - this.targetSquish *= 0.6F; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch index 2e11deed21..8568a1f469 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -463,7 +_,7 @@ - for (Player player : list) { +@@ -468,7 +_,7 @@ + for (Player player : players) { if (this.canAttack(player) && !this.isAlliedTo(player)) { - flag1 = true; -- if ((!flag || LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player)) -+ if ((!flag || net.minecraftforge.common.ForgeHooks.isNotDisguised(this).test(player)) + hasPotentialTarget = true; +- if ((!active || LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player)) ++ if ((!active || net.minecraftforge.common.ForgeHooks.isNotDisguised(this).test(player)) && this.isLookingAtMe( player, 0.5, false, true, this.getEyeY(), this.getY() + 0.5 * this.getScale(), (this.getEyeY() + this.getY()) / 2.0 )) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch new file mode 100644 index 0000000000..f2922c2523 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java ++++ b/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java +@@ -125,6 +_,8 @@ + float size = this.getDimensions(this.getPose()).width() * 2.0F; + float radius = size / 2.0F; + ++ // Forge: Don't spawn particles if it's handled by the implementation itself ++ if (!spawnCustomParticles()) + for (int i = 0; i < size * 16.0F; i++) { + float dir = this.random.nextFloat() * (float) (Math.PI * 2); + float d = this.random.nextFloat() * 0.5F + 0.5F; +@@ -145,6 +_,12 @@ + this.wasOnGround = this.onGround(); + this.decreaseSquish(); + } ++ ++ /** ++ * Called when the slime spawns particles on landing, see onUpdate. ++ * Return true to prevent the spawning of the default particles. ++ */ ++ protected boolean spawnCustomParticles() { return false; } + + protected void decreaseSquish() { + this.targetSquish *= 0.6F; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch rename to patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch index ed552dbb7d..17ca813544 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch @@ -1,26 +1,26 @@ ---- a/net/minecraft/world/entity/monster/MagmaCube.java -+++ b/net/minecraft/world/entity/monster/MagmaCube.java -@@ -71,17 +_,28 @@ - float f = this.getSize() * 0.1F; - this.setDeltaMovement(vec3.x, this.getJumpPower() + f, vec3.z); +--- a/net/minecraft/world/entity/monster/cubemob/MagmaCube.java ++++ b/net/minecraft/world/entity/monster/cubemob/MagmaCube.java +@@ -96,17 +_,28 @@ + float sizeJumpBoostPower = this.getSize() * 0.1F; + this.setDeltaMovement(movement.x, this.getJumpPower() + sizeJumpBoostPower, movement.z); this.needsSync = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } + /** @deprecated Forge - Use {@link #jumpInFluid(net.minecraftforge.fluids.FluidType)} */ @Override - protected void jumpInLiquid(TagKey p_204065_) { -- if (p_204065_ == FluidTags.LAVA) { -+ this.jumpInLiquidInternal(() -> p_204065_ == FluidTags.LAVA, () -> super.jumpInLiquid(p_204065_)); + protected void jumpInLiquid(final TagKey type) { +- if (type == FluidTags.LAVA) { ++ this.jumpInLiquidInternal(() -> type == FluidTags.LAVA, () -> super.jumpInLiquid(type)); + } + + private void jumpInLiquidInternal(java.util.function.BooleanSupplier isLava, Runnable onSuper) { + if (isLava.getAsBoolean()) { - Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(vec3.x, 0.22F + this.getSize() * 0.05F, vec3.z); + Vec3 movement = this.getDeltaMovement(); + this.setDeltaMovement(movement.x, 0.22F + this.getSize() * 0.05F, movement.z); this.needsSync = true; } else { -- super.jumpInLiquid(p_204065_); +- super.jumpInLiquid(type); + onSuper.run(); } + } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch new file mode 100644 index 0000000000..53a3f70a64 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/world/entity/monster/cubemob/SulfurCube.java ++++ b/net/minecraft/world/entity/monster/cubemob/SulfurCube.java +@@ -181,8 +_,8 @@ + } + + @Override +- protected void travelInFluid(final Vec3 input) { +- super.travelInFluid(input); ++ protected void travelInFluid(final Vec3 input, final net.minecraft.world.level.material.FluidState fluid) { ++ super.travelInFluid(input, fluid); + if (this.hasBodyItem() && this.floatsInLiquids) { + float vibeAmount = 0.2F * Mth.sin(this.tickCount * 0.4F); + double immersion = this.getFluidHeight(this.isInWater() ? FluidTags.WATER : FluidTags.LAVA) - this.getFluidJumpThreshold() + vibeAmount; +@@ -452,7 +_,7 @@ + } + + if (!this.canExplode() || !heldItem.is(Items.FLINT_AND_STEEL) && !heldItem.is(Items.FIRE_CHARGE)) { +- if (heldItem.is(Items.SHEARS) && this.readyForShearing()) { ++ if (heldItem.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.readyForShearing()) { + if (this.level() instanceof ServerLevel level) { + ItemStack itemStackToShear = this.getItemBySlot(EquipmentSlot.BODY); + this.shear(level, SoundSource.PLAYERS, heldItem); 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 13743c5da7..a2444bba97 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 @@ -1,23 +1,22 @@ --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -170,7 +_,7 @@ +@@ -148,7 +_,7 @@ HoglinAi.updateActivity(this); if (this.isConverting()) { this.timeInOverworld++; - if (this.timeInOverworld > 300) { -+ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { ++ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); this.finishConversion(); } -@@ -269,7 +_,10 @@ - this.convertTo( - EntityType.ZOGLIN, - ConversionParams.single(this, true, false), -- p_390697_ -> p_390697_.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) -+ p_390697_ -> { -+ p_390697_.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_390697_); -+ } - ); +@@ -249,9 +_,7 @@ } + private void finishConversion() { +- this.convertTo( +- EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) +- ); ++ this.convertTo(EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> { zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zoglin); }); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch index 1cda40db41..7fec99db3b 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/illager/Evoker.java +++ b/net/minecraft/world/entity/monster/illager/Evoker.java -@@ -283,7 +_,7 @@ +@@ -305,7 +_,7 @@ + } + + ServerLevel level = getServerLevel(Evoker.this.level()); +- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, Evoker.this)) { return false; - } else { - ServerLevel serverlevel = getServerLevel(Evoker.this.level()); -- if (!serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, Evoker.this)) { - return false; - } else { - List list = serverlevel.getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0, 4.0, 16.0)); + } + diff --git a/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch index abcaebf7bf..b2d3cc289a 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/monster/illager/Illusioner.java +++ b/net/minecraft/world/entity/monster/illager/Illusioner.java -@@ -171,9 +_,12 @@ +@@ -174,9 +_,12 @@ @Override - public void performRangedAttack(LivingEntity p_454025_, float p_457552_) { -- ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); -+ ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); - ItemStack itemstack1 = this.getProjectile(itemstack); - AbstractArrow abstractarrow = ProjectileUtil.getMobArrow(this, itemstack1, p_457552_, itemstack); + public void performRangedAttack(final LivingEntity target, final float power) { +- ItemStack bowItem = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); ++ ItemStack bowItem = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); + ItemStack projectile = this.getProjectile(bowItem); + AbstractArrow arrow = ProjectileUtil.getMobArrow(this, projectile, power, bowItem); + if (this.getMainHandItem().getItem() instanceof net.minecraft.world.item.BowItem bow) { -+ abstractarrow = bow.customArrow(abstractarrow); ++ arrow = bow.customArrow(arrow); + } - double d0 = p_454025_.getX() - this.getX(); - double d1 = p_454025_.getY(0.3333333333333333) - abstractarrow.getY(); - double d2 = p_454025_.getZ() - this.getZ(); + double xd = target.getX() - this.getX(); + double yd = target.getY(0.3333333333333333) - arrow.getY(); + double zd = target.getZ() - this.getZ(); 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 0477ac0a59..7cf9d86c38 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 @@ -1,22 +1,22 @@ --- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java -@@ -83,7 +_,7 @@ +@@ -86,7 +_,7 @@ this.timeInOverworld = 0; } - if (this.timeInOverworld > 300) { -+ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIFIED_PIGLIN, (timer) -> this.timeInOverworld = timer)) { - this.playConvertedSound(); - this.finishConversion(p_360786_); - } -@@ -102,7 +_,10 @@ ++ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIFIED_PIGLIN, (timer) -> this.timeInOverworld = timer)) { + if (level.getDifficulty() != Difficulty.PEACEFUL) { + this.playConvertedSound(); + } +@@ -110,7 +_,10 @@ this.convertTo( - EntityType.ZOMBIFIED_PIGLIN, + EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), -- p_449701_ -> p_449701_.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) -+ p_449701_ -> { -+ p_449701_.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_449701_); +- zombified -> zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) ++ zombified -> { ++ zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombified); + } ); } 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 7791f199c2..0b63ebe319 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 -@@ -352,7 +_,7 @@ +@@ -323,7 +_,7 @@ } else if (this.isChargingCrossbow()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { @@ -9,21 +9,20 @@ } } -@@ -389,7 +_,7 @@ - } +@@ -362,14 +_,14 @@ - protected void holdInOffHand(ItemStack p_34786_) { -- if (p_34786_.is(PiglinAi.BARTERING_ITEM)) { -+ if (p_34786_.isPiglinCurrency()) { - this.setItemSlot(EquipmentSlot.OFFHAND, p_34786_); - this.setGuaranteedDrop(EquipmentSlot.OFFHAND); - } else { -@@ -399,7 +_,7 @@ + protected void holdInOffHand(final ItemStack itemStack) { + this.setItemSlotAndDropWhenKilled(EquipmentSlot.OFFHAND, itemStack); +- if (!itemStack.is(PiglinAi.BARTERING_ITEM)) { ++ if (!itemStack.isPiglinCurrency()) { + this.setPersistenceRequired(); + } + } @Override - public boolean wantsToPickUp(ServerLevel p_369934_, ItemStack p_34777_) { -- return p_369934_.getGameRules().get(GameRules.MOB_GRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, p_34777_); -+ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_369934_, this) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, p_34777_); + public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) { +- return level.getGameRules().get(GameRules.MOB_GRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); ++ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, this) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); } - protected boolean canReplaceCurrentItem(ItemStack p_34788_) { + protected boolean canReplaceCurrentItem(final ItemStack newItemStack) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch index 48c1d69ac2..6e2e9bdc2b 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java -@@ -640,7 +_,7 @@ +@@ -647,7 +_,7 @@ - public static boolean isWearingSafeArmor(LivingEntity p_365495_) { - for (EquipmentSlot equipmentslot : EquipmentSlotGroup.ARMOR) { -- if (p_365495_.getItemBySlot(equipmentslot).is(ItemTags.PIGLIN_SAFE_ARMOR)) { -+ if (p_365495_.getItemBySlot(equipmentslot).makesPiglinsNeutral(p_365495_)) { + public static boolean isWearingSafeArmor(final LivingEntity livingEntity) { + for (EquipmentSlot slot : EquipmentSlotGroup.ARMOR) { +- if (livingEntity.getItemBySlot(slot).is(ItemTags.PIGLIN_SAFE_ARMOR)) { ++ if (livingEntity.getItemBySlot(slot).makesPiglinsNeutral(livingEntity)) { return true; } } -@@ -784,7 +_,7 @@ +@@ -799,7 +_,7 @@ } - private static boolean hasCrossbow(LivingEntity p_34919_) { -- return p_34919_.isHolding(Items.CROSSBOW); -+ return p_34919_.isHolding(is -> is.getItem() instanceof net.minecraft.world.item.CrossbowItem); + private static boolean hasCrossbow(final LivingEntity body) { +- return body.isHolding(Items.CROSSBOW); ++ return body.isHolding(is -> is.getItem() instanceof net.minecraft.world.item.CrossbowItem); } - private static void admireGoldItem(LivingEntity p_34939_) { -@@ -796,7 +_,7 @@ + private static void admireGoldItem(final LivingEntity body) { +@@ -811,7 +_,7 @@ } - private static boolean isBarterCurrency(ItemStack p_149968_) { -- return p_149968_.is(BARTERING_ITEM); -+ return p_149968_.is(BARTERING_ITEM) || p_149968_.isPiglinCurrency(); + private static boolean isBarterCurrency(final ItemStack itemStack) { +- return itemStack.is(BARTERING_ITEM); ++ return itemStack.is(BARTERING_ITEM) || itemStack.isPiglinCurrency(); } - private static boolean isFood(ItemStack p_149970_) { + private static boolean isFood(final ItemStack itemStack) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch index 29813ac679..2e86aca7c1 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch @@ -4,22 +4,22 @@ if (this.level() != null && !this.level().isClientSide()) { this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); -- ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); -+ ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); - if (itemstack.is(Items.BOW)) { - int i = this.getHardAttackInterval(); +- ItemStack usedWeapon = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); ++ ItemStack usedWeapon = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); + if (usedWeapon.is(Items.BOW)) { + int minAttackInterval = this.getHardAttackInterval(); if (this.level().getDifficulty() != Difficulty.HARD) { @@ -158,9 +_,12 @@ @Override - public void performRangedAttack(LivingEntity p_454925_, float p_452827_) { -- ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); -+ ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); - ItemStack itemstack1 = this.getProjectile(itemstack); - AbstractArrow abstractarrow = this.getArrow(itemstack1, p_452827_, itemstack); + public void performRangedAttack(final LivingEntity target, final float power) { +- ItemStack bowItem = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); ++ ItemStack bowItem = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); + ItemStack projectile = this.getProjectile(bowItem); + AbstractArrow arrow = this.getArrow(projectile, power, bowItem); + if (this.getMainHandItem().getItem() instanceof net.minecraft.world.item.BowItem bow) { -+ abstractarrow = bow.customArrow(abstractarrow); ++ arrow = bow.customArrow(arrow); + } - double d0 = p_454925_.getX() - this.getX(); - double d1 = p_454925_.getY(0.3333333333333333) - abstractarrow.getY(); - double d2 = p_454925_.getZ() - this.getZ(); + double xd = target.getX() - this.getX(); + double yd = target.getY(0.3333333333333333) - arrow.getY(); + double zd = target.getZ() - this.getZ(); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch index e89e35c83f..711d74d763 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch @@ -2,28 +2,10 @@ +++ b/net/minecraft/world/entity/monster/skeleton/Bogged.java @@ -70,7 +_,7 @@ @Override - protected InteractionResult mobInteract(Player p_453508_, InteractionHand p_459904_) { - ItemStack itemstack = p_453508_.getItemInHand(p_459904_); -- if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { -+ if (false && itemstack.is(Items.SHEARS) && this.readyForShearing()) { // Forge: move to onSheared - if (this.level() instanceof ServerLevel serverlevel) { - this.shear(serverlevel, SoundSource.PLAYERS, itemstack); - this.gameEvent(GameEvent.SHEAR, p_453508_); -@@ -137,5 +_,17 @@ - @Override - public boolean readyForShearing() { - return !this.isSheared() && this.isAlive(); -+ } -+ -+ @Override -+ public java.util.List onSheared(@org.jetbrains.annotations.Nullable Player player, @org.jetbrains.annotations.NotNull ItemStack item, Level world, net.minecraft.core.BlockPos pos, int fortune) { -+ if (world instanceof ServerLevel server) { -+ server.playSound(null, this, SoundEvents.BOGGED_SHEAR, SoundSource.PLAYERS, 1.0F, 1.0F); -+ this.setSheared(true); -+ var ret = new java.util.ArrayList(); -+ this.dropFromShearingLootTable(server, BuiltInLootTables.BOGGED_SHEAR, item, (slevel, stack) -> ret.add(stack)); -+ return ret; -+ } -+ return java.util.Collections.emptyList(); - } - } + protected InteractionResult mobInteract(final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); +- if (itemStack.is(Items.SHEARS) && this.readyForShearing()) { ++ if (itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && this.readyForShearing()) { + if (this.level() instanceof ServerLevel level) { + this.shear(level, SoundSource.PLAYERS, itemStack); + this.gameEvent(GameEvent.SHEAR, player); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch index 8dec6712af..62ab199b69 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/skeleton/Skeleton.java +++ b/net/minecraft/world/entity/monster/skeleton/Skeleton.java -@@ -92,6 +_,7 @@ +@@ -93,6 +_,7 @@ } protected void doFreezeConversion() { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.STRAY, (timer) -> this.conversionTime = timer)) return; - this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), p_451505_ -> { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.STRAY, (timer) -> this.conversionTime = timer)) return; + this.convertTo(EntityTypes.STRAY, ConversionParams.single(this, true, true), stray -> { if (!this.isSilent()) { this.level().levelEvent(null, 1048, this.blockPosition(), 0); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch index aed72331a5..885cb21e25 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/monster/spider/Spider.java +++ b/net/minecraft/world/entity/monster/spider/Spider.java -@@ -123,7 +_,10 @@ +@@ -124,7 +_,10 @@ @Override - public boolean canBeAffected(MobEffectInstance p_454269_) { -- return p_454269_.is(MobEffects.POISON) ? false : super.canBeAffected(p_454269_); -+ if (p_454269_.getEffect() == MobEffects.POISON) { -+ return net.minecraftforge.event.ForgeEventFactory.onLivingEffectCanApply(this, p_454269_).getResult().isAllowed(); + public boolean canBeAffected(final MobEffectInstance newEffect) { +- return newEffect.is(MobEffects.POISON) ? false : super.canBeAffected(newEffect); ++ if (newEffect.getEffect() == MobEffects.POISON) { ++ return net.minecraftforge.event.ForgeEventFactory.onLivingEffectCanApply(this, newEffect).getResult().isAllowed(); + } -+ return super.canBeAffected(p_454269_); ++ return super.canBeAffected(newEffect); } public boolean isClimbing() { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch index 7ac9964b75..77619ab765 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/zombie/Husk.java +++ b/net/minecraft/world/entity/monster/zombie/Husk.java -@@ -71,6 +_,7 @@ +@@ -80,6 +_,7 @@ @Override - protected void doUnderWaterConversion(ServerLevel p_454240_) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIE, (timer) -> this.conversionTime = timer)) return; - this.convertToZombieType(p_454240_, EntityType.ZOMBIE); + protected void doUnderWaterConversion(final ServerLevel level) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIE, (timer) -> this.conversionTime = timer)) return; + this.convertToZombieType(level, EntityTypes.ZOMBIE); if (!this.isSilent()) { - p_454240_.levelEvent(null, 1041, this.blockPosition(), 0); + level.levelEvent(null, 1041, this.blockPosition(), 0); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch index 0dc14522a4..d1a4f8ed66 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch @@ -1,64 +1,65 @@ --- a/net/minecraft/world/entity/monster/zombie/Zombie.java +++ b/net/minecraft/world/entity/monster/zombie/Zombie.java -@@ -237,19 +_,26 @@ +@@ -245,17 +_,21 @@ } - protected void convertToZombieType(ServerLevel p_455508_, EntityType p_460671_) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, p_460671_, timer -> this.conversionTime = timer)) return; + protected void convertToZombieType(final ServerLevel level, final EntityType zombieType) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, zombieType, timer -> this.conversionTime = timer)) return; this.convertTo( -- p_460671_, ConversionParams.single(this, true, true), p_451761_ -> p_451761_.handleAttributes(p_455508_.getCurrentDifficultyAt(p_451761_.blockPosition()).getSpecialMultiplier()) -+ p_460671_, ConversionParams.single(this, true, true), p_451761_ -> { -+ p_451761_.handleAttributes(p_455508_.getCurrentDifficultyAt(p_451761_.blockPosition()).getSpecialMultiplier()); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_451761_); + zombieType, + ConversionParams.single(this, true, true), +- newZombie -> newZombie.handleAttributes( +- level.getCurrentDifficultyAt(newZombie.blockPosition()).getSpecialMultiplier(), EntitySpawnReason.CONVERSION +- ) ++ newZombie -> { ++ newZombie.handleAttributes(level.getCurrentDifficultyAt(newZombie.blockPosition()).getSpecialMultiplier(), EntitySpawnReason.CONVERSION); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, newZombie); + } ); } @VisibleForTesting - public boolean convertVillagerToZombieVillager(ServerLevel p_454968_, Villager p_452932_) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(p_452932_, EntityType.ZOMBIE_VILLAGER, (timer) -> {})) + public boolean convertVillagerToZombieVillager(final ServerLevel level, final Villager villager) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(villager, EntityTypes.ZOMBIE_VILLAGER, (timer) -> {})) + return false; - ZombieVillager zombievillager = p_452932_.convertTo(EntityType.ZOMBIE_VILLAGER, ConversionParams.single(p_452932_, true, true), p_458247_ -> { - p_458247_.finalizeSpawn(p_454968_, p_454968_.getCurrentDifficultyAt(p_458247_.blockPosition()), EntitySpawnReason.CONVERSION, new Zombie.ZombieGroupData(false, true)); - p_458247_.setVillagerData(p_452932_.getVillagerData()); - p_458247_.setGossips(p_452932_.getGossips().copy()); - p_458247_.setTradeOffers(p_452932_.getOffers().copy()); - p_458247_.setVillagerXp(p_452932_.getVillagerXp()); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(p_452932_, p_458247_); - if (!this.isSilent()) { - p_454968_.levelEvent(null, 1026, this.blockPosition(), 0); - } -@@ -271,19 +_,26 @@ - livingentity = (LivingEntity)p_458181_.getEntity(); - } + ZombieVillager zombieVillager = villager.convertTo( + EntityTypes.ZOMBIE_VILLAGER, + ConversionParams.single(villager, true, true), +@@ -268,6 +_,7 @@ + zombie.setGossips(villager.getGossips().copy()); + zombie.setTradeOffers(villager.getOffers().copy()); + zombie.setVillagerXp(villager.getVillagerXp()); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(villager, zombie); + if (!this.isSilent()) { + level.levelEvent(null, 1026, this.blockPosition(), 0); + } +@@ -291,15 +_,26 @@ + target = (LivingEntity)source.getEntity(); + } -- if (livingentity != null -+ var vanilla = (livingentity != null - && p_452619_.getDifficulty() == Difficulty.HARD - && this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) -- && p_452619_.isSpawningMonsters()) { -+ && p_452619_.isSpawningMonsters()); - int i = Mth.floor(this.getX()); - int j = Mth.floor(this.getY()); - int k = Mth.floor(this.getZ()); - EntityType entitytype = this.getType(); -- Zombie zombie = entitytype.create(p_452619_, EntitySpawnReason.REINFORCEMENT); -- if (zombie == null) { -- return true; -- } -- +- if (target != null ++ var vanilla = (target != null + && level.getDifficulty() == Difficulty.HARD + && this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) +- && level.isSpawningMonsters()) { ++ && level.isSpawningMonsters()); ++ { + int x = Mth.floor(this.getX()); + int y = Mth.floor(this.getY()); + int z = Mth.floor(this.getZ()); + EntityType type = this.getType(); +- Zombie reinforcement = type.create(level, EntitySpawnReason.REINFORCEMENT); + -+ var event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, level(), i, j, k, livingentity, this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE)); ++ var event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, level(), x, y, z, target, this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE)); + -+ Zombie zombie = null; ++ Zombie reinforcement = null; + if (event.getResult().isAllowed() || (vanilla && event.getResult().isDefault())) { + if (event.getCustomSummonedAid() != null) -+ zombie = event.getCustomSummonedAid(); ++ reinforcement = event.getCustomSummonedAid(); + else -+ zombie = entitytype.create(this.level(), EntitySpawnReason.REINFORCEMENT); ++ reinforcement = type.create(this.level(), EntitySpawnReason.REINFORCEMENT); + } + -+ if (zombie != null) { - for (int l = 0; l < 50; l++) { - int i1 = i + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); - int j1 = j + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); + if (reinforcement == null) { + return true; + } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch index 931eacd406..2501359c69 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java -@@ -143,7 +_,7 @@ +@@ -152,7 +_,7 @@ if (!this.level().isClientSide() && this.isAlive() && this.isConverting()) { - int i = this.getConversionProgress(); - this.villagerConversionTime -= i; + int amount = this.getConversionProgress(); + this.villagerConversionTime -= amount; - if (this.villagerConversionTime <= 0) { -+ if (this.villagerConversionTime <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.VILLAGER, (timer) -> this.villagerConversionTime = timer)) { ++ if (this.villagerConversionTime <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.VILLAGER, (timer) -> this.villagerConversionTime = timer)) { this.finishConversion((ServerLevel)this.level()); } } -@@ -252,6 +_,7 @@ +@@ -267,6 +_,7 @@ if (!this.isSilent()) { - p_457527_.levelEvent(null, 1027, this.blockPosition(), 0); + level.levelEvent(null, 1027, this.blockPosition(), 0); } -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, p_460761_); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, villager); } ); } diff --git a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch index b763963b50..d20a2b3c9a 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java -@@ -66,12 +_,12 @@ - private void spawnCat(BlockPos p_35334_, ServerLevel p_35335_, boolean p_392522_) { - Cat cat = EntityType.CAT.create(p_35335_, EntitySpawnReason.NATURAL); +@@ -65,12 +_,12 @@ + private void spawnCat(final BlockPos spawnPos, final ServerLevel level, final boolean makePersistent) { + Cat cat = EntityTypes.CAT.create(level, EntitySpawnReason.NATURAL); if (cat != null) { -+ cat.snapTo(p_35334_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat - cat.finalizeSpawn(p_35335_, p_35335_.getCurrentDifficultyAt(p_35334_), EntitySpawnReason.NATURAL, null); - if (p_392522_) { ++ cat.snapTo(spawnPos, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat + cat.finalizeSpawn(level, level.getCurrentDifficultyAt(spawnPos), EntitySpawnReason.NATURAL, null); + if (makePersistent) { cat.setPersistenceRequired(); } -- cat.snapTo(p_35334_, 0.0F, 0.0F); - p_35335_.addFreshEntityWithPassengers(cat); +- cat.snapTo(spawnPos, 0.0F, 0.0F); + level.addFreshEntityWithPassengers(cat); } } diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch index 37c260f5de..49b20fbe26 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/npc/villager/AbstractVillager.java +++ b/net/minecraft/world/entity/npc/villager/AbstractVillager.java -@@ -125,6 +_,8 @@ +@@ -139,6 +_,8 @@ if (this.tradingPlayer instanceof ServerPlayer) { - CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, p_459364_.getResult()); + CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, offer.getResult()); } + -+ net.minecraftforge.event.ForgeEventFactory.onPlayerTradeWithVillager(this.tradingPlayer, p_459364_, this); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerTradeWithVillager(this.tradingPlayer, offer, this); } - protected abstract void rewardTradeXp(MerchantOffer p_458516_); + protected abstract void rewardTradeXp(final MerchantOffer offer); diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch index fb109a91ec..cd35c7a612 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/entity/npc/villager/Villager.java +++ b/net/minecraft/world/entity/npc/villager/Villager.java -@@ -320,7 +_,7 @@ +@@ -289,7 +_,7 @@ @Override - public InteractionResult mobInteract(Player p_458495_, InteractionHand p_455648_) { - ItemStack itemstack = p_458495_.getItemInHand(p_455648_); -- if (itemstack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping()) { -+ if (itemstack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping() || p_458495_.isSecondaryUseActive()) { - return super.mobInteract(p_458495_, p_455648_); - } else if (this.isBaby()) { - this.setUnhappy(); -@@ -760,7 +_,7 @@ + public InteractionResult mobInteract(final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); +- if (itemStack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping()) { ++ if (itemStack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping() || player.isSecondaryUseActive()) { + return super.mobInteract(player, hand); + } + +@@ -761,7 +_,7 @@ @Override - public void thunderHit(ServerLevel p_455159_, LightningBolt p_455393_) { -- if (p_455159_.getDifficulty() != Difficulty.PEACEFUL) { -+ if (p_455159_.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.WITCH, (timer) -> {})) { - LOGGER.info("Villager {} was struck by lightning {}.", this, p_455393_); - Witch witch = this.convertTo(EntityType.WITCH, ConversionParams.single(this, false, false), p_451416_ -> { - p_451416_.finalizeSpawn(p_455159_, p_455159_.getCurrentDifficultyAt(p_451416_.blockPosition()), EntitySpawnReason.CONVERSION, null); + public void thunderHit(final ServerLevel level, final LightningBolt lightningBolt) { +- if (level.getDifficulty() != Difficulty.PEACEFUL) { ++ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.WITCH, (timer) -> {})) { + LOGGER.info("Villager {} was struck by lightning {}.", this, lightningBolt); + Witch witch = this.convertTo(EntityTypes.WITCH, ConversionParams.single(this, false, false), w -> { + w.finalizeSpawn(level, level.getCurrentDifficultyAt(w.blockPosition()), EntitySpawnReason.CONVERSION, null); diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerTrades.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerTrades.java.patch deleted file mode 100644 index 6dc98e6971..0000000000 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerTrades.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/entity/npc/villager/VillagerTrades.java -+++ b/net/minecraft/world/entity/npc/villager/VillagerTrades.java -@@ -854,7 +_,7 @@ - 5 - ) - ) -- .build(); -+ .build().stream().collect(net.minecraft.util.Util.toMutableList()); // Forge: Turned into an ArrayList so it can be modified in VillagerTradingManager - public static final Map, Int2ObjectMap> EXPERIMENTAL_TRADES = Map.of( - VillagerProfession.LIBRARIAN, - toIntMap( -@@ -1279,6 +_,7 @@ - private final int villagerXp; - - public EmeraldsForVillagerTypeItem(int p_453689_, int p_451560_, int p_457573_, Map, Item> p_450639_) { -+ if (false) // FORGE: Modders can add custom villager types, so remove this validation - BuiltInRegistries.VILLAGER_TYPE.registryKeySet().stream().filter(p_455509_ -> !p_450639_.containsKey(p_455509_)).findAny().ifPresent(p_460167_ -> { - throw new IllegalStateException("Missing trade for villager type: " + p_460167_); - }); -@@ -1295,7 +_,9 @@ - if (resourcekey == null) { - return null; - } else { -- ItemCost itemcost = new ItemCost(this.trades.get(resourcekey), this.cost); -+ Item item = this.trades.get(resourcekey); -+ if (item == null) return null; // FORGE: Account for modded villager types by returning null if there is no trade -+ ItemCost itemcost = new ItemCost(item, this.cost); - return new MerchantOffer(itemcost, new ItemStack(Items.EMERALD), this.maxUses, this.villagerXp, 0.05F); - } - } else { diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch index e836aa12ce..edb7fda2f1 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/npc/villager/VillagerType.java +++ b/net/minecraft/world/entity/npc/villager/VillagerType.java -@@ -80,4 +_,9 @@ - public static ResourceKey byBiome(Holder p_452045_) { - return p_452045_.unwrapKey().map(BY_BIOME::get).orElse(PLAINS); +@@ -79,4 +_,9 @@ + public static ResourceKey byBiome(final Holder biome) { + return biome.unwrapKey().map(BY_BIOME::get).orElse(VillagerData.DEFAULT_TYPE); } + + /** FORGE: Registers the VillagerType that will spawn in the given biome. This method should be called during FMLCommonSetupEvent using event.enqueueWork() */ diff --git a/patches/minecraft/net/minecraft/world/entity/player/Input.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Input.java.patch index 11b0d3ca82..f13477d3bd 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Input.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Input.java.patch @@ -3,7 +3,7 @@ @@ -37,4 +_,8 @@ } }; - public static Input EMPTY = new Input(false, false, false, false, false, false, false); + public static final Input EMPTY = new Input(false, false, false, false, false, false, false); + + public Input jump(boolean value) { + return new Input(forward, backward, left, right, value, shift, sprint); 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 ccf24a7062..fcc33cde89 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch @@ -8,33 +8,33 @@ + return this.equipment; + } + - private boolean hasRemainingSpaceForItem(ItemStack p_36015_, ItemStack p_36016_) { - return !p_36015_.isEmpty() && ItemStack.isSameItemSameComponents(p_36015_, p_36016_) && p_36015_.isStackable() && p_36015_.getCount() < this.getMaxStackSize(p_36015_); - } -@@ -166,7 +_,7 @@ + private boolean hasRemainingSpaceForItem(final ItemStack slotItemStack, final ItemStack newItemStack) { + return !slotItemStack.isEmpty() + && ItemStack.isSameItemSameComponents(slotItemStack, newItemStack) +@@ -169,7 +_,7 @@ - for (int k = 0; k < 9; k++) { - int l = (this.selected + k) % 9; -- if (!this.items.get(l).isEnchanted()) { -+ if (!this.items.get(l).isNotReplaceableByPickAction(this.player, l)) { - return l; + for (int slot = 0; slot < 9; slot++) { + int index = (this.selected + slot) % 9; +- if (!this.items.get(index).isEnchanted()) { ++ if (!this.items.get(index).isNotReplaceableByPickAction(this.player, index)) { + return index; } } -@@ -237,7 +_,7 @@ +@@ -242,7 +_,7 @@ for (int i = 0; i < this.items.size(); i++) { - ItemStack itemstack = this.getItem(i); - if (!itemstack.isEmpty()) { -- itemstack.inventoryTick(this.player.level(), this.player, i == this.selected ? EquipmentSlot.MAINHAND : null); -+ itemstack.inventoryTick(this.player.level(), this.player, i == this.selected ? EquipmentSlot.MAINHAND : null, i); + ItemStack itemStack = this.getItem(i); + if (!itemStack.isEmpty()) { +- itemStack.inventoryTick(this.player.level(), this.player, i == this.selected ? EquipmentSlot.MAINHAND : null); ++ itemStack.inventoryTick(this.player.level(), this.player, i == this.selected ? EquipmentSlot.MAINHAND : null, i); } } } -@@ -287,6 +_,8 @@ - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "Adding item to inventory"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Item being added"); -+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_36042_.getItem()))); -+ crashreportcategory.setDetail("Item Class", () -> p_36042_.getItem().getClass().getName()); - crashreportcategory.setDetail("Item ID", Item.getId(p_36042_.getItem())); - crashreportcategory.setDetail("Item data", p_36042_.getDamageValue()); - crashreportcategory.setDetail("Item name", () -> p_36042_.getHoverName().getString()); +@@ -293,6 +_,8 @@ + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "Adding item to inventory"); + CrashReportCategory category = report.addCategory("Item being added"); ++ category.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem()))); ++ category.setDetail("Item Class", () -> itemStack.getItem().getClass().getName()); + category.setDetail("Item ID", Item.getId(itemStack.getItem())); + category.setDetail("Item data", itemStack.getDamageValue()); + category.setDetail("Item name", () -> itemStack.getHoverName().getString()); 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 307635bf46..a9f5e2cff1 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 -@@ -122,7 +_,7 @@ +@@ -123,7 +_,7 @@ import net.minecraft.world.scores.Team; import org.jspecify.annotations.Nullable; @@ -9,19 +9,19 @@ public static final int MAX_HEALTH = 20; public static final int SLEEP_DURATION = 100; public static final int WAKE_UP_DURATION = 10; -@@ -173,6 +_,9 @@ - public @Nullable Entity currentExplosionCause; - private boolean ignoreFallDamageFromCurrentImpulse = false; - private int currentImpulseContextResetGraceTime = 0; +@@ -171,6 +_,9 @@ + private Optional lastDeathLocation = Optional.empty(); + public @Nullable FishingHook fishing; + protected float hurtDir; + private final java.util.Collection prefixes = new java.util.LinkedList<>(); + private final java.util.Collection suffixes = new java.util.LinkedList<>(); + @Nullable private Pose forcedPose; - public Player(Level p_250508_, GameProfile p_252153_) { - super(EntityType.PLAYER, p_250508_); -@@ -181,6 +_,17 @@ + public Player(final Level level, final GameProfile gameProfile) { + super(EntityTypes.PLAYER, level); +@@ -179,6 +_,17 @@ this.inventory = new Inventory(this, this.equipment); - this.inventoryMenu = new InventoryMenu(this.inventory, !p_250508_.isClientSide(), this); + this.inventoryMenu = new InventoryMenu(this.inventory, !level.isClientSide(), this); this.containerMenu = this.inventoryMenu; + + // Forge: wrapped inventories moved to constructor as the inventory init was moved in here too @@ -37,7 +37,7 @@ } @Override -@@ -215,7 +_,8 @@ +@@ -216,7 +_,8 @@ .add(Attributes.MINING_EFFICIENCY) .add(Attributes.SWEEPING_DAMAGE_RATIO) .add(Attributes.WAYPOINT_TRANSMIT_RANGE, 6.0E7) @@ -47,7 +47,7 @@ } @Override -@@ -229,6 +_,7 @@ +@@ -230,6 +_,7 @@ @Override public void tick() { @@ -55,24 +55,24 @@ this.noPhysics = this.isSpectator(); if (this.isSpectator() || this.isPassenger()) { this.setOnGround(false); -@@ -244,7 +_,7 @@ - this.sleepCounter = 100; +@@ -246,7 +_,7 @@ } -- if (!this.level().isClientSide() && !this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, this.position()).canSleep(this.level())) { -+ if (!this.level().isClientSide() && !net.minecraftforge.event.ForgeEventFactory.onSleepingTimeCheck(this, getSleepingPos(), this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, this.position()))) { + if (!this.level().isClientSide() +- && !this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, this.position()).canSleep(this.level())) { ++ && !net.minecraftforge.event.ForgeEventFactory.onSleepingTimeCheck(this, getSleepingPos(), this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, this.position()))) { this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { -@@ -283,6 +_,7 @@ - if (this.currentImpulseContextResetGraceTime > 0) { - this.currentImpulseContextResetGraceTime--; - } +@@ -282,6 +_,7 @@ + + this.cooldowns.tick(); + this.updatePlayerPose(); + net.minecraftforge.event.ForgeEventFactory.onPlayerPostTick(this); } @Override -@@ -342,6 +_,10 @@ +@@ -341,6 +_,10 @@ } protected void updatePlayerPose() { @@ -81,142 +81,143 @@ + return; + } if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.SWIMMING)) { - Pose pose = this.getDesiredPose(); - Pose pose1; -@@ -526,6 +_,7 @@ + Pose desiredPose = this.getDesiredPose(); + Pose actualPose; +@@ -524,6 +_,7 @@ @Override - public void die(DamageSource p_36152_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, p_36152_)) return; - super.die(p_36152_); + public void die(final DamageSource source) { ++ if (net.minecraftforge.event.ForgeEventFactory.onLivingDeath(this, source)) return; + super.die(source); this.reapplyPosition(); - if (!this.isSpectator() && this.level() instanceof ServerLevel serverlevel) { -@@ -582,10 +_,15 @@ + if (!this.isSpectator() && this.level() instanceof ServerLevel level) { +@@ -580,10 +_,15 @@ } - public @Nullable ItemEntity drop(ItemStack p_36177_, boolean p_36178_) { -- return this.drop(p_36177_, false, p_36178_); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_36177_, p_36178_); + public @Nullable ItemEntity drop(final ItemStack itemStack, final boolean thrownFromHand) { +- return this.drop(itemStack, false, thrownFromHand); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStack, thrownFromHand); } + /** @deprecated Use {@link #getDestroySpeed(BlockState,BlockPos) */ - public float getDestroySpeed(BlockState p_36282_) { -+ return getDestroySpeed(p_36282_, null); + public float getDestroySpeed(final BlockState state) { ++ return getDestroySpeed(state, null); + } + -+ public float getDestroySpeed(BlockState p_36282_, @Nullable BlockPos pos) { - float f = this.inventory.getSelectedItem().getDestroySpeed(p_36282_); - if (f > 1.0F) { - f += (float)this.getAttributeValue(Attributes.MINING_EFFICIENCY); -@@ -614,11 +_,14 @@ - f /= 5.0F; ++ public float getDestroySpeed(BlockState state, @Nullable BlockPos pos) { + float speed = this.inventory.getSelectedItem().getDestroySpeed(state); + if (speed > 1.0F) { + speed += (float)this.getAttributeValue(Attributes.MINING_EFFICIENCY); +@@ -612,11 +_,14 @@ + speed /= 5.0F; } -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, p_36282_, f, pos); ++ speed = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, speed, pos); + - return f; + return speed; } - public boolean hasCorrectToolForDrops(BlockState p_36299_) { -- return !p_36299_.requiresCorrectToolForDrops() || this.inventory.getSelectedItem().isCorrectToolForDrops(p_36299_); -+ var vanilla = !p_36299_.requiresCorrectToolForDrops() || this.inventory.getSelectedItem().isCorrectToolForDrops(p_36299_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_36299_, vanilla); + public boolean hasCorrectToolForDrops(final BlockState state) { +- return !state.requiresCorrectToolForDrops() || this.inventory.getSelectedItem().isCorrectToolForDrops(state); ++ var vanilla = !state.requiresCorrectToolForDrops() || this.inventory.getSelectedItem().isCorrectToolForDrops(state); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, state, vanilla); } @Override -@@ -685,6 +_,7 @@ +@@ -677,6 +_,7 @@ @Override - public boolean hurtServer(ServerLevel p_369360_, DamageSource p_364544_, float p_368576_) { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_364544_, p_368576_)) return false; - if (this.isInvulnerableTo(p_369360_, p_364544_)) { + public boolean hurtServer(final ServerLevel level, final DamageSource source, float damage) { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, source, damage)) return false; + if (this.isInvulnerableTo(level, source)) { return false; - } else if (this.abilities.invulnerable && !p_364544_.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -753,10 +_,13 @@ + } +@@ -747,11 +_,14 @@ @Override - protected void actuallyHurt(ServerLevel p_365751_, DamageSource p_36312_, float p_36313_) { - if (!this.isInvulnerableTo(p_365751_, p_36312_)) { -+ p_36313_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_36312_, p_36313_); -+ if (p_36313_ <= 0) return; - p_36313_ = this.getDamageAfterArmorAbsorb(p_36312_, p_36313_); - p_36313_ = this.getDamageAfterMagicAbsorb(p_36312_, p_36313_); - float f1 = Math.max(p_36313_ - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (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.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f * 10.0F)); -@@ -827,6 +_,10 @@ + protected void actuallyHurt(final ServerLevel level, final DamageSource source, float dmg) { + if (!this.isInvulnerableTo(level, source)) { ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, source, dmg); ++ if (dmg <= 0) return; + dmg = this.getDamageAfterArmorAbsorb(source, dmg); + dmg = this.getDamageAfterMagicAbsorb(source, dmg); + float originalDamage = dmg; + dmg = Math.max(dmg - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (originalDamage - dmg)); ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, dmg); + float absorbedDamage = originalDamage - dmg; + if (absorbedDamage > 0.0F && absorbedDamage < 3.4028235E37F) { + this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(absorbedDamage * 10.0F)); +@@ -829,6 +_,10 @@ return InteractionResult.PASS; } else { -+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract(this, p_36159_, p_36158_); -+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract.BUS.post(event)) { ++ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific(this, hand, entity, location); ++ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific.BUS.post(event)) { + return event.getCancellationResult(); + } - ItemStack itemstack = this.getItemInHand(p_36159_); - ItemStack itemstack1 = itemstack.copy(); - InteractionResult interactionresult = p_36158_.interact(this, p_36159_); -@@ -835,6 +_,10 @@ - itemstack.setCount(itemstack1.getCount()); + ItemStack itemStack = this.getItemInHand(hand); + ItemStack itemStackClone = itemStack.copy(); + InteractionResult interact = entity.interact(this, hand, location); +@@ -837,6 +_,10 @@ + itemStack.setCount(itemStackClone.getCount()); } -+ if (!this.abilities.instabuild && itemstack.isEmpty()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_36159_.asEquipmentSlot()); ++ if (!this.abilities.instabuild && itemStack.isEmpty()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemStackClone, hand.asEquipmentSlot()); + } + - return interactionresult; + return interact; } else { - if (!itemstack.isEmpty() && p_36158_ instanceof LivingEntity) { -@@ -846,6 +_,7 @@ - if (interactionresult1.consumesAction()) { - this.level().gameEvent(GameEvent.ENTITY_INTERACT, p_36158_.position(), GameEvent.Context.of(this)); - if (itemstack.isEmpty() && !this.hasInfiniteMaterials()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_36159_.asEquipmentSlot()); - this.setItemInHand(p_36159_, ItemStack.EMPTY); + if (!itemStack.isEmpty() && entity instanceof LivingEntity livingEntity) { +@@ -848,6 +_,7 @@ + if (interactionResult.consumesAction()) { + this.level().gameEvent(GameEvent.ENTITY_INTERACT, entity.position(), GameEvent.Context.of(this)); + if (itemStack.isEmpty() && !this.hasInfiniteMaterials()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemStackClone, hand.asEquipmentSlot()); + this.setItemInHand(hand, ItemStack.EMPTY); } -@@ -945,6 +_,7 @@ +@@ -949,6 +_,7 @@ } - public void attack(Entity p_36347_) { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_36347_)) return; - if (!this.cannotAttack(p_36347_)) { - float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); - ItemStack itemstack = this.getWeaponItem(); -@@ -966,8 +_,10 @@ + public void attack(final Entity entity) { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, entity)) return; + if (!this.cannotAttack(entity)) { + float baseDamage = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); + ItemStack attackingItemStack = this.getWeaponItem(); +@@ -970,8 +_,10 @@ - f += itemstack.getItem().getAttackDamageBonus(p_36347_, f, damagesource); - boolean flag2 = flag && this.canCriticalAttack(p_36347_); -+ var hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); -+ flag2 = hitResult != null; - if (flag2) { -- f *= 1.5F; -+ f *= hitResult.getDamageModifier(); + baseDamage += attackingItemStack.getItem().getAttackDamageBonus(entity, baseDamage, damageSource); + boolean criticalAttack = fullStrengthAttack && this.canCriticalAttack(entity); ++ var hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, entity, criticalAttack, criticalAttack ? 1.5F : 1.0F); ++ criticalAttack = hitResult != null; + if (criticalAttack) { +- baseDamage *= 1.5F; ++ baseDamage *= hitResult.getDamageModifier(); } - float f3 = f + f2; -@@ -1039,7 +_,7 @@ - double d0 = this.getKnownMovement().horizontalDistanceSqr(); - double d1 = this.getSpeed() * 2.5; - if (d0 < Mth.square(d1)) { + float totalDamage = baseDamage + magicBoost; +@@ -1045,7 +_,7 @@ + double approximateSpeedSq = this.getKnownMovement().horizontalDistanceSqr(); + double maxSpeedForSweepAttack = this.getSpeed() * 2.5; + if (approximateSpeedSq < Mth.square(maxSpeedForSweepAttack)) { - return this.getItemInHand(InteractionHand.MAIN_HAND).is(ItemTags.SWORDS); + return this.getItemInHand(InteractionHand.MAIN_HAND).canPerformAction(net.minecraftforge.common.ToolActions.SWORD_SWEEP); } } -@@ -1075,8 +_,8 @@ +@@ -1088,8 +_,8 @@ - private void itemAttackInteraction(Entity p_456980_, ItemStack p_453550_, DamageSource p_453296_, boolean p_457792_) { - Entity entity = p_456980_; -- if (p_456980_ instanceof EnderDragonPart) { -- entity = ((EnderDragonPart)p_456980_).parentMob; -+ if (p_456980_ instanceof net.minecraftforge.entity.PartEntity pe) { -+ entity = pe.getParent(); + private void itemAttackInteraction(final Entity entity, final ItemStack attackingItemStack, final DamageSource damageSource, final boolean applyToTarget) { + Entity hurtTarget = entity; +- if (entity instanceof EnderDragonPart enderDragonPart) { +- hurtTarget = enderDragonPart.parentMob; ++ if (entity instanceof net.minecraftforge.entity.PartEntity pe) { ++ hurtTarget = pe.getParent(); } - boolean flag = false; -@@ -1101,6 +_,7 @@ + boolean itemHurtEnemy = false; +@@ -1114,6 +_,7 @@ } else { this.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); } @@ -224,123 +225,128 @@ } } } -@@ -1141,7 +_,7 @@ - if (this.level() instanceof ServerLevel serverlevel) { - float f = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * p_451630_; +@@ -1166,7 +_,7 @@ + if (this.level() instanceof ServerLevel serverLevel) { + float var12 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * baseDamage; -- for (LivingEntity livingentity : this.level().getEntitiesOfClass(LivingEntity.class, p_451034_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { -+ for (LivingEntity livingentity : this.level().getEntitiesOfClass(LivingEntity.class, this.getItemInHand(InteractionHand.MAIN_HAND).getSweepHitBox(this, p_451034_))) { - if (livingentity != this - && livingentity != p_451034_ - && !this.isAlliedTo(livingentity) -@@ -1307,6 +_,7 @@ +- for (LivingEntity nearby : this.level().getEntitiesOfClass(LivingEntity.class, entity.getBoundingBox().inflate(1.0, 0.25, 1.0))) { ++ for (LivingEntity nearby : this.level().getEntitiesOfClass(LivingEntity.class, this.getItemInHand(InteractionHand.MAIN_HAND).getSweepHitBox(this, entity))) { + if (nearby != this + && nearby != entity + && !this.isAlliedTo(nearby) +@@ -1339,6 +_,7 @@ } - public void stopSleepInBed(boolean p_36226_, boolean p_36227_) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_36226_, p_36227_); + public void stopSleepInBed(final boolean forcefulWakeUp, final boolean updateLevelList) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, forcefulWakeUp, updateLevelList); super.stopSleeping(); - if (this.level() instanceof ServerLevel && p_36227_) { + if (this.level() instanceof ServerLevel && updateLevelList) { ((ServerLevel)this.level()).updateSleepingPlayerList(); -@@ -1415,6 +_,7 @@ +@@ -1450,6 +_,7 @@ @Override - public boolean causeFallDamage(double p_391627_, float p_150093_, DamageSource p_150095_) { + public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { if (this.abilities.mayfly) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_150093_, p_150093_); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, fallDistance, damageModifier); return false; - } else { - if (p_391627_ >= 2.0) { -@@ -1469,13 +_,13 @@ - protected void playStepSound(BlockPos p_282121_, BlockState p_282194_) { + } + +@@ -1484,13 +_,13 @@ + protected void playStepSound(final BlockPos onPos, final BlockState onState) { if (this.isInWater()) { this.waterSwimSound(); -- this.playMuffledStepSound(p_282194_); -+ this.playMuffledStepSound(p_282194_, p_282121_); +- this.playMuffledStepSound(onState); ++ this.playMuffledStepSound(onState, onPos); } else { - BlockPos blockpos = this.getPrimaryStepSoundBlockPos(p_282121_); - if (!p_282121_.equals(blockpos)) { - BlockState blockstate = this.level().getBlockState(blockpos); - if (blockstate.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS)) { -- this.playCombinationStepSounds(blockstate, p_282194_); -+ this.playCombinationStepSounds(blockstate, p_282194_, blockpos, p_282121_); + BlockPos primaryStepSoundPos = this.getPrimaryStepSoundBlockPos(onPos); + if (!onPos.equals(primaryStepSoundPos)) { + BlockState primaryStepState = this.level().getBlockState(primaryStepSoundPos); + if (primaryStepState.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS)) { +- this.playCombinationStepSounds(primaryStepState, onState); ++ this.playCombinationStepSounds(primaryStepState, onState, primaryStepSoundPos, onPos); } else { - super.playStepSound(blockpos, blockstate); + super.playStepSound(primaryStepSoundPos, primaryStepState); } -@@ -1506,6 +_,12 @@ +@@ -1520,7 +_,13 @@ + this.tryResetCurrentImpulseContext(); } - public void giveExperiencePoints(int p_36291_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerXpChange(this, p_36291_); +- public void giveExperiencePoints(final int i) { ++ public void giveExperiencePoints(final int points) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerXpChange(this, points); + if (event == null) { + return; + } -+ p_36291_ = event.getAmount(); ++ int i = event.getAmount(); + - this.increaseScore(p_36291_); - this.experienceProgress = this.experienceProgress + (float)p_36291_ / this.getXpNeededForNextLevel(); - this.totalExperience = Mth.clamp(this.totalExperience + p_36291_, 0, Integer.MAX_VALUE); -@@ -1533,7 +_,7 @@ + this.increaseScore(i); + this.experienceProgress = this.experienceProgress + (float)i / this.getXpNeededForNextLevel(); + this.totalExperience = Mth.clamp(this.totalExperience + i, 0, Integer.MAX_VALUE); +@@ -1548,7 +_,7 @@ } - public void onEnchantmentPerformed(ItemStack p_36172_, int p_36173_) { -- this.experienceLevel -= p_36173_; -+ giveExperienceLevels(-p_36173_); + public void onEnchantmentPerformed(final ItemStack itemStack, final int enchantmentCost) { +- this.experienceLevel -= enchantmentCost; ++ giveExperienceLevels(-enchantmentCost); if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; -@@ -1544,6 +_,12 @@ +@@ -1558,7 +_,13 @@ + this.enchantmentSeed = this.random.nextInt(); } - public void giveExperienceLevels(int p_36276_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerLevelChange(this, p_36276_); +- public void giveExperienceLevels(final int amount) { ++ public void giveExperienceLevels(final int points) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerLevelChange(this, points); + if (event == null) { + return; + } -+ p_36276_ = event.getLevels(); ++ int amount = event.getLevels(); + - this.experienceLevel = IntMath.saturatedAdd(this.experienceLevel, p_36276_); + this.experienceLevel = IntMath.saturatedAdd(this.experienceLevel, amount); if (this.experienceLevel < 0) { this.experienceLevel = 0; -@@ -1689,7 +_,13 @@ +@@ -1697,7 +_,13 @@ @Override public Component getDisplayName() { -- MutableComponent mutablecomponent = PlayerTeam.formatNameForTeam(this.getTeam(), this.getName()); +- MutableComponent result = PlayerTeam.formatNameForTeam(this.getTeam(), this.getName()); + if (this.displayname == null) { + this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); + } -+ MutableComponent mutablecomponent = Component.literal(""); -+ mutablecomponent = prefixes.stream().reduce(mutablecomponent, MutableComponent::append); -+ mutablecomponent = mutablecomponent.append(PlayerTeam.formatNameForTeam(this.getTeam(), this.displayname)); -+ mutablecomponent = suffixes.stream().reduce(mutablecomponent, MutableComponent::append); - return this.decorateDisplayNameComponent(mutablecomponent); ++ MutableComponent result = Component.literal(""); ++ result = prefixes.stream().reduce(result, MutableComponent::append); ++ result = result.append(PlayerTeam.formatNameForTeam(this.getTeam(), this.displayname)); ++ result = suffixes.stream().reduce(result, MutableComponent::append); + return this.decorateDisplayNameComponent(result); } -@@ -1869,18 +_,19 @@ - Predicate predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getSupportedHeldProjectiles(); - ItemStack itemstack = ProjectileWeaponItem.getHeldProjectile(this, predicate); - if (!itemstack.isEmpty()) { -- return itemstack; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_36349_, itemstack); - } else { - predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getAllSupportedProjectiles(); +@@ -1882,7 +_,7 @@ + Predicate supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getSupportedHeldProjectiles(); + ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedProjectiles); + if (!heldProjectile.isEmpty()) { +- return heldProjectile; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, heldProjectile); + } - for (int i = 0; i < this.inventory.getContainerSize(); i++) { - ItemStack itemstack1 = this.inventory.getItem(i); - if (predicate.test(itemstack1)) { -- return itemstack1; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_36349_, itemstack1); - } - } - -- return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; -+ var vanilla = this.abilities.instabuild ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, p_36349_, vanilla); + supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getAllSupportedProjectiles(); +@@ -1890,11 +_,12 @@ + for (int i = 0; i < this.inventory.getContainerSize(); i++) { + ItemStack itemStack = this.inventory.getItem(i); + if (supportedProjectiles.test(itemStack)) { +- return itemStack; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, itemStack); } } + +- return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ var vanilla = this.abilities.instabuild ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, vanilla); } -@@ -2035,6 +_,54 @@ - this.currentImpulseImpactPos = null; - this.ignoreFallDamageFromCurrentImpulse = false; + + @Override +@@ -2015,6 +_,54 @@ + double maxRange = this.blockInteractionRange() + buffer; + return new AABB(pos).distanceToSqr(this.getEyePosition()) < maxRange * maxRange; } + + public Collection getPrefixes() { 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 43223d1376..c484ae4a55 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -306,6 +_,13 @@ +@@ -314,6 +_,13 @@ } @Override @@ -11,6 +11,6 @@ + } + + @Override - public DoubleDoubleImmutablePair calculateHorizontalHurtKnockbackDirection(LivingEntity p_343097_, DamageSource p_343307_) { - double d0 = p_343097_.position().x - this.position().x; - double d1 = p_343097_.position().z - this.position().z; + public DoubleDoubleImmutablePair calculateHorizontalHurtKnockbackDirection(final LivingEntity hurtEntity, final DamageSource damageSource) { + double dx = hurtEntity.position().x - this.position().x; + double dz = hurtEntity.position().z - this.position().z; 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 1458fb8a7e..d78b9f93df 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -1,55 +1,55 @@ --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java -@@ -249,8 +_,8 @@ - if (p_37137_.canInteractWithLevel()) { - ItemStack itemstack = p_37137_.getMainHandItem(); - ItemStack itemstack1 = p_37137_.getOffhandItem(); -- boolean flag = itemstack.is(Items.FISHING_ROD); -- boolean flag1 = itemstack1.is(Items.FISHING_ROD); -+ boolean flag = itemstack.canPerformAction(net.minecraftforge.common.ToolActions.FISHING_ROD_CAST); -+ boolean flag1 = itemstack1.canPerformAction(net.minecraftforge.common.ToolActions.FISHING_ROD_CAST); - if ((flag || flag1) && this.distanceToSqr(p_37137_) <= 1024.0) { +@@ -254,8 +_,8 @@ + if (owner.canInteractWithLevel()) { + ItemStack selectedItem = owner.getMainHandItem(); + ItemStack selectedItemOffHand = owner.getOffhandItem(); +- boolean mainHandIsFishing = selectedItem.is(Items.FISHING_ROD); +- boolean offHandIsFishing = selectedItemOffHand.is(Items.FISHING_ROD); ++ boolean mainHandIsFishing = selectedItem.canPerformAction(net.minecraftforge.common.ToolActions.FISHING_ROD_CAST); ++ boolean offHandIsFishing = selectedItemOffHand.canPerformAction(net.minecraftforge.common.ToolActions.FISHING_ROD_CAST); + if ((mainHandIsFishing || offHandIsFishing) && this.distanceToSqr(owner) <= 1024.0) { return false; } -@@ -262,6 +_,7 @@ +@@ -267,6 +_,7 @@ private void checkCollision() { - HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); -+ if (hitresult.getType() == HitResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) - this.hitTargetOrDeflectSelf(hitresult); + HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); ++ if (hitResult.getType() == HitResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitResult)) + this.hitTargetOrDeflectSelf(hitResult); } -@@ -451,6 +_,7 @@ - Player player = this.getPlayerOwner(); - if (!this.level().isClientSide() && player != null && !this.shouldStopFishing(player)) { - int i = 0; +@@ -448,6 +_,7 @@ + Player owner = this.getPlayerOwner(); + if (!this.level().isClientSide() && owner != null && !this.shouldStopFishing(owner)) { + int dmg = 0; + net.minecraftforge.event.entity.player.ItemFishedEvent event = null; if (this.hookedIn != null) { this.pullEntity(this.hookedIn); - CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, Collections.emptyList()); -@@ -461,10 +_,16 @@ + CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)owner, rod, this, Collections.emptyList()); +@@ -458,10 +_,16 @@ .withParameter(LootContextParams.ORIGIN, this.position()) - .withParameter(LootContextParams.TOOL, p_37157_) + .withParameter(LootContextParams.TOOL, rod) .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.ATTACKING_ENTITY, this.getOwner()) - .withLuck(this.luck + player.getLuck()) + .withLuck(this.luck + owner.getLuck()) .create(LootContextParamSets.FISHING); - LootTable loottable = this.level().getServer().reloadableRegistries().getLootTable(BuiltInLootTables.FISHING); - List list = loottable.getRandomItems(lootparams); -+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.onGround() ? 2 : 1, this); + LootTable lootTable = this.level().getServer().reloadableRegistries().getLootTable(BuiltInLootTables.FISHING); + List items = lootTable.getRandomItems(params); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(items, this.onGround() ? 2 : 1, this); + if (net.minecraftforge.event.entity.player.ItemFishedEvent.BUS.post(event)) { + this.discard(); + return event.getRodDamage(); + } - CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, list); + CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)owner, rod, this, items); - for (ItemStack itemstack : list) { -@@ -494,7 +_,7 @@ + for (ItemStack itemStack : items) { +@@ -487,7 +_,7 @@ } this.discard(); -- return i; -+ return event == null ? i : event.getRodDamage(); +- return dmg; ++ return event == null ? dmg : event.getRodDamage(); } else { return 0; } 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 da4ffbc292..12dfb84f1e 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/net/minecraft/world/entity/projectile/LlamaSpit.java -@@ -43,7 +_,8 @@ +@@ -44,7 +_,8 @@ super.tick(); - Vec3 vec3 = this.getDeltaMovement(); - HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); -- this.hitTargetOrDeflectSelf(hitresult); -+ if (hitresult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) -+ this.hitTargetOrDeflectSelf(hitresult); - double d0 = this.getX() + vec3.x; - double d1 = this.getY() + vec3.y; - double d2 = this.getZ() + vec3.z; + Vec3 movement = this.getDeltaMovement(); + HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); +- this.hitTargetOrDeflectSelf(hitResult); ++ if (hitResult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitResult)) ++ this.hitTargetOrDeflectSelf(hitResult); + double x = this.getX() + movement.x; + double y = this.getY() + movement.y; + double z = this.getZ() + movement.z; 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 d2908e4058..7702952934 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java -@@ -349,7 +_,7 @@ +@@ -363,7 +_,7 @@ @Override - public boolean mayInteract(ServerLevel p_364907_, BlockPos p_150168_) { - Entity entity = this.getOwner(); -- return entity instanceof Player ? entity.mayInteract(p_364907_, p_150168_) : entity == null || p_364907_.getGameRules().get(GameRules.MOB_GRIEFING); -+ return entity instanceof Player ? entity.mayInteract(p_364907_, p_150168_) : entity == null || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_364907_, entity); + public boolean mayInteract(final ServerLevel level, final BlockPos pos) { + Entity owner = this.getOwner(); +- return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().get(GameRules.MOB_GRIEFING); ++ return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, owner); } - public boolean mayBreak(ServerLevel p_361134_) { + public boolean mayBreak(final ServerLevel level) { 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 8b9d1ecb0c..d7381e8823 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/entity/projectile/ProjectileUtil.java +++ b/net/minecraft/world/entity/projectile/ProjectileUtil.java -@@ -113,7 +_,7 @@ - Vec3 vec31 = optional.get(); - double d1 = p_37289_.distanceToSqr(vec31); - if (d1 < d0 || d0 == 0.0) { -- if (entity1.getRootVehicle() == p_37288_.getRootVehicle()) { -+ if (entity1.getRootVehicle() == p_37288_.getRootVehicle() && !entity1.canRiderInteract()) { - if (d0 == 0.0) { - entity = entity1; - vec3 = vec31; -@@ -240,8 +_,13 @@ +@@ -127,7 +_,7 @@ + Vec3 location = clipPoint.get(); + double dd = from.distanceToSqr(location); + if (dd < nearest || nearest == 0.0) { +- if (entity.getRootVehicle() == except.getRootVehicle()) { ++ if (entity.getRootVehicle() == except.getRootVehicle() && !entity.canRiderInteract()) { + if (nearest == 0.0) { + hovered = entity; + hoveredPos = location; +@@ -268,8 +_,13 @@ } } + @Deprecated - public static InteractionHand getWeaponHoldingHand(LivingEntity p_37298_, Item p_37299_) { - return p_37298_.getMainHandItem().is(p_37299_) ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; + public static InteractionHand getWeaponHoldingHand(final LivingEntity mob, final Item weaponItem) { + return mob.getMainHandItem().is(weaponItem) ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; + } + + public static InteractionHand getWeaponHoldingHand(LivingEntity livingEntity, Predicate itemPredicate) { + return itemPredicate.test(livingEntity.getMainHandItem().getItem()) ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; } - public static AbstractArrow getMobArrow(LivingEntity p_37301_, ItemStack p_37302_, float p_37303_, @Nullable ItemStack p_342402_) { + public static AbstractArrow getMobArrow(final LivingEntity mob, final ItemStack projectile, final float power, final @Nullable ItemStack firedFromWeapon) { 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 4faee46142..60354ed24f 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java -@@ -217,7 +_,7 @@ +@@ -218,7 +_,7 @@ this.handlePortal(); } -- if (hitresult != null && this.isAlive() && hitresult.getType() != HitResult.Type.MISS) { -+ if (hitresult != null && this.isAlive() && hitresult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { - this.hitTargetOrDeflectSelf(hitresult); +- if (hitResult != null && this.isAlive() && hitResult.getType() != HitResult.Type.MISS) { ++ if (hitResult != null && this.isAlive() && hitResult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitResult)) { + this.hitTargetOrDeflectSelf(hitResult); } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch index 41d4112127..39f52acee7 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch @@ -4,8 +4,8 @@ this.updateRotation(); this.applyEffectsFromBlocks(); super.tick(); -- if (hitresult.getType() != HitResult.Type.MISS && this.isAlive()) { -+ if (hitresult.getType() != HitResult.Type.MISS && this.isAlive() && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { - this.hitTargetOrDeflectSelf(hitresult); +- if (result.getType() != HitResult.Type.MISS && this.isAlive()) { ++ if (result.getType() != HitResult.Type.MISS && this.isAlive() && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, result)) { + this.hitTargetOrDeflectSelf(result); } } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch index bf9c1723a7..bfe8e60770 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java -@@ -78,6 +_,7 @@ +@@ -79,6 +_,7 @@ private @Nullable List piercedAndKilledEntities; private ItemStack pickupItemStack = this.getDefaultPickupItem(); private @Nullable ItemStack firedFromWeapon = null; + private final IntOpenHashSet ignoredEntities = new IntOpenHashSet(); - protected AbstractArrow(EntityType p_450750_, Level p_450850_) { - super(p_450750_, p_450850_); -@@ -191,7 +_,7 @@ + protected AbstractArrow(final EntityType type, final Level level) { + super(type, level); +@@ -196,7 +_,7 @@ this.shakeTime--; } @@ -17,12 +17,12 @@ this.clearFire(); } -@@ -587,7 +_,7 @@ - protected boolean canHitEntity(Entity p_454713_) { - return p_454713_ instanceof Player && this.getOwner() instanceof Player player && !player.canHarmPlayer((Player)p_454713_) +@@ -601,7 +_,7 @@ + protected boolean canHitEntity(final Entity entity) { + return entity instanceof Player playerEntity && this.getOwner() instanceof Player player && !player.canHarmPlayer(playerEntity) ? false -- : super.canHitEntity(p_454713_) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(p_454713_.getId())); -+ : super.canHitEntity(p_454713_) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(p_454713_.getId())) && !this.ignoredEntities.contains(p_454713_.getId()); +- : super.canHitEntity(entity) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(entity.getId())); ++ : super.canHitEntity(entity) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(entity.getId())) && !this.ignoredEntities.contains(entity.getId()); } @Override diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java.patch index 8b0e968f86..dc1b951871 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/AbstractHurtingProjectile.java -@@ -89,7 +_,7 @@ +@@ -91,7 +_,7 @@ this.igniteForSeconds(1.0F); } -- if (hitresult.getType() != HitResult.Type.MISS && this.isAlive()) { -+ if (hitresult.getType() != HitResult.Type.MISS && this.isAlive() && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { - this.hitTargetOrDeflectSelf(hitresult); +- if (hitResult.getType() != HitResult.Type.MISS && this.isAlive()) { ++ if (hitResult.getType() != HitResult.Type.MISS && this.isAlive() && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitResult)) { + this.hitTargetOrDeflectSelf(hitResult); } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch index 7b339480ea..22cf159ffe 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java -@@ -31,7 +_,7 @@ - protected void onHit(HitResult p_451111_) { - super.onHit(p_451111_); - if (this.level() instanceof ServerLevel serverlevel) { -- boolean flag = serverlevel.getGameRules().get(GameRules.MOB_GRIEFING); -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, this.getOwner()); - this.level().explode(this, this.getX(), this.getY(), this.getZ(), this.explosionPower, flag, Level.ExplosionInteraction.MOB); +@@ -32,7 +_,7 @@ + protected void onHit(final HitResult hitResult) { + super.onHit(hitResult); + if (this.level() instanceof ServerLevel serverLevel) { +- boolean grief = serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); ++ boolean grief = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, this.getOwner()); + this.level().explode(this, this.getX(), this.getY(), this.getZ(), this.explosionPower, grief, Level.ExplosionInteraction.MOB); this.discard(); } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch index 515a0b7436..35452cb788 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java -@@ -51,7 +_,7 @@ - super.onHitBlock(p_452526_); - if (this.level() instanceof ServerLevel serverlevel) { - Entity entity = this.getOwner(); -- if (!(entity instanceof Mob) || serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, entity)) { - BlockPos blockpos = p_452526_.getBlockPos().relative(p_452526_.getDirection()); - if (this.level().isEmptyBlock(blockpos)) { - this.level().setBlockAndUpdate(blockpos, BaseFireBlock.getState(this.level(), blockpos)); +@@ -52,7 +_,7 @@ + super.onHitBlock(hitResult); + if (this.level() instanceof ServerLevel serverLevel) { + Entity owner = this.getOwner(); +- if (!(owner instanceof Mob) || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (!(owner instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, owner)) { + BlockPos pos = hitResult.getBlockPos().relative(hitResult.getDirection()); + if (this.level().isEmptyBlock(pos)) { + this.level().setBlockAndUpdate(pos, BaseFireBlock.getState(this.level(), pos)); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch index 12ad1714c0..d9ef30e129 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java -@@ -49,7 +_,7 @@ - - @Override - public float getBlockExplosionResistance(Explosion p_459983_, BlockGetter p_451795_, BlockPos p_456538_, BlockState p_459565_, FluidState p_454710_, float p_453616_) { -- return this.isDangerous() && WitherBoss.canDestroy(p_459565_) ? Math.min(0.8F, p_453616_) : p_453616_; -+ return this.isDangerous() && p_459565_.canEntityDestroy(p_451795_, p_456538_, this) ? Math.min(0.8F, p_453616_) : p_453616_; +@@ -52,7 +_,7 @@ + public float getBlockExplosionResistance( + final Explosion explosion, final BlockGetter level, final BlockPos pos, final BlockState block, final FluidState fluid, final float resistance + ) { +- return this.isDangerous() && WitherBoss.canDestroy(block) ? Math.min(0.8F, resistance) : resistance; ++ return this.isDangerous() && block.canEntityDestroy(level, pos, this) ? Math.min(0.8F, resistance) : resistance; } @Override diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch index f027d7a490..7cc436e850 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java @@ -104,6 +_,13 @@ - Vec3 vec3 = this.oldPosition(); - if (entity instanceof ServerPlayer serverplayer) { - if (serverplayer.connection.isAcceptingMessages()) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayer, this.getX(), this.getY(), this.getZ(), this, 5.0F, p_451483_); + Vec3 teleportPos = this.oldPosition(); + if (owner instanceof ServerPlayer player) { + if (player.connection.isAcceptingMessages()) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(player, this.getX(), this.getY(), this.getZ(), this, 5.0F, hitResult); + if (event == null) { + this.discard(); + return; + } -+ vec3 = event.getTarget(); ++ teleportPos = event.getTarget(); + - if (this.random.nextFloat() < 0.05F && serverlevel.isSpawningMonsters()) { - Endermite endermite = EntityType.ENDERMITE.create(serverlevel, EntitySpawnReason.TRIGGERED); + if (this.random.nextFloat() < 0.05F && level.isSpawningMonsters() && level.getLevelData().getDifficulty() != Difficulty.PEACEFUL) { + Endermite endermite = EntityTypes.ENDERMITE.create(level, EntitySpawnReason.TRIGGERED); if (endermite != null) { -@@ -130,7 +_,7 @@ - if (serverplayer1 != null) { - serverplayer1.resetFallDistance(); - serverplayer1.resetCurrentImpulseContext(); -- serverplayer1.hurtServer(serverplayer.level(), this.damageSources().enderPearl(), 5.0F); -+ serverplayer1.hurtServer(serverplayer.level(), this.damageSources().enderPearl(), event.getAttackDamage()); +@@ -124,7 +_,7 @@ + if (newOwner != null) { + newOwner.resetFallDistance(); + newOwner.resetCurrentImpulseContext(); +- newOwner.hurtServer(player.level(), this.damageSources().enderPearl(), 5.0F); ++ newOwner.hurtServer(player.level(), this.damageSources().enderPearl(), event.getAttackDamage()); } - this.playSound(serverlevel, vec3); + this.playSound(level, teleportPos); diff --git a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch index a0897586ff..650d7048c3 100644 --- a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -820,7 +_,7 @@ +@@ -830,7 +_,7 @@ } } -- static enum RaiderType { -+ static enum RaiderType implements net.minecraftforge.common.IExtensibleEnum { - VINDICATOR(EntityType.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), - EVOKER(EntityType.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), - PILLAGER(EntityType.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), -@@ -834,6 +_,20 @@ - private RaiderType(final EntityType p_37821_, final int[] p_37822_) { - this.entityType = p_37821_; - this.spawnsPerWaveBeforeBonus = p_37822_; +- public enum RaiderType { ++ public enum RaiderType implements net.minecraftforge.common.IExtensibleEnum { + VINDICATOR(EntityTypes.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), + EVOKER(EntityTypes.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), + PILLAGER(EntityTypes.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), +@@ -844,6 +_,20 @@ + RaiderType(final EntityType entityType, final int[] spawnsPerWaveBeforeBonus) { + this.entityType = entityType; + this.spawnsPerWaveBeforeBonus = spawnsPerWaveBeforeBonus; + } + + /** 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 cf8ca9fbe4..c9931d4fad 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -102,6 +_,9 @@ +@@ -100,6 +_,9 @@ this.setContainerLootTable(null); - LootParams.Builder lootparams$builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); + LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); + // Forge: set the chest to killer_entity for loot context. + if (this instanceof net.minecraft.world.entity.vehicle.minecart.AbstractMinecartContainer entityContainer) -+ lootparams$builder.withParameter(LootContextParams.ATTACKING_ENTITY, entityContainer); - if (p_219950_ != null) { - lootparams$builder.withLuck(p_219950_.getLuck()).withParameter(LootContextParams.THIS_ENTITY, p_219950_); ++ builder.withParameter(LootContextParams.ATTACKING_ENTITY, entityContainer); + if (player != null) { + builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch index f89b1d587a..b0daa4861e 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch @@ -9,55 +9,55 @@ private static final EntityDataAccessor DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_ID_BUBBLE_TIME = SynchedEntityData.defineId(AbstractBoat.class, EntityDataSerializers.INT); -@@ -422,7 +_,7 @@ - for (int i2 = i1; i2 < j1; i2++) { - blockpos$mutableblockpos.set(l1, k1, i2); - FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); -- if (fluidstate.is(FluidTags.WATER)) { -+ if (this.canBoatInFluid(fluidstate)) { - f = Math.max(f, fluidstate.getHeight(this.level(), blockpos$mutableblockpos)); +@@ -416,7 +_,7 @@ + for (int z = minZ; z < maxZ; z++) { + pos.set(x, y, z); + FluidState fluidState = this.level().getFluidState(pos); +- if (fluidState.is(FluidTags.WATER)) { ++ if (this.canBoatInFluid(fluidState)) { + blockHeight = Math.max(blockHeight, fluidState.getHeight(this.level(), pos)); } -@@ -468,7 +_,7 @@ - voxelshape, - BooleanOp.AND - )) { -- f += blockstate.getBlock().getFriction(); -+ f += blockstate.getFriction(this.level(), blockpos$mutableblockpos, this); - k1++; +@@ -458,7 +_,7 @@ + BlockState blockState = this.level().getBlockState(blockPos); + if (!(blockState.getBlock() instanceof LilyPadBlock) + && Shapes.joinIsNotEmpty(blockState.getCollisionShape(this.level(), blockPos).move(blockPos), boatShape, BooleanOp.AND)) { +- friction += blockState.getBlock().getFriction(); ++ friction += blockState.getFriction(this.level(), blockPos, this); + count++; } } -@@ -497,7 +_,7 @@ - for (int i2 = i1; i2 < j1; i2++) { - blockpos$mutableblockpos.set(k1, l1, i2); - FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); -- if (fluidstate.is(FluidTags.WATER)) { -+ if (this.canBoatInFluid(fluidstate)) { - float f = l1 + fluidstate.getHeight(this.level(), blockpos$mutableblockpos); - this.waterLevel = Math.max((double)f, this.waterLevel); - flag |= aabb.minY < f; -@@ -526,7 +_,7 @@ - for (int i2 = i1; i2 < j1; i2++) { - blockpos$mutableblockpos.set(k1, l1, i2); - FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); -- if (fluidstate.is(FluidTags.WATER) -+ if (this.canBoatInFluid(fluidstate) - && d0 < blockpos$mutableblockpos.getY() + fluidstate.getHeight(this.level(), blockpos$mutableblockpos)) { - if (!fluidstate.isSource()) { +@@ -487,7 +_,7 @@ + for (int z = minZ; z < maxZ; z++) { + pos.set(x, y, z); + FluidState fluidState = this.level().getFluidState(pos); +- if (fluidState.is(FluidTags.WATER)) { ++ if (this.canBoatInFluid(fluidState)) { + float height = y + fluidState.getHeight(this.level(), pos); + this.waterLevel = Math.max(height, this.waterLevel); + inWater |= bb.minY < height; +@@ -516,7 +_,7 @@ + for (int z = z0; z < z1; z++) { + pos.set(x, y, z); + FluidState fluidState = this.level().getFluidState(pos); +- if (fluidState.is(FluidTags.WATER) && maxY < pos.getY() + fluidState.getHeight(this.level(), pos)) { ++ if (this.canBoatInFluid(fluidState) && maxY < pos.getY() + fluidState.getHeight(this.level(), pos)) { + if (!fluidState.isSource()) { return AbstractBoat.Status.UNDER_FLOWING_WATER; -@@ -729,7 +_,7 @@ + } +@@ -725,7 +_,7 @@ if (!this.isPassenger()) { - if (p_455047_) { + if (onGround) { this.resetFallDistance(); -- } else if (!this.level().getFluidState(this.blockPosition().below()).is(FluidTags.WATER) && p_456661_ < 0.0) { -+ } else if (!this.canBoatInFluid(this.level().getFluidState(this.blockPosition().below())) && p_456661_ < 0.0) { - this.fallDistance -= (float)p_456661_; +- } else if (!this.level().getFluidState(this.blockPosition().below()).is(FluidTags.WATER) && ya < 0.0) { ++ } else if (!this.canBoatInFluid(this.level().getFluidState(this.blockPosition().below())) && ya < 0.0) { + this.fallDistance -= (float)ya; } } -@@ -753,7 +_,7 @@ +@@ -749,7 +_,7 @@ @Override - protected boolean canAddPassenger(Entity p_457043_) { + protected boolean canAddPassenger(final Entity passenger) { - return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); + return this.getPassengers().size() < this.getMaxPassengers() && !this.canBoatInFluid(this.getEyeInFluidType()); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/ChestBoat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/ChestBoat.java.patch index 58a9c754f5..66dd3a9ca6 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/ChestBoat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/ChestBoat.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/vehicle/boat/ChestBoat.java +++ b/net/minecraft/world/entity/vehicle/boat/ChestBoat.java @@ -15,4 +_,26 @@ - protected double rideHeight(EntityDimensions p_451474_) { - return p_451474_.height() / 3.0F; + protected double rideHeight(final EntityDimensions dimensions) { + return dimensions.height() / 3.0F; } + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch index 4863cd479d..a6ea0ec349 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch @@ -15,18 +15,18 @@ ); + private boolean canBePushed = true; - protected AbstractMinecart(EntityType p_452328_, Level p_453891_) { - super(p_452328_, p_453891_); + protected AbstractMinecart(final EntityType type, final Level level) { + super(type, level); this.blocksBuilding = true; -- if (useExperimentalMovement(p_453891_)) { +- if (useExperimentalMovement(level)) { - this.behavior = new NewMinecartBehavior(this); - } else { - this.behavior = new OldMinecartBehavior(this); - } -+ this.behavior = behaviorFactory.apply(this, p_453891_); ++ this.behavior = behaviorFactory.apply(this, level); } - protected AbstractMinecart(EntityType p_455342_, Level p_453365_, double p_454565_, double p_451452_, double p_452544_) { + protected AbstractMinecart(final EntityType type, final Level level, final double x, final double y, final double z) { @@ -166,7 +_,7 @@ @Override @@ -36,14 +36,14 @@ } @Override -@@ -363,16 +_,24 @@ +@@ -367,22 +_,31 @@ } - protected void comeOffTrack(ServerLevel p_460723_) { -- double d0 = this.getMaxSpeed(p_460723_); -+ double d0 = this.onGround() ? this.getMaxSpeed(p_460723_) : getMaxSpeedAirLateral(); - Vec3 vec3 = this.getDeltaMovement(); - this.setDeltaMovement(Mth.clamp(vec3.x, -d0, d0), vec3.y, Mth.clamp(vec3.z, -d0, d0)); + protected void comeOffTrack(final ServerLevel level) { +- double maxSpeed = this.getMaxSpeed(level); ++ double maxSpeed = this.onGround() ? this.getMaxSpeed(level) : getMaxSpeedAirLateral(); + Vec3 movement = this.getDeltaMovement(); + this.setDeltaMovement(Mth.clamp(movement.x, -maxSpeed, maxSpeed), movement.y, Mth.clamp(movement.z, -maxSpeed, maxSpeed)); if (this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().scale(0.5)); } @@ -58,21 +58,28 @@ + this.move(MoverType.SELF, this.getDeltaMovement()); if (!this.onGround()) { -- this.setDeltaMovement(this.getDeltaMovement().scale(0.95)); -+ this.setDeltaMovement(this.getDeltaMovement().scale(getDragAir())); + this.setDeltaMovement(this.getDeltaMovement().scale(this.getAirDrag())); } } -@@ -429,7 +_,7 @@ - public Vec3 getRedstoneDirection(BlockPos p_456192_) { - BlockState blockstate = this.level().getBlockState(p_456192_); - if (blockstate.is(Blocks.POWERED_RAIL) && blockstate.getValue(PoweredRailBlock.POWERED)) { -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level(), p_456192_, this); - if (railshape == RailShape.EAST_WEST) { - if (this.isRedstoneConductor(p_456192_.west())) { ++ private float airDrag = DEFAULT_AIR_DRAG; + @Override + protected float getAirDrag() { +- return 0.95F; ++ return airDrag; + } + + protected double makeStepAlongTrack(final BlockPos pos, final RailShape shape, final double movementLeft) { +@@ -438,7 +_,7 @@ + public Vec3 getRedstoneDirection(final BlockPos pos) { + BlockState state = this.level().getBlockState(pos); + if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) { +- RailShape shape = state.getValue(((BaseRailBlock)state.getBlock()).getShapeProperty()); ++ RailShape shape = ((BaseRailBlock)state.getBlock()).getRailDirection(state, this.level(), pos, this); + if (shape == RailShape.EAST_WEST) { + if (this.isRedstoneConductor(pos.west())) { return new Vec3(1.0, 0.0, 0.0); -@@ -601,5 +_,42 @@ +@@ -609,5 +_,40 @@ public boolean isFurnace() { return false; @@ -96,9 +103,7 @@ + private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL; + @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; } + @Override public void setMaxSpeedAirVertical(float value) { maxSpeedAirVertical = value; } -+ private double dragAir = DEFAULT_AIR_DRAG; -+ @Override public double getDragAir() { return dragAir; } -+ @Override public void setDragAir(double value) { dragAir = value; } ++ @Override public void setAirDrag(float value) { airDrag = value; } + @Override + public double getMaxSpeedWithRail() { //Non-default because getMaximumSpeed is protected + if (!canUseRail()) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java.patch index 2f6f01c6c6..57de611c21 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java.patch @@ -3,10 +3,10 @@ @@ -94,6 +_,8 @@ @Override - public InteractionResult interact(Player p_452542_, InteractionHand p_458127_) { -+ var ret = super.interact(p_452542_, p_458127_); + public InteractionResult interact(final Player player, final InteractionHand hand, final Vec3 location) { ++ var ret = super.interact(player, hand, location); + if (ret.consumesAction()) return ret; - return this.interactWithContainerVehicle(p_452542_); + return this.interactWithContainerVehicle(player); } @@ -162,5 +_,27 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch index 0561fc1f25..20536dbc0b 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java +++ b/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java -@@ -84,6 +_,8 @@ +@@ -87,6 +_,8 @@ @Override - public InteractionResult interact(Player p_459569_, InteractionHand p_455676_) { -+ InteractionResult ret = super.interact(p_459569_, p_455676_); + public InteractionResult interact(final Player player, final InteractionHand hand, final Vec3 location) { ++ InteractionResult ret = super.interact(player, hand, location); + if (ret.consumesAction()) return ret; - if (!p_459569_.canUseGameMasterBlocks()) { + if (!player.canUseGameMasterBlocks()) { return InteractionResult.PASS; - } else { + } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch index d6fd72d553..ecdf77384e 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java +++ b/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java @@ -19,6 +_,11 @@ - public void broadcastEvent(Level p_451201_, BlockPos p_454356_, int p_454162_) { - p_451201_.broadcastEntityEvent(MinecartSpawner.this, (byte)p_454162_); + public void broadcastEvent(final Level level, final BlockPos pos, final int id) { + level.broadcastEntityEvent(MinecartSpawner.this, (byte)id); } + + @Override diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch index 7d96ac3654..e0b8e71275 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch @@ -1,53 +1,53 @@ --- a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java +++ b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java -@@ -169,7 +_,7 @@ +@@ -153,7 +_,7 @@ - public void adjustToRails(BlockPos p_451133_, BlockState p_453781_, boolean p_453463_) { - if (BaseRailBlock.isRail(p_453781_)) { -- RailShape railshape = p_453781_.getValue(((BaseRailBlock)p_453781_.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)p_453781_.getBlock()).getRailDirection(p_453781_, this.level(), p_451133_, this.minecart); - Pair pair = AbstractMinecart.exits(railshape); - Vec3 vec3 = new Vec3(pair.getFirst()).scale(0.5); - Vec3 vec31 = new Vec3(pair.getSecond()).scale(0.5); -@@ -259,12 +_,12 @@ - if (flag) { + public void adjustToRails(final BlockPos targetBlockPos, final BlockState currentState, final boolean instant) { + if (BaseRailBlock.isRail(currentState)) { +- RailShape shape = currentState.getValue(((BaseRailBlock)currentState.getBlock()).getShapeProperty()); ++ RailShape shape = ((BaseRailBlock)currentState.getBlock()).getRailDirection(currentState, this.level(), targetBlockPos, this.minecart); + Pair exits = AbstractMinecart.exits(shape); + Vec3 exit0 = new Vec3(exits.getFirst()).scale(0.5); + Vec3 exit1 = new Vec3(exits.getSecond()).scale(0.5); +@@ -246,12 +_,12 @@ + if (onRails) { this.minecart.resetFallDistance(); this.minecart.setOldPosAndRot(); -- if (blockstate.is(Blocks.ACTIVATOR_RAIL)) { -+ if (blockstate.getBlock() instanceof PoweredRailBlock power && power.isActivatorRail()) { +- if (currentState.is(Blocks.ACTIVATOR_RAIL)) { ++ if (currentState.getBlock() instanceof PoweredRailBlock power && power.isActivatorRail()) { this.minecart - .activateMinecart(p_450194_, blockpos.getX(), blockpos.getY(), blockpos.getZ(), blockstate.getValue(PoweredRailBlock.POWERED)); + .activateMinecart(level, currentPos.getX(), currentPos.getY(), currentPos.getZ(), currentState.getValue(PoweredRailBlock.POWERED)); } -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level(), blockpos, this.minecart); - Vec3 vec31 = this.calculateTrackSpeed(p_450194_, vec3.horizontal(), newminecartbehavior$trackiteration, blockpos, blockstate, railshape); - if (newminecartbehavior$trackiteration.firstIteration) { - newminecartbehavior$trackiteration.movementLeft = vec31.horizontalDistance(); -@@ -393,7 +_,7 @@ +- RailShape shape = currentState.getValue(((BaseRailBlock)currentState.getBlock()).getShapeProperty()); ++ RailShape shape = ((BaseRailBlock)currentState.getBlock()).getRailDirection(currentState, this.level(), currentPos, this.minecart); + Vec3 newDeltaMovement = this.calculateTrackSpeed(level, initialStepDeltaMovement.horizontal(), trackIteration, currentPos, currentState, shape); + if (trackIteration.firstIteration) { + trackIteration.movementLeft = newDeltaMovement.horizontalDistance(); +@@ -386,7 +_,7 @@ } - private Vec3 calculateHaltTrackSpeed(Vec3 p_460405_, BlockState p_457203_) { -- if (p_457203_.is(Blocks.POWERED_RAIL) && !p_457203_.getValue(PoweredRailBlock.POWERED)) { -+ if (p_457203_.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail() && !p_457203_.getValue(PoweredRailBlock.POWERED)) { - return p_460405_.length() < 0.03 ? Vec3.ZERO : p_460405_.scale(0.5); + private Vec3 calculateHaltTrackSpeed(final Vec3 deltaMovement, final BlockState state) { +- if (state.is(Blocks.POWERED_RAIL) && !state.getValue(PoweredRailBlock.POWERED)) { ++ if (state.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail() && !state.getValue(PoweredRailBlock.POWERED)) { + return deltaMovement.length() < 0.03 ? Vec3.ZERO : deltaMovement.scale(0.5); } else { - return p_460405_; -@@ -401,7 +_,7 @@ + return deltaMovement; +@@ -394,7 +_,7 @@ } - private Vec3 calculateBoostTrackSpeed(Vec3 p_451672_, BlockPos p_453710_, BlockState p_457216_) { -- if (p_457216_.is(Blocks.POWERED_RAIL) && p_457216_.getValue(PoweredRailBlock.POWERED)) { -+ if (p_457216_.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail() && p_457216_.getValue(PoweredRailBlock.POWERED)) { - if (p_451672_.length() > 0.01) { - return p_451672_.normalize().scale(p_451672_.length() + 0.06); - } else { -@@ -453,7 +_,7 @@ - BlockState blockstate = this.level().getBlockState(BlockPos.containing(vec36)); - if (flag) { - if (BaseRailBlock.isRail(blockstate)) { -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level(), BlockPos.containing(vec36), this.minecart); - if (this.restAtVShape(p_452428_, railshape)) { - return 0.0; - } + private Vec3 calculateBoostTrackSpeed(final Vec3 deltaMovement, final BlockPos pos, final BlockState state) { +- if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) { ++ if (state.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail() && state.getValue(PoweredRailBlock.POWERED)) { + if (deltaMovement.length() > 0.01) { + return deltaMovement.normalize().scale(deltaMovement.length() + 0.06); + } +@@ -448,7 +_,7 @@ + BlockState newBlockState = this.level().getBlockState(BlockPos.containing(newPosition)); + if (inHill) { + if (BaseRailBlock.isRail(newBlockState)) { +- RailShape newRailShape = newBlockState.getValue(((BaseRailBlock)newBlockState.getBlock()).getShapeProperty()); ++ RailShape newRailShape = ((BaseRailBlock)newBlockState.getBlock()).getRailDirection(newBlockState, this.level(), BlockPos.containing(newPosition), this.minecart); + if (this.restAtVShape(shape, newRailShape)) { + return 0.0; + } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java.patch index 402ed08f47..53f4548353 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java.patch @@ -1,93 +1,94 @@ --- a/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java +++ b/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java @@ -60,9 +_,9 @@ - BlockState blockstate = this.level().getBlockState(blockpos); - boolean $$4 = BaseRailBlock.isRail(blockstate); - this.minecart.setOnRails($$4); -- if ($$4) { -+ if (this.minecart.canUseRail() && $$4) { - this.moveAlongTrack(serverlevel); -- if (blockstate.is(Blocks.ACTIVATOR_RAIL)) { -+ if (blockstate.getBlock() instanceof PoweredRailBlock power && power.isActivatorRail()) { - this.minecart - .activateMinecart( - serverlevel, blockpos.getX(), blockpos.getY(), blockpos.getZ(), blockstate.getValue(PoweredRailBlock.POWERED) -@@ -115,18 +_,19 @@ - d1 = blockpos.getY(); - boolean flag = false; - boolean flag1 = false; -- if (blockstate.is(Blocks.POWERED_RAIL)) { -+ BaseRailBlock baserailblock = (BaseRailBlock)blockstate.getBlock(); -+ if (blockstate.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail()) { - flag = blockstate.getValue(PoweredRailBlock.POWERED); - flag1 = !flag; + BlockState state = this.level().getBlockState(var11); + boolean onRails = BaseRailBlock.isRail(state); + this.minecart.setOnRails(onRails); +- if (onRails) { ++ if (this.minecart.canUseRail() && onRails) { + this.moveAlongTrack(level); +- if (state.is(Blocks.ACTIVATOR_RAIL)) { ++ if (state.getBlock() instanceof PoweredRailBlock power && power.isActivatorRail()) { + this.minecart.activateMinecart(level, var11.getX(), var11.getY(), var11.getZ(), state.getValue(PoweredRailBlock.POWERED)); + } + } else { +@@ -112,18 +_,19 @@ + y = pos.getY(); + boolean powerTrack = false; + boolean haltTrack = false; +- if (state.is(Blocks.POWERED_RAIL)) { ++ BaseRailBlock baserailblock = (BaseRailBlock)state.getBlock(); ++ if (state.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail()) { + powerTrack = state.getValue(PoweredRailBlock.POWERED); + haltTrack = !powerTrack; } -- double d3 = 0.0078125; -+ double d3 = getSlopeAdjustment(); +- double slideSpeed = 0.0078125; ++ double slideSpeed = getSlopeAdjustment(); if (this.minecart.isInWater()) { - d3 *= 0.2; + slideSpeed *= 0.2; } - Vec3 vec31 = this.getDeltaMovement(); -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = baserailblock.getRailDirection(blockstate, this.level(), blockpos, this.minecart); - switch (railshape) { + Vec3 movement = this.getDeltaMovement(); +- RailShape shape = state.getValue(((BaseRailBlock)state.getBlock()).getShapeProperty()); ++ RailShape shape = baserailblock.getRailDirection(state, this.level(), pos, this.minecart); + switch (shape) { case ASCENDING_EAST: - this.setDeltaMovement(vec31.add(-d3, 0.0, 0.0)); -@@ -178,7 +_,7 @@ + this.setDeltaMovement(movement.add(-slideSpeed, 0.0, 0.0)); +@@ -175,7 +_,7 @@ } } -- if (flag1) { -+ if (flag1 && shouldDoRailFunctions()) { - double d20 = this.getDeltaMovement().horizontalDistance(); - if (d20 < 0.03) { +- if (haltTrack) { ++ if (haltTrack && shouldDoRailFunctions()) { + double speedLength = this.getDeltaMovement().horizontalDistance(); + if (speedLength < 0.03) { this.setDeltaMovement(Vec3.ZERO); -@@ -207,10 +_,7 @@ - d0 = d21 + d4 * d12; - d2 = d9 + d5 * d12; - this.setPos(d0, d1, d2); -- double d23 = this.minecart.isVehicle() ? 0.75 : 1.0; -- double d24 = this.minecart.getMaxSpeed(p_458640_); -- vec31 = this.getDeltaMovement(); -- this.minecart.move(MoverType.SELF, new Vec3(Mth.clamp(d23 * vec31.x, -d24, d24), 0.0, Mth.clamp(d23 * vec31.z, -d24, d24))); -+ this.moveMinecartOnRail(p_458640_); - if (vec3i.getY() != 0 - && Mth.floor(this.minecart.getX()) - blockpos.getX() == vec3i.getX() - && Mth.floor(this.minecart.getZ()) - blockpos.getZ() == vec3i.getZ()) { -@@ -242,7 +_,11 @@ - this.setDeltaMovement(d25 * (j - blockpos.getX()), vec36.y, d25 * (i - blockpos.getZ())); +@@ -204,11 +_,7 @@ + x = x0 + xD * progress; + z = z0 + zD * progress; + this.setPos(x, y, z); +- double scale = this.minecart.isVehicle() ? 0.75 : 1.0; +- double maxSpeed = this.minecart.getMaxSpeed(level); +- movement = this.getDeltaMovement(); +- this.minecart +- .move(MoverType.SELF, new Vec3(Mth.clamp(scale * movement.x, -maxSpeed, maxSpeed), 0.0, Mth.clamp(scale * movement.z, -maxSpeed, maxSpeed))); ++ this.moveMinecartOnRail(level); + if (exit0.getY() != 0 && Mth.floor(this.minecart.getX()) - pos.getX() == exit0.getX() && Mth.floor(this.minecart.getZ()) - pos.getZ() == exit0.getZ()) { + this.setPos(this.minecart.getX(), this.minecart.getY() + exit0.getY(), this.minecart.getZ()); + } else if (exit1.getY() != 0 +@@ -238,7 +_,11 @@ + this.setDeltaMovement(otherPow * (xn - pos.getX()), vec3.y, otherPow * (zn - pos.getZ())); } -- if (flag) { +- if (powerTrack) { + if (shouldDoRailFunctions()) { -+ baserailblock.onMinecartPass(blockstate, level(), blockpos, this.minecart); ++ baserailblock.onMinecartPass(state, level(), pos, this.minecart); + } + -+ if (flag && shouldDoRailFunctions()) { - Vec3 vec37 = this.getDeltaMovement(); - double d26 = vec37.horizontalDistance(); - if (d26 > 0.01) { -@@ -285,7 +_,7 @@ ++ if (powerTrack && shouldDoRailFunctions()) { + Vec3 vec3 = this.getDeltaMovement(); + double speedLength = vec3.horizontalDistance(); + if (speedLength > 0.01) { +@@ -281,7 +_,7 @@ - BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); - if (BaseRailBlock.isRail(blockstate)) { -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level(), new BlockPos(i, j, k), this.minecart); - p_458616_ = j; - if (railshape.isSlope()) { - p_458616_ = j + 1; -@@ -323,7 +_,7 @@ + BlockState state = this.level().getBlockState(new BlockPos(xt, yt, zt)); + if (BaseRailBlock.isRail(state)) { +- RailShape shape = state.getValue(((BaseRailBlock)state.getBlock()).getShapeProperty()); ++ RailShape shape = ((BaseRailBlock)state.getBlock()).getRailDirection(state, this.level(), new BlockPos(xt, yt, zt), this.minecart); + y = yt; + if (shape.isSlope()) { + y = yt + 1; +@@ -319,7 +_,7 @@ - BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); - if (BaseRailBlock.isRail(blockstate)) { -- RailShape railshape = blockstate.getValue(((BaseRailBlock)blockstate.getBlock()).getShapeProperty()); -+ RailShape railshape = ((BaseRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level(), new BlockPos(i, j, k), this.minecart); - Pair pair = AbstractMinecart.exits(railshape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i1 = pair.getSecond(); -@@ -416,5 +_,20 @@ + BlockState state = this.level().getBlockState(new BlockPos(xt, yt, zt)); + if (BaseRailBlock.isRail(state)) { +- RailShape shape = state.getValue(((BaseRailBlock)state.getBlock()).getShapeProperty()); ++ RailShape shape = ((BaseRailBlock)state.getBlock()).getRailDirection(state, this.level(), new BlockPos(xt, yt, zt), this.minecart); + Pair exits = AbstractMinecart.exits(shape); + Vec3i exit0 = exits.getFirst(); + Vec3i exit1 = exits.getSecond(); +@@ -412,5 +_,20 @@ @Override public double getSlowdownFactor() { return this.minecart.isVehicle() ? 0.997 : 0.96; diff --git a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index 68df0ef153..b7e2243a9e 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -439,6 +_,7 @@ - ItemStack itemstack10 = this.getCarried(); - p_150434_.updateTutorialInventoryAction(itemstack10, slot7.getItem(), clickaction); - if (!this.tryItemClickBehaviourOverride(p_150434_, clickaction, slot7, itemstack9, itemstack10)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.onItemStackedOn(itemstack9, itemstack10, slot7, clickaction, p_150434_, createCarriedSlotAccess())) - if (itemstack9.isEmpty()) { - if (!itemstack10.isEmpty()) { - int i3 = clickaction == ClickAction.PRIMARY ? itemstack10.getCount() : 1; +@@ -435,6 +_,7 @@ + ItemStack carried = this.getCarried(); + player.updateTutorialInventoryAction(carried, slot.getItem(), clickAction); + if (!this.tryItemClickBehaviourOverride(player, clickAction, slot, clicked, carried)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onItemStackedOn(carried, clicked, slot, clickAction, player, createCarriedSlotAccess())) + if (clicked.isEmpty()) { + if (!carried.isEmpty()) { + int amount = clickAction == ClickAction.PRIMARY ? carried.getCount() : 1; @@ -648,7 +_,7 @@ - ItemStack itemstack = slot.getItem(); - if (!itemstack.isEmpty() && ItemStack.isSameItemSameComponents(p_38904_, itemstack)) { - int j = itemstack.getCount() + p_38904_.getCount(); -- int k = slot.getMaxStackSize(itemstack); -+ int k = Math.min(slot.getMaxStackSize(itemstack), itemstack.getMaxStackSize()); - if (j <= k) { - p_38904_.setCount(0); - itemstack.setCount(j); + ItemStack target = slot.getItem(); + if (!target.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, target)) { + int totalStack = target.getCount() + itemStack.getCount(); +- int maxStackSize = slot.getMaxStackSize(target); ++ int maxStackSize = Math.min(slot.getMaxStackSize(target), target.getMaxStackSize()); + if (totalStack <= maxStackSize) { + itemStack.setCount(0); + target.setCount(totalStack); diff --git a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch index f7b3103b5d..c7ebd6ab50 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -1,48 +1,48 @@ --- a/net/minecraft/world/inventory/AnvilMenu.java +++ b/net/minecraft/world/inventory/AnvilMenu.java -@@ -79,6 +_,8 @@ - p_150474_.giveExperienceLevels(-this.cost.get()); +@@ -77,6 +_,8 @@ + player.giveExperienceLevels(-this.cost.get()); } -+ float breakChance = net.minecraftforge.event.ForgeEventFactory.onAnvilRepair(p_150474_, p_150475_, AnvilMenu.this.inputSlots.getItem(0), AnvilMenu.this.inputSlots.getItem(1)).getBreakChance(); ++ float breakChance = net.minecraftforge.event.ForgeEventFactory.onAnvilRepair(player, carried, AnvilMenu.this.inputSlots.getItem(0), AnvilMenu.this.inputSlots.getItem(1)).getBreakChance(); + if (this.repairItemCountCost > 0) { - ItemStack itemstack = this.inputSlots.getItem(1); - if (!itemstack.isEmpty() && itemstack.getCount() > this.repairItemCountCost) { -@@ -101,7 +_,7 @@ + ItemStack addition = this.inputSlots.getItem(1); + if (!addition.isEmpty() && addition.getCount() > this.repairItemCountCost) { +@@ -99,7 +_,7 @@ this.inputSlots.setItem(0, ItemStack.EMPTY); - this.access.execute((p_150479_, p_150480_) -> { - BlockState blockstate = p_150479_.getBlockState(p_150480_); -- if (!p_150474_.hasInfiniteMaterials() && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < 0.12F) { -+ if (!p_150474_.hasInfiniteMaterials() && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < breakChance) { - BlockState blockstate1 = AnvilBlock.damage(blockstate); - if (blockstate1 == null) { - p_150479_.removeBlock(p_150480_, false); -@@ -130,8 +_,11 @@ - ItemEnchantments.Mutable itemenchantments$mutable = new ItemEnchantments.Mutable(EnchantmentHelper.getEnchantmentsForCrafting(itemstack1)); - j += (long)itemstack.getOrDefault(DataComponents.REPAIR_COST, 0).intValue() + itemstack2.getOrDefault(DataComponents.REPAIR_COST, 0).intValue(); + this.access.execute((level, pos) -> { + BlockState state = level.getBlockState(pos); +- if (!player.hasInfiniteMaterials() && state.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { ++ if (!player.hasInfiniteMaterials() && state.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < breakChance) { + BlockState newBlockState = AnvilBlock.damage(state); + if (newBlockState == null) { + level.removeBlock(pos, false); +@@ -128,8 +_,11 @@ + ItemEnchantments.Mutable enchantments = new ItemEnchantments.Mutable(EnchantmentHelper.getEnchantmentsForCrafting(result)); + tax += (long)input.getOrDefault(DataComponents.REPAIR_COST, 0).intValue() + addition.getOrDefault(DataComponents.REPAIR_COST, 0).intValue(); this.repairItemCountCost = 0; -+ boolean flag = false; ++ boolean usingBook = false; + -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, resultSlots, itemName, j, this.player)) return; - if (!itemstack2.isEmpty()) { -- boolean flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); -+ flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); - if (itemstack1.isDamageableItem() && itemstack.isValidRepairItem(itemstack2)) { - int l2 = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4); - if (l2 <= 0) { -@@ -235,6 +_,10 @@ - itemstack1.remove(DataComponents.CUSTOM_NAME); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, input, addition, resultSlots, itemName, tax, this.player)) return; + if (!addition.isEmpty()) { +- boolean usingBook = addition.has(DataComponents.STORED_ENCHANTMENTS); ++ usingBook = addition.has(DataComponents.STORED_ENCHANTMENTS); + if (result.isDamageableItem() && input.isValidRepairItem(addition)) { + int repairAmount = Math.min(result.getDamageValue(), result.getMaxDamage() / 4); + if (repairAmount <= 0) { +@@ -233,6 +_,10 @@ + result.remove(DataComponents.CUSTOM_NAME); } -+ if (flag && !itemstack1.isBookEnchantable(itemstack2)) { -+ itemstack1 = ItemStack.EMPTY; ++ if (usingBook && !result.isBookEnchantable(addition)) { ++ result = ItemStack.EMPTY; + } + - int k2 = i <= 0 ? 0 : (int)Mth.clamp(j + i, 0L, 2147483647L); - this.cost.set(k2); - if (i <= 0) { -@@ -306,5 +_,9 @@ + int finalPrice = price <= 0 ? 0 : (int)Mth.clamp(tax + price, 0L, 2147483647L); + this.cost.set(finalPrice); + if (price <= 0) { +@@ -304,5 +_,9 @@ public int getCost() { return this.cost.get(); diff --git a/patches/minecraft/net/minecraft/world/inventory/ArmorSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/ArmorSlot.java.patch index 90bff38906..4b95215c38 100644 --- a/patches/minecraft/net/minecraft/world/inventory/ArmorSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/ArmorSlot.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/inventory/ArmorSlot.java +++ b/net/minecraft/world/inventory/ArmorSlot.java -@@ -37,7 +_,7 @@ +@@ -43,7 +_,7 @@ @Override - public boolean mayPlace(ItemStack p_344267_) { -- return this.owner.isEquippableInSlot(p_344267_, this.slot); -+ return p_344267_.canEquip(slot, owner); + public boolean mayPlace(final ItemStack itemStack) { +- return this.owner.isEquippableInSlot(itemStack, this.slot); ++ return itemStack.canEquip(slot, owner); } @Override diff --git a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch index 9c42af6e5a..ea2a685a9a 100644 --- a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/inventory/BeaconMenu.java +++ b/net/minecraft/world/inventory/BeaconMenu.java -@@ -87,10 +_,8 @@ +@@ -88,10 +_,8 @@ } - slot.onQuickCraft(itemstack1, itemstack); -- } else if (!this.paymentSlot.hasItem() && this.paymentSlot.mayPlace(itemstack1) && itemstack1.getCount() == 1) { -- if (!this.moveItemStackTo(itemstack1, 0, 1, false)) { + slot.onQuickCraft(stack, clicked); +- } else if (!this.paymentSlot.hasItem() && this.paymentSlot.mayPlace(stack) && stack.getCount() == 1) { +- if (!this.moveItemStackTo(stack, 0, 1, false)) { - return ItemStack.EMPTY; - } -+ } else if (this.moveItemStackTo(itemstack1, 0, 1, false)) { //Forge Fix Shift Clicking in beacons with stacks larger then 1. ++ } else if (this.moveItemStackTo(stack, 0, 1, false)) { //Forge Fix Shift Clicking in beacons with stacks larger then 1. + return ItemStack.EMPTY; - } else if (p_39052_ >= 1 && p_39052_ < 28) { - if (!this.moveItemStackTo(itemstack1, 28, 37, false)) { + } else if (slotIndex >= 1 && slotIndex < 28) { + if (!this.moveItemStackTo(stack, 28, 37, false)) { return ItemStack.EMPTY; diff --git a/patches/minecraft/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/BrewingStandMenu.java.patch index 7108e80639..701b3abb7b 100644 --- a/patches/minecraft/net/minecraft/world/inventory/BrewingStandMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/BrewingStandMenu.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java @@ -45,9 +_,9 @@ - this.brewingStand = p_39095_; - this.brewingStandData = p_39096_; - PotionBrewing potionbrewing = p_39094_.player.level().potionBrewing(); -- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 0, 56, 51)); -- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 1, 79, 58)); -- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 2, 102, 51)); -+ this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 0, 56, 51, potionbrewing)); -+ this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 1, 79, 58, potionbrewing)); -+ this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 2, 102, 51, potionbrewing)); - this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionbrewing, p_39095_, 3, 79, 17)); - this.addSlot(new BrewingStandMenu.FuelSlot(p_39095_, 4, 17, 17)); - this.addDataSlots(p_39096_); + this.brewingStand = brewingStand; + this.brewingStandData = brewingStandData; + PotionBrewing potionBrewing = inventory.player.level().potionBrewing(); +- this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 0, 56, 51)); +- this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 1, 79, 58)); +- this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 2, 102, 51)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 0, 56, 51, potionBrewing)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 1, 79, 58, potionBrewing)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStand, 2, 102, 51, potionBrewing)); + this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionBrewing, brewingStand, 3, 79, 17)); + this.addSlot(new BrewingStandMenu.FuelSlot(brewingStand, 4, 17, 17)); + this.addDataSlots(brewingStandData); @@ -75,7 +_,7 @@ - if (!this.moveItemStackTo(itemstack1, 3, 4, false)) { + if (!this.moveItemStackTo(stack, 3, 4, false)) { return ItemStack.EMPTY; } -- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) { -+ } else if (this.slots.get(0).mayPlace(itemstack)) { // Forge: Use the slot's place which goes through custom recipes. - if (!this.moveItemStackTo(itemstack1, 0, 3, false)) { +- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(clicked)) { ++ } else if (this.slots.get(0).mayPlace(clicked)) { // Forge: Use the slot's place which goes through custom recipes. + if (!this.moveItemStackTo(stack, 0, 3, false)) { return ItemStack.EMPTY; } @@ -157,12 +_,23 @@ @@ -29,28 +29,28 @@ + private final PotionBrewing potionBrewing; + + /** @deprecated Use the one that specifes a PotionBrewing */ - public PotionSlot(Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { -+ this(p_39123_, p_39124_, p_39125_, p_39126_, null); + public PotionSlot(final Container container, final int slot, final int x, final int y) { ++ this(container, slot, x, y, null); + } + -+ public PotionSlot(Container p_39123_, int p_39124_, int p_39125_, int p_39126_, PotionBrewing potionBrewing) { - super(p_39123_, p_39124_, p_39125_, p_39126_); ++ public PotionSlot(final Container container, final int slot, final int x, final int y, PotionBrewing potionBrewing) { + super(container, slot, x, y); + this.potionBrewing = potionBrewing; } @Override - public boolean mayPlace(ItemStack p_39132_) { + public boolean mayPlace(final ItemStack itemStack) { + if (this.potionBrewing != null) { -+ return this.potionBrewing.isValidInput(p_39132_); ++ return this.potionBrewing.isValidInput(itemStack); + } - return mayPlaceItem(p_39132_); + return mayPlaceItem(itemStack); } @@ -175,6 +_,7 @@ - public void onTake(Player p_150499_, ItemStack p_150500_) { - Optional> optional = p_150500_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); - if (optional.isPresent() && p_150499_ instanceof ServerPlayer serverplayer) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(p_150499_, p_150500_); - CriteriaTriggers.BREWED_POTION.trigger(serverplayer, optional.get()); + public void onTake(final Player player, final ItemStack carried) { + Optional> potion = carried.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (potion.isPresent() && player instanceof ServerPlayer serverPlayer) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(player, carried); + CriteriaTriggers.BREWED_POTION.trigger(serverPlayer, potion.get()); } diff --git a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch index 3c91be2590..2f1523645e 100644 --- a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -1,48 +1,48 @@ --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -62,7 +_,7 @@ +@@ -61,7 +_,7 @@ this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { @Override - public boolean mayPlace(ItemStack p_39517_) { -- return p_39517_.is(Items.LAPIS_LAZULI); -+ return p_39517_.is(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS); + public boolean mayPlace(final ItemStack itemStack) { +- return itemStack.is(Items.LAPIS_LAZULI); ++ return itemStack.is(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS); } @Override -@@ -90,23 +_,25 @@ - if (!itemstack.isEmpty() && itemstack.isEnchantable()) { - this.access.execute((p_449765_, p_449766_) -> { - IdMap> idmap = p_449765_.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).asHolderIdMap(); -- int j = 0; -+ float j = 0; +@@ -89,23 +_,24 @@ + if (!itemStack.isEmpty() && itemStack.isEnchantable()) { + this.access.execute((level, pos) -> { + IdMap> holders = level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).asHolderIdMap(); +- int bookcases = 0; ++ float bookcases = 0; - for (BlockPos blockpos : EnchantingTableBlock.BOOKSHELF_OFFSETS) { - if (EnchantingTableBlock.isValidBookShelf(p_449765_, p_449766_, blockpos)) { - j++; -+ j += p_449765_.getBlockState(p_449766_.offset(blockpos)).getEnchantPowerBonus(p_449765_, p_449766_.offset(blockpos)); + for (BlockPos offset : EnchantingTableBlock.BOOKSHELF_OFFSETS) { + if (EnchantingTableBlock.isValidBookShelf(level, pos, offset)) { +- bookcases++; ++ bookcases += level.getBlockState(pos.offset(offset)).getEnchantPowerBonus(level, pos.offset(offset)); } } this.random.setSeed(this.enchantmentSeed.get()); - for (int k = 0; k < 3; k++) { -- this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, j, itemstack); -+ this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, (int)j, itemstack); - this.enchantClue[k] = -1; - this.levelClue[k] = -1; - if (this.costs[k] < k + 1) { - this.costs[k] = 0; + for (int ixx = 0; ixx < 3; ixx++) { +- this.costs[ixx] = EnchantmentHelper.getEnchantmentCost(this.random, ixx, bookcases, itemStack); ++ this.costs[ixx] = EnchantmentHelper.getEnchantmentCost(this.random, ixx, (int)bookcases, itemStack); + this.enchantClue[ixx] = -1; + this.levelClue[ixx] = -1; + if (this.costs[ixx] < ixx + 1) { + this.costs[ixx] = 0; } -+ this.costs[k] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_449765_, p_449766_, k, (int)j, itemstack, costs[k]); ++ this.costs[ixx] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(level, pos, ixx, (int)bookcases, itemStack, costs[ixx]); } - for (int l = 0; l < 3; l++) { -@@ -233,7 +_,7 @@ - if (!this.moveItemStackTo(itemstack1, 2, 38, true)) { + for (int ix = 0; ix < 3; ix++) { +@@ -234,7 +_,7 @@ + if (!this.moveItemStackTo(stack, 2, 38, true)) { return ItemStack.EMPTY; } -- } else if (itemstack1.is(Items.LAPIS_LAZULI)) { -+ } else if (itemstack1.is(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS)) { - if (!this.moveItemStackTo(itemstack1, 1, 2, true)) { +- } else if (stack.is(Items.LAPIS_LAZULI)) { ++ } else if (stack.is(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS)) { + if (!this.moveItemStackTo(stack, 1, 2, true)) { return ItemStack.EMPTY; } diff --git a/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch index f1b2a8f389..dfbc1e38ed 100644 --- a/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch @@ -4,6 +4,6 @@ } this.removeCount = 0; -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSmeltedEvent(this.player, p_39558_); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSmeltedEvent(this.player, carried); } } diff --git a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch index 81d5ceda73..ad4727baae 100644 --- a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -1,50 +1,50 @@ --- a/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/net/minecraft/world/inventory/GrindstoneMenu.java -@@ -38,6 +_,7 @@ +@@ -37,6 +_,7 @@ } }; private final ContainerLevelAccess access; + private int xp = -1; - public GrindstoneMenu(int p_39563_, Inventory p_39564_) { - this(p_39563_, p_39564_, ContainerLevelAccess.NULL); -@@ -49,13 +_,13 @@ + public GrindstoneMenu(final int containerId, final Inventory inventory) { + this(containerId, inventory, ContainerLevelAccess.NULL); +@@ -48,13 +_,13 @@ this.addSlot(new Slot(this.repairSlots, 0, 49, 19) { @Override - public boolean mayPlace(ItemStack p_39607_) { -- return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_); -+ return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_) || p_39607_.canGrindstoneRepair(); + public boolean mayPlace(final ItemStack itemStack) { +- return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack); ++ return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack) || itemStack.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.repairSlots, 1, 49, 40) { @Override - public boolean mayPlace(ItemStack p_39616_) { -- return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_); -+ return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_) || p_39616_.canGrindstoneRepair(); + public boolean mayPlace(final ItemStack itemStack) { +- return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack); ++ return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack) || itemStack.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.resultSlots, 2, 129, 34) { -@@ -66,6 +_,7 @@ +@@ -65,6 +_,7 @@ @Override - public void onTake(Player p_150574_, ItemStack p_150575_) { -+ if (net.minecraftforge.common.ForgeHooks.onGrindstoneTake(GrindstoneMenu.this.repairSlots, p_39568_, this::getExperienceAmount)) return; - p_39568_.execute((p_39634_, p_39635_) -> { - if (p_39634_ instanceof ServerLevel) { - ExperienceOrb.award((ServerLevel)p_39634_, Vec3.atCenterOf(p_39635_), this.getExperienceAmount(p_39634_)); -@@ -78,6 +_,7 @@ + public void onTake(final Player player, final ItemStack carried) { ++ if (net.minecraftforge.common.ForgeHooks.onGrindstoneTake(GrindstoneMenu.this.repairSlots, access, this::getExperienceAmount)) return; + access.execute((level, pos) -> { + if (level instanceof ServerLevel serverLevel) { + ExperienceOrb.award(serverLevel, Vec3.atCenterOf(pos), this.getExperienceAmount(level)); +@@ -77,6 +_,7 @@ } - private int getExperienceAmount(Level p_39632_) { + private int getExperienceAmount(final Level level) { + if (xp > -1) return xp; - int i = 0; - i += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0)); - i += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1)); -@@ -121,6 +_,17 @@ + int amount = 0; + amount += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0)); + amount += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1)); +@@ -120,6 +_,17 @@ } - private ItemStack computeResult(ItemStack p_335167_, ItemStack p_329934_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onGrindstoneChange(p_335167_, p_329934_, this.resultSlots, -1); + private ItemStack computeResult(final ItemStack input, final ItemStack additional) { ++ var event = net.minecraftforge.event.ForgeEventFactory.onGrindstoneChange(input, additional, this.resultSlots, -1); + if (event == null) { + this.xp = -1; + return ItemStack.EMPTY; @@ -55,6 +55,6 @@ + this.xp = Integer.MIN_VALUE; + } + - boolean flag = !p_335167_.isEmpty() || !p_329934_.isEmpty(); - if (!flag) { + boolean hasAnItem = !input.isEmpty() || !additional.isEmpty(); + if (!hasAnItem) { return ItemStack.EMPTY; diff --git a/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch b/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch index 346db1f1df..7c0ce1d242 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 GENERIC_9x1 = register("generic_9x1", ChestMenu::oneRow); public static final MenuType GENERIC_9x2 = register("generic_9x2", ChestMenu::twoRows); public static final MenuType GENERIC_9x3 = register("generic_9x3", ChestMenu::threeRows); -@@ -57,6 +_,14 @@ +@@ -59,6 +_,14 @@ @Override public FeatureFlagSet requiredFeatures() { return this.requiredFeatures; diff --git a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch index bb560d646d..05358614f9 100644 --- a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/inventory/ResultSlot.java +++ b/net/minecraft/world/inventory/ResultSlot.java -@@ -51,6 +_,7 @@ - protected void checkTakeAchievements(ItemStack p_40185_) { +@@ -57,6 +_,7 @@ + protected void checkTakeAchievements(final ItemStack carried) { if (this.removeCount > 0) { - p_40185_.onCraftedBy(this.player, this.removeCount); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerCraftingEvent(this.player, p_40185_, this.craftSlots); + carried.onCraftedBy(this.player, this.removeCount); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerCraftingEvent(this.player, carried, this.craftSlots); } - if (this.container instanceof RecipeCraftingHolder recipecraftingholder) { -@@ -86,7 +_,9 @@ - CraftingInput craftinginput = craftinginput$positioned.input(); - int i = craftinginput$positioned.left(); - int j = craftinginput$positioned.top(); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_150638_); - NonNullList nonnulllist = this.getRemainingItems(craftinginput, p_150638_.level()); + if (this.container instanceof RecipeCraftingHolder recipeCraftingHolder) { +@@ -92,7 +_,9 @@ + CraftingInput input = positionedRecipe.input(); + int recipeLeft = positionedRecipe.left(); + int recipeTop = positionedRecipe.top(); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(player); + NonNullList remaining = this.getRemainingItems(input, player.level()); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - for (int k = 0; k < craftinginput.height(); k++) { - for (int l = 0; l < craftinginput.width(); l++) { + for (int y = 0; y < input.height(); y++) { + for (int x = 0; x < input.width(); x++) { diff --git a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch index 3d1e646679..1ea69e510c 100644 --- a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch @@ -8,8 +8,8 @@ + return background; } - public ItemStack remove(int p_40227_) { -@@ -160,5 +_,36 @@ + public ItemStack remove(final int amount) { +@@ -167,5 +_,36 @@ public boolean isFake() { return false; diff --git a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch index 8903a80916..08f09afa2a 100644 --- a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch @@ -1,46 +1,46 @@ --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java -@@ -64,7 +_,7 @@ - if (playerHasBlockingItemUseIntent(p_40529_)) { +@@ -65,7 +_,7 @@ return InteractionResult.PASS; - } else { -- Optional optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos)); -+ Optional optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos), p_40529_); - if (optional.isEmpty()) { - return InteractionResult.PASS; - } else { -@@ -90,17 +_,24 @@ + } + +- Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos)); ++ Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos), context); + if (newBlock.isEmpty()) { + return InteractionResult.PASS; + } +@@ -92,17 +_,24 @@ } - private Optional evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_) { -- Optional optional = this.getStripped(p_311198_); -+ return this.evaluateNewBlockState(p_312809_, p_313114_, p_312029_, p_311198_, null); + private Optional evaluateNewBlockState(final Level level, final BlockPos pos, final @Nullable Player player, final BlockState oldState) { +- Optional strippedBlock = this.getStripped(oldState); ++ return this.evaluateNewBlockState(level, pos, player, oldState, null); + } + -+ private Optional evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_, @Nullable UseOnContext ctx) { -+ var strip = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false); -+ Optional optional = strip != null ? Optional.of(strip) : this.getStripped(p_311198_); - if (optional.isPresent()) { - p_312809_.playSound(p_312029_, p_313114_, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); - return optional; ++ private Optional evaluateNewBlockState(final Level level, final BlockPos pos, final @Nullable Player player, final BlockState oldState, final @Nullable UseOnContext ctx) { ++ var strip = ctx == null ? null : oldState.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false); ++ Optional strippedBlock = strip != null ? Optional.of(strip) : this.getStripped(oldState); + if (strippedBlock.isPresent()) { + level.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); + return strippedBlock; } else { -- Optional optional1 = WeatheringCopper.getPrevious(p_311198_); -+ var scrape = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false); -+ Optional optional1 = scrape != null ? Optional.of(scrape) : WeatheringCopper.getPrevious(p_311198_); - if (optional1.isPresent()) { - spawnSoundAndParticle(p_312809_, p_313114_, p_312029_, p_311198_, SoundEvents.AXE_SCRAPE, 3005); - return optional1; +- Optional scrapedBlock = WeatheringCopper.getPrevious(oldState); ++ var scrape = ctx == null ? null : oldState.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false); ++ Optional scrapedBlock = scrape != null ? Optional.of(scrape) : WeatheringCopper.getPrevious(oldState); + if (scrapedBlock.isPresent()) { + spawnSoundAndParticle(level, pos, player, oldState, SoundEvents.AXE_SCRAPE, 3005); + return scrapedBlock; } else { -- Optional optional2 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(p_311198_.getBlock())) -+ var waxOff = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_WAX_OFF, false); -+ Optional optional2 = waxOff != null ? Optional.of(waxOff) : Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(p_311198_.getBlock())) - .map(p_150694_ -> p_150694_.withPropertiesOf(p_311198_)); - if (optional2.isPresent()) { - spawnSoundAndParticle(p_312809_, p_313114_, p_312029_, p_311198_, SoundEvents.AXE_WAX_OFF, 3004); -@@ -125,5 +_,21 @@ - private Optional getStripped(BlockState p_150691_) { - return Optional.ofNullable(STRIPPABLES.get(p_150691_.getBlock())) - .map(p_359378_ -> p_359378_.defaultBlockState().setValue(RotatedPillarBlock.AXIS, p_150691_.getValue(RotatedPillarBlock.AXIS))); +- Optional waxoffBlock = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(oldState.getBlock())) ++ var waxOff = ctx == null ? null : oldState.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_WAX_OFF, false); ++ Optional waxoffBlock = waxOff != null ? Optional.of(waxOff) : Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(oldState.getBlock())) + .map(b -> b.withPropertiesOf(oldState)); + if (waxoffBlock.isPresent()) { + spawnSoundAndParticle(level, pos, player, oldState, SoundEvents.AXE_WAX_OFF, 3004); +@@ -129,5 +_,16 @@ + private Optional getStripped(final BlockState state) { + return Optional.ofNullable(STRIPPABLES.get(state.getBlock())) + .map(block -> block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, state.getValue(RotatedPillarBlock.AXIS))); + } + + @Override @@ -52,10 +52,5 @@ + public static BlockState getAxeStrippingState(BlockState originalState) { + Block block = STRIPPABLES.get(originalState.getBlock()); + return block != null ? block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, originalState.getValue(RotatedPillarBlock.AXIS)) : null; -+ } -+ -+ @Override -+ public boolean canDisableShield(ItemStack stack, ItemStack shield, net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.entity.LivingEntity attacker) { -+ return true; } } diff --git a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch index b7af32585c..8a01695623 100644 --- a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch @@ -1,24 +1,21 @@ --- a/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java -@@ -77,9 +_,9 @@ - } - } - -- SoundType soundtype = blockstate1.getSoundType(); -+ SoundType soundtype = blockstate1.getSoundType(level, blockpos, p_40577_.getPlayer()); - level.playSound( -- player, blockpos, this.getPlaceSound(blockstate1), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F -+ player, blockpos, this.getPlaceSound(blockstate1, level, blockpos, p_40577_.getPlayer()), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F - ); - level.gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(player, blockstate1)); - itemstack.consume(1, player); -@@ -89,10 +_,16 @@ +@@ -83,17 +_,23 @@ + } } + +- SoundType soundType = placedState.getSoundType(); +- level.playSound(player, pos, this.getPlaceSound(placedState), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); ++ SoundType soundType = placedState.getSoundType(level, pos, placeContext.getPlayer()); ++ level.playSound(player, pos, this.getPlaceSound(placedState, level, pos, placeContext.getPlayer()), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); + level.gameEvent(GameEvent.BLOCK_PLACE, pos, GameEvent.Context.of(player, placedState)); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } + @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) } - protected SoundEvent getPlaceSound(BlockState p_40588_) { - return p_40588_.getSoundType().getPlaceSound(); + protected SoundEvent getPlaceSound(final BlockState blockState) { + return blockState.getSoundType().getPlaceSound(); } + //Forge: Sensitive version of BlockItem#getPlaceSound @@ -26,13 +23,13 @@ + return state.getSoundType(world, pos, entity).getPlaceSound(); + } + - public @Nullable BlockPlaceContext updatePlacementContext(BlockPlaceContext p_40609_) { - return p_40609_; + public @Nullable BlockPlaceContext updatePlacementContext(final BlockPlaceContext context) { + return context; } -@@ -185,6 +_,10 @@ +@@ -188,6 +_,10 @@ - public void registerBlocks(Map p_40607_, Item p_40608_) { - p_40607_.put(this.getBlock(), p_40608_); + public void registerBlocks(final Map map, final Item item) { + map.put(this.getBlock(), item); + } + + public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { diff --git a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch index b1534159e5..f6bccac981 100644 --- a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/world/item/BoneMealItem.java +++ b/net/minecraft/world/item/BoneMealItem.java -@@ -38,7 +_,7 @@ - BlockPos blockpos = p_40637_.getClickedPos(); - BlockPos blockpos1 = blockpos.relative(p_40637_.getClickedFace()); - ItemStack itemstack = p_40637_.getItemInHand(); -- if (growCrop(itemstack, level, blockpos)) { -+ if (applyBonemeal(itemstack, level, blockpos, p_40637_.getPlayer())) { +@@ -37,7 +_,7 @@ + BlockPos pos = context.getClickedPos(); + BlockPos relative = pos.relative(context.getClickedFace()); + ItemStack boneMealStack = context.getItemInHand(); +- if (growCrop(boneMealStack, level, pos)) { ++ if (applyBonemeal(boneMealStack, level, pos, context.getPlayer())) { if (!level.isClientSide()) { - itemstack.causeUseVibration(p_40637_.getPlayer(), GameEvent.ITEM_INTERACT_FINISH); - level.levelEvent(1505, blockpos, 15); + boneMealStack.causeUseVibration(context.getPlayer(), GameEvent.ITEM_INTERACT_FINISH); + level.levelEvent(1505, pos, 15); @@ -61,8 +_,18 @@ } } + @Deprecated //Forge: Use Player/Hand version - public static boolean growCrop(ItemStack p_40628_, Level p_40629_, BlockPos p_40630_) { -+ if (p_40629_ instanceof net.minecraft.server.level.ServerLevel) { -+ return applyBonemeal(p_40628_, p_40629_, p_40630_, null); + public static boolean growCrop(final ItemStack itemStack, final Level level, final BlockPos pos) { ++ if (level instanceof net.minecraft.server.level.ServerLevel) { ++ return applyBonemeal(itemStack, level, pos, null); + } + return false; + } + -+ public static boolean applyBonemeal(ItemStack p_40628_, Level p_40629_, BlockPos p_40630_, net.minecraft.world.entity.player.Player player) { - BlockState blockstate = p_40629_.getBlockState(p_40630_); -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_40629_, p_40630_, blockstate, p_40628_); ++ public static boolean applyBonemeal(final ItemStack itemStack, final Level level, final BlockPos pos, net.minecraft.world.entity.player.Player player) { + BlockState state = level.getBlockState(pos); ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, level, pos, state, itemStack); + if (hook != 0) return hook > 0; - if (blockstate.getBlock() instanceof BonemealableBlock bonemealableblock && bonemealableblock.isValidBonemealTarget(p_40629_, p_40630_, blockstate)) { - if (p_40629_ instanceof ServerLevel) { - if (bonemealableblock.isBonemealSuccess(p_40629_, p_40629_.random, p_40630_, blockstate)) { + if (state.getBlock() instanceof BonemealableBlock block && block.isValidBonemealTarget(level, pos, state)) { + if (level instanceof ServerLevel serverLevel) { + if (block.isBonemealSuccess(level, level.getRandom(), pos, state)) { diff --git a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch index dc8ed330ba..4e7b7d26fd 100644 --- a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java -@@ -32,6 +_,9 @@ - return false; - } else { - int i = this.getUseDuration(p_40667_, p_40669_) - p_40670_; -+ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40667_, p_40668_, player, i, true); -+ if (i < 0) return false; +@@ -31,6 +_,9 @@ + } + + int timeHeld = this.getUseDuration(itemStack, entity) - remainingTime; ++ timeHeld = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(itemStack, level, player, timeHeld, true); ++ if (timeHeld < 0) return false; + - float f = getPowerForTime(i); - if (f < 0.1) { - return false; -@@ -89,6 +_,8 @@ - public InteractionResult use(Level p_40672_, Player p_40673_, InteractionHand p_40674_) { - ItemStack itemstack = p_40673_.getItemInHand(p_40674_); - boolean flag = !p_40673_.getProjectile(itemstack).isEmpty(); -+ var ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, p_40672_, p_40673_, p_40674_, flag); + float pow = getPowerForTime(timeHeld); + if (pow < 0.1) { + return false; +@@ -95,6 +_,8 @@ + public InteractionResult use(final Level level, final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); + boolean foundProjectile = !player.getProjectile(itemStack).isEmpty(); ++ var ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemStack, level, player, hand, foundProjectile); + if (ret != null) return ret; - if (!p_40673_.hasInfiniteMaterials() && !flag) { + if (!player.hasInfiniteMaterials() && !foundProjectile) { return InteractionResult.FAIL; - } else { + } diff --git a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch index c78510c909..b90ffe3574 100644 --- a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch @@ -1,15 +1,18 @@ --- a/net/minecraft/world/item/BucketItem.java +++ b/net/minecraft/world/item/BucketItem.java -@@ -33,15 +_,29 @@ +@@ -32,17 +_,31 @@ + import org.jspecify.annotations.Nullable; + public class BucketItem extends Item implements DispensibleContainerItem { - private final Fluid content; +- protected final Fluid content; ++ private final Fluid content; // Needs to be private for ASM transformer + // Forge: Use the other constructor that takes a Supplier + @Deprecated - public BucketItem(Fluid p_40689_, Item.Properties p_40690_) { - super(p_40690_); - this.content = p_40689_; -+ this.fluidSupplier = net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_40689_); + public BucketItem(final Fluid content, final Item.Properties properties) { + super(properties); + this.content = content; ++ this.fluidSupplier = net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(content); + } + + /** @@ -22,81 +25,83 @@ } @Override - public InteractionResult use(Level p_40703_, Player p_40704_, InteractionHand p_40705_) { - ItemStack itemstack = p_40704_.getItemInHand(p_40705_); - BlockHitResult blockhitresult = getPlayerPOVHitResult(p_40703_, p_40704_, this.content == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); -+ var ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_40704_, p_40703_, itemstack, blockhitresult); + public InteractionResult use(final Level level, final Player player, final InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); + BlockHitResult hitResult = getPlayerPOVHitResult(level, player, this.getFluidContext()); ++ var ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, level, itemStack, hitResult); + if (ret != null) return ret; - if (blockhitresult.getType() == HitResult.Type.MISS) { + if (hitResult.getType() == HitResult.Type.MISS) { return InteractionResult.PASS; - } else if (blockhitresult.getType() != HitResult.Type.BLOCK) { -@@ -58,7 +_,7 @@ - ItemStack itemstack3 = bucketpickup.pickupBlock(p_40704_, p_40703_, blockpos, blockstate1); - if (!itemstack3.isEmpty()) { - p_40704_.awardStat(Stats.ITEM_USED.get(this)); -- bucketpickup.getPickupSound().ifPresent(p_150709_ -> p_40704_.playSound(p_150709_, 1.0F, 1.0F)); -+ bucketpickup.getPickupSound(blockstate1).ifPresent(p_150709_ -> p_40704_.playSound(p_150709_, 1.0F, 1.0F)); - p_40703_.gameEvent(p_40704_, GameEvent.FLUID_PICKUP, blockpos); - ItemStack itemstack2 = ItemUtils.createFilledResult(itemstack, p_40704_, itemstack3); - if (!p_40703_.isClientSide()) { -@@ -72,8 +_,8 @@ - return InteractionResult.FAIL; - } else { - BlockState blockstate = p_40703_.getBlockState(blockpos); -- BlockPos blockpos2 = blockstate.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? blockpos : blockpos1; -- if (this.emptyContents(p_40704_, p_40703_, blockpos2, blockhitresult)) { -+ BlockPos blockpos2 = canBlockContainFluid(p_40703_, blockpos, blockstate) ? blockpos : blockpos1; -+ if (this.emptyContents(p_40704_, p_40703_, blockpos2, blockhitresult, itemstack)) { - this.checkExtraContent(p_40704_, p_40703_, itemstack, blockpos2); - if (p_40704_ instanceof ServerPlayer) { - CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer)p_40704_, blockpos2, itemstack); -@@ -97,8 +_,13 @@ - public void checkExtraContent(@Nullable LivingEntity p_397951_, Level p_150712_, ItemStack p_150713_, BlockPos p_150714_) { + } +@@ -56,8 +_,8 @@ + BlockPos directionOffsetPos = pos.relative(direction); + if (level.mayInteract(player, pos) && player.mayUseItemAt(directionOffsetPos, direction, itemStack)) { + BlockState clicked = level.getBlockState(pos); +- BlockPos placePos = clicked.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? pos : directionOffsetPos; +- if (this.emptyContents(player, level, placePos, hitResult)) { ++ BlockPos placePos = canBlockContainFluid(level, pos, clicked) ? pos : directionOffsetPos; ++ if (this.emptyContents(player, level, placePos, hitResult, itemStack)) { + this.checkExtraContent(player, level, itemStack, placePos); + if (player instanceof ServerPlayer serverPlayer && this.content != Fluids.EMPTY) { + CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placePos, itemStack); +@@ -73,7 +_,7 @@ + ItemStack taken = bucketPickupBlock.pickupBlock(player, level, pos, blockState); + if (!taken.isEmpty()) { + player.awardStat(Stats.ITEM_USED.get(this)); +- bucketPickupBlock.getPickupSound().ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); ++ bucketPickupBlock.getPickupSound(blockState).ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); + level.gameEvent(player, GameEvent.FLUID_PICKUP, pos); + ItemStack result = ItemUtils.createFilledResult(itemStack, player, taken); + if (!level.isClientSide()) { +@@ -104,8 +_,13 @@ + public void checkExtraContent(final @Nullable LivingEntity user, final Level level, final ItemStack itemStack, final BlockPos pos) { } + @Deprecated //Forge: use the ItemStack sensitive version @Override - public boolean emptyContents(@Nullable LivingEntity p_392717_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_) { -+ return this.emptyContents(p_392717_, p_150717_, p_150718_, p_150719_, null); + public boolean emptyContents(final @Nullable LivingEntity user, final Level level, final BlockPos pos, final @Nullable BlockHitResult hitResult) { ++ return this.emptyContents(user, level, pos, hitResult, null); + } + -+ public boolean emptyContents(@Nullable LivingEntity p_392717_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_, @Nullable ItemStack container) { - if (!(this.content instanceof FlowingFluid flowingfluid)) { ++ public boolean emptyContents(final @Nullable LivingEntity user, final Level level, final BlockPos pos, final @Nullable BlockHitResult hitResult, final @Nullable ItemStack containerItem) { + if (!(this.content instanceof FlowingFluid flowingFluid)) { return false; } else { -@@ -110,8 +_,12 @@ - || $$7 instanceof LiquidBlockContainer liquidblockcontainer - && liquidblockcontainer.canPlaceLiquid(p_392717_, p_150717_, p_150718_, blockstate, this.content); - boolean flag3 = blockstate.isAir() || flag2 && (!flag1 || p_150719_ == null); -+ java.util.Optional containedFluidStack = java.util.Optional.ofNullable(container).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained); - if (!flag3) { -- return p_150719_ != null && this.emptyContents(p_392717_, p_150717_, p_150719_.getBlockPos().relative(p_150719_.getDirection()), null); -+ return p_150719_ != null && this.emptyContents(p_392717_, p_150717_, p_150719_.getBlockPos().relative(p_150719_.getDirection()), null, container); -+ } else if (containedFluidStack.isPresent() && this.content.getFluidType().isVaporizedOnPlacement(p_150717_, p_150718_, containedFluidStack.get())) { -+ this.content.getFluidType().onVaporize(p_392717_, p_150717_, p_150718_, containedFluidStack.get()); +@@ -116,8 +_,14 @@ + boolean placeLiquid = mayReplace + || block instanceof LiquidBlockContainer container && container.canPlaceLiquid(user, level, pos, blockState, this.content); + boolean canPlaceFluidInsideBlock = blockState.isAir() || placeLiquid && (!shiftKeyDown || hitResult == null); ++ var containedFluidStack = java.util.Optional.ofNullable(containerItem).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained); + if (!canPlaceFluidInsideBlock) { +- return hitResult != null && this.emptyContents(user, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null); ++ return hitResult != null && this.emptyContents(user, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, containerItem); ++ } ++ ++ if (containedFluidStack.isPresent() && this.content.getFluidType().isVaporizedOnPlacement(level, pos, containedFluidStack.get())) { ++ this.content.getFluidType().onVaporize(user, level, pos, containedFluidStack.get()); + return true; - } else if (p_150717_.environmentAttributes().getValue(EnvironmentAttributes.WATER_EVAPORATES, p_150718_) && this.content.is(FluidTags.WATER)) { - int l = p_150718_.getX(); - int i = p_150718_.getY(); -@@ -138,7 +_,7 @@ + } + + if (level.environmentAttributes().getValue(EnvironmentAttributes.WATER_EVAPORATES, pos) && this.content.is(FluidTags.WATER)) { +@@ -132,7 +_,7 @@ } return true; -- } else if ($$7 instanceof LiquidBlockContainer liquidblockcontainer1 && this.content == Fluids.WATER) { -+ } else if ($$7 instanceof LiquidBlockContainer liquidblockcontainer1 && liquidblockcontainer1.canPlaceLiquid(p_392717_, p_150717_, p_150718_, blockstate, content) && this.content == Fluids.WATER) { - liquidblockcontainer1.placeLiquid(p_150717_, p_150718_, blockstate, flowingfluid.getSource(false)); - this.playEmptySound(p_392717_, p_150717_, p_150718_); +- } else if (block instanceof LiquidBlockContainer container && this.content == Fluids.WATER) { ++ } else if (block instanceof LiquidBlockContainer container && container.canPlaceLiquid(user, level, pos, blockState, content) && this.content == Fluids.WATER) { + container.placeLiquid(level, pos, blockState, flowingFluid.getSource(false)); + this.playEmptySound(user, level, pos); return true; -@@ -159,8 +_,33 @@ +@@ -153,8 +_,33 @@ - protected void playEmptySound(@Nullable LivingEntity p_393933_, LevelAccessor p_40697_, BlockPos p_40698_) { - SoundEvent soundevent = this.content.is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY; -+ var custom = this.content.getFluidType().getSound(p_393933_, p_40697_, p_40698_, net.minecraftforge.common.SoundActions.BUCKET_EMPTY); + protected void playEmptySound(final @Nullable LivingEntity user, final LevelAccessor level, final BlockPos pos) { + SoundEvent soundEvent = this.content.is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY; ++ var custom = this.content.getFluidType().getSound(user, level, pos, net.minecraftforge.common.SoundActions.BUCKET_EMPTY); + if (custom != null) { -+ soundevent = custom; ++ soundEvent = custom; + } - p_40697_.playSound(p_393933_, p_40698_, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); - p_40697_.gameEvent(p_393933_, GameEvent.FLUID_PLACE, p_40698_); + level.playSound(user, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); + level.gameEvent(user, GameEvent.FLUID_PLACE, pos); + } + + /** Forge: TODO: Forge ItemStack capabilities - Lex 042724 diff --git a/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch b/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch index 0e18379e1f..9b1a179268 100644 --- a/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BundleItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/BundleItem.java +++ b/net/minecraft/world/item/BundleItem.java -@@ -86,6 +_,7 @@ - - @Override - public boolean overrideOtherStackedOnMe(ItemStack p_150742_, ItemStack p_150743_, Slot p_150744_, ClickAction p_150745_, Player p_150746_, SlotAccess p_150747_) { -+ if (p_150742_.getCount() != 1) return false; - if (p_150745_ == ClickAction.PRIMARY && p_150743_.isEmpty()) { - toggleSelectedItem(p_150742_, -1); +@@ -97,6 +_,7 @@ + public boolean overrideOtherStackedOnMe( + final ItemStack self, final ItemStack other, final Slot slot, final ClickAction clickAction, final Player player, final SlotAccess carriedItem + ) { ++ if (other.getCount() != 1) return false; + if (clickAction == ClickAction.PRIMARY && other.isEmpty()) { + toggleSelectedItem(self, -1); return false; diff --git a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch index a42456a195..428c06f7a2 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 -@@ -27,6 +_,12 @@ +@@ -25,6 +_,12 @@ private Set displayItemsSearchTab = ItemStackLinkedSet.createTypeAndComponentsSet(); private final Supplier iconGenerator; private final CreativeModeTab.DisplayItemsGenerator displayItemsGenerator; @@ -11,22 +11,22 @@ + public final java.util.List tabsBefore; + public final java.util.List tabsAfter; - CreativeModeTab( - CreativeModeTab.Row p_260217_, -@@ -34,7 +_,8 @@ - CreativeModeTab.Type p_260176_, - Component p_260100_, - Supplier p_259543_, -- CreativeModeTab.DisplayItemsGenerator p_259085_ -+ CreativeModeTab.DisplayItemsGenerator p_259085_, + private CreativeModeTab( + final CreativeModeTab.Row row, +@@ -32,7 +_,8 @@ + final CreativeModeTab.Type type, + final Component displayName, + final Supplier iconGenerator, +- final CreativeModeTab.DisplayItemsGenerator displayItemsGenerator ++ final CreativeModeTab.DisplayItemsGenerator displayItemsGenerator, + Builder builder ) { - this.row = p_260217_; - this.column = p_259557_; -@@ -42,12 +_,27 @@ - this.iconGenerator = p_259543_; - this.displayItemsGenerator = p_259085_; - this.type = p_260176_; + this.row = row; + this.column = column; +@@ -40,12 +_,27 @@ + this.iconGenerator = iconGenerator; + this.displayItemsGenerator = displayItemsGenerator; + this.type = type; + this.hasSearchBar = builder.hasSearchBar; + this.searchBarWidth = builder.searchBarWidth; + this.labelColor = builder.labelColor; @@ -43,25 +43,25 @@ + return new CreativeModeTab.Builder(Row.TOP, 0); } - public static Identifier createTextureLocation(String p_343491_) { - return Identifier.withDefaultNamespace("textures/gui/container/creative_inventory/tab_" + p_343491_ + ".png"); + public static Identifier createTextureLocation(final String name) { + return Identifier.withDefaultNamespace("textures/gui/container/creative_inventory/tab_" + name + ".png"); } + /** @deprecated Forge: use {@link #builder()} **/ - public static CreativeModeTab.Builder builder(CreativeModeTab.Row p_259342_, int p_260312_) { - return new CreativeModeTab.Builder(p_259342_, p_260312_); + public static CreativeModeTab.Builder builder(final CreativeModeTab.Row row, final int column) { + return new CreativeModeTab.Builder(row, column); } -@@ -105,7 +_,7 @@ - ResourceKey resourcekey = BuiltInRegistries.CREATIVE_MODE_TAB - .getResourceKey(this) - .orElseThrow(() -> new IllegalStateException("Unregistered creative tab: " + this)); -- this.displayItemsGenerator.accept(p_270156_, creativemodetab$itemdisplaybuilder); -+ net.minecraftforge.common.ForgeHooks.onCreativeModeTabBuildContents(this, resourcekey, this.displayItemsGenerator, p_270156_, creativemodetab$itemdisplaybuilder); - this.displayItems = creativemodetab$itemdisplaybuilder.tabContents; - this.displayItemsSearchTab = creativemodetab$itemdisplaybuilder.searchTabContents; +@@ -100,7 +_,7 @@ + + public void buildContents(final CreativeModeTab.ItemDisplayParameters parameters) { + CreativeModeTab.ItemDisplayBuilder displayList = new CreativeModeTab.ItemDisplayBuilder(this, parameters.enabledFeatures); +- this.displayItemsGenerator.accept(parameters, displayList); ++ net.minecraftforge.common.ForgeHooks.onCreativeModeTabBuildContents(this, this.displayItemsGenerator, parameters, displayList); + this.displayItems = displayList.tabContents; + this.displayItemsSearchTab = displayList.searchTabContents; } -@@ -122,6 +_,22 @@ - return this.displayItemsSearchTab.contains(p_259317_); +@@ -117,6 +_,22 @@ + return this.displayItemsSearchTab.contains(stack); } + public boolean hasSearchBar() { @@ -81,9 +81,9 @@ + } + public static class Builder { - private static final CreativeModeTab.DisplayItemsGenerator EMPTY_GENERATOR = (p_270422_, p_259433_) -> {}; + private static final CreativeModeTab.DisplayItemsGenerator EMPTY_GENERATOR = (parameters, output) -> {}; private final CreativeModeTab.Row row; -@@ -134,6 +_,14 @@ +@@ -129,6 +_,14 @@ private boolean alignedRight = false; private CreativeModeTab.Type type = CreativeModeTab.Type.CATEGORY; private Identifier backgroundTexture = CreativeModeTab.DEFAULT_BACKGROUND; @@ -96,19 +96,19 @@ + private final java.util.List tabsBefore = new java.util.ArrayList<>(); + private final java.util.List tabsAfter = new java.util.ArrayList<>(); - public Builder(CreativeModeTab.Row p_259171_, int p_259661_) { - this.row = p_259171_; -@@ -172,6 +_,9 @@ + public Builder(final CreativeModeTab.Row row, final int column) { + this.row = row; +@@ -167,6 +_,9 @@ - protected CreativeModeTab.Builder type(CreativeModeTab.Type p_259283_) { - this.type = p_259283_; -+ if (p_259283_ == Type.SEARCH) { + protected CreativeModeTab.Builder type(final CreativeModeTab.Type type) { + this.type = type; ++ if (type == Type.SEARCH) { + return this.withSearchBar(); + } return this; } -@@ -180,13 +_,80 @@ +@@ -175,12 +_,81 @@ return this; } @@ -184,11 +184,10 @@ public CreativeModeTab build() { if ((this.type == CreativeModeTab.Type.HOTBAR || this.type == CreativeModeTab.Type.INVENTORY) && this.displayItemsGenerator != EMPTY_GENERATOR) { throw new IllegalStateException("Special tabs can't have display items"); - } else { -- CreativeModeTab creativemodetab = new CreativeModeTab( -- this.row, this.column, this.type, this.displayName, this.iconGenerator, this.displayItemsGenerator -- ); -+ CreativeModeTab creativemodetab = this.tabFactory.apply(this); - creativemodetab.alignedRight = this.alignedRight; - creativemodetab.showTitle = this.showTitle; - creativemodetab.canScroll = this.canScroll; + } + +- CreativeModeTab tab = new CreativeModeTab(this.row, this.column, this.type, this.displayName, this.iconGenerator, this.displayItemsGenerator); ++ CreativeModeTab tab = this.tabFactory.apply(this); + tab.alignedRight = this.alignedRight; + tab.showTitle = this.showTitle; + tab.canScroll = this.canScroll; diff --git a/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch b/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch index f29e9cbbe8..1874ab130d 100644 --- a/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/CrossbowItem.java +++ b/net/minecraft/world/item/CrossbowItem.java -@@ -163,6 +_,7 @@ - Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_, @Nullable LivingEntity p_329478_ +@@ -185,6 +_,7 @@ + final @Nullable LivingEntity targetOverride ) { - if (p_40888_ instanceof ServerLevel serverlevel) { -+ if (p_40889_ instanceof Player player && net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40891_, p_40889_.level(), player, 1, true) < 0) return; - ChargedProjectiles chargedprojectiles = p_40891_.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); - if (chargedprojectiles != null && !chargedprojectiles.isEmpty()) { - this.shoot( + if (level instanceof ServerLevel serverLevel) { ++ if (shooter instanceof Player player && net.minecraftforge.event.ForgeEventFactory.onArrowLoose(weapon, shooter.level(), player, 1, true) < 0) return; + ChargedProjectiles charged = weapon.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); + if (charged != null && !charged.isEmpty()) { + this.shoot(serverLevel, shooter, hand, weapon, charged.itemCopies(), power, uncertainty, shooter instanceof Player, targetOverride); diff --git a/patches/minecraft/net/minecraft/world/item/DispensibleContainerItem.java.patch b/patches/minecraft/net/minecraft/world/item/DispensibleContainerItem.java.patch index 503aa7307f..0ee3d949cc 100644 --- a/patches/minecraft/net/minecraft/world/item/DispensibleContainerItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DispensibleContainerItem.java.patch @@ -6,9 +6,9 @@ -public interface DispensibleContainerItem { +public interface DispensibleContainerItem extends net.minecraftforge.common.extensions.IForgeDispensibleContainerItem { - default void checkExtraContent(@Nullable LivingEntity p_391486_, Level p_150818_, ItemStack p_150819_, BlockPos p_150820_) { + default void checkExtraContent(final @Nullable LivingEntity user, final Level level, final ItemStack itemStack, final BlockPos pos) { } + @Deprecated //Forge: use the ItemStack sensitive version - boolean emptyContents(@Nullable LivingEntity p_396492_, Level p_150822_, BlockPos p_150823_, @Nullable BlockHitResult p_150824_); + boolean emptyContents(final @Nullable LivingEntity user, final Level level, final BlockPos pos, final @Nullable BlockHitResult hitResult); } diff --git a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch index 9dd5d9bfa8..b7f6c100bf 100644 --- a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java -@@ -52,6 +_,8 @@ +@@ -60,6 +_,8 @@ private final int textureDiffuseColor; private final int fireworkColor; private final int textColor; + private final net.minecraft.tags.TagKey dyesTag; + private final net.minecraft.tags.TagKey dyedTag; - private DyeColor(final int p_41046_, final String p_41047_, final int p_41048_, final MapColor p_285297_, final int p_41050_, final int p_41051_) { - this.id = p_41046_; -@@ -60,6 +_,8 @@ - this.textColor = ARGB.opaque(p_41051_); - this.textureDiffuseColor = ARGB.opaque(p_41048_); - this.fireworkColor = p_41050_; -+ this.dyesTag = net.minecraft.tags.ItemTags.create("c", "dyes/" + p_41047_); -+ this.dyedTag = net.minecraft.tags.ItemTags.create("c", "dyed/" + p_41047_); + DyeColor( + final int id, +@@ -77,6 +_,8 @@ + this.textColor = ARGB.opaque(textColor); + this.textureDiffuseColor = ARGB.opaque(textureDiffuseColor); + this.fireworkColor = fireworkColor; ++ this.dyesTag = net.minecraft.tags.ItemTags.create("c", "dyes/" + name); ++ this.dyedTag = net.minecraft.tags.ItemTags.create("c", "dyed/" + name); } public int getId() { -@@ -108,6 +_,27 @@ +@@ -129,6 +_,27 @@ @Override public String getSerializedName() { return this.name; @@ -45,4 +45,4 @@ + return net.minecraftforge.common.ForgeHooks.getDyeColorFromItemStack(stack); } - public static DyeColor getMixedColor(ServerLevel p_377753_, DyeColor p_378336_, DyeColor p_376650_) { + public static DyeColor getMixedColor(final ServerLevel level, final DyeColor dyeColor1, final DyeColor dyeColor2) { diff --git a/patches/minecraft/net/minecraft/world/item/FishingRodItem.java.patch b/patches/minecraft/net/minecraft/world/item/FishingRodItem.java.patch index 6f042c101a..4f670b94f4 100644 --- a/patches/minecraft/net/minecraft/world/item/FishingRodItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/FishingRodItem.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/item/FishingRodItem.java +++ b/net/minecraft/world/item/FishingRodItem.java @@ -24,7 +_,11 @@ - if (p_41291_.fishing != null) { - if (!p_41290_.isClientSide()) { - int i = p_41291_.fishing.retrieve(itemstack); -+ ItemStack original = itemstack.copy(); - itemstack.hurtAndBreak(i, p_41291_, p_41292_.asEquipmentSlot()); -+ if (itemstack.isEmpty()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_41291_, original, p_41292_.asEquipmentSlot()); + if (player.fishing != null) { + if (!level.isClientSide()) { + int dmg = player.fishing.retrieve(itemStack); ++ ItemStack original = itemStack.copy(); + itemStack.hurtAndBreak(dmg, player, hand.asEquipmentSlot()); ++ if (itemStack.isEmpty()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, original, hand.asEquipmentSlot()); + } } - p_41290_.playSound( + level.playSound( @@ -60,5 +_,10 @@ } diff --git a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch index d99cd9c232..590f71809b 100644 --- a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch @@ -14,19 +14,19 @@ ImmutableMap.of( Blocks.GRASS_BLOCK, @@ -44,7 +_,8 @@ - public InteractionResult useOn(UseOnContext p_41341_) { - Level level = p_41341_.getLevel(); - BlockPos blockpos = p_41341_.getClickedPos(); -- Pair, Consumer> pair = TILLABLES.get(level.getBlockState(blockpos).getBlock()); -+ BlockState toolModifiedState = level.getBlockState(blockpos).getToolModifiedState(p_41341_, net.minecraftforge.common.ToolActions.HOE_TILL, false); -+ Pair, Consumer> pair = toolModifiedState == null ? null : Pair.of(ctx -> true, changeIntoState(toolModifiedState)); - if (pair == null) { + public InteractionResult useOn(final UseOnContext context) { + Level level = context.getLevel(); + BlockPos pos = context.getClickedPos(); +- Pair, Consumer> logicPair = TILLABLES.get(level.getBlockState(pos).getBlock()); ++ BlockState toolModifiedState = level.getBlockState(pos).getToolModifiedState(context, net.minecraftforge.common.ToolActions.HOE_TILL, false); ++ Pair, Consumer> logicPair = toolModifiedState == null ? null : Pair.of(ctx -> true, changeIntoState(toolModifiedState)); + if (logicPair == null) { return InteractionResult.PASS; - } else { + } @@ -84,5 +_,10 @@ - public static boolean onlyIfAirAbove(UseOnContext p_150857_) { - return p_150857_.getClickedFace() != Direction.DOWN && p_150857_.getLevel().getBlockState(p_150857_.getClickedPos().above()).isAir(); + public static boolean onlyIfAirAbove(final UseOnContext context) { + return context.getClickedFace() != Direction.DOWN && context.getLevel().getBlockState(context.getClickedPos().above()).isAir(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/item/Item.java.patch b/patches/minecraft/net/minecraft/world/item/Item.java.patch index 1ebf4958ee..6643c1cfdd 100644 --- a/patches/minecraft/net/minecraft/world/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Item.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -95,7 +_,7 @@ +@@ -96,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; --public class Item implements FeatureElement, ItemLike { -+public class Item implements FeatureElement, ItemLike, net.minecraftforge.common.extensions.IForgeItem { +-public class Item implements ItemLike, FeatureElement { ++public class Item implements ItemLike, FeatureElement, net.minecraftforge.common.extensions.IForgeItem { public static final Codec> CODEC = BuiltInRegistries.ITEM .holderByNameCodec() - .validate( -@@ -105,7 +_,7 @@ - ); - public static final StreamCodec> STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.ITEM); + .validate(item -> item.is(Items.AIR.builtInRegistryHolder()) ? DataResult.error(() -> "Item must not be minecraft:air") : DataResult.success(item)); +@@ -107,7 +_,7 @@ + : DataResult.success(item) + ); private static final Logger LOGGER = LogUtils.getLogger(); - public static final Map BY_BLOCK = Maps.newHashMap(); + public static final Map BY_BLOCK = net.minecraftforge.registries.GameData.ItemCallbacks.getBlockItemMap(); public static final Identifier BASE_ATTACK_DAMAGE_ID = Identifier.withDefaultNamespace("base_attack_damage"); public static final Identifier BASE_ATTACK_SPEED_ID = Identifier.withDefaultNamespace("base_attack_speed"); public static final int DEFAULT_MAX_STACK_SIZE = 64; -@@ -142,6 +_,7 @@ - LOGGER.error("Item classes should end with Item and {} doesn't.", s); +@@ -146,6 +_,7 @@ + LOGGER.error("Item classes should end with Item and {} doesn't.", className); } } + initClient(); } @Deprecated -@@ -149,17 +_,25 @@ +@@ -153,8 +_,15 @@ return this.builtInRegistryHolder; } @@ -34,36 +34,33 @@ + private DataComponentMap builtComponents = null; + public DataComponentMap components() { -- return this.components; +- return this.builtInRegistryHolder.components(); + if (builtComponents == null) { -+ builtComponents = net.minecraftforge.common.ForgeHooks.gatherItemComponents(this, components); ++ builtComponents = net.minecraftforge.common.ForgeHooks.gatherItemComponents(this, this.builtInRegistryHolder.components()); + } + + return builtComponents; } public int getDefaultMaxStackSize() { -- return this.components.getOrDefault(DataComponents.MAX_STACK_SIZE, 1); -+ return builtComponents == null ? this.components.getOrDefault(DataComponents.MAX_STACK_SIZE, 1) : this.builtComponents.getOrDefault(DataComponents.MAX_STACK_SIZE, 1); - } - - public void onUseTick(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { +@@ -164,6 +_,7 @@ + public void onUseTick(final Level level, final LivingEntity livingEntity, final ItemStack itemStack, final int ticksRemaining) { } + /** @deprecated Forge: {@link net.minecraftforge.common.extensions.IForgeItem#onDestroyed(ItemEntity, DamageSource) Use damage source sensitive version} */ - public void onDestroyed(ItemEntity p_150887_) { + public void onDestroyed(final ItemEntity itemEntity) { } -@@ -276,6 +_,8 @@ +@@ -282,6 +_,8 @@ return BuiltInRegistries.ITEM.wrapAsHolder(this).getRegisteredName(); } + /** Forge: use {@link ItemStack#getCraftingRemainder()}. */ + @Deprecated - public final ItemStack getCraftingRemainder() { - return this.craftingRemainingItem == null ? ItemStack.EMPTY : new ItemStack(this.craftingRemainingItem); + public final @Nullable ItemStackTemplate getCraftingRemainder() { + return this.craftingRemainingItem; } -@@ -366,6 +_,30 @@ +@@ -374,6 +_,30 @@ return false; } @@ -92,9 +89,9 @@ + public void initializeClient(java.util.function.Consumer consumer) { } + public static class Properties { - private static final DependantName BLOCK_DESCRIPTION_ID = p_449793_ -> Util.makeDescriptionId("block", p_449793_.identifier()); - private static final DependantName ITEM_DESCRIPTION_ID = p_449792_ -> Util.makeDescriptionId("item", p_449792_.identifier()); -@@ -683,6 +_,11 @@ + private static final DependantName BLOCK_DESCRIPTION_ID = id -> Util.makeDescriptionId("block", id.identifier()); + private static final DependantName ITEM_DESCRIPTION_ID = id -> Util.makeDescriptionId("item", id.identifier()); +@@ -722,6 +_,11 @@ boolean isPeaceful(); @@ -103,18 +100,18 @@ + return null; + } + - static Item.TooltipContext of(final @Nullable Level p_332083_) { - return p_332083_ == null ? EMPTY : new Item.TooltipContext() { + static Item.TooltipContext of(final @Nullable Level level) { + return level == null ? EMPTY : new Item.TooltipContext() { @Override -@@ -703,6 +_,11 @@ +@@ -742,6 +_,11 @@ @Override public boolean isPeaceful() { - return p_332083_.getDifficulty() == Difficulty.PEACEFUL; + return level.getDifficulty() == Difficulty.PEACEFUL; + } + + @Override + public Level level() { -+ return p_332083_; ++ return level; } }; } diff --git a/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch b/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch index 7cafbc478e..1edea0db85 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch @@ -20,9 +20,9 @@ private byte id; private final String name; - private ItemDisplayContext(final int p_270624_, final String p_270851_) { - this.name = p_270851_; - this.id = (byte)p_270624_; + ItemDisplayContext(final int id, final String name) { + this.name = name; + this.id = (byte)id; + this.isModded = false; + this.fallback = null; } diff --git a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch index dda9b33ea8..559de64dbb 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch @@ -1,110 +1,111 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -104,7 +_,7 @@ +@@ -99,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; --public final class ItemStack implements DataComponentHolder { -+public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider.ItemStacks implements DataComponentHolder, net.minecraftforge.common.extensions.IForgeItemStack { +-public final class ItemStack implements DataComponentHolder, ItemInstance { ++public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider.ItemStacks implements DataComponentHolder, ItemInstance, net.minecraftforge.common.extensions.IForgeItemStack { private static final List OP_NBT_WARNING = List.of( Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD), Component.translatable("item.op_warning.line2").withStyle(ChatFormatting.RED), -@@ -273,12 +_,15 @@ +@@ -257,12 +_,15 @@ } - private ItemStack(ItemLike p_331826_, int p_332766_, PatchedDataComponentMap p_333722_) { + private ItemStack(final Holder item, final int count, final PatchedDataComponentMap components) { + super(true); - this.item = p_331826_.asItem(); - this.count = p_332766_; - this.components = p_333722_; -+ gatherCapabilities(() -> this.item.getCapabilityProvider(this)); + this.item = item; + this.count = count; + this.components = components; ++ gatherCapabilities(() -> this.item.get().getCapabilityProvider(this)); } - private ItemStack(@Nullable Void p_282703_) { + private ItemStack(final @Nullable Void nullMarker) { + super(false); this.item = null; this.components = new PatchedDataComponentMap(DataComponentMap.EMPTY); } -@@ -359,13 +_,22 @@ +@@ -355,6 +_,15 @@ } - public InteractionResult useOn(UseOnContext p_41662_) { -+ if (!p_41662_.getLevel().isClientSide()) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(p_41662_); -+ return onItemUse(p_41662_, (c) -> getItem().useOn(p_41662_)); + public InteractionResult useOn(final UseOnContext context) { ++ if (!context.getLevel().isClientSide()) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(context); ++ return onItemUse(context, (c) -> getItem().useOn(context)); + } + -+ public InteractionResult onItemUseFirst(UseOnContext p_41662_) { -+ return onItemUse(p_41662_, (c) -> getItem().onItemUseFirst(this, p_41662_)); ++ public InteractionResult onItemUseFirst(UseOnContext context) { ++ return onItemUse(context, (c) -> getItem().onItemUseFirst(this, context)); + } + -+ private InteractionResult onItemUse(UseOnContext p_41662_, java.util.function.Function callback) { - Player player = p_41662_.getPlayer(); - BlockPos blockpos = p_41662_.getClickedPos(); - if (player != null && !player.getAbilities().mayBuild && !this.canPlaceOnBlockInAdventureMode(new BlockInWorld(p_41662_.getLevel(), blockpos, false))) { - return InteractionResult.PASS; - } else { - Item item = this.getItem(); -- InteractionResult interactionresult = item.useOn(p_41662_); -+ InteractionResult interactionresult = callback.apply(p_41662_); - if (player != null && interactionresult instanceof InteractionResult.Success interactionresult$success && interactionresult$success.wasItemInteraction()) { - player.awardStat(Stats.ITEM_USED.get(item)); - } -@@ -450,18 +_,26 @@ ++ private InteractionResult onItemUse(UseOnContext context, java.util.function.Function callback) { + Player player = context.getPlayer(); + BlockPos pos = context.getClickedPos(); + if (player != null && !player.getAbilities().mayBuild && !this.canPlaceOnBlockInAdventureMode(new BlockInWorld(context.getLevel(), pos, false))) { +@@ -362,7 +_,7 @@ + } + + Item usedItem = this.getItem(); +- InteractionResult result = usedItem.useOn(context); ++ InteractionResult result = callback.apply(context); + if (player != null && result instanceof InteractionResult.Success success && success.wasItemInteraction()) { + player.awardStat(Stats.ITEM_USED.get(usedItem)); + } +@@ -442,18 +_,26 @@ } - public void hurtAndBreak(int p_220158_, ServerLevel p_342197_, @Nullable ServerPlayer p_220160_, Consumer p_343361_) { -- int i = this.processDurabilityChange(p_220158_, p_342197_, p_220160_); + public void hurtAndBreak(final int amount, final ServerLevel level, final @Nullable ServerPlayer player, final Consumer onBreak) { +- int newAmount = this.processDurabilityChange(amount, level, player); + // FORGE: use context-sensitive sister of processDurabilityChange that calls IForgeItem.damageItem -+ int i = this.processDurabilityChange(p_220158_, p_342197_, p_220160_, true, p_343361_); - if (i != 0) { - this.applyDamage(this.getDamageValue() + i, p_220160_, p_343361_); ++ int newAmount = this.processDurabilityChange(amount, level, player, true, onBreak); + if (newAmount != 0) { + this.applyDamage(this.getDamageValue() + newAmount, player, onBreak); } } - private int processDurabilityChange(int p_362423_, ServerLevel p_364910_, @Nullable ServerPlayer p_365570_) { -+ return this.processDurabilityChange(p_362423_, p_364910_, p_365570_, false, p_359411_ -> { }); + private int processDurabilityChange(final int amount, final ServerLevel level, final @Nullable ServerPlayer player) { ++ return this.processDurabilityChange(amount, level, player, false, item -> { }); + } + + /** FORGE: context-sensitive sister of processDurabilityChange that calls IForgeItem.damageItem */ -+ private int processDurabilityChange(int p_362423_, ServerLevel p_364910_, @Nullable ServerPlayer p_365570_, boolean canBreak, Consumer onBreak) { ++ private int processDurabilityChange(int amount, final ServerLevel level, final @Nullable ServerPlayer player, final boolean canBreak, final Consumer onBreak) { if (!this.isDamageableItem()) { return 0; - } else if (p_365570_ != null && p_365570_.hasInfiniteMaterials()) { + } else if (player != null && player.hasInfiniteMaterials()) { return 0; } else { + // FORGE: modify the base damage based on the item's impl of IForgeItem.damageItem -+ p_362423_ = this.damageItem(p_362423_, p_364910_, p_365570_, canBreak, onBreak); - return p_362423_ > 0 ? EnchantmentHelper.processDurabilityChange(p_364910_, this, p_362423_) : p_362423_; ++ amount = this.damageItem(amount, level, player, canBreak, onBreak); + return amount > 0 ? EnchantmentHelper.processDurabilityChange(level, this, amount) : amount; } } -@@ -501,7 +_,13 @@ - p_41623_, - serverlevel, - p_41624_ instanceof ServerPlayer serverplayer ? serverplayer : null, -- p_341563_ -> p_41624_.onEquippedItemBroken(p_341563_, p_335324_) -+ p_341563_ -> { -+ if (p_41624_ instanceof Player player) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, this, p_335324_); -+ if (player.getUseItem() == this) player.stopUsingItem(); // Forge: fix MC-168573 +@@ -490,7 +_,13 @@ + public void hurtAndBreak(final int amount, final LivingEntity owner, final EquipmentSlot slot) { + if (owner.level() instanceof ServerLevel serverLevel) { + this.hurtAndBreak( +- amount, serverLevel, owner instanceof ServerPlayer player ? player : null, brokenItem -> owner.onEquippedItemBroken(brokenItem, slot) ++ amount, serverLevel, owner instanceof ServerPlayer player ? player : null, brokenItem -> { ++ if (owner instanceof Player ownerPlayer) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(ownerPlayer, this, slot); ++ if (ownerPlayer.getUseItem() == this) ownerPlayer.stopUsingItem(); // Forge: fix MC-168573 + } -+ p_41624_.onEquippedItemBroken(p_341563_, p_335324_); ++ owner.onEquippedItemBroken(brokenItem, slot); + } ); } } -@@ -854,6 +_,7 @@ - List list = Lists.newArrayList(); - list.add(this.getStyledHoverName()); - this.addDetailsToTooltip(p_331329_, tooltipdisplay, p_41652_, p_41653_, list::add); -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_41652_, list, p_41653_); - return list; +@@ -857,6 +_,7 @@ + List lines = Lists.newArrayList(); + lines.add(this.getStyledHoverName()); + this.addDetailsToTooltip(context, display, player, tooltipFlag, lines::add); ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, player, lines, tooltipFlag, context, display); + return lines; } } -@@ -1110,6 +_,7 @@ +@@ -1105,6 +_,7 @@ } } + /** @deprecated Forge: Use {@linkplain net.minecraftforge.common.extensions.IForgeItemStack#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ - public void onDestroyed(ItemEntity p_150925_) { - this.getItem().onDestroyed(p_150925_); + public void onDestroyed(final ItemEntity itemEntity) { + this.getItem().onDestroyed(itemEntity); } diff --git a/patches/minecraft/net/minecraft/world/item/Items.java.patch b/patches/minecraft/net/minecraft/world/item/Items.java.patch index 75a7691505..3e3e617bf7 100644 --- a/patches/minecraft/net/minecraft/world/item/Items.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Items.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -2320,7 +_,25 @@ +@@ -2099,7 +_,25 @@ } - public static Item registerBlock(Block p_252092_, Block... p_248886_) { -- Item item = registerBlock(p_252092_); -+ Item item = registerBlock(p_252092_, (block_, prop_) -> { + private static Item registerBlock(final BlockItemId id, final Block block, final Block... alternatives) { +- Item item = registerBlock(id, block); ++ Item item = registerBlock(id, block, (block_, prop_) -> { + return new BlockItem(block_, prop_) { + @Override + public void registerBlocks(java.util.Map map, Item self) { + super.registerBlocks(map, self); -+ for (var b : p_248886_) { ++ for (var b : alternatives) { + map.put(b, self); + } + } @@ -18,23 +18,23 @@ + @Override + public void removeFromBlockToItemMap(java.util.Map map, Item self) { + super.removeFromBlockToItemMap(map, self); -+ for (var b : p_248886_) { ++ for (var b : alternatives) { + map.remove(b); + } + } + }; + }); - for (Block block : p_248886_) { - Item.BY_BLOCK.put(block, item); -@@ -2359,10 +_,6 @@ + for (Block alternative : alternatives) { + Item.BY_BLOCK.put(alternative, item); +@@ -2140,10 +_,6 @@ - public static Item registerItem(ResourceKey p_364577_, Function p_366144_, Item.Properties p_369845_) { - Item item = p_366144_.apply(p_369845_.setId(p_364577_)); -- if (item instanceof BlockItem blockitem) { -- blockitem.registerBlocks(Item.BY_BLOCK, item); + private static Item registerItem(final ResourceKey id, final Function itemFactory, final Item.Properties properties) { + Item item = itemFactory.apply(properties.setId(id)); +- if (item instanceof BlockItem blockItem) { +- blockItem.registerBlocks(Item.BY_BLOCK, item); - } - - return Registry.register(BuiltInRegistries.ITEM, p_364577_, item); + return Registry.register(BuiltInRegistries.ITEM, id, item); } } diff --git a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch index d104208f6e..3201c6da54 100644 --- a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/MobBucketItem.java +++ b/net/minecraft/world/item/MobBucketItem.java -@@ -18,13 +_,18 @@ +@@ -21,13 +_,18 @@ import org.jspecify.annotations.Nullable; public class MobBucketItem extends BucketItem { @@ -10,11 +10,11 @@ + private final java.util.function.Supplier emptySoundSupplier; + @Deprecated - public MobBucketItem(EntityType p_151137_, Fluid p_151138_, SoundEvent p_151139_, Item.Properties p_151140_) { -- super(p_151138_, p_151140_); -- this.type = p_151137_; -- this.emptySound = p_151139_; -+ this(() -> p_151137_, () -> p_151138_, () -> p_151139_, p_151140_); + public MobBucketItem(final EntityType type, final Fluid content, final SoundEvent emptySound, final Item.Properties properties) { +- super(content, properties); +- this.type = type; +- this.emptySound = emptySound; ++ this(() -> type, () -> content, () -> emptySound, properties); + } + + public MobBucketItem(java.util.function.Supplier> entitySupplier, java.util.function.Supplier fluidSupplier, java.util.function.Supplier soundSupplier, Item.Properties properties) { @@ -24,31 +24,36 @@ } @Override -@@ -37,11 +_,11 @@ +@@ -40,11 +_,11 @@ @Override - protected void playEmptySound(@Nullable LivingEntity p_391719_, LevelAccessor p_151152_, BlockPos p_151153_) { -- p_151152_.playSound(p_391719_, p_151153_, this.emptySound, SoundSource.NEUTRAL, 1.0F, 1.0F); -+ p_151152_.playSound(p_391719_, p_151153_, this.getEmptySound(), SoundSource.NEUTRAL, 1.0F, 1.0F); + protected void playEmptySound(final @Nullable LivingEntity user, final LevelAccessor level, final BlockPos pos) { +- level.playSound(user, pos, this.emptySound, SoundSource.NEUTRAL, 1.0F, 1.0F); ++ level.playSound(user, pos, this.getEmptySound(), SoundSource.NEUTRAL, 1.0F, 1.0F); } - private void spawn(ServerLevel p_151142_, ItemStack p_151143_, BlockPos p_151144_) { -- Mob mob = this.type.create(p_151142_, EntityType.createDefaultStackConfig(p_151142_, p_151143_, null), p_151144_, EntitySpawnReason.BUCKET, true, false); -+ Mob mob = this.getFishType().create(p_151142_, EntityType.createDefaultStackConfig(p_151142_, p_151143_, null), p_151144_, EntitySpawnReason.BUCKET, true, false); + private void spawn(final ServerLevel level, final ItemStack itemStack, final BlockPos spawnPos) { +- Mob mob = this.type.create(level, EntityType.createDefaultStackConfig(level, itemStack, null), spawnPos, EntitySpawnReason.BUCKET, true, false); ++ Mob mob = this.getFishType().create(level, EntityType.createDefaultStackConfig(level, itemStack, null), spawnPos, EntitySpawnReason.BUCKET, true, false); if (mob instanceof Bucketable bucketable) { - CustomData customdata = p_151143_.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); - bucketable.loadFromBucketTag(customdata.copyTag()); -@@ -52,5 +_,13 @@ - p_151142_.addFreshEntityWithPassengers(mob); - mob.playAmbientSound(); + CustomData entityData = itemStack.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); + bucketable.loadFromBucketTag(entityData.copyTag()); +@@ -57,9 +_,17 @@ } -+ } -+ + } + + protected EntityType getFishType() { + return entityTypeSupplier.get(); + } + + protected SoundEvent getEmptySound() { + return emptySoundSupplier.get(); - } - } ++ } ++ + @Override + public boolean emptyContents(final @Nullable LivingEntity user, final Level level, final BlockPos pos, final @Nullable BlockHitResult hitResult) { +- if (this.content == Fluids.EMPTY) { ++ if (this.getContent() == Fluids.EMPTY) { + this.playEmptySound(user, level, pos); + return true; + } else { diff --git a/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch b/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch index e7e46f7976..cc2c0b2383 100644 --- a/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/item/ProjectileWeaponItem.java +++ b/net/minecraft/world/item/ProjectileWeaponItem.java -@@ -87,6 +_,7 @@ - protected Projectile createProjectile(Level p_333069_, LivingEntity p_334736_, ItemStack p_333680_, ItemStack p_329118_, boolean p_336242_) { - ArrowItem arrowitem = p_329118_.getItem() instanceof ArrowItem arrowitem1 ? arrowitem1 : (ArrowItem)Items.ARROW; - AbstractArrow abstractarrow = arrowitem.createArrow(p_333069_, p_329118_, p_334736_, p_333680_); -+ abstractarrow = customArrow(abstractarrow); - if (p_336242_) { - abstractarrow.setCritArrow(true); +@@ -95,6 +_,7 @@ + ) { + ArrowItem arrowItem = projectile.getItem() instanceof ArrowItem arrow ? arrow : (ArrowItem)Items.ARROW; + AbstractArrow arrow = arrowItem.createArrow(level, projectile, shooter, weapon); ++ arrow = customArrow(arrow); + if (isCrit) { + arrow.setCritArrow(true); } -@@ -101,9 +_,10 @@ - int i = p_335616_.level() instanceof ServerLevel serverlevel ? EnchantmentHelper.processProjectileCount(serverlevel, p_329054_, p_335616_, 1) : 1; - List list = new ArrayList<>(i); - ItemStack itemstack1 = p_328618_.copy(); -+ boolean infinite = p_328618_.getItem() instanceof ArrowItem arrow && arrow.isInfinite(p_328618_, p_329054_, p_335616_); +@@ -110,9 +_,10 @@ + int numProjectiles = shooter.level() instanceof ServerLevel serverLevel ? EnchantmentHelper.processProjectileCount(serverLevel, weapon, shooter, 1) : 1; + List drawn = new ArrayList<>(numProjectiles); + ItemStack projectileCopy = projectile.copy(); ++ boolean infinite = projectile.getItem() instanceof ArrowItem arrow && arrow.isInfinite(projectile, weapon, shooter); - for (int j = 0; j < i; j++) { -- ItemStack itemstack = useAmmo(p_329054_, j == 0 ? p_328618_ : itemstack1, p_335616_, j > 0); -+ ItemStack itemstack = useAmmo(p_329054_, j == 0 ? p_328618_ : itemstack1, p_335616_, j > 0 || infinite); - if (!itemstack.isEmpty()) { - list.add(itemstack); - } -@@ -131,5 +_,9 @@ - - return itemstack; + for (int i = 0; i < numProjectiles; i++) { +- ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0); ++ ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0 || infinite); + if (!drawnStack.isEmpty()) { + drawn.add(drawnStack); + } +@@ -141,5 +_,9 @@ } + + return used; + } + + public AbstractArrow customArrow(AbstractArrow arrow) { diff --git a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch index 2705968866..188a0fb9fe 100644 --- a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch @@ -1,31 +1,20 @@ --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java -@@ -83,4 +_,34 @@ - return super.useOn(p_186371_); +@@ -83,4 +_,23 @@ + return super.useOn(context); } } + + @Override + public InteractionResult interactLivingEntity(ItemStack stack, Player playerIn, LivingEntity entity, net.minecraft.world.InteractionHand hand) { -+ if (entity instanceof net.minecraftforge.common.IForgeShearable target) { -+ if (entity.level().isClientSide()) { -+ return InteractionResult.SUCCESS; -+ } ++ if (entity instanceof net.minecraft.world.entity.Shearable target) { ++ if (entity.level().isClientSide() || !target.readyForShearing()) ++ return InteractionResult.CONSUME; + var serverLevel = (net.minecraft.server.level.ServerLevel)entity.level(); -+ -+ BlockPos pos = BlockPos.containing(entity.position()); -+ if (target.isShearable(stack, entity.level(), pos)) { -+ var key = net.minecraft.world.item.enchantment.Enchantments.FORTUNE; -+ var drops = target.onSheared(playerIn, stack, entity.level(), pos, net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(entity.level().holderLookup(key.registryKey()).getOrThrow(key), stack)); -+ var rand = new java.util.Random(); -+ for (var drop : drops) { -+ var ent = entity.spawnAtLocation(serverLevel, drop, 1.0F); -+ ent.setDeltaMovement(ent.getDeltaMovement().add((double)((rand.nextFloat() - rand.nextFloat()) * 0.1F), (double)(rand.nextFloat() * 0.05F), (double)((rand.nextFloat() - rand.nextFloat()) * 0.1F))); -+ } -+ if (!drops.isEmpty()) -+ stack.hurtAndBreak(1, playerIn, hand.asEquipmentSlot()); -+ } -+ return InteractionResult.SUCCESS; ++ target.shear(serverLevel, SoundSource.PLAYERS, stack); ++ serverLevel.gameEvent(playerIn, GameEvent.SHEAR, entity.position()); ++ stack.hurtAndBreak(1, playerIn, hand.asEquipmentSlot()); ++ return InteractionResult.SUCCESS_SERVER; + } + return InteractionResult.PASS; + } diff --git a/patches/minecraft/net/minecraft/world/item/ShieldItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShieldItem.java.patch deleted file mode 100644 index a031feae79..0000000000 --- a/patches/minecraft/net/minecraft/world/item/ShieldItem.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/item/ShieldItem.java -+++ b/net/minecraft/world/item/ShieldItem.java -@@ -13,4 +_,10 @@ - DyeColor dyecolor = p_360971_.get(DataComponents.BASE_COLOR); - return (Component)(dyecolor != null ? Component.translatable(this.descriptionId + "." + dyecolor.getName()) : super.getName(p_360971_)); - } -+ -+ @Override -+ @Deprecated(forRemoval = true, since = "1.21.5") -+ public boolean canPerformAction(ItemStack stack, net.minecraftforge.common.ToolAction toolAction) { -+ return net.minecraftforge.common.ToolActions.DEFAULT_SHIELD_ACTIONS.contains(toolAction); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch index c4ceaa3010..8d0bc05084 100644 --- a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/item/ShovelItem.java +++ b/net/minecraft/world/item/ShovelItem.java -@@ -42,9 +_,9 @@ - return InteractionResult.PASS; - } else { - Player player = p_43119_.getPlayer(); -- BlockState blockstate1 = FLATTENABLES.get(blockstate.getBlock()); -+ BlockState blockstate1 = blockstate.getToolModifiedState(p_43119_, net.minecraftforge.common.ToolActions.SHOVEL_FLATTEN, false); - BlockState blockstate2 = null; -- if (blockstate1 != null && level.getBlockState(blockpos.above()).isAir()) { -+ if (blockstate1 != null && level.isEmptyBlock(blockpos.above())) { - level.playSound(player, blockpos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); - blockstate2 = blockstate1; - } else if (blockstate.getBlock() instanceof CampfireBlock && blockstate.getValue(CampfireBlock.LIT)) { +@@ -43,9 +_,9 @@ + } + + Player player = context.getPlayer(); +- BlockState newState = FLATTENABLES.get(blockState.getBlock()); ++ BlockState newState = blockState.getToolModifiedState(context, net.minecraftforge.common.ToolActions.SHOVEL_FLATTEN, false); + BlockState updatedState = null; +- if (newState != null && level.getBlockState(pos.above()).isAir()) { ++ if (newState != null && level.isEmptyBlock(pos.above())) { + level.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); + updatedState = newState; + } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { @@ -70,5 +_,15 @@ - return InteractionResult.PASS; - } + } else { + return InteractionResult.PASS; } + } + diff --git a/patches/minecraft/net/minecraft/world/item/StandingAndWallBlockItem.java.patch b/patches/minecraft/net/minecraft/world/item/StandingAndWallBlockItem.java.patch index 2141a23708..0b5d7a62c1 100644 --- a/patches/minecraft/net/minecraft/world/item/StandingAndWallBlockItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/StandingAndWallBlockItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/StandingAndWallBlockItem.java +++ b/net/minecraft/world/item/StandingAndWallBlockItem.java @@ -49,4 +_,9 @@ - super.registerBlocks(p_43252_, p_43253_); - p_43252_.put(this.wallBlock, p_43253_); + super.registerBlocks(map, item); + map.put(this.wallBlock, item); } + + public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { diff --git a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch index 7bb31b4fa2..b6321fc02b 100644 --- a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch @@ -1,19 +1,21 @@ --- a/net/minecraft/world/item/alchemy/PotionBrewing.java +++ b/net/minecraft/world/item/alchemy/PotionBrewing.java -@@ -19,15 +_,35 @@ +@@ -19,17 +_,37 @@ private final List containers; private final List> potionMixes; private final List> containerMixes; + private final List recipes; - PotionBrewing(List p_331253_, List> p_333814_, List> p_332419_) { -+ this(p_331253_, p_333814_, p_332419_, null); + private PotionBrewing( + final List containers, final List> potionMixes, final List> containerMixes + ) { ++ this(containers, potionMixes, containerMixes, null); + } + -+ PotionBrewing(List p_331253_, List> p_333814_, List> p_332419_, Builder builder) { - this.containers = p_331253_; - this.potionMixes = p_333814_; - this.containerMixes = p_332419_; ++ PotionBrewing(final List containers, final List> potionMixes, final List> containerMixes, Builder builder) { + this.containers = containers; + this.potionMixes = potionMixes; + this.containerMixes = containerMixes; + var tmp = new ArrayList(); + tmp.add(new net.minecraftforge.common.brewing.VanillaBrewingRecipe(this, this::mixVanilla)); + if (builder != null) { @@ -22,50 +24,50 @@ + this.recipes = java.util.Collections.unmodifiableList(tmp); } - public boolean isIngredient(ItemStack p_43507_) { -- return this.isContainerIngredient(p_43507_) || this.isPotionIngredient(p_43507_); -+ if (p_43507_.isEmpty()) { + public boolean isIngredient(final ItemStack ingredient) { +- return this.isContainerIngredient(ingredient) || this.isPotionIngredient(ingredient); ++ if (ingredient.isEmpty()) { + return false; + } + + for (var recipe : recipes) { -+ if (recipe.isIngredient(p_43507_)) { ++ if (recipe.isIngredient(ingredient)) { + return true; + } + } + return false; } - private boolean isContainer(ItemStack p_328293_) { -@@ -71,9 +_,10 @@ + private boolean isContainer(final ItemStack input) { +@@ -73,9 +_,10 @@ } - public boolean hasMix(ItemStack p_43509_, ItemStack p_43510_) { -- return !this.isContainer(p_43509_) ? false : this.hasContainerMix(p_43509_, p_43510_) || this.hasPotionMix(p_43509_, p_43510_); -+ return !mix(p_43510_, p_43509_).isEmpty(); + public boolean hasMix(final ItemStack source, final ItemStack ingredient) { +- return !this.isContainer(source) ? false : this.hasContainerMix(source, ingredient) || this.hasPotionMix(source, ingredient); ++ return !mix(ingredient, source).isEmpty(); } + /** @deprecated Forge: use hasMix(ItemStack, ItemStack)*/ - public boolean hasContainerMix(ItemStack p_43520_, ItemStack p_43521_) { + public boolean hasContainerMix(final ItemStack source, final ItemStack ingredient) { for (PotionBrewing.Mix mix : this.containerMixes) { - if (p_43520_.is(mix.from) && mix.ingredient.test(p_43521_)) { -@@ -84,6 +_,7 @@ + if (source.is(mix.from) && mix.ingredient.test(ingredient)) { +@@ -86,6 +_,7 @@ return false; } + /** @deprecated Forge: use hasMix(ItemStack, ItemStack)*/ - public boolean hasPotionMix(ItemStack p_43525_, ItemStack p_43526_) { - Optional> optional = p_43525_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); - if (optional.isEmpty()) { -@@ -100,6 +_,19 @@ + public boolean hasPotionMix(final ItemStack source, final ItemStack ingredient) { + Optional> potion = source.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (potion.isEmpty()) { +@@ -102,6 +_,19 @@ } - public ItemStack mix(ItemStack p_43530_, ItemStack p_43531_) { -+ if (p_43531_.isEmpty() || p_43531_.getCount() != 1) return ItemStack.EMPTY; -+ if (p_43530_.isEmpty()) return ItemStack.EMPTY; + public ItemStack mix(final ItemStack ingredient, final ItemStack source) { ++ if (source.isEmpty() || source.getCount() != 1) return ItemStack.EMPTY; ++ if (ingredient.isEmpty()) return ItemStack.EMPTY; + + for (var recipe : recipes) { -+ ItemStack output = recipe.getOutput(p_43531_, p_43530_); ++ ItemStack output = recipe.getOutput(source, ingredient); + if (!output.isEmpty()) { + return output; + } @@ -73,12 +75,12 @@ + return ItemStack.EMPTY; + } + -+ private ItemStack mixVanilla(ItemStack p_43530_, ItemStack p_43531_) { - if (p_43531_.isEmpty()) { - return p_43531_; - } else { -@@ -124,9 +_,29 @@ ++ private ItemStack mixVanilla(final ItemStack ingredient, final ItemStack source) { + if (source.isEmpty()) { + return source; } +@@ -126,9 +_,29 @@ + return source; } + /** @@ -100,22 +102,22 @@ + return this.recipes; + } + - public static PotionBrewing bootstrap(FeatureFlagSet p_329176_) { - PotionBrewing.Builder potionbrewing$builder = new PotionBrewing.Builder(p_329176_); - addVanillaMixes(potionbrewing$builder); -+ net.minecraftforge.event.ForgeEventFactory.onBrewingRecipeRegister(potionbrewing$builder, p_329176_); - return potionbrewing$builder.build(); + public static PotionBrewing bootstrap(final FeatureFlagSet enabledFeatures) { + PotionBrewing.Builder builder = new PotionBrewing.Builder(enabledFeatures); + addVanillaMixes(builder); ++ net.minecraftforge.event.ForgeEventFactory.onBrewingRecipeRegister(builder, enabledFeatures); + return builder.build(); } -@@ -195,6 +_,7 @@ +@@ -197,6 +_,7 @@ private final List> potionMixes = new ArrayList<>(); private final List> containerMixes = new ArrayList<>(); private final FeatureFlagSet enabledFeatures; + private final List recipes = new ArrayList<>(); - public Builder(FeatureFlagSet p_332559_) { - this.enabledFeatures = p_332559_; -@@ -234,8 +_,13 @@ + public Builder(final FeatureFlagSet enabledFeatures) { + this.enabledFeatures = enabledFeatures; +@@ -236,8 +_,13 @@ } } diff --git a/patches/minecraft/net/minecraft/world/item/component/CustomData.java.patch b/patches/minecraft/net/minecraft/world/item/component/CustomData.java.patch new file mode 100644 index 0000000000..85f0f844d2 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/item/component/CustomData.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/item/component/CustomData.java ++++ b/net/minecraft/world/item/component/CustomData.java +@@ -31,6 +_,10 @@ + return NbtUtils.compareNbt(expectedTag, this.tag, true); + } + ++ public boolean strictMatchedBy(final CompoundTag expectedTag) { ++ return expectedTag == null ? this.tag == null : expectedTag.equals(this.tag); ++ } ++ + public static void update(final DataComponentType component, final ItemStack itemStack, final Consumer consumer) { + CustomData newData = itemStack.getOrDefault(component, EMPTY).update(consumer); + if (newData.tag.isEmpty()) { 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 2ed408a6db..556426ce03 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java -@@ -81,7 +_,7 @@ - for (int i = 0; i < nonnulllist.size(); i++) { - ItemStack itemstack = p_342084_.getItem(i); - if (!itemstack.isEmpty()) { -- ItemStack itemstack1 = itemstack.getItem().getCraftingRemainder(); -+ ItemStack itemstack1 = itemstack.getCraftingRemainder(); - if (!itemstack1.isEmpty()) { - nonnulllist.set(i, itemstack1); - } else if (!itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().isEmpty()) { +@@ -97,7 +_,7 @@ + for (int slot = 0; slot < result.size(); slot++) { + ItemStack itemStack = input.getItem(slot); + if (!itemStack.isEmpty()) { +- ItemStackTemplate remainder = itemStack.getItem().getCraftingRemainder(); ++ ItemStackTemplate remainder = itemStack.getCraftingRemainder(); + if (remainder != null) { + result.set(slot, remainder.create()); + } else if (!itemStack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().isEmpty()) { 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 02ad0ced58..bb1f36ea96 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/crafting/BookCloningRecipe.java +++ b/net/minecraft/world/item/crafting/BookCloningRecipe.java -@@ -87,7 +_,7 @@ +@@ -130,7 +_,7 @@ - for (int i = 0; i < nonnulllist.size(); i++) { - ItemStack itemstack = p_344901_.getItem(i); -- ItemStack itemstack1 = itemstack.getItem().getCraftingRemainder(); -+ ItemStack itemstack1 = itemstack.getCraftingRemainder(); - if (!itemstack1.isEmpty()) { - nonnulllist.set(i, itemstack1); - } else if (itemstack.has(DataComponents.WRITTEN_BOOK_CONTENT)) { + for (int slot = 0; slot < result.size(); slot++) { + ItemStack itemStack = input.getItem(slot); +- ItemStackTemplate remainder = itemStack.getItem().getCraftingRemainder(); ++ ItemStackTemplate remainder = itemStack.getCraftingRemainder(); + if (remainder != null) { + result.set(slot, remainder.create()); + } else if (itemStack.has(DataComponents.WRITTEN_BOOK_CONTENT)) { diff --git a/patches/minecraft/net/minecraft/world/item/crafting/CraftingRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/CraftingRecipe.java.patch index 48caa1052d..70076f9f32 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/CraftingRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/CraftingRecipe.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/item/crafting/CraftingRecipe.java +++ b/net/minecraft/world/item/crafting/CraftingRecipe.java -@@ -23,8 +_,7 @@ - NonNullList nonnulllist = NonNullList.withSize(p_368314_.size(), ItemStack.EMPTY); +@@ -27,8 +_,7 @@ + NonNullList result = NonNullList.withSize(input.size(), ItemStack.EMPTY); - for (int i = 0; i < nonnulllist.size(); i++) { -- Item item = p_368314_.getItem(i).getItem(); -- nonnulllist.set(i, item.getCraftingRemainder()); -+ nonnulllist.set(i, p_368314_.getItem(i).getCraftingRemainder()); + for (int slot = 0; slot < result.size(); slot++) { +- Item item = input.getItem(slot).getItem(); +- ItemStackTemplate remainder = item.getCraftingRemainder(); ++ ItemStackTemplate remainder = input.getItem(slot).getCraftingRemainder(); + result.set(slot, remainder != null ? remainder.create() : ItemStack.EMPTY); } - return nonnulllist; 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 5e0c8d5860..3defabf390 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -3,39 +3,39 @@ @@ -23,18 +_,26 @@ import net.minecraft.world.level.ItemLike; - public class Ingredient implements StackedContents.IngredientInfo>, Predicate { + public class Ingredient implements Predicate, StackedContents.IngredientInfo> { - public static final StreamCodec CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM) + private static final StreamCodec VANILLA_CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM) - .map(Ingredient::new, p_359816_ -> p_359816_.values); + .map(Ingredient::new, i -> i.values); - public static final StreamCodec> OPTIONAL_CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM) + public static final StreamCodec CONTENTS_STREAM_CODEC = net.minecraftforge.common.ForgeHooks.ingredientStreamCodec(); + public static final StreamCodec> OPTIONAL_CONTENTS_STREAM_CODEC = CONTENTS_STREAM_CODEC .map( -- p_359814_ -> p_359814_.size() == 0 ? Optional.empty() : Optional.of(new Ingredient((HolderSet)p_359814_)), -- p_359815_ -> p_359815_.>map(p_359810_ -> p_359810_.values).orElse(HolderSet.direct()) +- ingredient -> ingredient.size() == 0 ? Optional.empty() : Optional.of(new Ingredient((HolderSet)ingredient)), +- ingredient -> ingredient.>map(i -> i.values).orElse(HolderSet.empty()) + ingredient -> ingredient.items().count() == 0 ? Optional.empty() : Optional.of(ingredient), + ingredient -> ingredient.orElseGet(() -> Ingredient.of()) ); public static final Codec> NON_AIR_HOLDER_SET_CODEC = HolderSetCodec.create(Registries.ITEM, Item.CODEC, false); -- public static final Codec CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC).xmap(Ingredient::new, p_359811_ -> p_359811_.values); +- public static final Codec CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC).xmap(Ingredient::new, i -> i.values); - private final HolderSet values; -+ private static final Codec VANILLA_CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC).xmap(Ingredient::new, p_359811_ -> p_359811_.values); ++ private static final Codec VANILLA_CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC).xmap(Ingredient::new, i -> i.values); + private static final com.mojang.serialization.MapCodec VANILLA_MAP_CODEC = VANILLA_CODEC.fieldOf("value"); + public static final Codec CODEC = net.minecraftforge.common.ForgeHooks.ingredientBaseCodec(VANILLA_CODEC); + protected final HolderSet values; - protected Ingredient(HolderSet p_368516_) { -+ this(p_368516_, true); + protected Ingredient(final HolderSet values) { ++ this(values, true); + } + -+ protected Ingredient(HolderSet p_368516_, boolean validate) { ++ protected Ingredient(HolderSet values, boolean validate) { + if (validate) - p_368516_.unwrap().ifRight(p_359817_ -> { - if (p_359817_.isEmpty()) { + values.unwrap().ifRight(directValues -> { + if (directValues.isEmpty()) { throw new UnsupportedOperationException("Ingredients can't be empty"); -@@ -106,5 +_,50 @@ +@@ -113,5 +_,50 @@ } else { - return slotdisplay; + return inputDisplay; } + } + diff --git a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch index 97d34f6909..c46060b222 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -1,33 +1,34 @@ --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -63,14 +_,21 @@ +@@ -61,15 +_,22 @@ private SelectableRecipe.SingleInputSet stonecutterRecipes = SelectableRecipe.SingleInputSet.empty(); private List allDisplays = List.of(); private Map>, List> recipeToDisplay = Map.of(); + private final net.minecraftforge.common.crafting.conditions.ICondition.IContext context; //Forge: add context + /** @deprecated Forge: use {@linkplain RecipeManager#RecipeManager(net.minecraftforge.common.crafting.conditions.ICondition.IContext) constructor with context}. */ - public RecipeManager(HolderLookup.Provider p_330459_) { -+ this(p_330459_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + public RecipeManager(final HolderLookup.Provider registries) { ++ this(registries, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + } + -+ public RecipeManager(HolderLookup.Provider p_330459_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { - this.registries = p_330459_; ++ public RecipeManager(HolderLookup.Provider registries, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { + this.registries = registries; + this.context = context; } - protected RecipeMap prepare(ResourceManager p_368640_, ProfilerFiller p_361102_) { - SortedMap> sortedmap = new TreeMap<>(); -- SimpleJsonResourceReloadListener.scanDirectory(p_368640_, RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, sortedmap); -+ SimpleJsonResourceReloadListener.scanDirectory(p_368640_, RECIPE_LISTER, this.context.wrap(this.registries.createSerializationContext(JsonOps.INSTANCE)), Recipe.CODEC, sortedmap); - List> list = new ArrayList<>(sortedmap.size()); - sortedmap.forEach((p_449831_, p_449832_) -> { - ResourceKey> resourcekey = ResourceKey.create(Registries.RECIPE, p_449831_); + protected RecipeMap prepare(final ResourceManager manager, final ProfilerFiller profiler) { + SortedMap> recipes = new TreeMap<>(); + SimpleJsonResourceReloadListener.scanDirectory( +- manager, RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, recipes ++ manager, RECIPE_LISTER, this.context.wrap(this.registries.createSerializationContext(JsonOps.INSTANCE)), Recipe.CODEC, recipes + ); + List> recipeHolders = new ArrayList<>(recipes.size()); + recipes.forEach((id, recipe) -> { @@ -86,6 +_,7 @@ } - public void finalizeRecipeLoading(FeatureFlagSet p_360842_) { + public void finalizeRecipeLoading(final FeatureFlagSet enabledFlags) { + //net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registries, false, false); - List> list = new ArrayList<>(); - List list1 = RECIPE_PROPERTY_SETS.entrySet() + List> stonecutterRecipes = new ArrayList<>(); + List propertySetCollectors = RECIPE_PROPERTY_SETS.entrySet() .stream() diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch index 50da8986b7..4c42452a08 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/net/minecraft/world/item/crafting/ShapedRecipe.java -@@ -18,7 +_,19 @@ +@@ -15,7 +_,19 @@ + import net.minecraft.world.item.crafting.display.SlotDisplay; import net.minecraft.world.level.Level; - import org.jspecify.annotations.Nullable; --public class ShapedRecipe implements CraftingRecipe { -+public class ShapedRecipe implements CraftingRecipe, net.minecraftforge.common.crafting.IShapedRecipe { +-public class ShapedRecipe extends NormalCraftingRecipe { ++public class ShapedRecipe extends NormalCraftingRecipe implements net.minecraftforge.common.crafting.IShapedRecipe { + static int MAX_WIDTH = 3; + static int MAX_HEIGHT = 3; + /** @@ -18,13 +18,13 @@ + if (MAX_WIDTH < width) MAX_WIDTH = width; + if (MAX_HEIGHT < height) MAX_HEIGHT = height; + } - final ShapedRecipePattern pattern; - final ItemStack result; - final String group; -@@ -65,6 +_,16 @@ - } + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + i -> i.group( + Recipe.CommonInfo.MAP_CODEC.forGetter(o -> o.commonInfo), +@@ -77,6 +_,16 @@ - return this.placementInfo; + public int getHeight() { + return this.pattern.height(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch index d97f857523..96480b3066 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapedRecipePattern.java +++ b/net/minecraft/world/item/crafting/ShapedRecipePattern.java -@@ -204,18 +_,22 @@ +@@ -203,10 +_,14 @@ return this.ingredients; } @@ -9,21 +9,22 @@ + } + public record Data(Map key, List pattern) { - private static final Codec> PATTERN_CODEC = Codec.STRING.listOf().comapFlatMap(p_311191_ -> { -- if (p_311191_.size() > 3) { + private static final Codec> PATTERN_CODEC = Codec.STRING.listOf().comapFlatMap(strings -> { +- if (strings.size() > 3) { - return DataResult.error(() -> "Invalid pattern: too many rows, 3 is maximum"); -+ if (p_311191_.size() > ShapedRecipe.MAX_HEIGHT) { ++ if (strings.size() > ShapedRecipe.MAX_HEIGHT) { + return DataResult.error(() -> "Invalid pattern: too many rows, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); - } else if (p_311191_.isEmpty()) { - return DataResult.error(() -> "Invalid pattern: empty pattern not allowed"); - } else { - int i = p_311191_.getFirst().length(); + } - for (String s : p_311191_) { -- if (s.length() > 3) { -- return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); -+ if (s.length() > ShapedRecipe.MAX_HEIGHT) { -+ return DataResult.error(() -> "Invalid pattern: too many columns, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); - } + if (strings.isEmpty()) { +@@ -216,8 +_,8 @@ + int firstLength = strings.getFirst().length(); - if (i != s.length()) { + for (String line : strings) { +- if (line.length() > 3) { +- return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); ++ if (line.length() > ShapedRecipe.MAX_HEIGHT) { ++ return DataResult.error(() -> "Invalid pattern: too many columns, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); + } + + if (firstLength != line.length()) { 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 8eb9db1949..84301529be 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch @@ -1,42 +1,43 @@ --- a/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java -@@ -23,12 +_,14 @@ - final ItemStack result; - final List ingredients; - private @Nullable PlacementInfo placementInfo; +@@ -20,7 +_,7 @@ + Recipe.CommonInfo.MAP_CODEC.forGetter(o -> o.commonInfo), + CraftingRecipe.CraftingBookInfo.MAP_CODEC.forGetter(o -> o.bookInfo), + ItemStackTemplate.CODEC.fieldOf("result").forGetter(o -> o.result), +- Ingredient.CODEC.listOf(1, 9).fieldOf("ingredients").forGetter(o -> o.ingredients) ++ Ingredient.CODEC.listOf(/*1, 9 Forge: Make this usable for larger crafting windows*/).fieldOf("ingredients").forGetter(o -> o.ingredients) + ) + .apply(i, ShapelessRecipe::new) + ); +@@ -38,6 +_,7 @@ + public static final RecipeSerializer SERIALIZER = new RecipeSerializer<>(MAP_CODEC, STREAM_CODEC); + private final ItemStackTemplate result; + private final List ingredients; + private final boolean isSimple; - public ShapelessRecipe(String p_249640_, CraftingBookCategory p_249390_, ItemStack p_252071_, List p_365863_) { - this.group = p_249640_; - this.category = p_249390_; - this.result = p_252071_; - this.ingredients = p_365863_; + public ShapelessRecipe( + final Recipe.CommonInfo commonInfo, final CraftingRecipe.CraftingBookInfo bookInfo, final ItemStackTemplate result, final List ingredients +@@ -45,6 +_,7 @@ + super(commonInfo, bookInfo); + this.result = result; + this.ingredients = ingredients; + this.isSimple = this.ingredients.stream().allMatch(Ingredient::isSimple); } @Override -@@ -58,10 +_,12 @@ - public boolean matches(CraftingInput p_345423_, Level p_44263_) { - if (p_345423_.ingredientCount() != this.ingredients.size()) { +@@ -60,10 +_,12 @@ + public boolean matches(final CraftingInput input, final Level level) { + if (input.ingredientCount() != this.ingredients.size()) { return false; -+ } else if (p_345423_.size() == 1 && this.ingredients.size() == 1) { -+ return this.ingredients.getFirst().test(p_345423_.getItem(0)); ++ } else if (input.size() == 1 && this.ingredients.size() == 1) { ++ return this.ingredients.getFirst().test(input.getItem(0)); + } else if (!isSimple) { -+ return net.minecraftforge.common.util.RecipeMatcher.findMatches(p_345423_.items(), this.ingredients) != null; ++ return net.minecraftforge.common.util.RecipeMatcher.findMatches(input.items(), this.ingredients) != null; } else { -- return p_345423_.size() == 1 && this.ingredients.size() == 1 -- ? this.ingredients.getFirst().test(p_345423_.getItem(0)) -- : p_345423_.stackedContents().canCraft(this, null); -+ return p_345423_.stackedContents().canCraft(this, null); +- return input.size() == 1 && this.ingredients.size() == 1 +- ? this.ingredients.getFirst().test(input.getItem(0)) +- : input.stackedContents().canCraft(this, null); ++ return input.stackedContents().canCraft(this, null); } } -@@ -86,7 +_,7 @@ - Codec.STRING.optionalFieldOf("group", "").forGetter(p_299460_ -> p_299460_.group), - CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(p_297437_ -> p_297437_.category), - ItemStack.STRICT_CODEC.fieldOf("result").forGetter(p_300770_ -> p_300770_.result), -- Ingredient.CODEC.listOf(1, 9).fieldOf("ingredients").forGetter(p_359857_ -> p_359857_.ingredients) -+ Ingredient.CODEC.listOf(/*1, 9 Forge: Make this usable for larger crafting windows*/).fieldOf("ingredients").forGetter(p_359857_ -> p_359857_.ingredients) - ) - .apply(p_359856_, ShapelessRecipe::new) - ); diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch index 75acf09a5e..77af83fa5c 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/enchantment/EnchantmentHelper.java +++ b/net/minecraft/world/item/enchantment/EnchantmentHelper.java -@@ -582,7 +_,7 @@ - public static List getAvailableEnchantmentResults(int p_44818_, ItemStack p_44819_, Stream> p_342857_) { - List list = Lists.newArrayList(); - boolean flag = p_44819_.is(Items.BOOK); -- p_342857_.filter(p_341799_ -> p_341799_.value().isPrimaryItem(p_44819_) || flag).forEach(p_341708_ -> { -+ p_342857_.filter(p_341799_ -> p_44819_.canApplyAtEnchantingTable(p_341799_) || flag).forEach(p_341708_ -> { - Enchantment enchantment = p_341708_.value(); +@@ -602,7 +_,7 @@ + public static List getAvailableEnchantmentResults(final int value, final ItemStack itemStack, final Stream> source) { + List results = Lists.newArrayList(); + boolean isBook = itemStack.is(Items.BOOK); +- source.filter(enchantment -> enchantment.value().isPrimaryItem(itemStack) || isBook).forEach(holder -> { ++ source.filter(enchantment -> itemStack.canApplyAtEnchantingTable(enchantment) || isBook).forEach(holder -> { + Enchantment enchantment = holder.value(); - for (int i = enchantment.getMaxLevel(); i >= enchantment.getMinLevel(); i--) { + for (int level = enchantment.getMaxLevel(); level >= enchantment.getMinLevel(); level--) { diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java.patch index 175219cc72..bec1e9be00 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java +++ b/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java -@@ -48,6 +_,7 @@ - for (BlockPos blockpos1 : BlockPos.betweenClosed(blockpos.offset(-i, 0, -i), blockpos.offset(i, Math.min(j - 1, 0), i))) { - if (blockpos1.distToCenterSqr(p_342913_.x(), blockpos1.getY() + 0.5, p_342913_.z()) < Mth.square(i) - && this.predicate.map(p_343365_ -> p_343365_.test(p_343394_, blockpos1)).orElse(true) -+ && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_343742_, net.minecraftforge.common.util.BlockSnapshot.create(p_343394_.dimension(), p_343394_, blockpos), net.minecraft.core.Direction.UP) - && p_343394_.setBlockAndUpdate(blockpos1, this.blockState.getState(randomsource, blockpos1))) { - this.triggerGameEvent.ifPresent(p_344749_ -> p_343394_.gameEvent(p_343742_, (Holder)p_344749_, blockpos1)); +@@ -47,6 +_,7 @@ + for (BlockPos pos : BlockPos.betweenClosed(centerBlock.offset(-dist, 0, -dist), centerBlock.offset(dist, Math.min(height - 1, 0), dist))) { + if (pos.distToCenterSqr(position.x(), pos.getY() + 0.5, position.z()) < Mth.square(dist) + && this.predicate.map(p -> p.test(serverLevel, pos)).orElse(true) ++ && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(entity, net.minecraftforge.common.util.BlockSnapshot.create(serverLevel.dimension(), serverLevel, centerBlock), net.minecraft.core.Direction.UP) + && serverLevel.setBlockAndUpdate(pos, this.blockState.getState(serverLevel, random, pos))) { + this.triggerGameEvent.ifPresent(event -> serverLevel.gameEvent(entity, (Holder)event, pos)); } diff --git a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch index 9c91bb9469..29f5661043 100644 --- a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,25 +1,27 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -154,13 +_,15 @@ +@@ -152,15 +_,16 @@ - entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), randomsource.nextFloat() * 360.0F, 0.0F); + entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { -- if (spawndata.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(p_151312_, EntitySpawnReason.SPAWNER) || !mob.checkSpawnObstruction(p_151312_)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.checkSpawnPositionSpawner(mob, p_151312_, EntitySpawnReason.SPAWNER, spawndata, this)) { +- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(level, EntitySpawnReason.SPAWNER) +- || !mob.checkSpawnObstruction(level)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.checkSpawnPositionSpawner(mob, level, EntitySpawnReason.SPAWNER, nextSpawnData, this)) { continue; } - boolean flag1 = spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().getString("id").isPresent(); -- if (flag1) { -- ((Mob)entity).finalizeSpawn(p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, null); + boolean hasNoConfiguration = nextSpawnData.getEntityToSpawn().size() == 1 + && nextSpawnData.getEntityToSpawn().getString("id").isPresent(); +- if (hasNoConfiguration) { +- ((Mob)entity).finalizeSpawn(level, level.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, null); + // Forge: Patch in FinalizeSpawn for spawners so it may be fired unconditionally, instead of only when vanilla normally would trigger it. -+ var event = net.minecraftforge.event.ForgeEventFactory.onFinalizeSpawnSpawner(mob, p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), null, valueinput, this); -+ if (event != null && flag1) { -+ mob.finalizeSpawn(p_151312_, event.getDifficulty(), EntitySpawnReason.SPAWNER, null); ++ var event = net.minecraftforge.event.ForgeEventFactory.onFinalizeSpawnSpawner(mob, level, level.getCurrentDifficultyAt(entity.blockPosition()), null, input, this); ++ if (event != null && hasNoConfiguration) { ++ mob.finalizeSpawn(level, event.getDifficulty(), EntitySpawnReason.SPAWNER, null); } - spawndata.getEquipment().ifPresent(mob::equip); -@@ -277,5 +_,14 @@ + nextSpawnData.getEquipment().ifPresent(mob::equip); +@@ -279,5 +_,14 @@ public double getOSpin() { return this.oSpin; diff --git a/patches/minecraft/net/minecraft/world/level/BlockGetter.java.patch b/patches/minecraft/net/minecraft/world/level/BlockGetter.java.patch index b4dbf3f4d4..b882756ced 100644 --- a/patches/minecraft/net/minecraft/world/level/BlockGetter.java.patch +++ b/patches/minecraft/net/minecraft/world/level/BlockGetter.java.patch @@ -6,15 +6,15 @@ -public interface BlockGetter extends LevelHeightAccessor { +public interface BlockGetter extends LevelHeightAccessor, net.minecraftforge.common.extensions.IForgeBlockGetter { - @Nullable BlockEntity getBlockEntity(BlockPos p_45570_); + @Nullable BlockEntity getBlockEntity(BlockPos pos); - default Optional getBlockEntity(BlockPos p_151367_, BlockEntityType p_151368_) { + default Optional getBlockEntity(final BlockPos pos, final BlockEntityType type) { @@ -34,7 +_,7 @@ - FluidState getFluidState(BlockPos p_45569_); + FluidState getFluidState(BlockPos pos); - default int getLightEmission(BlockPos p_45572_) { -- return this.getBlockState(p_45572_).getLightEmission(); -+ return this.getBlockState(p_45572_).getLightEmission(this, p_45572_); + default int getLightEmission(final BlockPos pos) { +- return this.getBlockState(pos).getLightEmission(); ++ return this.getBlockState(pos).getLightEmission(this, pos); } - default Stream getBlockStates(AABB p_45557_) { + default Stream getBlockStates(final AABB box) { diff --git a/patches/minecraft/net/minecraft/world/level/DataPackConfig.java.patch b/patches/minecraft/net/minecraft/world/level/DataPackConfig.java.patch index 9194011a4d..cd03031fdc 100644 --- a/patches/minecraft/net/minecraft/world/level/DataPackConfig.java.patch +++ b/patches/minecraft/net/minecraft/world/level/DataPackConfig.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/DataPackConfig.java +++ b/net/minecraft/world/level/DataPackConfig.java -@@ -19,7 +_,7 @@ +@@ -15,7 +_,7 @@ private final List disabled; - public DataPackConfig(List p_45848_, List p_45849_) { -- this.enabled = ImmutableList.copyOf(p_45848_); -+ this.enabled = new java.util.ArrayList<>(p_45848_); - this.disabled = ImmutableList.copyOf(p_45849_); + public DataPackConfig(final List enabled, final List disabled) { +- this.enabled = ImmutableList.copyOf(enabled); ++ this.enabled = new java.util.ArrayList<>(enabled); + this.disabled = ImmutableList.copyOf(disabled); } -@@ -29,5 +_,9 @@ +@@ -25,5 +_,9 @@ public List getDisabled() { return this.disabled; diff --git a/patches/minecraft/net/minecraft/world/level/ExplosionDamageCalculator.java.patch b/patches/minecraft/net/minecraft/world/level/ExplosionDamageCalculator.java.patch index 510dce6c54..ebeaeb6226 100644 --- a/patches/minecraft/net/minecraft/world/level/ExplosionDamageCalculator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/ExplosionDamageCalculator.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/net/minecraft/world/level/ExplosionDamageCalculator.java -@@ -9,7 +_,7 @@ - - public class ExplosionDamageCalculator { - public Optional getBlockExplosionResistance(Explosion p_46099_, BlockGetter p_46100_, BlockPos p_46101_, BlockState p_46102_, FluidState p_46103_) { -- return p_46102_.isAir() && p_46103_.isEmpty() ? Optional.empty() : Optional.of(Math.max(p_46102_.getBlock().getExplosionResistance(), p_46103_.getExplosionResistance())); -+ return p_46102_.isAir() && p_46103_.isEmpty() ? Optional.empty() : Optional.of(Math.max(p_46102_.getExplosionResistance(p_46100_, p_46101_, p_46099_), p_46103_.getExplosionResistance(p_46100_, p_46101_, p_46099_))); +@@ -13,7 +_,7 @@ + ) { + return block.isAir() && fluid.isEmpty() + ? Optional.empty() +- : Optional.of(Math.max(block.getBlock().getExplosionResistance(), fluid.getExplosionResistance())); ++ : Optional.of(Math.max(block.getBlock().getExplosionResistance(block, level, pos, explosion), fluid.getExplosionResistance(level, pos, explosion))); } - public boolean shouldBlockExplode(Explosion p_46094_, BlockGetter p_46095_, BlockPos p_46096_, BlockState p_46097_, float p_46098_) { + public boolean shouldBlockExplode(final Explosion explosion, final BlockGetter level, final BlockPos pos, final BlockState state, final float power) { diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index c8f5a899ba..c0ee39b1c6 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -85,7 +_,7 @@ +@@ -90,7 +_,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; import org.jspecify.annotations.Nullable; @@ -9,7 +9,7 @@ public static final Codec> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, Identifier.withDefaultNamespace("overworld")); public static final ResourceKey NETHER = ResourceKey.create(Registries.DIMENSION, Identifier.withDefaultNamespace("the_nether")); -@@ -125,6 +_,11 @@ +@@ -131,6 +_,11 @@ private final DamageSources damageSources; private final PalettedContainerFactory palettedContainerFactory; private long subTickCount; @@ -20,64 +20,62 @@ + private final java.util.ArrayList pendingFreshBlockEntities = new java.util.ArrayList<>(); protected Level( - WritableLevelData p_270739_, -@@ -136,6 +_,7 @@ - long p_270248_, - int p_270466_ - ) { -+ super(); - this.levelData = p_270739_; - this.dimensionTypeRegistration = p_270240_; - this.dimension = p_270683_; -@@ -217,11 +_,35 @@ - } else { - LevelChunk levelchunk = this.getChunkAt(p_46605_); - Block block = p_46606_.getBlock(); + final WritableLevelData levelData, +@@ -219,7 +_,7 @@ + } + + @Override +- public boolean setBlock(final BlockPos pos, final BlockState blockState, final @Block.UpdateFlags int updateFlags, final int updateLimit) { ++ public boolean setBlock(BlockPos pos, final BlockState blockState, @Block.UpdateFlags final int updateFlags, final int updateLimit) { + if (!this.isInValidBounds(pos)) { + return false; + } +@@ -230,12 +_,31 @@ + + LevelChunk chunk = this.getChunkAt(pos); + Block block = blockState.getBlock(); + -+ p_46605_ = p_46605_.immutable(); // Forge - prevent mutable BlockPos leaks -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isClientSide) { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.dimension, this, p_46605_, p_46607_); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ - BlockState blockstate = levelchunk.setBlockState(p_46605_, p_46606_, p_46607_); - if (blockstate == null) { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } else { - BlockState blockstate1 = this.getBlockState(p_46605_); -+ 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_); -+ } -+ -+ return true; -+ } ++ pos = pos.immutable(); // Forge - prevent mutable BlockPos leaks ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isClientSide) { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.dimension, this, pos, updateFlags); ++ this.capturedBlockSnapshots.add(blockSnapshot); + } ++ + BlockState oldState = chunk.setBlockState(pos, blockState, updateFlags); + if (oldState == null) { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + +- BlockState newState = this.getBlockState(pos); ++ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates ++ this.markAndNotifyBlock(pos, chunk, oldState, blockState, updateFlags, updateLimit); ++ } ++ ++ return true; + } + + // Split off from original setBlockState(BlockPos, BlockState, int, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos p_46605_, @Nullable LevelChunk levelchunk, BlockState blockstate, BlockState p_46606_, int p_46607_, int p_46608_) { -+ Block block = p_46606_.getBlock(); -+ BlockState blockstate1 = getBlockState(p_46605_); -+ { -+ { - if (blockstate1 == p_46606_) { - if (blockstate != blockstate1) { - this.setBlocksDirty(p_46605_, blockstate, blockstate1); -@@ -248,9 +_,8 @@ - } - - this.updatePOIOnBlockStateChange(p_46605_, blockstate, blockstate1); -+ p_46606_.onBlockStateChange(this, p_46605_, blockstate); - } -- -- return true; ++ public void markAndNotifyBlock(final BlockPos pos, final @Nullable LevelChunk chunk, final BlockState oldState, final BlockState blockState, @Block.UpdateFlags final int updateFlags, final int updateLimit) { ++ Block block = blockState.getBlock(); ++ BlockState newState = getBlockState(pos); + if (newState == blockState) { + if (oldState != newState) { + this.setBlocksDirty(pos, oldState, newState); +@@ -262,9 +_,8 @@ } + + this.updatePOIOnBlockStateChange(pos, oldState, newState); ++ blockState.onBlockStateChange(this, pos, oldState); } +- +- return true; } -@@ -484,8 +_,28 @@ - (this.tickingBlockEntities ? this.pendingBlockEntityTickers : this.blockEntityTickers).add(p_151526_); + + public void updatePOIOnBlockStateChange(final BlockPos pos, final BlockState oldState, final BlockState newState) { +@@ -531,8 +_,27 @@ + (this.tickingBlockEntities ? this.pendingBlockEntityTickers : this.blockEntityTickers).add(ticker); } + public void addFreshBlockEntities(java.util.Collection beList) { @@ -89,7 +87,6 @@ + } + public void tickBlockEntities() { -+ + if (!this.pendingFreshBlockEntities.isEmpty()) { + this.freshBlockEntities.addAll(this.pendingFreshBlockEntities); + this.pendingFreshBlockEntities.clear(); @@ -105,84 +102,83 @@ if (!this.pendingBlockEntityTickers.isEmpty()) { this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); this.pendingBlockEntityTickers.clear(); -@@ -508,12 +_,19 @@ +@@ -555,12 +_,19 @@ - public void guardEntityTick(Consumer p_46654_, T p_46655_) { + public void guardEntityTick(final Consumer tick, final T entity) { try { -+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(p_46655_); - p_46654_.accept(p_46655_); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Entity being ticked"); - p_46655_.fillCrashReportCategory(crashreportcategory); ++ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(entity); + tick.accept(entity); + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "Ticking entity"); + CrashReportCategory category = report.addCategory("Entity being ticked"); + entity.fillCrashReportCategory(category); + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { -+ com.mojang.logging.LogUtils.getLogger().error("{}", crashreport.getFriendlyReport(net.minecraft.ReportType.CRASH)); -+ p_46655_.discard(); ++ com.mojang.logging.LogUtils.getLogger().error("{}", report.getFriendlyReport(net.minecraft.ReportType.CRASH)); ++ entity.discard(); + } else - throw new ReportedException(crashreport); + throw new ReportedException(report); + } finally { -+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(p_46655_); ++ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(entity); } } -@@ -669,6 +_,7 @@ - if (this.isInValidBounds(p_46748_)) { - this.getChunkAt(p_46748_).removeBlockEntity(p_46748_); +@@ -716,6 +_,7 @@ + if (this.isInValidBounds(pos)) { + this.getChunkAt(pos).removeBlockEntity(pos); } -+ this.updateNeighbourForOutputSignal(p_46748_, getBlockState(p_46748_).getBlock()); //Notify neighbors of changes ++ this.updateNeighbourForOutputSignal(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes } - public boolean isLoaded(BlockPos p_46750_) { -@@ -743,9 +_,9 @@ + public boolean isLoaded(final BlockPos pos) { +@@ -781,8 +_,8 @@ } }); -- for (EnderDragonPart enderdragonpart : this.dragonParts()) { -+ for (var enderdragonpart : this.getPartEntities()) { - if (enderdragonpart != p_46536_ -- && enderdragonpart.parentMob != p_46536_ -+ && enderdragonpart.getParent() != p_46536_ - && p_46538_.test(enderdragonpart) - && p_46537_.intersects(enderdragonpart.getBoundingBox())) { - list.add(enderdragonpart); -@@ -778,8 +_,8 @@ +- for (EnderDragonPart dragonPart : this.dragonParts()) { +- if (dragonPart != except && dragonPart.parentMob != except && selector.test(dragonPart) && bb.intersects(dragonPart.getBoundingBox())) { ++ for (var dragonPart : this.getPartEntities()) { ++ if (dragonPart != except && dragonPart.getParent() != except && selector.test(dragonPart) && bb.intersects(dragonPart.getBoundingBox())) { + output.add(dragonPart); + } + } +@@ -815,8 +_,8 @@ } } -- if (p_261454_ instanceof EnderDragon enderdragon) { -- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { -+ if (p_261454_ .isMultipartEntity()) { -+ for (var enderdragonpart : p_261454_.getParts()) { - T t = p_261885_.tryCast(enderdragonpart); - if (t != null && p_261688_.test(t)) { - p_262071_.add(t); -@@ -952,17 +_,16 @@ +- if (e instanceof EnderDragon enderDragon) { +- for (EnderDragonPart subEntity : enderDragon.getSubEntities()) { ++ if (e.isMultipartEntity()) { ++ for (var subEntity : e.getParts()) { + T castSubPart = type.tryCast(subEntity); + if (castSubPart != null && selector.test(castSubPart)) { + output.add(castSubPart); +@@ -1004,17 +_,16 @@ public abstract Scoreboard getScoreboard(); - public void updateNeighbourForOutputSignal(BlockPos p_46718_, Block p_46719_) { + public void updateNeighbourForOutputSignal(final BlockPos pos, final Block changedBlock) { - for (Direction direction : Direction.Plane.HORIZONTAL) { + for (Direction direction : Direction.getUpdateOrder()) { - BlockPos blockpos = p_46718_.relative(direction); - if (this.hasChunkAt(blockpos)) { - BlockState blockstate = this.getBlockState(blockpos); -- if (blockstate.is(Blocks.COMPARATOR)) { -- this.neighborChanged(blockstate, blockpos, p_46719_, null, false); -- } else if (blockstate.isRedstoneConductor(this, blockpos)) { -+ blockstate.onNeighborChange(this, blockpos, p_46718_); -+ if (blockstate.isRedstoneConductor(this, blockpos)) { - blockpos = blockpos.relative(direction); - blockstate = this.getBlockState(blockpos); -- if (blockstate.is(Blocks.COMPARATOR)) { -- this.neighborChanged(blockstate, blockpos, p_46719_, null, false); -+ if (blockstate.getWeakChanges(this, blockpos)) { -+ blockstate.onNeighborChange(this, blockpos, p_46718_); + BlockPos relativePos = pos.relative(direction); + if (this.hasChunkAt(relativePos)) { + BlockState state = this.getBlockState(relativePos); +- if (state.is(Blocks.COMPARATOR)) { +- this.neighborChanged(state, relativePos, changedBlock, null, false); +- } else if (state.isRedstoneConductor(this, relativePos)) { ++ state.onNeighborChange(this, relativePos, pos); ++ if (state.isRedstoneConductor(this, relativePos)) { + relativePos = relativePos.relative(direction); + state = this.getBlockState(relativePos); +- if (state.is(Blocks.COMPARATOR)) { +- this.neighborChanged(state, relativePos, changedBlock, null, false); ++ if (state.getWeakChanges(this, relativePos)) { ++ state.onNeighborChange(this, relativePos, pos); } } } -@@ -1047,6 +_,20 @@ +@@ -1099,6 +_,20 @@ } - public abstract EnvironmentAttributeSystem environmentAttributes(); + public abstract ClockManager clockManager(); + + private double maxEntityRadius = 2.0D; + @@ -198,5 +194,5 @@ + return maxEntityRadius; + } - public abstract PotionBrewing potionBrewing(); + public abstract EnvironmentAttributeSystem environmentAttributes(); diff --git a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch index 25d7ad83d8..bdbe1d6a2b 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 -@@ -176,6 +_,11 @@ +@@ -175,6 +_,11 @@ } @Deprecated @@ -9,6 +9,6 @@ + } + + @Deprecated - default boolean hasChunkAt(int p_151578_, int p_151579_) { - return this.hasChunk(SectionPos.blockToSectionCoord(p_151578_), SectionPos.blockToSectionCoord(p_151579_)); + default boolean hasChunkAt(final int blockX, final int blockZ) { + return this.hasChunk(SectionPos.blockToSectionCoord(blockX), SectionPos.blockToSectionCoord(blockZ)); } diff --git a/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch b/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch index 12bcc24c8d..c06f4d8b78 100644 --- a/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch @@ -1,73 +1,67 @@ --- a/net/minecraft/world/level/LevelSettings.java +++ b/net/minecraft/world/level/LevelSettings.java -@@ -15,9 +_,16 @@ - private final boolean allowCommands; - private final GameRules gameRules; - private final WorldDataConfiguration dataConfiguration; -- -- public LevelSettings( -- String p_250485_, GameType p_250207_, boolean p_251631_, Difficulty p_252122_, boolean p_248961_, GameRules p_457827_, WorldDataConfiguration p_249797_ -+ private final com.mojang.serialization.Lifecycle lifecycle; -+ -+ public LevelSettings( -+ String p_250485_, GameType p_250207_, boolean p_251631_, Difficulty p_252122_, boolean p_248961_, GameRules p_248536_, WorldDataConfiguration p_249797_ -+ ) { -+ this(p_250485_, p_250207_, p_251631_, p_252122_, p_248961_, p_248536_, p_249797_, com.mojang.serialization.Lifecycle.stable()); +@@ -6,8 +_,12 @@ + import net.minecraft.world.Difficulty; + + public record LevelSettings( +- String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration ++ String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration, com.mojang.serialization.Lifecycle lifecycle + ) { ++ public LevelSettings(String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration) { ++ this(levelName, gameType, difficultySettings, allowCommands, dataConfiguration, com.mojang.serialization.Lifecycle.stable()); + } + -+ public LevelSettings( -+ String p_250485_, GameType p_250207_, boolean p_251631_, Difficulty p_252122_, boolean p_248961_, GameRules p_457827_, WorldDataConfiguration p_249797_, com.mojang.serialization.Lifecycle lifecycle - ) { - this.levelName = p_250485_; - this.gameType = p_250207_; -@@ -26,6 +_,7 @@ - this.allowCommands = p_248961_; - this.gameRules = p_457827_; - this.dataConfiguration = p_249797_; -+ this.lifecycle = lifecycle; - } - - public static LevelSettings parse(Dynamic p_46925_, WorldDataConfiguration p_251697_) { -@@ -37,7 +_,8 @@ - p_46925_.get("Difficulty").asNumber().map(p_46928_ -> Difficulty.byId(p_46928_.byteValue())).result().orElse(Difficulty.NORMAL), - p_46925_.get("allowCommands").asBoolean(gametype == GameType.CREATIVE), - GameRules.codec(p_251697_.enabledFeatures()).parse(p_46925_.get("game_rules").orElseEmptyMap()).resultOrPartial(LOGGER::warn).orElseThrow(), -- p_251697_ -+ p_251697_, -+ net.minecraftforge.common.ForgeHooks.parseLifecycle(p_46925_.get("forgeLifecycle").asString("stable")) + public static LevelSettings parse(final Dynamic input, final WorldDataConfiguration loadConfig) { + GameType gameType = GameType.byId(input.get("GameType").asInt(0)); + return new LevelSettings( +@@ -15,12 +_,13 @@ + gameType, + input.get("difficulty_settings").read(LevelSettings.DifficultySettings.CODEC).result().orElse(LevelSettings.DifficultySettings.DEFAULT), + input.get("allowCommands").asBoolean(gameType == GameType.CREATIVE), +- loadConfig ++ loadConfig, ++ net.minecraftforge.common.ForgeHooks.parseLifecycle(input.get("forgeLifecycle").asString("stable")) ); } -@@ -70,20 +_,28 @@ + public LevelSettings withGameType(final GameType gameType) { +- return new LevelSettings(this.levelName, gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration); ++ return new LevelSettings(this.levelName, gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration, this.lifecycle); } - public LevelSettings withGameType(GameType p_46923_) { -- return new LevelSettings(this.levelName, p_46923_, this.hardcore, this.difficulty, this.allowCommands, this.gameRules, this.dataConfiguration); -+ return new LevelSettings(this.levelName, p_46923_, this.hardcore, this.difficulty, this.allowCommands, this.gameRules, this.dataConfiguration, this.lifecycle); + public LevelSettings withAllowCommands(final boolean allowCommands) { +@@ -33,7 +_,8 @@ + this.gameType, + new LevelSettings.DifficultySettings(difficulty, this.difficultySettings.hardcore(), this.difficultySettings.locked()), + this.allowCommands, +- this.dataConfiguration ++ this.dataConfiguration, ++ this.lifecycle + ); } - public LevelSettings withDifficulty(Difficulty p_46919_) { -- return new LevelSettings(this.levelName, this.gameType, this.hardcore, p_46919_, this.allowCommands, this.gameRules, this.dataConfiguration); -+ return new LevelSettings(this.levelName, this.gameType, this.hardcore, p_46919_, this.allowCommands, this.gameRules, this.dataConfiguration, this.lifecycle); +@@ -43,16 +_,21 @@ + this.gameType, + new LevelSettings.DifficultySettings(this.difficultySettings.difficulty(), this.difficultySettings.hardcore(), locked), + this.allowCommands, +- this.dataConfiguration ++ this.dataConfiguration, ++ this.lifecycle + ); } - public LevelSettings withDataConfiguration(WorldDataConfiguration p_250867_) { -- return new LevelSettings(this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules, p_250867_); -+ return new LevelSettings(this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules, p_250867_, this.lifecycle); + public LevelSettings withDataConfiguration(final WorldDataConfiguration dataConfiguration) { +- return new LevelSettings(this.levelName, this.gameType, this.difficultySettings, this.allowCommands, dataConfiguration); ++ return new LevelSettings(this.levelName, this.gameType, this.difficultySettings, this.allowCommands, dataConfiguration, this.lifecycle); } public LevelSettings copy() { - return new LevelSettings( -- this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules.copy(this.dataConfiguration.enabledFeatures()), this.dataConfiguration -+ this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules.copy(this.dataConfiguration.enabledFeatures()), this.dataConfiguration, this.lifecycle - ); +- return new LevelSettings(this.levelName, this.gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration); ++ return new LevelSettings(this.levelName, this.gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration, this.lifecycle); + } + -+ public LevelSettings withLifecycle(com.mojang.serialization.Lifecycle lifecycle) { -+ return new LevelSettings(this.levelName, this.gameType, this.hardcore, this.difficulty, this.allowCommands, this.gameRules, this.dataConfiguration, lifecycle); -+ } -+ -+ public com.mojang.serialization.Lifecycle getLifecycle() { -+ return this.lifecycle; ++ public LevelSettings withLifecycle(final com.mojang.serialization.Lifecycle lifecycle) { ++ return new LevelSettings(this.levelName, this.gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration, lifecycle); } - } + + public record DifficultySettings(Difficulty difficulty, boolean hardcore, boolean locked) { diff --git a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch index 02120817f7..42d63762ca 100644 --- a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch @@ -1,64 +1,63 @@ --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -72,7 +_,7 @@ +@@ -75,7 +_,7 @@ - for (Entity entity : p_186526_) { + for (Entity entity : entities) { if (!(entity instanceof Mob mob && (mob.isPersistenceRequired() || mob.requiresCustomPersistence()))) { -- MobCategory mobcategory = entity.getType().getCategory(); -+ MobCategory mobcategory = entity.getClassification(true); - if (mobcategory != MobCategory.MISC) { - BlockPos blockpos = entity.blockPosition(); - p_186527_.query(ChunkPos.asLong(blockpos), p_275163_ -> { -@@ -203,7 +_,7 @@ - l1++; - p_47040_.addFreshEntityWithPassengers(mob); - p_47044_.run(mob, p_47041_); -- if (j >= mob.getMaxSpawnClusterSize()) { -+ if (j >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mob)) { +- MobCategory category = entity.getType().getCategory(); ++ MobCategory category = entity.getClassification(true); + if (category != MobCategory.MISC) { + BlockPos pos = entity.blockPosition(); + chunkGetter.query(ChunkPos.pack(pos), chunk -> { +@@ -211,7 +_,7 @@ + groupSize++; + level.addFreshEntityWithPassengers(mob); + spawnCallback.run(mob, chunk); +- if (clusterSize >= mob.getMaxSpawnClusterSize()) { ++ if (clusterSize >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mob)) { return; } -@@ -276,7 +_,7 @@ - private static boolean isValidPositionForMob(ServerLevel p_46992_, Mob p_46993_, double p_46994_) { - return p_46994_ > p_46993_.getType().getCategory().getDespawnDistance() * p_46993_.getType().getCategory().getDespawnDistance() && p_46993_.removeWhenFarAway(p_46994_) +@@ -288,7 +_,7 @@ + return nearestPlayerDistanceSqr > mob.getType().getCategory().getDespawnDistance() * mob.getType().getCategory().getDespawnDistance() + && mob.removeWhenFarAway(nearestPlayerDistanceSqr) ? false -- : p_46993_.checkSpawnRules(p_46992_, EntitySpawnReason.NATURAL) && p_46993_.checkSpawnObstruction(p_46992_); -+ : net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(p_46993_, p_46992_, EntitySpawnReason.NATURAL); +- : mob.checkSpawnRules(level, EntitySpawnReason.NATURAL) && mob.checkSpawnObstruction(level); ++ : net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(mob, level, EntitySpawnReason.NATURAL); } private static Optional getRandomSpawnMobAt( -@@ -307,9 +_,13 @@ - BlockPos p_220448_, - @Nullable Holder p_220449_ +@@ -324,9 +_,11 @@ + final BlockPos pos, + final @Nullable Holder biome ) { -- return isInNetherFortressBounds(p_220448_, p_220444_, p_220447_, p_220445_) +- return isInNetherFortressBounds(pos, level, mobCategory, structureManager) - ? NetherFortressStructure.FORTRESS_ENEMIES -- : p_220446_.getMobsAt(p_220449_ != null ? p_220449_ : p_220444_.getBiome(p_220448_), p_220445_, p_220447_, p_220448_); -+ // Forge: Add in potential spawns, and replace hardcoded nether fortress mob list -+ return net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(p_220444_, p_220447_, p_220448_, -+ isInNetherFortressBounds(p_220448_, p_220444_, p_220447_, p_220445_) -+ ? p_220445_.registryAccess().lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.FORTRESS) -+ .get().spawnOverrides().get(MobCategory.MONSTER).spawns() -+ : p_220446_.getMobsAt(p_220449_ != null ? p_220449_ : p_220444_.getBiome(p_220448_), p_220445_, p_220447_, p_220448_) +- : generator.getMobsAt(biome != null ? biome : level.getBiome(pos), structureManager, mobCategory, pos); ++ return net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(level, mobCategory, pos, ++ isInNetherFortressBounds(pos, level, mobCategory, structureManager) ++ ? structureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getOrThrow(BuiltinStructures.FORTRESS).get().spawnOverrides().get(MobCategory.MONSTER).spawns() ++ : generator.getMobsAt(biome != null ? biome : level.getBiome(pos), structureManager, mobCategory, pos) + ); } - public static boolean isInNetherFortressBounds(BlockPos p_220456_, ServerLevel p_220457_, MobCategory p_220458_, StructureManager p_220459_) { -@@ -395,7 +_,7 @@ - } + public static boolean isInNetherFortressBounds( +@@ -417,8 +_,7 @@ - entity.snapTo(d0, blockpos.getY(), d1, p_220454_.nextFloat() * 360.0F, 0.0F); -- if (entity instanceof Mob mob && mob.checkSpawnRules(p_220451_, EntitySpawnReason.CHUNK_GENERATION) && mob.checkSpawnObstruction(p_220451_)) { -+ if (entity instanceof Mob mob && net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(mob, p_220451_, EntitySpawnReason.CHUNK_GENERATION)) { - spawngroupdata = mob.finalizeSpawn( - p_220451_, p_220451_.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CHUNK_GENERATION, spawngroupdata + entity.snapTo(fx, pos.getY(), fz, random.nextFloat() * 360.0F, 0.0F); + if (entity instanceof Mob mob +- && mob.checkSpawnRules(level, EntitySpawnReason.CHUNK_GENERATION) +- && mob.checkSpawnObstruction(level)) { ++ && net.minecraftforge.event.ForgeEventFactory.checkSpawnPosition(mob, level, EntitySpawnReason.CHUNK_GENERATION)) { + groupSpawnData = mob.finalizeSpawn( + level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CHUNK_GENERATION, groupSpawnData ); -@@ -499,7 +_,7 @@ +@@ -527,7 +_,7 @@ } - this.spawnPotential.addCharge(blockpos, d0); -- MobCategory mobcategory = entitytype.getCategory(); -+ MobCategory mobcategory = p_47132_.getClassification(true); - this.mobCategoryCounts.addTo(mobcategory, 1); - this.localMobCapCalculator.addMob(new ChunkPos(blockpos), mobcategory); + this.spawnPotential.addCharge(pos, charge); +- MobCategory category = type.getCategory(); ++ MobCategory category = mob.getClassification(true); + this.mobCategoryCounts.addTo(category, 1); + this.localMobCapCalculator.addMob(ChunkPos.containing(pos), category); } diff --git a/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch b/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch index 1c584b034e..57726cd98d 100644 --- a/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch +++ b/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -169,7 +_,7 @@ - return new ObjectArrayList<>(set); + return new ObjectArrayList<>(toBlowSet); } - private void hurtEntities() { + private void hurtEntities(List blocks) { if (!(this.radius < 1.0E-5F)) { - float f = this.radius * 2.0F; - int i = Mth.floor(this.center.x - f - 1.0); + float doubleRadius = this.radius * 2.0F; + int x0 = Mth.floor(this.center.x - doubleRadius - 1.0); @@ -179,7 +_,9 @@ - int i1 = Mth.floor(this.center.z - f - 1.0); - int j1 = Mth.floor(this.center.z + f + 1.0); + int z0 = Mth.floor(this.center.z - doubleRadius - 1.0); + int z1 = Mth.floor(this.center.z + doubleRadius + 1.0); -- for (Entity entity : this.level.getEntities(this.source, new AABB(i, k, i1, j, l, j1))) { -+ var entities = this.level.getEntities(this.source, new AABB(i, k, i1, j, l, j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.level, this, blocks, entities, f); +- for (Entity entity : this.level.getEntities(this.source, new AABB(x0, y0, z0, x1, y1, z1))) { ++ var entities = this.level.getEntities(this.source, new AABB(x0, y0, z0, x1, y1, z1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.level, this, blocks, entities, doubleRadius); + for (Entity entity : entities) { if (!entity.ignoreExplosion(this)) { - double d0 = Math.sqrt(entity.distanceToSqr(this.center)) / f; - if (!(d0 > 1.0)) { + double dist = Math.sqrt(entity.distanceToSqr(this.center)) / doubleRadius; + if (!(dist > 1.0)) { @@ -235,7 +_,7 @@ public int explode() { this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center); - List list = this.calculateExplodedPositions(); + List toBlow = this.calculateExplodedPositions(); - this.hurtEntities(); -+ this.hurtEntities(list); ++ this.hurtEntities(toBlow); if (this.interactsWithBlocks()) { - ProfilerFiller profilerfiller = Profiler.get(); - profilerfiller.push("explosion_blocks"); + ProfilerFiller profiler = Profiler.get(); + profiler.push("explosion_blocks"); diff --git a/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch index 610631297d..8e06992beb 100644 --- a/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch +++ b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/SignalGetter.java +++ b/net/minecraft/world/level/SignalGetter.java @@ -65,7 +_,7 @@ - default int getSignal(BlockPos p_277961_, Direction p_277351_) { - BlockState blockstate = this.getBlockState(p_277961_); - int i = blockstate.getSignal(this, p_277961_, p_277351_); -- return blockstate.isRedstoneConductor(this, p_277961_) ? Math.max(i, this.getDirectSignalTo(p_277961_)) : i; -+ return blockstate.shouldCheckWeakPower(this, p_277961_, p_277351_) ? Math.max(i, this.getDirectSignalTo(p_277961_)) : i; + default int getSignal(final BlockPos pos, final Direction direction) { + BlockState state = this.getBlockState(pos); + int signal = state.getSignal(this, pos, direction); +- return state.isRedstoneConductor(this, pos) ? Math.max(signal, this.getDirectSignalTo(pos)) : signal; ++ return state.shouldCheckWeakPower(this, pos, direction) ? Math.max(signal, this.getDirectSignalTo(pos)) : signal; } - default boolean hasNeighborSignal(BlockPos p_277626_) { + default int getBestOwnOrNeighbourSignal(final BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch index 6f7de28896..f847507ef4 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java -@@ -36,9 +_,9 @@ +@@ -35,9 +_,9 @@ public final class Biome { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( - p_449877_ -> p_449877_.group( -- Biome.ClimateSettings.CODEC.forGetter(p_151717_ -> p_151717_.climateSettings), -+ Biome.ClimateSettings.CODEC.forGetter(p_151717_ -> p_151717_.modifiableBiomeInfo().getOriginalBiomeInfo().climateSettings()), // FORGE: Patch codec to ignore field redirect coremods. - EnvironmentAttributeMap.CODEC_ONLY_POSITIONAL.optionalFieldOf("attributes", EnvironmentAttributeMap.EMPTY).forGetter(p_449873_ -> p_449873_.attributes), -- BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter(p_220550_ -> p_220550_.specialEffects), -+ BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter(p_220550_ -> p_220550_.modifiableBiomeInfo().getOriginalBiomeInfo().effects()), // FORGE: Patch codec to ignore field redirect coremods. - BiomeGenerationSettings.CODEC.forGetter(p_220548_ -> p_220548_.generationSettings), - MobSpawnSettings.CODEC.forGetter(p_220546_ -> p_220546_.mobSettings) + i -> i.group( +- Biome.ClimateSettings.CODEC.forGetter(b -> b.climateSettings), ++ Biome.ClimateSettings.CODEC.forGetter(b -> b.modifiableBiomeInfo().getOriginalBiomeInfo().climateSettings()), // FORGE: Patch codec to ignore field redirect coremods. + EnvironmentAttributeMap.CODEC_ONLY_POSITIONAL.optionalFieldOf("attributes", EnvironmentAttributeMap.EMPTY).forGetter(b -> b.attributes), +- BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter(b -> b.specialEffects), ++ BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter(b -> b.modifiableBiomeInfo().getOriginalBiomeInfo().effects()), // FORGE: Patch codec to ignore field redirect coremods. + BiomeGenerationSettings.CODEC.forGetter(b -> b.generationSettings), + MobSpawnSettings.CODEC.forGetter(b -> b.mobSettings) ) -@@ -62,8 +_,10 @@ +@@ -65,8 +_,10 @@ @Deprecated(forRemoval = true) public static final PerlinSimplexNoise BIOME_INFO_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(2345L)), ImmutableList.of(0)); private static final int TEMPERATURE_CACHE_SIZE = 1024; @@ -23,19 +23,19 @@ private final MobSpawnSettings mobSettings; private final EnvironmentAttributeMap attributes; private final BiomeSpecialEffects specialEffects; -@@ -76,6 +_,7 @@ - long2floatlinkedopenhashmap.defaultReturnValue(Float.NaN); - return long2floatlinkedopenhashmap; +@@ -79,6 +_,7 @@ + map.defaultReturnValue(Float.NaN); + return map; }); + private final net.minecraftforge.common.world.ModifiableBiomeInfo modifiableBiomeInfo; - Biome( - Biome.ClimateSettings p_220530_, -@@ -89,10 +_,11 @@ - this.mobSettings = p_220533_; - this.attributes = p_455689_; - this.specialEffects = p_220531_; -+ this.modifiableBiomeInfo = new net.minecraftforge.common.world.ModifiableBiomeInfo(new net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo(p_220530_, p_220531_, p_220532_, p_220533_)); // FORGE: cache original biome info on construction so we can bypass our field read coremods where necessary + private Biome( + final Biome.ClimateSettings climateSettings, +@@ -92,10 +_,11 @@ + this.mobSettings = mobSettings; + this.attributes = attributes; + this.specialEffects = specialEffects; ++ this.modifiableBiomeInfo = new net.minecraftforge.common.world.ModifiableBiomeInfo(new net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo(climateSettings, specialEffects, generationSettings, mobSettings)); // FORGE: cache original biome info on construction so we can bypass our field read coremods where necessary } public MobSpawnSettings getMobSettings() { @@ -44,7 +44,7 @@ } public boolean hasPrecipitation() { -@@ -194,7 +_,7 @@ +@@ -197,7 +_,7 @@ } public BiomeGenerationSettings getGenerationSettings() { @@ -52,8 +52,8 @@ + return this.modifiableBiomeInfo().get().generationSettings(); } - public int getGrassColor(double p_47465_, double p_47466_) { -@@ -247,6 +_,31 @@ + public int getGrassColor(final double x, final double z) { +@@ -250,6 +_,31 @@ public int getWaterColor() { return this.specialEffects.waterColor(); diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch index 3a0ab5621a..32e97a6bf5 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/BiomeGenerationSettings.java +++ b/net/minecraft/world/level/biome/BiomeGenerationSettings.java -@@ -99,6 +_,17 @@ +@@ -92,6 +_,17 @@ protected final List>> carvers = new ArrayList<>(); protected final List>> features = new ArrayList<>(); @@ -15,12 +15,12 @@ + return this; + } + - public BiomeGenerationSettings.PlainBuilder addFeature(GenerationStep.Decoration p_256360_, Holder p_256577_) { - return this.addFeature(p_256360_.ordinal(), p_256577_); + public BiomeGenerationSettings.PlainBuilder addFeature(final GenerationStep.Decoration step, final Holder feature) { + return this.addFeature(step.ordinal(), feature); } -@@ -107,6 +_,11 @@ - this.addFeatureStepsUpTo(p_256305_); - this.features.get(p_256305_).add(p_255636_); +@@ -100,6 +_,11 @@ + this.addFeatureStepsUpTo(index); + this.features.get(index).add(feature); return this; + } + @@ -29,4 +29,4 @@ + return this.features.get(stage.ordinal()); } - public BiomeGenerationSettings.PlainBuilder addCarver(Holder> p_256082_) { + public BiomeGenerationSettings.PlainBuilder addCarver(final Holder> carver) { diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch index 4dd164fe4d..5e4c8d0438 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/biome/BiomeSpecialEffects.java +++ b/net/minecraft/world/level/biome/BiomeSpecialEffects.java -@@ -24,6 +_,10 @@ - .apply(p_449881_, BiomeSpecialEffects::new) +@@ -28,6 +_,10 @@ + .apply(i, BiomeSpecialEffects::new) ); + public net.minecraftforge.common.world.BiomeSpecialEffectsBuilder copy() { @@ -11,7 +11,7 @@ public static class Builder { protected OptionalInt waterColor = OptionalInt.empty(); protected Optional foliageColorOverride = Optional.empty(); -@@ -31,6 +_,10 @@ +@@ -35,6 +_,10 @@ protected Optional grassColorOverride = Optional.empty(); protected BiomeSpecialEffects.GrassColorModifier grassColorModifier = BiomeSpecialEffects.GrassColorModifier.NONE; @@ -19,39 +19,38 @@ + return net.minecraftforge.common.world.BiomeSpecialEffectsBuilder.create(); + } + - public BiomeSpecialEffects.Builder waterColor(int p_48035_) { - this.waterColor = OptionalInt.of(p_48035_); + public BiomeSpecialEffects.Builder waterColor(final int waterColor) { + this.waterColor = OptionalInt.of(waterColor); return this; -@@ -67,7 +_,7 @@ +@@ -71,7 +_,7 @@ } } -- public static enum GrassColorModifier implements StringRepresentable { +- public enum GrassColorModifier implements StringRepresentable { + public static enum GrassColorModifier implements StringRepresentable, net.minecraftforge.common.IExtensibleEnum { NONE("none") { @Override - public int modifyColor(double p_48081_, double p_48082_, int p_48083_) { -@@ -89,11 +_,16 @@ + public int modifyColor(final double x, final double z, final int baseColor) { +@@ -93,9 +_,16 @@ }; private final String name; -- public static final Codec CODEC = StringRepresentable.fromEnum( -- BiomeSpecialEffects.GrassColorModifier::values +- public static final Codec CODEC = StringRepresentable.fromEnum(BiomeSpecialEffects.GrassColorModifier::values); + public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum( + BiomeSpecialEffects.GrassColorModifier::values, + BiomeSpecialEffects.GrassColorModifier::byName - ); ++ ); + private static final java.util.Map BY_NAME = java.util.Arrays.stream(values()).collect(java.util.stream.Collectors.toMap(BiomeSpecialEffects.GrassColorModifier::getName, grassColorModifier -> grassColorModifier)); + private ColorModifier delegate; -- public abstract int modifyColor(double p_48065_, double p_48066_, int p_48067_); -+ public int modifyColor(double p_48065_, double p_48066_, int p_48067_) { -+ return delegate.modifyGrassColor(p_48065_, p_48066_, p_48067_); +- public abstract int modifyColor(final double x, final double z, final int baseColor); ++ public int modifyColor(final double x, final double z, final int baseColor) { ++ return delegate.modifyGrassColor(x, z, baseColor); + } - GrassColorModifier(final String p_48058_) { - this.name = p_48058_; -@@ -106,6 +_,30 @@ + GrassColorModifier(final String name) { + this.name = name; +@@ -108,6 +_,30 @@ @Override public String getSerializedName() { return this.name; diff --git a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch index 8fa43b8e89..fa2f93ca8d 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch @@ -7,18 +7,18 @@ + private final java.util.Set typesView; + private final java.util.Set> costView; - MobSpawnSettings( - float p_196689_, Map> p_196690_, Map, MobSpawnSettings.MobSpawnCost> p_196691_ -@@ -51,6 +_,8 @@ - this.creatureGenerationProbability = p_196689_; - this.spawners = ImmutableMap.copyOf(p_196690_); - this.mobSpawnCosts = ImmutableMap.copyOf(p_196691_); + private MobSpawnSettings( + final float creatureGenerationProbability, +@@ -53,6 +_,8 @@ + this.creatureGenerationProbability = creatureGenerationProbability; + this.spawners = ImmutableMap.copyOf(spawners); + this.mobSpawnCosts = ImmutableMap.copyOf(mobSpawnCosts); + this.typesView = java.util.Collections.unmodifiableSet(this.spawners.keySet()); + this.costView = java.util.Collections.unmodifiableSet(this.mobSpawnCosts.keySet()); } - public WeightedList getMobs(MobCategory p_151799_) { -@@ -63,6 +_,14 @@ + public WeightedList getMobs(final MobCategory category) { +@@ -65,6 +_,14 @@ public float getCreatureProbability() { return this.creatureGenerationProbability; diff --git a/patches/minecraft/net/minecraft/world/level/block/AttachedStemBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/AttachedStemBlock.java.patch index dd5de85507..a8c65d1e04 100644 --- a/patches/minecraft/net/minecraft/world/level/block/AttachedStemBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/AttachedStemBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/AttachedStemBlock.java +++ b/net/minecraft/world/level/block/AttachedStemBlock.java -@@ -81,7 +_,7 @@ +@@ -90,7 +_,7 @@ @Override - protected boolean mayPlaceOn(BlockState p_48863_, BlockGetter p_48864_, BlockPos p_48865_) { -- return p_48863_.is(Blocks.FARMLAND); -+ return p_48863_.getBlock() instanceof net.minecraft.world.level.block.FarmBlock; + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { +- return state.is(this.supportBlocks); ++ return state.getBlock() instanceof FarmlandBlock; } @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/BambooStalkBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BambooStalkBlock.java.patch index e663ab770d..ee5352661c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BambooStalkBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BambooStalkBlock.java.patch @@ -11,23 +11,23 @@ private static final VoxelShape SHAPE_LARGE = Block.column(10.0, 0.0, 16.0); @@ -119,10 +_,12 @@ @Override - protected void randomTick(BlockState p_261931_, ServerLevel p_261751_, BlockPos p_261616_, RandomSource p_261766_) { - if (p_261931_.getValue(STAGE) == 0) { -- if (p_261766_.nextInt(3) == 0 && p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { -+ boolean vanilla = p_261766_.nextInt(3) == 0; -+ if (p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { - int i = this.getHeightBelowUpToMax(p_261751_, p_261616_) + 1; -- if (i < 16) { -+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_261751_, p_261616_, p_261931_, vanilla)) { - this.growBamboo(p_261931_, p_261751_, p_261616_, p_261766_, i); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_261751_, p_261616_, p_261931_); + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + if (state.getValue(STAGE) == 0) { +- if (random.nextInt(3) == 0 && level.isEmptyBlock(pos.above()) && level.getRawBrightness(pos.above(), 0) >= 9) { ++ boolean vanilla = random.nextInt(3) == 0; ++ if (level.isEmptyBlock(pos.above()) && level.getRawBrightness(pos.above(), 0) >= 9) { + int height = this.getHeightBelowUpToMax(level, pos) + 1; +- if (height < 16) { ++ if (height < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, vanilla)) { + this.growBamboo(state, level, pos, random, height); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } } -@@ -225,5 +_,11 @@ +@@ -230,5 +_,11 @@ } - return i; + return height; + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch index 045538f3cf..a3f3d83125 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/level/block/BaseFireBlock.java +++ b/net/minecraft/world/level/block/BaseFireBlock.java -@@ -154,6 +_,7 @@ - if (!p_49282_.is(p_49279_.getBlock())) { - if (inPortalDimension(p_49280_)) { - Optional optional = PortalShape.findEmptyPortalShape(p_49280_, p_49281_, Direction.Axis.X); -+ optional = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_49280_, p_49281_, optional); - if (optional.isPresent()) { - optional.get().createPortalBlocks(p_49280_); +@@ -161,6 +_,7 @@ + if (!oldState.is(state.getBlock())) { + if (inPortalDimension(level)) { + Optional optionalShape = PortalShape.findEmptyPortalShape(level, pos, Direction.Axis.X); ++ optionalShape = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(level, pos, optionalShape); + if (optionalShape.isPresent()) { + optionalShape.get().createPortalBlocks(level); return; -@@ -196,7 +_,7 @@ - boolean flag = false; +@@ -204,7 +_,7 @@ + boolean hasObsidian = false; - for (Direction direction : Direction.values()) { -- if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).is(Blocks.OBSIDIAN)) { -+ if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).isPortalFrame(p_49270_, blockpos$mutableblockpos)) { - flag = true; - break; - } + for (Direction face : Direction.values()) { +- if (level.getBlockState(testPos.set(pos).move(face)).is(Blocks.OBSIDIAN)) { ++ if (level.getBlockState(testPos.set(pos).move(face)).isPortalFrame(level, testPos)) { + hasObsidian = true; + break; + } 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 33240a7469..9ccda93a2a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -9,26 +9,26 @@ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; private static final VoxelShape SHAPE_FLAT = Block.column(16.0, 0.0, 2.0); private static final VoxelShape SHAPE_SLOPE = Block.column(16.0, 0.0, 8.0); -@@ -79,7 +_,7 @@ +@@ -81,7 +_,7 @@ + final BlockState state, final Level level, final BlockPos pos, final Block block, final @Nullable Orientation orientation, final boolean movedByPiston + ) { + if (!level.isClientSide() && level.getBlockState(pos).is(this)) { +- RailShape shape = state.getValue(this.getShapeProperty()); ++ RailShape shape = getRailDirection(state, level, pos, null); + if (shouldBeRemoved(pos, level, shape)) { + dropResources(state, level, pos); + level.removeBlock(pos, movedByPiston); +@@ -120,7 +_,7 @@ @Override - protected void neighborChanged(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, @Nullable Orientation p_362860_, boolean p_49382_) { - if (!p_49378_.isClientSide() && p_49378_.getBlockState(p_49379_).is(this)) { -- RailShape railshape = p_49377_.getValue(this.getShapeProperty()); -+ RailShape railshape = getRailDirection(p_49377_, p_49378_, p_49379_, null); - if (shouldBeRemoved(p_49379_, p_49378_, railshape)) { - dropResources(p_49377_, p_49378_, p_49379_); - p_49378_.removeBlock(p_49379_, p_49382_); -@@ -123,7 +_,7 @@ - @Override - protected void affectNeighborsAfterRemoval(BlockState p_397007_, ServerLevel p_395211_, BlockPos p_393934_, boolean p_393188_) { - if (!p_393188_) { -- if (p_397007_.getValue(this.getShapeProperty()).isSlope()) { -+ if (getRailDirection(p_397007_, p_395211_, p_393934_, null).isSlope()) { - p_395211_.updateNeighborsAt(p_393934_.above(), this); + protected void affectNeighborsAfterRemoval(final BlockState state, final ServerLevel level, final BlockPos pos, final boolean movedByPiston) { + if (!movedByPiston) { +- if (state.getValue(this.getShapeProperty()).isSlope()) { ++ if (getRailDirection(state, level, pos, null).isSlope()) { + level.updateNeighborsAt(pos.above(), this); } -@@ -144,6 +_,11 @@ - return blockstate.setValue(this.getShapeProperty(), flag1 ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).setValue(WATERLOGGED, flag); +@@ -141,6 +_,11 @@ + return state.setValue(this.getShapeProperty(), isEastWest ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).setValue(WATERLOGGED, isWaterSource); } + /** @@ -38,20 +38,20 @@ + @Deprecated public abstract Property getShapeProperty(); - protected RailShape rotate(RailShape p_409491_, Rotation p_408760_) { -@@ -299,5 +_,15 @@ + protected RailShape rotate(final RailShape shape, final Rotation rotation) { +@@ -296,5 +_,15 @@ @Override - protected FluidState getFluidState(BlockState p_152158_) { - return p_152158_.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(p_152158_); + protected FluidState getFluidState(final BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override -+ public boolean isFlexibleRail(BlockState state, BlockGetter world, BlockPos pos) { ++ public boolean isFlexibleRail(final BlockState state, final BlockGetter level, final BlockPos pos) { + return !this.isStraight; + } + + @Override -+ public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, net.minecraft.world.entity.vehicle.minecart.@Nullable AbstractMinecart cart) { ++ public RailShape getRailDirection(final BlockState state, final BlockGetter level, final BlockPos pos, final net.minecraft.world.entity.vehicle.minecart.@Nullable AbstractMinecart cart) { + return state.getValue(getShapeProperty()); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch index f8c40511f1..887e3eeda0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -146,7 +_,7 @@ - boolean flag = false; - if (i >= 5) { - Item item = p_331014_.getItem(); -- if (p_329187_ instanceof ServerLevel serverlevel && p_331014_.is(Items.SHEARS)) { -+ if (p_329187_ instanceof ServerLevel serverlevel && p_331014_.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { - dropHoneycomb(serverlevel, p_331014_, p_328141_, p_329187_.getBlockEntity(p_335985_), p_336201_, p_335985_); - p_329187_.playSound(null, p_336201_.getX(), p_336201_.getY(), p_336201_.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); - p_331014_.hurtAndBreak(1, p_336201_, p_333071_.asEquipmentSlot()); +@@ -161,7 +_,7 @@ + boolean hiveEmptied = false; + if (honeyLevel >= 5) { + Item item = itemStack.getItem(); +- if (level instanceof ServerLevel serverLevel && itemStack.is(Items.SHEARS)) { ++ if (level instanceof ServerLevel serverLevel && itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { + dropHoneycomb(serverLevel, itemStack, state, level.getBlockEntity(pos), player, pos); + level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); + itemStack.hurtAndBreak(1, player, hand.asEquipmentSlot()); 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 1de3d532b1..c58c556221 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/Block.java +++ b/net/minecraft/world/level/block/Block.java -@@ -74,11 +_,12 @@ +@@ -75,11 +_,12 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -15,65 +15,68 @@ private static final LoadingCache SHAPE_FULL_BLOCK_CACHE = CacheBuilder.newBuilder() .maximumSize(512L) .weakKeys() -@@ -245,6 +_,7 @@ - LOGGER.error("Block classes should end with Block and {} doesn't.", s); +@@ -247,6 +_,7 @@ + LOGGER.error("Block classes should end with Block and {} doesn't.", className); } } + initClient(); } - public static boolean isExceptionForConnection(BlockState p_152464_) { -@@ -295,12 +_,19 @@ + public static boolean isExceptionForConnection(final BlockState state) { +@@ -297,7 +_,12 @@ } } + @Deprecated // FORGE: use shouldRenderFace with level and block pos instead - public static boolean shouldRenderFace(BlockState p_152445_, BlockState p_362730_, Direction p_152448_) { -+ return shouldRenderFace(net.minecraft.world.level.EmptyBlockGetter.INSTANCE, BlockPos.ZERO, p_152445_, p_362730_, p_152448_); + public static boolean shouldRenderFace(final BlockState state, final BlockState neighborState, final Direction direction) { ++ return shouldRenderFace(net.minecraft.world.level.EmptyBlockGetter.INSTANCE, BlockPos.ZERO, state, neighborState, direction); + } + -+ public static boolean shouldRenderFace(BlockGetter level, BlockPos pos, BlockState p_152445_, BlockState p_362730_, Direction p_152448_) { - VoxelShape voxelshape = p_362730_.getFaceOcclusionShape(p_152448_.getOpposite()); - if (voxelshape == Shapes.block()) { ++ public static boolean shouldRenderFace(final BlockGetter level, final BlockPos pos, final BlockState state, final BlockState neighborState, final Direction direction) { + VoxelShape occluder = neighborState.getFaceOcclusionShape(direction.getOpposite()); + if (occluder == Shapes.block()) { return false; - } else if (p_152445_.skipRendering(p_362730_, p_152448_)) { - return false; -+ } else if (p_152445_.supportsExternalFaceHiding() && p_362730_.hidesNeighborFace(level, pos.relative(p_152448_), p_152445_, p_152448_.getOpposite())) { -+ return false; - } else if (voxelshape == Shapes.empty()) { - return true; - } else { -@@ -388,9 +_,13 @@ - public static void dropResources( - BlockState p_49882_, Level p_49883_, BlockPos p_49884_, @Nullable BlockEntity p_49885_, @Nullable Entity p_49886_, ItemStack p_49887_ - ) { -+ dropResources(p_49882_, p_49883_, p_49884_, p_49885_, p_49886_, p_49887_, true); -+ } -+ -+ public static void dropResources(BlockState p_49882_, Level p_49883_, BlockPos p_49884_, @Nullable BlockEntity p_49885_, @Nullable Entity p_49886_, ItemStack p_49887_, boolean dropXp) { - if (p_49883_ instanceof ServerLevel) { - getDrops(p_49882_, (ServerLevel)p_49883_, p_49884_, p_49885_, p_49886_, p_49887_).forEach(p_49944_ -> popResource(p_49883_, p_49884_, p_49944_)); -- p_49882_.spawnAfterBreak((ServerLevel)p_49883_, p_49884_, p_49887_, true); -+ p_49882_.spawnAfterBreak((ServerLevel)p_49883_, p_49884_, p_49887_, dropXp); +@@ -396,17 +_,22 @@ } } -@@ -418,7 +_,7 @@ ++ public static void dropResources(final BlockState state, final Level level, final BlockPos pos, final @Nullable BlockEntity blockEntity, final @Nullable Entity breaker, final ItemStack tool) { ++ dropResources(state, level, pos, blockEntity, breaker, tool, true); ++ } ++ + public static void dropResources( + final BlockState state, + final Level level, + final BlockPos pos, + final @Nullable BlockEntity blockEntity, + final @Nullable Entity breaker, +- final ItemStack tool ++ final ItemStack tool, ++ final boolean dropXp + ) { + if (level instanceof ServerLevel serverLevel) { + getDrops(state, serverLevel, pos, blockEntity, breaker, tool).forEach(stack -> popResource(level, pos, stack)); +- state.spawnAfterBreak(serverLevel, pos, tool, true); ++ state.spawnAfterBreak(serverLevel, pos, tool, dropXp); + } } - private static void popResource(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { -- if (p_152441_ instanceof ServerLevel serverlevel && !p_152443_.isEmpty() && serverlevel.getGameRules().get(GameRules.BLOCK_DROPS)) { -+ if (p_152441_ instanceof ServerLevel serverlevel && !p_152443_.isEmpty() && serverlevel.getGameRules().get(GameRules.BLOCK_DROPS) && !p_152441_.restoringBlockSnapshots) { - ItemEntity itementity = p_152442_.get(); - itementity.setDefaultPickUpDelay(); - p_152441_.addFreshEntity(itementity); -@@ -426,11 +_,12 @@ +@@ -436,7 +_,7 @@ } - public void popExperience(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { -- if (p_49806_.getGameRules().get(GameRules.BLOCK_DROPS)) { -+ if (p_49806_.getGameRules().get(GameRules.BLOCK_DROPS) && !p_49806_.restoringBlockSnapshots) { - ExperienceOrb.award(p_49806_, Vec3.atCenterOf(p_49807_), p_49808_); + private static void popResource(final Level level, final Supplier entityFactory, final ItemStack itemStack) { +- if (level instanceof ServerLevel serverLevel && !itemStack.isEmpty() && serverLevel.getGameRules().get(GameRules.BLOCK_DROPS)) { ++ if (level instanceof ServerLevel serverLevel && !itemStack.isEmpty() && serverLevel.getGameRules().get(GameRules.BLOCK_DROPS) && !level.restoringBlockSnapshots) { + ItemEntity entity = entityFactory.get(); + entity.setDefaultPickUpDelay(); + level.addFreshEntity(entity); +@@ -444,11 +_,12 @@ + } + + public void popExperience(final ServerLevel level, final BlockPos pos, final int amount) { +- if (level.getGameRules().get(GameRules.BLOCK_DROPS)) { ++ if (level.getGameRules().get(GameRules.BLOCK_DROPS) && !level.restoringBlockSnapshots) { + ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount); } } @@ -81,25 +84,25 @@ public float getExplosionResistance() { return this.explosionResistance; } -@@ -448,7 +_,8 @@ - public void playerDestroy(Level p_49827_, Player p_49828_, BlockPos p_49829_, BlockState p_49830_, @Nullable BlockEntity p_49831_, ItemStack p_49832_) { - p_49828_.awardStat(Stats.BLOCK_MINED.get(this)); - p_49828_.causeFoodExhaustion(0.005F); -- dropResources(p_49830_, p_49827_, p_49829_, p_49831_, p_49828_, p_49832_); +@@ -473,7 +_,8 @@ + ) { + player.awardStat(Stats.BLOCK_MINED.get(this)); + player.causeFoodExhaustion(0.005F); +- dropResources(state, level, pos, blockEntity, player, destroyedWith); + //Forge: Don't drop xp as part of the resources as it is handled by the patches in ServerPlayerGameMode#destroyBlock -+ dropResources(p_49830_, p_49827_, p_49829_, p_49831_, p_49828_, p_49832_, false); ++ dropResources(state, level, pos, blockEntity, player, destroyedWith, false); } - public void setPlacedBy(Level p_49847_, BlockPos p_49848_, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack p_49851_) { -@@ -470,6 +_,7 @@ - p_49822_.setDeltaMovement(p_49822_.getDeltaMovement().multiply(1.0, 0.0, 1.0)); + public void setPlacedBy(final Level level, final BlockPos pos, final BlockState state, final @Nullable LivingEntity by, final ItemStack itemStack) { +@@ -495,6 +_,7 @@ + return this.bounceRestitution; } + /** @deprecated Forge: use {@link net.minecraftforge.common.extensions.IForgeBlockState#getFriction(LevelReader, BlockPos, Entity)}*/ public float getFriction() { return this.friction; } -@@ -540,7 +_,7 @@ +@@ -565,7 +_,7 @@ this.item = Item.byBlock(this); } @@ -108,7 +111,7 @@ } public boolean hasDynamicShape() { -@@ -606,6 +_,79 @@ +@@ -630,6 +_,79 @@ public int hashCode() { return System.identityHashCode(this.first) * 31 + System.identityHashCode(this.second); } @@ -157,7 +160,7 @@ + } else if (net.minecraftforge.common.PlantType.FUNGUS.equals(type)) { + return state.is(BlockTags.NYLIUM) || this == Blocks.MYCELIUM || this == Blocks.SOUL_SOIL; + } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) { -+ return state.is(Blocks.FARMLAND); ++ return state.is(BlockTags.GROWS_CROPS); + } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) { + return state.isFaceSturdy(world, pos, Direction.UP) && state.canOcclude(); + } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) { 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 575709c767..60a67065f3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -769,7 +_,7 @@ - public static final Block RED_BED = registerBed("red_bed", DyeColor.RED); - public static final Block BLACK_BED = registerBed("black_bed", DyeColor.BLACK); +@@ -705,7 +_,7 @@ + .pushReaction(PushReaction.DESTROY) + ); public static final Block POWERED_RAIL = register( -- "powered_rail", PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) -+ "powered_rail", prop -> new PoweredRailBlock(prop, true), BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) +- BlockItemIds.POWERED_RAIL, PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) ++ BlockItemIds.POWERED_RAIL, prop -> new PoweredRailBlock(prop, true), BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) ); public static final Block DETECTOR_RAIL = register( - "detector_rail", DetectorRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) -@@ -6949,14 +_,5 @@ + BlockItemIds.DETECTOR_RAIL, DetectorRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) +@@ -5992,14 +_,5 @@ - private static Block register(String p_50796_, BlockBehaviour.Properties p_362760_) { - return register(p_50796_, Block::new, p_362760_); + private static Block register(final ResourceKey id, final BlockBehaviour.Properties properties) { + return register(id, Block::new, properties); - } - - static { - for (Block block : BuiltInRegistries.BLOCK) { -- for (BlockState blockstate : block.getStateDefinition().getPossibleStates()) { -- Block.BLOCK_STATE_REGISTRY.add(blockstate); -- blockstate.initCache(); +- for (BlockState state : block.getStateDefinition().getPossibleStates()) { +- Block.BLOCK_STATE_REGISTRY.add(state); +- state.initCache(); - } - } } diff --git a/patches/minecraft/net/minecraft/world/level/block/BucketPickup.java.patch b/patches/minecraft/net/minecraft/world/level/block/BucketPickup.java.patch index 343ca9a931..3a06261700 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BucketPickup.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BucketPickup.java.patch @@ -6,7 +6,7 @@ -public interface BucketPickup { +public interface BucketPickup extends net.minecraftforge.common.extensions.IForgeBucketPickup { - ItemStack pickupBlock(@Nullable LivingEntity p_391402_, LevelAccessor p_152719_, BlockPos p_152720_, BlockState p_152721_); + ItemStack pickupBlock(@Nullable LivingEntity user, LevelAccessor level, BlockPos pos, BlockState state); + /** @deprecated Forge: Use state-sensitive variant instead */ + @Deprecated 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 2600b9ede9..577502a100 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch @@ -12,39 +12,39 @@ @@ -45,6 +_,7 @@ @Override - protected void tick(BlockState p_220908_, ServerLevel p_220909_, BlockPos p_220910_, RandomSource p_220911_) { -+ if (!p_220909_.isAreaLoaded(p_220910_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update - if (!p_220908_.canSurvive(p_220909_, p_220910_)) { - p_220909_.destroyBlock(p_220910_, true); + protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ if (!level.isAreaLoaded(pos, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update + if (!state.canSurvive(level, pos)) { + level.destroyBlock(pos, true); } @@ -63,6 +_,7 @@ } } -+ if (!net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_220914_, blockpos, p_220913_, true)) return; - if (j == 8 && this.canSurvive(this.defaultBlockState(), p_220914_, p_220915_.above())) { - double d0 = i >= 3 ? 0.25 : 0.1; - if (p_220916_.nextDouble() <= d0) { ++ if (!net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, true)) return; + if (age == 8 && this.canSurvive(this.defaultBlockState(), level, pos.above())) { + double chanceToGrowFlower = height >= 3 ? 0.25 : 0.1; + if (random.nextDouble() <= chanceToGrowFlower) { @@ -78,6 +_,7 @@ - if (j < 15) { - p_220914_.setBlock(p_220915_, p_220913_.setValue(AGE, j + 1), 260); + if (age < 15) { + level.setBlock(pos, state.setValue(AGE, age + 1), 260); } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_220914_, p_220915_, p_220913_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } @@ -119,7 +_,7 @@ } - BlockState blockstate1 = p_51154_.getBlockState(p_51155_.below()); -- return (blockstate1.is(Blocks.CACTUS) || blockstate1.is(BlockTags.SAND)) && !p_51154_.getBlockState(p_51155_.above()).liquid(); -+ return blockstate1.canSustainPlant(p_51154_, p_51155_, Direction.UP, this) && !p_51154_.getBlockState(p_51155_.above()).liquid(); + BlockState belowState = level.getBlockState(pos.below()); +- return (belowState.is(this) || belowState.is(BlockTags.SUPPORTS_CACTUS)) && !level.getBlockState(pos.above()).liquid(); ++ return belowState.canSustainPlant(level, pos, Direction.UP, this) && !level.getBlockState(pos.above()).liquid(); } @Override -@@ -135,5 +_,15 @@ +@@ -142,5 +_,15 @@ @Override - protected boolean isPathfindable(BlockState p_51143_, PathComputationType p_51146_) { + protected boolean isPathfindable(final BlockState state, final PathComputationType type) { return false; + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/CactusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CactusFlowerBlock.java.patch index d5c1e8e2b8..9deaf39f07 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CactusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CactusFlowerBlock.java.patch @@ -1,11 +1,10 @@ --- a/net/minecraft/world/level/block/CactusFlowerBlock.java +++ b/net/minecraft/world/level/block/CactusFlowerBlock.java -@@ -31,7 +_,7 @@ - protected boolean mayPlaceOn(BlockState p_395694_, BlockGetter p_391810_, BlockPos p_391352_) { - BlockState blockstate = p_391810_.getBlockState(p_391352_); - return blockstate.is(Blocks.CACTUS) -- || blockstate.is(Blocks.FARMLAND) -+ || blockstate.getBlock() instanceof net.minecraft.world.level.block.FarmBlock - || blockstate.isFaceSturdy(p_391810_, p_391352_, Direction.UP, SupportType.CENTER); +@@ -31,6 +_,6 @@ + @Override + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { + BlockState blockBelow = level.getBlockState(pos); +- return blockBelow.is(BlockTags.SUPPORT_OVERRIDE_CACTUS_FLOWER) || blockBelow.isFaceSturdy(level, pos, Direction.UP, SupportType.CENTER); ++ return blockBelow.is(BlockTags.SUPPORT_OVERRIDE_CACTUS_FLOWER) || blockBelow.isFaceSturdy(level, pos, Direction.UP, SupportType.CENTER) || blockBelow.getBlock() instanceof FarmlandBlock; } } diff --git a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch index 054d255374..9f3bc3982b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -262,7 +_,7 @@ +@@ -271,7 +_,7 @@ return true; } -- boolean flag = Shapes.joinIsNotEmpty(SHAPE_VIRTUAL_POST, blockstate.getCollisionShape(p_51249_, p_51250_, CollisionContext.empty()), BooleanOp.AND); -+ boolean flag = Shapes.joinIsNotEmpty(SHAPE_VIRTUAL_POST, blockstate.getCollisionShape(p_51249_, blockpos, CollisionContext.empty()), BooleanOp.AND); // FORGE: Fix MC-201374 - if (flag) { - BlockState blockstate1 = p_51249_.getBlockState(blockpos.below()); - return isLitCampfire(blockstate1); +- boolean smokeBlocked = Shapes.joinIsNotEmpty(SHAPE_VIRTUAL_POST, blockState.getCollisionShape(level, pos, CollisionContext.empty()), BooleanOp.AND); ++ boolean smokeBlocked = Shapes.joinIsNotEmpty(SHAPE_VIRTUAL_POST, blockState.getCollisionShape(level, posToCheck, CollisionContext.empty()), BooleanOp.AND); // FORGE: Fix MC-201374 + if (smokeBlocked) { + BlockState belowState = level.getBlockState(posToCheck.below()); + return isLitCampfire(belowState); diff --git a/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch index 2b5940a586..97cdda45c1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java -@@ -371,7 +_,8 @@ +@@ -368,7 +_,8 @@ @Override - protected BlockState mirror(BlockState p_51549_, Mirror p_51550_) { -- return p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); -+ BlockState rotated = p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); -+ return p_51550_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests + protected BlockState mirror(final BlockState state, final Mirror mirror) { +- return state.rotate(mirror.getRotation(state.getValue(FACING))); ++ BlockState rotated = state.rotate(mirror.getRotation(state.getValue(FACING))); ++ return mirror == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests } @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch index a07221c1b5..ec7947bafe 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch @@ -1,42 +1,19 @@ --- a/net/minecraft/world/level/block/ChorusFlowerBlock.java +++ b/net/minecraft/world/level/block/ChorusFlowerBlock.java -@@ -66,11 +_,11 @@ - BlockPos blockpos = p_220982_.above(); - if (p_220981_.isEmptyBlock(blockpos) && blockpos.getY() <= p_220981_.getMaxY()) { - int i = p_220980_.getValue(AGE); -- if (i < 5) { -+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_220981_, blockpos, p_220980_, true)) { - boolean flag = false; - boolean flag1 = false; - BlockState blockstate = p_220981_.getBlockState(p_220982_.below()); -- if (blockstate.is(Blocks.END_STONE)) { -+ if (blockstate.is(Blocks.END_STONE) || blockstate.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)) { - flag = true; - } else if (blockstate.is(this.plant)) { - int j = 1; -@@ -78,7 +_,7 @@ - for (int k = 0; k < 4; k++) { - BlockState blockstate1 = p_220981_.getBlockState(p_220982_.below(j + 1)); - if (!blockstate1.is(this.plant)) { -- if (blockstate1.is(Blocks.END_STONE)) { -+ if (blockstate1.is(Blocks.END_STONE) || blockstate1.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)) { - flag1 = true; - } - break; -@@ -122,6 +_,7 @@ +@@ -65,7 +_,7 @@ + BlockPos above = pos.above(); + if (level.isEmptyBlock(above) && above.getY() <= level.getMaxY()) { + int currentAge = state.getValue(AGE); +- if (currentAge < 5) { ++ if (currentAge < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, above, state, true)) { + boolean growUpwards = false; + boolean pillarOnSupportBlock = false; + BlockState belowState = level.getBlockState(pos.below()); +@@ -121,6 +_,7 @@ } else { - this.placeDeadFlower(p_220981_, p_220982_); + this.placeDeadFlower(level, pos); } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_220981_, p_220982_, p_220980_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } } -@@ -167,7 +_,7 @@ - @Override - protected boolean canSurvive(BlockState p_51683_, LevelReader p_51684_, BlockPos p_51685_) { - BlockState blockstate = p_51684_.getBlockState(p_51685_.below()); -- if (!blockstate.is(this.plant) && !blockstate.is(Blocks.END_STONE)) { -+ if (!blockstate.is(this.plant) && !blockstate.is(Blocks.END_STONE) && !blockstate.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)) { - if (!blockstate.isAir()) { - return false; - } else { diff --git a/patches/minecraft/net/minecraft/world/level/block/ChorusPlantBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ChorusPlantBlock.java.patch deleted file mode 100644 index 1364279a15..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/ChorusPlantBlock.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/minecraft/world/level/block/ChorusPlantBlock.java -+++ b/net/minecraft/world/level/block/ChorusPlantBlock.java -@@ -49,7 +_,7 @@ - BlockState blockstate4 = p_51711_.getBlockState(p_51712_.south()); - BlockState blockstate5 = p_51711_.getBlockState(p_51712_.west()); - Block block = p_312378_.getBlock(); -- return p_312378_.trySetValue(DOWN, blockstate.is(block) || blockstate.is(Blocks.CHORUS_FLOWER) || blockstate.is(Blocks.END_STONE)) -+ return p_312378_.trySetValue(DOWN, blockstate.is(block) || blockstate.is(Blocks.CHORUS_FLOWER) || blockstate.is(Blocks.END_STONE) || blockstate.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)) - .trySetValue(UP, blockstate1.is(block) || blockstate1.is(Blocks.CHORUS_FLOWER)) - .trySetValue(NORTH, blockstate2.is(block) || blockstate2.is(Blocks.CHORUS_FLOWER)) - .trySetValue(EAST, blockstate3.is(block) || blockstate3.is(Blocks.CHORUS_FLOWER)) -@@ -72,7 +_,7 @@ - p_364837_.scheduleTick(p_51732_, this, 1); - return super.updateShape(p_51728_, p_369826_, p_364837_, p_51732_, p_51729_, p_51733_, p_51730_, p_368636_); - } else { -- boolean flag = p_51730_.is(this) || p_51730_.is(Blocks.CHORUS_FLOWER) || p_51729_ == Direction.DOWN && p_51730_.is(Blocks.END_STONE); -+ boolean flag = p_51730_.is(this) || p_51730_.is(Blocks.CHORUS_FLOWER) || p_51729_ == Direction.DOWN && (p_51730_.is(Blocks.END_STONE) || p_51730_.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)); - return p_51728_.setValue(PROPERTY_BY_DIRECTION.get(p_51729_), flag); - } - } -@@ -98,13 +_,13 @@ - } - - BlockState blockstate2 = p_51725_.getBlockState(blockpos.below()); -- if (blockstate2.is(this) || blockstate2.is(Blocks.END_STONE)) { -+ if (blockstate2.is(this) || blockstate2.is(Blocks.END_STONE) || blockstate2.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON)) { - return true; - } - } - } - -- return blockstate.is(this) || blockstate.is(Blocks.END_STONE); -+ return blockstate.is(this) || blockstate.is(Blocks.END_STONE) || blockstate.is(net.minecraftforge.common.Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON); - } - - @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch index de814765d7..802af346aa 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/level/block/CocoaBlock.java +++ b/net/minecraft/world/level/block/CocoaBlock.java -@@ -52,10 +_,11 @@ +@@ -50,10 +_,11 @@ @Override - protected void randomTick(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { -- if (p_221001_.random.nextInt(5) == 0) { + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { +- if (level.getRandom().nextInt(5) == 0) { + { - int i = p_221000_.getValue(AGE); -- if (i < 2) { -+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221001_, p_221002_, p_221000_, p_221001_.random.nextInt(5) == 0)) { - p_221001_.setBlock(p_221002_, p_221000_.setValue(AGE, i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221001_, p_221002_, p_221000_); + int age = state.getValue(AGE); +- if (age < 2) { ++ if (age < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, level.getRandom().nextInt(5) == 0)) { + level.setBlock(pos, state.setValue(AGE, age + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } } diff --git a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch index c26336914c..52d73a8d8b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java -@@ -199,4 +_,16 @@ - protected void createBlockStateDefinition(StateDefinition.Builder p_51887_) { - p_51887_.add(FACING, MODE, POWERED); +@@ -198,4 +_,16 @@ + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + builder.add(FACING, MODE, POWERED); } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/ConcretePowderBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ConcretePowderBlock.java.patch index 2d470e1600..2b9bcbec80 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ConcretePowderBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ConcretePowderBlock.java.patch @@ -1,49 +1,49 @@ --- a/net/minecraft/world/level/block/ConcretePowderBlock.java +++ b/net/minecraft/world/level/block/ConcretePowderBlock.java -@@ -36,7 +_,7 @@ +@@ -35,7 +_,7 @@ @Override - public void onLand(Level p_52068_, BlockPos p_52069_, BlockState p_52070_, BlockState p_52071_, FallingBlockEntity p_52072_) { -- if (shouldSolidify(p_52068_, p_52069_, p_52071_)) { -+ if (shouldSolidify(p_52068_, p_52069_, p_52070_, p_52071_.getFluidState())) { // Forge: Use block of falling entity instead of block at replaced position, and check if shouldSolidify with the FluidState of the replaced block - p_52068_.setBlock(p_52069_, this.concrete.defaultBlockState(), 3); + public void onLand(final Level level, final BlockPos pos, final BlockState state, final BlockState replacedBlock, final FallingBlockEntity entity) { +- if (shouldSolidify(level, pos, replacedBlock)) { ++ if (shouldSolidify(level, pos, state, replacedBlock.getFluidState())) { // Forge: Use block of falling entity instead of block at replaced position, and check if shouldSolidify with the FluidState of the replaced block + level.setBlock(pos, this.concrete.defaultBlockState(), 3); } } -@@ -49,20 +_,24 @@ - return shouldSolidify(blockgetter, blockpos, blockstate) ? this.concrete.defaultBlockState() : super.getStateForPlacement(p_52063_); +@@ -48,20 +_,24 @@ + return shouldSolidify(level, pos, replacedBlock) ? this.concrete.defaultBlockState() : super.getStateForPlacement(context); } -+ private static boolean shouldSolidify(BlockGetter p_52081_, BlockPos p_52082_, BlockState p_52083_, net.minecraft.world.level.material.FluidState fluidState) { -+ return p_52083_.canBeHydrated(p_52081_, p_52082_, fluidState, p_52082_) || touchesLiquid(p_52081_, p_52082_, p_52083_); ++ private static boolean shouldSolidify(final BlockGetter level, final BlockPos pos, final BlockState state, final net.minecraft.world.level.material.FluidState fluidState) { ++ return state.canBeHydrated(level, pos, fluidState, pos) || touchesLiquid(level, pos, state); + } + - private static boolean shouldSolidify(BlockGetter p_52081_, BlockPos p_52082_, BlockState p_52083_) { -- return canSolidify(p_52083_) || touchesLiquid(p_52081_, p_52082_); -+ return shouldSolidify(p_52081_, p_52082_, p_52083_, p_52081_.getFluidState(p_52082_)); + private static boolean shouldSolidify(final BlockGetter level, final BlockPos pos, final BlockState replacedBlock) { +- return canSolidify(replacedBlock) || touchesLiquid(level, pos); ++ return shouldSolidify(level, pos, replacedBlock, level.getFluidState(pos)); } -- private static boolean touchesLiquid(BlockGetter p_52065_, BlockPos p_52066_) { -+ private static boolean touchesLiquid(BlockGetter p_52065_, BlockPos p_52066_, BlockState state) { - boolean flag = false; - BlockPos.MutableBlockPos blockpos$mutableblockpos = p_52066_.mutable(); +- private static boolean touchesLiquid(final BlockGetter level, final BlockPos pos) { ++ private static boolean touchesLiquid(final BlockGetter level, BlockPos pos, BlockState state) { + boolean touchesLiquid = false; + BlockPos.MutableBlockPos testPos = pos.mutable(); for (Direction direction : Direction.values()) { - BlockState blockstate = p_52065_.getBlockState(blockpos$mutableblockpos); -- if (direction != Direction.DOWN || canSolidify(blockstate)) { -+ if (direction != Direction.DOWN || state.canBeHydrated(p_52065_, p_52066_, blockstate.getFluidState(), blockpos$mutableblockpos)) { - blockpos$mutableblockpos.setWithOffset(p_52066_, direction); - blockstate = p_52065_.getBlockState(blockpos$mutableblockpos); -- if (canSolidify(blockstate) && !blockstate.isFaceSturdy(p_52065_, p_52066_, direction.getOpposite())) { -+ if (state.canBeHydrated(p_52065_, p_52066_, blockstate.getFluidState(), blockpos$mutableblockpos) && !blockstate.isFaceSturdy(p_52065_, p_52066_, direction.getOpposite())) { - flag = true; + BlockState blockState = level.getBlockState(testPos); +- if (direction != Direction.DOWN || canSolidify(blockState)) { ++ if (direction != Direction.DOWN || state.canBeHydrated(level, pos, blockState.getFluidState(), testPos)) { + testPos.setWithOffset(pos, direction); + blockState = level.getBlockState(testPos); +- if (canSolidify(blockState) && !blockState.isFaceSturdy(level, pos, direction.getOpposite())) { ++ if (state.canBeHydrated(level, pos, blockState.getFluidState(), testPos) && !blockState.isFaceSturdy(level, pos, direction.getOpposite())) { + touchesLiquid = true; break; } -@@ -87,7 +_,7 @@ - BlockState p_52076_, - RandomSource p_369257_ +@@ -86,7 +_,7 @@ + final BlockState neighbourState, + final RandomSource random ) { -- return touchesLiquid(p_361484_, p_52078_) -+ return touchesLiquid(p_361484_, p_52078_, p_52074_) +- return touchesLiquid(level, pos) ++ return touchesLiquid(level, pos, state) ? this.concrete.defaultBlockState() - : super.updateShape(p_52074_, p_361484_, p_362145_, p_52078_, p_52075_, p_52079_, p_52076_, p_369257_); + : super.updateShape(state, level, ticks, pos, directionToNeighbour, neighbourPos, neighbourState, random); } diff --git a/patches/minecraft/net/minecraft/world/level/block/CoralBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CoralBlock.java.patch index ea6a1bed14..6538cf0c9c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CoralBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CoralBlock.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/block/CoralBlock.java +++ b/net/minecraft/world/level/block/CoralBlock.java -@@ -61,9 +_,10 @@ +@@ -60,9 +_,10 @@ } - protected boolean scanForWater(BlockGetter p_52135_, BlockPos p_52136_) { -+ BlockState state = p_52135_.getBlockState(p_52136_); + protected boolean scanForWater(final BlockGetter level, final BlockPos blockPos) { ++ BlockState state = level.getBlockState(blockPos); for (Direction direction : Direction.values()) { - FluidState fluidstate = p_52135_.getFluidState(p_52136_.relative(direction)); -- if (fluidstate.is(FluidTags.WATER)) { -+ if (state.canBeHydrated(p_52135_, p_52136_, fluidstate, p_52136_.relative(direction))) { + FluidState fluidState = level.getFluidState(blockPos.relative(direction)); +- if (fluidState.is(FluidTags.WATER)) { ++ if (state.canBeHydrated(level, blockPos, fluidState, blockPos.relative(direction))) { return true; } } diff --git a/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch index f3d45a8a6d..7f997a1db0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/level/block/CrafterBlock.java +++ b/net/minecraft/world/level/block/CrafterBlock.java -@@ -184,12 +_,15 @@ - ServerLevel p_336186_, BlockPos p_312358_, CrafterBlockEntity p_309887_, ItemStack p_310474_, BlockState p_310667_, RecipeHolder p_329387_ +@@ -194,12 +_,15 @@ + final RecipeHolder recipe ) { - Direction direction = p_310667_.getValue(ORIENTATION).front(); -+ var itemhandler = net.minecraftforge.items.VanillaInventoryCodeHooks.getItemHandler(p_336186_, p_312358_.relative(direction), direction.getOpposite()).orElse(null); - Container container = HopperBlockEntity.getContainerAt(p_336186_, p_312358_.relative(direction)); - ItemStack itemstack = p_310474_.copy(); - if (container != null && (container instanceof CrafterBlockEntity || p_310474_.getCount() > container.getMaxStackSize(p_310474_))) { - while (!itemstack.isEmpty()) { - ItemStack itemstack2 = itemstack.copyWithCount(1); - ItemStack itemstack1 = HopperBlockEntity.addItem(p_309887_, container, itemstack2, direction.getOpposite()); -+ if (itemhandler != null && !itemstack1.isEmpty()) // Vanilla insert failed, try IItemHandler -+ itemstack1 = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack1, false); - if (!itemstack1.isEmpty()) { + Direction direction = blockState.getValue(ORIENTATION).front(); ++ var itemhandler = net.minecraftforge.items.VanillaInventoryCodeHooks.getItemHandler(level, pos.relative(direction), direction.getOpposite()).orElse(null); + Container into = HopperBlockEntity.getContainerAt(level, pos.relative(direction)); + ItemStack remaining = results.copy(); + if (into != null && (into instanceof CrafterBlockEntity || results.getCount() > into.getMaxStackSize(results))) { + while (!remaining.isEmpty()) { + ItemStack copy = remaining.copyWithCount(1); + ItemStack itemStack = HopperBlockEntity.addItem(blockEntity, into, copy, direction.getOpposite()); ++ if (itemhandler != null && !itemStack.isEmpty()) // Vanilla insert failed, try IItemHandler ++ itemStack = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemStack, false); + if (!itemStack.isEmpty()) { break; } -@@ -200,10 +_,14 @@ - while (!itemstack.isEmpty()) { - int i = itemstack.getCount(); - itemstack = HopperBlockEntity.addItem(p_309887_, container, itemstack, direction.getOpposite()); -+ if (itemhandler != null && i == itemstack.getCount()) // Vanilla insert failed, try IItemHandler -+ itemstack = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack, false); - if (i == itemstack.getCount()) { +@@ -210,10 +_,14 @@ + while (!remaining.isEmpty()) { + int oldSize = remaining.getCount(); + remaining = HopperBlockEntity.addItem(blockEntity, into, remaining, direction.getOpposite()); ++ if (itemhandler != null && oldSize == remaining.getCount()) // Vanilla insert failed, try IItemHandler ++ remaining = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, remaining, false); + if (oldSize == remaining.getCount()) { break; } } + } else { -+ itemstack = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack, false); ++ remaining = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, remaining, false); } - if (!itemstack.isEmpty()) { + if (!remaining.isEmpty()) { diff --git a/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch index d0e0a1446f..b1f8f5aa24 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch @@ -1,43 +1,43 @@ --- a/net/minecraft/world/level/block/CropBlock.java +++ b/net/minecraft/world/level/block/CropBlock.java -@@ -46,7 +_,7 @@ +@@ -47,7 +_,7 @@ @Override - protected boolean mayPlaceOn(BlockState p_52302_, BlockGetter p_52303_, BlockPos p_52304_) { -- return p_52302_.is(Blocks.FARMLAND); -+ return p_52302_.getBlock() instanceof net.minecraft.world.level.block.FarmBlock; + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { +- return state.is(BlockTags.SUPPORTS_CROPS); ++ return state.getBlock() instanceof FarmlandBlock; } protected IntegerProperty getAgeProperty() { -@@ -80,8 +_,9 @@ - int i = this.getAge(p_221050_); - if (i < this.getMaxAge()) { - float f = getGrowthSpeed(this, p_221051_, p_221052_); -- if (p_221053_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221051_, p_221052_, p_221050_, p_221053_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_221051_.setBlock(p_221052_, this.getStateForAge(i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221051_, p_221052_, p_221050_); +@@ -81,8 +_,9 @@ + int age = this.getAge(state); + if (age < this.getMaxAge()) { + float growthSpeed = getGrowthSpeed(this, level, pos); +- if (random.nextInt((int)(25.0F / growthSpeed) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, random.nextInt((int)(25.0F / growthSpeed) + 1) == 0)) { + level.setBlock(pos, this.getStateForAge(age + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } } -@@ -104,9 +_,9 @@ - for (int j = -1; j <= 1; j++) { - float f1 = 0.0F; - BlockState blockstate = p_52274_.getBlockState(blockpos.offset(i, 0, j)); -- if (blockstate.is(Blocks.FARMLAND)) { -+ if (blockstate.canSustainPlant(p_52274_, blockpos.offset(i, 0, j), net.minecraft.core.Direction.UP, (net.minecraftforge.common.IPlantable) p_52273_)) { - f1 = 1.0F; -- if (blockstate.getValue(FarmBlock.MOISTURE) > 0) { -+ if (blockstate.isFertile(p_52274_, p_52275_.offset(i, 0, j))) { - f1 = 3.0F; +@@ -105,9 +_,9 @@ + for (int zz = -1; zz <= 1; zz++) { + float blockSpeed = 0.0F; + BlockState blockState = level.getBlockState(below.offset(xx, 0, zz)); +- if (blockState.is(BlockTags.GROWS_CROPS)) { ++ if (blockState.canSustainPlant(level, below.offset(xx, 0, zz), net.minecraft.core.Direction.UP, (net.minecraftforge.common.IPlantable)type)) { + blockSpeed = 1.0F; +- if (blockState.getValueOrElse(FarmlandBlock.MOISTURE, 0) > 0) { ++ if (blockState.isFertile(level, below.offset(xx, 0, zz))) { + blockSpeed = 3.0F; } } -@@ -151,7 +_,7 @@ - - @Override - protected void entityInside(BlockState p_52277_, Level p_52278_, BlockPos p_52279_, Entity p_52280_, InsideBlockEffectApplier p_391246_, boolean p_432051_) { -- if (p_52278_ instanceof ServerLevel serverlevel && p_52280_ instanceof Ravager && serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (p_52278_ instanceof ServerLevel serverlevel && p_52280_ instanceof Ravager && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverlevel, p_52280_)) { - serverlevel.destroyBlock(p_52279_, true, p_52280_); +@@ -159,7 +_,7 @@ + final InsideBlockEffectApplier effectApplier, + final boolean isPrecise + ) { +- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(serverLevel, entity)) { + serverLevel.destroyBlock(pos, true, entity); } diff --git a/patches/minecraft/net/minecraft/world/level/block/DetectorRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DetectorRailBlock.java.patch index a416bf6616..ef9b8bde3e 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DetectorRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DetectorRailBlock.java.patch @@ -2,8 +2,8 @@ +++ b/net/minecraft/world/level/block/DetectorRailBlock.java @@ -39,6 +_,10 @@ - public DetectorRailBlock(BlockBehaviour.Properties p_52431_) { - super(true, p_52431_); + public DetectorRailBlock(final BlockBehaviour.Properties properties) { + super(true, properties); + this.registerDefaultState(); + } + @@ -11,23 +11,23 @@ this.registerDefaultState(this.stateDefinition.any().setValue(POWERED, false).setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(WATERLOGGED, false)); } -@@ -147,7 +_,10 @@ - return list.get(0).getCommandBlock().getSuccessCount(); +@@ -154,7 +_,10 @@ + return commandBlocks.get(0).getCommandBlock().getSuccessCount(); } -- List list1 = this.getInteractingMinecartOfType(p_52455_, p_52456_, AbstractMinecart.class, EntitySelector.CONTAINER_ENTITY_SELECTOR); -+ List carts = this.getInteractingMinecartOfType(p_52455_, p_52456_, AbstractMinecart.class, e -> e.isAlive()); +- List entities = this.getInteractingMinecartOfType(level, pos, AbstractMinecart.class, EntitySelector.CONTAINER_ENTITY_SELECTOR); ++ List carts = this.getInteractingMinecartOfType(level, pos, AbstractMinecart.class, e -> e.isAlive()); + if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel(); -+ List list1 = carts.stream().filter(EntitySelector.CONTAINER_ENTITY_SELECTOR).toList(); ++ List entities = carts.stream().filter(EntitySelector.CONTAINER_ENTITY_SELECTOR).toList(); + - if (!list1.isEmpty()) { - return AbstractContainerMenu.getRedstoneSignalFromContainer((Container)list1.get(0)); + if (!entities.isEmpty()) { + return AbstractContainerMenu.getRedstoneSignalFromContainer((Container)entities.get(0)); } -@@ -188,6 +_,6 @@ +@@ -190,6 +_,6 @@ @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_52469_) { -- p_52469_.add(SHAPE, POWERED, WATERLOGGED); -+ p_52469_.add(getShapeProperty(), POWERED, WATERLOGGED); + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { +- builder.add(SHAPE, POWERED, WATERLOGGED); ++ builder.add(getShapeProperty(), POWERED, WATERLOGGED); } } 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 4ba66c754b..1bb6cc9725 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/DiodeBlock.java +++ b/net/minecraft/world/level/block/DiodeBlock.java -@@ -175,6 +_,9 @@ - Direction direction = p_52583_.getValue(FACING); - BlockPos blockpos = p_52582_.relative(direction.getOpposite()); - Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(p_52581_, direction.getOpposite(), Direction.UP); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_52581_, p_52582_, p_52581_.getBlockState(p_52582_), java.util.EnumSet.of(direction.getOpposite()), false)) { +@@ -181,6 +_,9 @@ + Direction direction = state.getValue(FACING); + BlockPos oppositePos = pos.relative(direction.getOpposite()); + Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, direction.getOpposite(), Direction.UP); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(level, pos, level.getBlockState(pos), java.util.EnumSet.of(direction.getOpposite()), false)) { + return; + } - p_52581_.neighborChanged(blockpos, this, orientation); - p_52581_.updateNeighborsAtExceptFromFacing(blockpos, this, direction, orientation); + level.neighborChanged(oppositePos, this, orientation); + level.updateNeighborsAtExceptFromFacing(oppositePos, this, direction, orientation); } diff --git a/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch index ae6f75ef2c..445be8a492 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/net/minecraft/world/level/block/DoublePlantBlock.java -@@ -79,6 +_,7 @@ - return super.canSurvive(p_52887_, p_52888_, p_52889_); - } else { - BlockState blockstate = p_52888_.getBlockState(p_52889_.below()); -+ if (p_52887_.getBlock() != this) return super.canSurvive(p_52887_, p_52888_, p_52889_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - return blockstate.is(this) && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER; +@@ -80,6 +_,7 @@ } + + BlockState belowState = level.getBlockState(pos.below()); ++ if (state.getBlock() != this) return super.canSurvive(state, level, pos); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + return belowState.is(this) && belowState.getValue(HALF) == DoubleBlockHalf.LOWER; } + diff --git a/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch index 9c378753c0..d91f08f9ac 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/DropExperienceBlock.java +++ b/net/minecraft/world/level/block/DropExperienceBlock.java -@@ -30,8 +_,13 @@ +@@ -29,8 +_,13 @@ @Override - protected void spawnAfterBreak(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { - super.spawnAfterBreak(p_221086_, p_221087_, p_221088_, p_221089_, p_221090_); -- if (p_221090_) { -+ if (false && p_221090_) { // Forge: moved to getExpDrop - this.tryDropExperience(p_221087_, p_221088_, p_221089_, this.xpRange); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge: moved to getExpDrop + this.tryDropExperience(level, pos, tool, this.xpRange); } + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch index a395e4b7e9..934255a286 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/DropperBlock.java +++ b/net/minecraft/world/level/block/DropperBlock.java @@ -56,7 +_,7 @@ - p_52944_.levelEvent(1001, p_52945_, 0); + level.levelEvent(1001, pos, 0); } else { - ItemStack itemstack = dispenserblockentity.getItem(i); -- if (!itemstack.isEmpty()) { -+ if (!itemstack.isEmpty() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_52944_, p_52945_, dispenserblockentity, i, itemstack)) { - Direction direction = p_52944_.getBlockState(p_52945_).getValue(FACING); - Container container = HopperBlockEntity.getContainerAt(p_52944_, p_52945_.relative(direction)); - ItemStack itemstack1; + ItemStack itemStack = blockEntity.getItem(slot); +- if (!itemStack.isEmpty()) { ++ if (!itemStack.isEmpty() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(level, pos, blockEntity, slot, itemStack)) { + Direction direction = level.getBlockState(pos).getValue(FACING); + Container into = HopperBlockEntity.getContainerAt(level, pos.relative(direction)); + ItemStack remaining; diff --git a/patches/minecraft/net/minecraft/world/level/block/DryVegetationBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DryVegetationBlock.java.patch deleted file mode 100644 index 026a05e152..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/DryVegetationBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/DryVegetationBlock.java -+++ b/net/minecraft/world/level/block/DryVegetationBlock.java -@@ -12,7 +_,7 @@ - import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.VoxelShape; - --public class DryVegetationBlock extends VegetationBlock { -+public class DryVegetationBlock extends VegetationBlock implements net.minecraftforge.common.IForgeShearable { - public static final MapCodec CODEC = simpleCodec(DryVegetationBlock::new); - private static final VoxelShape SHAPE = Block.column(12.0, 0.0, 13.0); - diff --git a/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch index 7dfb7f2916..c87f502932 100644 --- a/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch @@ -3,9 +3,9 @@ @@ -46,7 +_,7 @@ } - public static boolean isValidBookShelf(Level p_328191_, BlockPos p_328702_, BlockPos p_336071_) { -- return p_328191_.getBlockState(p_328702_.offset(p_336071_)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) -+ return p_328191_.getBlockState(p_328702_.offset(p_336071_)).getEnchantPowerBonus(p_328191_, p_328702_.offset(p_336071_)) != 0 - && p_328191_.getBlockState(p_328702_.offset(p_336071_.getX() / 2, p_336071_.getY(), p_336071_.getZ() / 2)).is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); + public static boolean isValidBookShelf(final Level level, final BlockPos pos, final BlockPos offset) { +- return level.getBlockState(pos.offset(offset)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ++ return level.getBlockState(pos.offset(offset)).getEnchantPowerBonus(level, pos.offset(offset)) != 0 + && level.getBlockState(pos.offset(offset.getX() / 2, offset.getY(), offset.getZ() / 2)).is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); } diff --git a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch deleted file mode 100644 index c1f0d92e38..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/world/level/block/FarmBlock.java -+++ b/net/minecraft/world/level/block/FarmBlock.java -@@ -107,10 +_,7 @@ - @Override - public void fallOn(Level p_153227_, BlockState p_153228_, BlockPos p_153229_, Entity p_153230_, double p_394537_) { - if (p_153227_ instanceof ServerLevel serverlevel -- && p_153227_.random.nextFloat() < p_394537_ - 0.5 -- && p_153230_ instanceof LivingEntity -- && (p_153230_ instanceof Player || serverlevel.getGameRules().get(GameRules.MOB_GRIEFING)) -- && p_153230_.getBbWidth() * p_153230_.getBbWidth() * p_153230_.getBbHeight() > 0.512F) { -+ && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(serverlevel, p_153229_, Blocks.DIRT.defaultBlockState(), p_394537_, p_153230_)) { // Forge: Move logic to Entity#canTrample - turnToDirt(p_153230_, p_153228_, p_153227_, p_153229_); - } - -@@ -124,17 +_,20 @@ - } - - private static boolean shouldMaintainFarmland(BlockGetter p_279219_, BlockPos p_279209_) { -- return p_279219_.getBlockState(p_279209_.above()).is(BlockTags.MAINTAINS_FARMLAND); -+ BlockState plant = p_279219_.getBlockState(p_279209_.above()); -+ BlockState state = p_279219_.getBlockState(p_279209_); -+ return plant.getBlock() instanceof net.minecraftforge.common.IPlantable plantable && state.canSustainPlant(p_279219_, p_279209_, Direction.UP, plantable); - } - - private static boolean isNearWater(LevelReader p_53259_, BlockPos p_53260_) { -+ BlockState state = p_53259_.getBlockState(p_53260_); - for (BlockPos blockpos : BlockPos.betweenClosed(p_53260_.offset(-4, 0, -4), p_53260_.offset(4, 1, 4))) { -- if (p_53259_.getFluidState(blockpos).is(FluidTags.WATER)) { -+ if (state.canBeHydrated(p_53259_, p_53260_, p_53259_.getFluidState(blockpos), blockpos)) { - return true; - } - } - -- return false; -+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_53259_, p_53260_); - } - - @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/FarmlandBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FarmlandBlock.java.patch new file mode 100644 index 0000000000..a0834c0c7c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/FarmlandBlock.java.patch @@ -0,0 +1,39 @@ +--- a/net/minecraft/world/level/block/FarmlandBlock.java ++++ b/net/minecraft/world/level/block/FarmlandBlock.java +@@ -108,10 +_,7 @@ + @Override + public void fallOn(final Level level, final BlockState state, final BlockPos pos, final Entity entity, final double fallDistance) { + if (level instanceof ServerLevel serverLevel +- && level.getRandom().nextFloat() < fallDistance - 0.5 +- && entity instanceof LivingEntity +- && (entity instanceof Player || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) +- && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { ++ && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(serverLevel, pos, state, fallDistance, entity)) { // Forge: Move logic to Entity#canTrample + turnToDirt(entity, state, level, pos); + } + +@@ -125,17 +_,22 @@ + } + + private static boolean shouldMaintainFarmland(final BlockGetter level, final BlockPos pos) { ++ BlockState plant = level.getBlockState(pos.above()); ++ BlockState state = level.getBlockState(pos); ++ if (plant.getBlock() instanceof net.minecraftforge.common.IPlantable plantable && state.canSustainPlant(level, pos, Direction.UP, plantable)) ++ return true; + return level.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND); + } + + private static boolean isNearWater(final LevelReader level, final BlockPos pos) { ++ BlockState state = level.getBlockState(pos); + for (BlockPos blockPos : BlockPos.betweenClosed(pos.offset(-4, 0, -4), pos.offset(4, 1, 4))) { +- if (level.getFluidState(blockPos).is(FluidTags.WATER)) { ++ if (state.canBeHydrated(level, pos, level.getFluidState(blockPos), blockPos)) { + return true; + } + } + +- return false; ++ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(level, pos); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch index d208aee5e4..097e64d0ce 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/FenceGateBlock.java +++ b/net/minecraft/world/level/block/FenceGateBlock.java -@@ -59,6 +_,8 @@ - Util.mapValues(SHAPE_OCCLUSION, p_390935_ -> p_390935_.move(0.0, -0.1875, 0.0).optimize()) +@@ -57,6 +_,8 @@ + Util.mapValues(SHAPE_OCCLUSION, v -> v.move(0.0, -0.1875, 0.0).optimize()) ); private final WoodType type; + private final net.minecraft.sounds.SoundEvent openSound; @@ -9,46 +9,46 @@ @Override public MapCodec codec() { -@@ -66,8 +_,14 @@ +@@ -64,8 +_,14 @@ } - public FenceGateBlock(WoodType p_273340_, BlockBehaviour.Properties p_273352_) { -- super(p_273352_.sound(p_273340_.soundType())); -+ this(p_273340_, p_273352_, p_273340_.fenceGateOpen(), p_273340_.fenceGateClose()); + public FenceGateBlock(final WoodType type, final BlockBehaviour.Properties properties) { +- super(properties.sound(type.soundType())); ++ this(type, properties, type.fenceGateOpen(), type.fenceGateClose()); + } + -+ public FenceGateBlock(WoodType p_273340_, BlockBehaviour.Properties p_273352_, net.minecraft.sounds.SoundEvent openSound, net.minecraft.sounds.SoundEvent closeSound) { -+ super(p_273352_); - this.type = p_273340_; ++ public FenceGateBlock(final WoodType type, final BlockBehaviour.Properties properties, final net.minecraft.sounds.SoundEvent openSound, final net.minecraft.sounds.SoundEvent closeSound) { ++ super(properties); + this.type = type; + this.openSound = openSound; + this.closeSound = closeSound; this.registerDefaultState(this.stateDefinition.any().setValue(OPEN, false).setValue(POWERED, false).setValue(IN_WALL, false)); } -@@ -165,7 +_,7 @@ - p_53366_.playSound( - p_53368_, - p_53367_, -- flag ? this.type.fenceGateOpen() : this.type.fenceGateClose(), -+ flag ? this.openSound : this.closeSound, - SoundSource.BLOCKS, - 1.0F, - p_53366_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -182,7 +_,7 @@ - p_368190_.playSound( - null, - p_311232_, -- flag ? this.type.fenceGateClose() : this.type.fenceGateOpen(), -+ flag ? this.closeSound : this.openSound, - SoundSource.BLOCKS, - 1.0F, - p_368190_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -203,7 +_,7 @@ - p_53373_.playSound( +@@ -156,7 +_,7 @@ + + boolean opens = state.getValue(OPEN); + level.playSound( +- player, pos, opens ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F ++ player, pos, opens ? this.openSound : this.closeSound, SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F + ); + level.gameEvent(player, opens ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + return InteractionResult.SUCCESS; +@@ -170,7 +_,7 @@ + boolean open = state.getValue(OPEN); + level.setBlockAndUpdate(pos, state.setValue(OPEN, !open)); + level.playSound( +- null, pos, open ? this.type.fenceGateClose() : this.type.fenceGateOpen(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F ++ null, pos, open ? this.openSound : this.closeSound, SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F + ); + level.gameEvent(open ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, pos, GameEvent.Context.of(state)); + } +@@ -190,7 +_,7 @@ + level.playSound( null, - p_53374_, -- flag ? this.type.fenceGateOpen() : this.type.fenceGateClose(), -+ flag ? this.openSound : this.closeSound, + pos, +- hasPower ? this.type.fenceGateOpen() : this.type.fenceGateClose(), ++ hasPower ? this.openSound : this.closeSound, SoundSource.BLOCKS, 1.0F, - p_53373_.getRandom().nextFloat() * 0.1F + 0.9F + level.getRandom().nextFloat() * 0.1F + 0.9F diff --git a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch index 483dd82a6a..c3f5c9deec 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch @@ -1,129 +1,128 @@ --- a/net/minecraft/world/level/block/FireBlock.java +++ b/net/minecraft/world/level/block/FireBlock.java @@ -115,13 +_,13 @@ - protected BlockState getStateForPlacement(BlockGetter p_53471_, BlockPos p_53472_) { - BlockPos blockpos = p_53472_.below(); - BlockState blockstate = p_53471_.getBlockState(blockpos); -- if (!this.canBurn(blockstate) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) { -+ if (!this.canCatchFire(p_53471_, p_53472_, Direction.UP) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) { - BlockState blockstate1 = this.defaultBlockState(); + protected BlockState getStateForPlacement(final BlockGetter level, final BlockPos pos) { + BlockPos below = pos.below(); + BlockState belowState = level.getBlockState(below); +- if (!this.canBurn(belowState) && !belowState.isFaceSturdy(level, below, Direction.UP)) { ++ if (!this.canCatchFire(level, pos, Direction.UP) && !belowState.isFaceSturdy(level, below, Direction.UP)) { + BlockState result = this.defaultBlockState(); for (Direction direction : Direction.values()) { - BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction); - if (booleanproperty != null) { -- blockstate1 = blockstate1.setValue(booleanproperty, this.canBurn(p_53471_.getBlockState(p_53472_.relative(direction)))); -+ blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_53471_, p_53472_.relative(direction), direction.getOpposite()))); + BooleanProperty property = PROPERTY_BY_DIRECTION.get(direction); + if (property != null) { +- result = result.setValue(property, this.canBurn(level.getBlockState(pos.relative(direction)))); ++ result = result.setValue(property, Boolean.valueOf(this.canCatchFire(level, pos.relative(direction), direction.getOpposite()))); } } @@ -146,7 +_,7 @@ } - BlockState blockstate = p_221161_.getBlockState(p_221162_.below()); -- boolean flag = blockstate.is(p_221161_.dimensionType().infiniburn()); -+ boolean flag = blockstate.isFireSource(p_221161_, p_221162_, Direction.UP); - int i = p_221160_.getValue(AGE); - if (!flag && p_221161_.isRaining() && this.isNearRain(p_221161_, p_221162_) && p_221163_.nextFloat() < 0.2F + i * 0.03F) { - p_221161_.removeBlock(p_221162_, false); + BlockState belowState = level.getBlockState(pos.below()); +- boolean infiniBurn = belowState.is(level.dimensionType().infiniburn()); ++ boolean infiniBurn = belowState.isFireSource(level, pos, Direction.UP); + int age = state.getValue(AGE); + if (!infiniBurn && level.isRaining() && this.isNearRain(level, pos) && random.nextFloat() < 0.2F + age * 0.03F) { + level.removeBlock(pos, false); @@ -167,7 +_,7 @@ return; } -- if (i == 15 && p_221163_.nextInt(4) == 0 && !this.canBurn(p_221161_.getBlockState(p_221162_.below()))) { -+ if (i == 15 && p_221163_.nextInt(4) == 0 && !this.canCatchFire(p_221161_, p_221162_.below(), Direction.UP)) { - p_221161_.removeBlock(p_221162_, false); +- if (age == 15 && random.nextInt(4) == 0 && !this.canBurn(level.getBlockState(pos.below()))) { ++ if (age == 15 && random.nextInt(4) == 0 && !this.canCatchFire(level, pos.below(), Direction.UP)) { + level.removeBlock(pos, false); return; } @@ -175,12 +_,12 @@ - boolean flag1 = p_221161_.environmentAttributes().getValue(EnvironmentAttributes.INCREASED_FIRE_BURNOUT, p_221162_); - int k = flag1 ? -50 : 0; -- this.checkBurnOut(p_221161_, p_221162_.east(), 300 + k, p_221163_, i); -- this.checkBurnOut(p_221161_, p_221162_.west(), 300 + k, p_221163_, i); -- this.checkBurnOut(p_221161_, p_221162_.below(), 250 + k, p_221163_, i); -- this.checkBurnOut(p_221161_, p_221162_.above(), 250 + k, p_221163_, i); -- this.checkBurnOut(p_221161_, p_221162_.north(), 300 + k, p_221163_, i); -- this.checkBurnOut(p_221161_, p_221162_.south(), 300 + k, p_221163_, i); -+ this.checkBurnOut(p_221161_, p_221162_.east(), 300 + k, p_221163_, i, Direction.WEST); -+ this.checkBurnOut(p_221161_, p_221162_.west(), 300 + k, p_221163_, i, Direction.EAST); -+ this.checkBurnOut(p_221161_, p_221162_.below(), 250 + k, p_221163_, i, Direction.UP); -+ this.checkBurnOut(p_221161_, p_221162_.above(), 250 + k, p_221163_, i, Direction.DOWN); -+ this.checkBurnOut(p_221161_, p_221162_.north(), 300 + k, p_221163_, i, Direction.SOUTH); -+ this.checkBurnOut(p_221161_, p_221162_.south(), 300 + k, p_221163_, i, Direction.NORTH); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + boolean increasedBurnout = level.environmentAttributes().getValue(EnvironmentAttributes.INCREASED_FIRE_BURNOUT, pos); + int extra = increasedBurnout ? -50 : 0; +- this.checkBurnOut(level, pos.east(), 300 + extra, random, age); +- this.checkBurnOut(level, pos.west(), 300 + extra, random, age); +- this.checkBurnOut(level, pos.below(), 250 + extra, random, age); +- this.checkBurnOut(level, pos.above(), 250 + extra, random, age); +- this.checkBurnOut(level, pos.north(), 300 + extra, random, age); +- this.checkBurnOut(level, pos.south(), 300 + extra, random, age); ++ this.checkBurnOut(level, pos.east(), 300 + extra, random, age, Direction.WEST); ++ this.checkBurnOut(level, pos.west(), 300 + extra, random, age, Direction.EAST); ++ this.checkBurnOut(level, pos.below(), 250 + extra, random, age, Direction.UP); ++ this.checkBurnOut(level, pos.above(), 250 + extra, random, age, Direction.DOWN); ++ this.checkBurnOut(level, pos.north(), 300 + extra, random, age, Direction.SOUTH); ++ this.checkBurnOut(level, pos.south(), 300 + extra, random, age, Direction.NORTH); + BlockPos.MutableBlockPos testPos = new BlockPos.MutableBlockPos(); - for (int l = -1; l <= 1; l++) { -@@ -223,33 +_,31 @@ - || p_53429_.isRainingAt(p_53430_.south()); + for (int xx = -1; xx <= 1; xx++) { +@@ -221,33 +_,31 @@ + || level.isRainingAt(testPos.south()); } + @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only. - public int getBurnOdds(BlockState p_221165_) { - return p_221165_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221165_.getValue(BlockStateProperties.WATERLOGGED) + public int getBurnOdds(final BlockState state) { + return state.hasProperty(BlockStateProperties.WATERLOGGED) && state.getValue(BlockStateProperties.WATERLOGGED) ? 0 - : this.burnOdds.getInt(p_221165_.getBlock()); + : this.burnOdds.getInt(state.getBlock()); } + @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed - public int getIgniteOdds(BlockState p_221167_) { - return p_221167_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221167_.getValue(BlockStateProperties.WATERLOGGED) + public int getIgniteOdds(final BlockState state) { + return state.hasProperty(BlockStateProperties.WATERLOGGED) && state.getValue(BlockStateProperties.WATERLOGGED) ? 0 - : this.igniteOdds.getInt(p_221167_.getBlock()); + : this.igniteOdds.getInt(state.getBlock()); } -- private void checkBurnOut(Level p_221151_, BlockPos p_221152_, int p_221153_, RandomSource p_221154_, int p_221155_) { -- int i = this.getBurnOdds(p_221151_.getBlockState(p_221152_)); -+ private void checkBurnOut(Level p_221151_, BlockPos p_221152_, int p_221153_, RandomSource p_221154_, int p_221155_, Direction face) { -+ int i = p_221151_.getBlockState(p_221152_).getFlammability(p_221151_, p_221152_, face); - if (p_221154_.nextInt(p_221153_) < i) { - BlockState blockstate = p_221151_.getBlockState(p_221152_); -+ blockstate.onCaughtFire(p_221151_, p_221152_, face, null); - if (p_221154_.nextInt(p_221155_ + 10) < 5 && !p_221151_.isRainingAt(p_221152_)) { - int j = Math.min(p_221155_ + p_221154_.nextInt(5) / 4, 15); - p_221151_.setBlock(p_221152_, this.getStateWithAge(p_221151_, p_221152_, j), 3); +- private void checkBurnOut(final Level level, final BlockPos pos, final int chance, final RandomSource random, final int age) { +- int odds = this.getBurnOdds(level.getBlockState(pos)); ++ private void checkBurnOut(final Level level, final BlockPos pos, final int chance, final RandomSource random, final int age, final Direction face) { ++ int odds = level.getBlockState(pos).getFlammability(level, pos, face); + if (random.nextInt(chance) < odds) { + BlockState oldState = level.getBlockState(pos); ++ oldState.onCaughtFire(level, pos, face, null); + if (random.nextInt(age + 10) < 5 && !level.isRainingAt(pos)) { + int newAge = Math.min(age + random.nextInt(5) / 4, 15); + level.setBlock(pos, this.getStateWithAge(level, pos, newAge), 3); } else { - p_221151_.removeBlock(p_221152_, false); + level.removeBlock(pos, false); } - -- Block block = blockstate.getBlock(); +- Block block = oldState.getBlock(); - if (block instanceof TntBlock) { -- TntBlock.prime(p_221151_, p_221152_); +- TntBlock.prime(level, pos); - } } } -@@ -260,7 +_,7 @@ +@@ -258,7 +_,7 @@ - private boolean isValidFireLocation(BlockGetter p_53486_, BlockPos p_53487_) { + private boolean isValidFireLocation(final BlockGetter level, final BlockPos pos) { for (Direction direction : Direction.values()) { -- if (this.canBurn(p_53486_.getBlockState(p_53487_.relative(direction)))) { -+ if (this.canCatchFire(p_53486_, p_53487_.relative(direction), direction.getOpposite())) { +- if (this.canBurn(level.getBlockState(pos.relative(direction)))) { ++ if (this.canCatchFire(level, pos.relative(direction), direction.getOpposite())) { return true; } } -@@ -276,13 +_,14 @@ +@@ -275,12 +_,13 @@ - for (Direction direction : Direction.values()) { - BlockState blockstate = p_221157_.getBlockState(p_221158_.relative(direction)); -- i = Math.max(this.getIgniteOdds(blockstate), i); -+ i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.relative(direction), direction.getOpposite()), i); - } - - return i; + for (Direction direction : Direction.values()) { + BlockState blockState = level.getBlockState(pos.relative(direction)); +- odds = Math.max(this.getIgniteOdds(blockState), odds); ++ odds = Math.max(blockState.getFireSpreadSpeed(level, pos.relative(direction), direction.getOpposite()), odds); } + + return odds; } + @Deprecated //Forge: Use canCatchFire with more context @Override - protected boolean canBurn(BlockState p_53489_) { - return this.getIgniteOdds(p_53489_) > 0; -@@ -304,8 +_,21 @@ + protected boolean canBurn(final BlockState state) { + return this.getIgniteOdds(state) > 0; +@@ -302,8 +_,21 @@ } - public void setFlammable(Block p_53445_, int p_53446_, int p_53447_) { -+ if (p_53445_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.igniteOdds.put(p_53445_, p_53446_); - this.burnOdds.put(p_53445_, p_53447_); + private void setFlammable(final Block block, final int igniteOdds, final int burnOdds) { ++ if (block == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.igniteOdds.put(block, igniteOdds); + this.burnOdds.put(block, burnOdds); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch index d411d232a1..4ae076fdd6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -1,15 +1,12 @@ --- a/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/net/minecraft/world/level/block/FlowerPotBlock.java -@@ -45,9 +_,31 @@ +@@ -43,9 +_,31 @@ } - public FlowerPotBlock(Block p_53528_, BlockBehaviour.Properties p_53529_) { -- super(p_53529_); -- this.potted = p_53528_; -- POTTED_BY_CONTENT.put(p_53528_, this); -+ this(Blocks.FLOWER_POT == null ? null : () -> (FlowerPotBlock) net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.FLOWER_POT).get(), () -> net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_53528_).get(), p_53529_); + public FlowerPotBlock(final Block potted, final BlockBehaviour.Properties properties) { ++ this(Blocks.FLOWER_POT == null ? null : () -> (FlowerPotBlock) net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.FLOWER_POT).get(), () -> net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(potted).get(), properties); + if (Blocks.FLOWER_POT != null) { -+ ((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(p_53528_), () -> this); ++ ((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(potted), () -> this); + } + } + @@ -22,7 +19,9 @@ + * @param properties + */ + public FlowerPotBlock(@org.jetbrains.annotations.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_53528_, BlockBehaviour.Properties properties) { -+ super(properties); + super(properties); +- this.potted = potted; +- POTTED_BY_CONTENT.put(potted, this); + this.potted = null; // Unused, redirected by coremod + this.flowerDelegate = p_53528_; + if (emptyPot == null) { @@ -35,25 +34,25 @@ } @Override -@@ -60,7 +_,7 @@ - ItemStack p_329639_, BlockState p_328047_, Level p_328816_, BlockPos p_334572_, Player p_329206_, InteractionHand p_329142_, BlockHitResult p_330607_ +@@ -64,7 +_,7 @@ + final BlockHitResult hitResult ) { - BlockState blockstate = (p_329639_.getItem() instanceof BlockItem blockitem -- ? POTTED_BY_CONTENT.getOrDefault(blockitem.getBlock(), Blocks.AIR) -+ ? getEmptyPot().fullPots.getOrDefault(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(blockitem.getBlock()), net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.AIR)).get() + BlockState newContents = (itemStack.getItem() instanceof BlockItem blockItem +- ? POTTED_BY_CONTENT.getOrDefault(blockItem.getBlock(), Blocks.AIR) ++ ? getEmptyPot().fullPots.getOrDefault(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(blockItem.getBlock()), net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.AIR)).get() : Blocks.AIR) .defaultBlockState(); - if (blockstate.isAir()) { -@@ -86,7 +_,7 @@ - p_333787_.drop(itemstack, false); - } - -- p_334489_.setBlock(p_330334_, Blocks.FLOWER_POT.defaultBlockState(), 3); -+ p_334489_.setBlock(p_330334_, getEmptyPot().defaultBlockState(), 3); - p_334489_.gameEvent(p_333787_, GameEvent.BLOCK_CHANGE, p_330334_); - return InteractionResult.SUCCESS; + if (newContents.isAir()) { +@@ -95,7 +_,7 @@ + player.drop(plant, false); } -@@ -118,7 +_,7 @@ + +- level.setBlock(pos, Blocks.FLOWER_POT.defaultBlockState(), 3); ++ level.setBlock(pos, getEmptyPot().defaultBlockState(), 3); + level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + return InteractionResult.SUCCESS; + } +@@ -126,7 +_,7 @@ } public Block getPotted() { @@ -62,9 +61,9 @@ } @Override -@@ -153,5 +_,24 @@ +@@ -161,5 +_,24 @@ } else { - return p_376074_.is(Blocks.POTTED_CLOSED_EYEBLOSSOM) ? Blocks.POTTED_OPEN_EYEBLOSSOM.defaultBlockState() : p_376074_; + return state.is(Blocks.POTTED_CLOSED_EYEBLOSSOM) ? Blocks.POTTED_OPEN_EYEBLOSSOM.defaultBlockState() : state; } + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch deleted file mode 100644 index 470e064d1e..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/world/level/block/FungusBlock.java -+++ b/net/minecraft/world/level/block/FungusBlock.java -@@ -76,6 +_,10 @@ - - @Override - public void performBonemeal(ServerLevel p_221243_, RandomSource p_221244_, BlockPos p_221245_, BlockState p_221246_) { -- this.getFeature(p_221243_).ifPresent(p_256352_ -> p_256352_.value().place(p_221243_, p_221243_.getChunkSource().getGenerator(), p_221244_, p_221245_)); -+ this.getFeature(p_221243_).ifPresent(p_256352_ -> { -+ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221243_, p_221244_, p_221245_, p_256352_); -+ if (event.getResult().isDenied()) return; -+ event.getFeature().value().place(p_221243_, p_221243_.getChunkSource().getGenerator(), p_221244_, p_221245_); -+ }); - } - } diff --git a/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch index 9a16ca6843..affd25cb75 100644 --- a/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java +++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java -@@ -42,10 +_,13 @@ +@@ -48,10 +_,13 @@ @Override - protected void randomTick(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { -- if (p_221350_.getValue(AGE) < 25 && p_221353_.nextDouble() < this.growPerTickProbability) { -+ var vanilla = p_221353_.nextDouble() < this.growPerTickProbability; -+ var target = p_221352_.relative(this.growthDirection); -+ if (p_221350_.getValue(AGE) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221351_, target, p_221351_.getBlockState(target), vanilla)) { - BlockPos blockpos = p_221352_.relative(this.growthDirection); - if (this.canGrowInto(p_221351_.getBlockState(blockpos))) { - p_221351_.setBlockAndUpdate(blockpos, this.getGrowIntoState(p_221350_, p_221351_.random)); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221351_, blockpos, p_221351_.getBlockState(blockpos)); + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { +- if (state.getValue(AGE) < 25 && random.nextDouble() < this.growPerTickProbability) { ++ var vanilla = random.nextDouble() < this.growPerTickProbability; ++ var target = pos.relative(this.growthDirection); ++ if (state.getValue(AGE) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, target, level.getBlockState(target), vanilla)) { + BlockPos growthPos = pos.relative(this.growthDirection); + if (this.canGrowInto(level.getBlockState(growthPos))) { + level.setBlockAndUpdate(growthPos, this.getGrowIntoState(state, level.getRandom())); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, growthPos, level.getBlockState(growthPos)); } } } diff --git a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch deleted file mode 100644 index 4e47c3c6e6..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/LeavesBlock.java -+++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -26,7 +_,7 @@ - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; - --public abstract class LeavesBlock extends Block implements SimpleWaterloggedBlock { -+public abstract class LeavesBlock extends Block implements SimpleWaterloggedBlock, net.minecraftforge.common.IForgeShearable { - public static final int DECAY_DISTANCE = 7; - public static final IntegerProperty DISTANCE = BlockStateProperties.DISTANCE; - public static final BooleanProperty PERSISTENT = BlockStateProperties.PERSISTENT; diff --git a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch index a5fe8e1b69..02758f99bc 100644 --- a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -1,75 +1,78 @@ --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -53,7 +_,8 @@ - p_422116_ -> p_422116_.group(FLOWING_FLUID.fieldOf("fluid").forGetter(p_312827_ -> p_312827_.fluid), propertiesCodec()).apply(p_422116_, LiquidBlock::new) +@@ -52,7 +_,8 @@ + i -> i.group(FLOWING_FLUID.fieldOf("fluid").forGetter(b -> b.fluid), propertiesCodec()).apply(i, LiquidBlock::new) ); public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL; - protected final FlowingFluid fluid; + @Deprecated // Use getFluid + private final FlowingFluid fluid; private final List stateCache; - public static final VoxelShape SHAPE_STABLE = Block.column(16.0, 0.0, 8.0); - public static final ImmutableList POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of(Direction.DOWN, Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST); -@@ -63,6 +_,7 @@ + public static final ImmutableList POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of( + Direction.DOWN, Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST +@@ -64,6 +_,7 @@ return CODEC; } + @Deprecated // Forge: Use the constructor that takes a supplier - public LiquidBlock(FlowingFluid p_54694_, BlockBehaviour.Properties p_54695_) { - super(p_54695_); - this.fluid = p_54694_; -@@ -75,6 +_,19 @@ + public LiquidBlock(final FlowingFluid fluid, final BlockBehaviour.Properties properties) { + super(properties); + this.fluid = fluid; +@@ -76,6 +_,19 @@ - this.stateCache.add(p_54694_.getFlowing(8, true)); + this.stateCache.add(fluid.getFlowing(8, true)); this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 0)); + fluidStateCacheInitialized = true; -+ supplier = () -> p_54694_; ++ supplier = () -> fluid; + } + + /** -+ * @param p_54694_ A fluid supplier such as {@link net.minecraftforge.registries.RegistryObject} ++ * @param fluid A fluid supplier such as {@link net.minecraftforge.registries.RegistryObject} + */ -+ public LiquidBlock(java.util.function.Supplier p_54694_, BlockBehaviour.Properties p_54695_) { -+ super(p_54695_); ++ public LiquidBlock(final java.util.function.Supplier fluid, final BlockBehaviour.Properties properties) { ++ super(properties); + this.fluid = null; + this.stateCache = Lists.newArrayList(); + this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); -+ this.supplier = p_54694_; ++ this.supplier = fluid; } @Override -@@ -113,6 +_,7 @@ +@@ -124,6 +_,7 @@ @Override - protected FluidState getFluidState(BlockState p_54765_) { - int i = p_54765_.getValue(LEVEL); + protected FluidState getFluidState(final BlockState state) { + int level = state.getValue(LEVEL); + if (!fluidStateCacheInitialized) initFluidStateCache(); - return this.stateCache.get(Math.min(i, 8)); + return this.stateCache.get(Math.min(level, 8)); } -@@ -138,7 +_,7 @@ +@@ -149,7 +_,7 @@ @Override - protected void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { -- if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { -+ if (!net.minecraftforge.fluids.FluidInteractionRegistry.canInteract(p_54755_, p_54756_)) { - p_54755_.scheduleTick(p_54756_, p_54754_.getFluidState().getType(), this.fluid.getTickDelay(p_54755_)); + protected void onPlace(final BlockState state, final Level level, final BlockPos pos, final BlockState oldState, final boolean movedByPiston) { +- if (this.shouldSpreadLiquid(level, pos, state)) { ++ if (!net.minecraftforge.fluids.FluidInteractionRegistry.canInteract(level, pos)) { + level.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(level)); } - } -@@ -163,11 +_,12 @@ - @Override - protected void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, @Nullable Orientation p_368724_, boolean p_54714_) { -- if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { -+ if (!net.minecraftforge.fluids.FluidInteractionRegistry.canInteract(p_54710_, p_54711_)) { - p_54710_.scheduleTick(p_54711_, p_54709_.getFluidState().getType(), this.fluid.getTickDelay(p_54710_)); +@@ -197,7 +_,7 @@ + protected void neighborChanged( + final BlockState state, final Level level, final BlockPos pos, final Block block, final @Nullable Orientation orientation, final boolean movedByPiston + ) { +- if (this.shouldSpreadLiquid(level, pos, state)) { ++ if (!net.minecraftforge.fluids.FluidInteractionRegistry.canInteract(level, pos)) { + level.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(level)); + } + +@@ -213,6 +_,7 @@ } } + @Deprecated // FORGE: Use FluidInteractionRegistry#canInteract instead - private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) { + private boolean shouldSpreadLiquid(final Level level, final BlockPos pos, final BlockState state) { if (this.fluid.is(FluidTags.LAVA)) { - boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL); -@@ -214,5 +_,24 @@ + boolean isOverSoulSoil = level.getBlockState(pos.below()).is(Blocks.SOUL_SOIL); +@@ -259,5 +_,24 @@ @Override public Optional getPickupSound() { return this.fluid.getPickupSound(); 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 89ae290aa8..09c7d20ef3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java -@@ -82,7 +_,7 @@ - protected boolean canSurvive(BlockState p_54880_, LevelReader p_54881_, BlockPos p_54882_) { - BlockPos blockpos = p_54882_.below(); - BlockState blockstate = p_54881_.getBlockState(blockpos); -- return blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK) ? true : p_54881_.getRawBrightness(p_54882_, 0) < 13 && this.mayPlaceOn(blockstate, p_54881_, blockpos); -+ return blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK) ? true : p_54881_.getRawBrightness(p_54882_, 0) < 13 && blockstate.canSustainPlant(p_54881_, blockpos, net.minecraft.core.Direction.UP, this); +@@ -83,7 +_,7 @@ + protected boolean canSurvive(final BlockState state, final LevelReader level, final BlockPos pos) { + BlockPos belowPos = pos.below(); + BlockState below = level.getBlockState(belowPos); +- return below.is(BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT) ? true : level.getRawBrightness(pos, 0) < 13 && this.mayPlaceOn(below, level, belowPos); ++ return below.is(BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT) ? true : level.getRawBrightness(pos, 0) < 13 && below.canSustainPlant(level, belowPos, net.minecraft.core.Direction.UP, this); } - public boolean growMushroom(ServerLevel p_221774_, BlockPos p_221775_, BlockState p_221776_, RandomSource p_221777_) { -@@ -90,8 +_,10 @@ - if (optional.isEmpty()) { + public boolean growMushroom(final ServerLevel level, final BlockPos pos, final BlockState state, final RandomSource random) { +@@ -92,8 +_,10 @@ return false; - } else { -+ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221774_, p_221777_, p_221775_, optional.get()); -+ if (event.getResult().isDenied()) return false; - p_221774_.removeBlock(p_221775_, false); -- if (optional.get().value().place(p_221774_, p_221774_.getChunkSource().getGenerator(), p_221777_, p_221775_)) { -+ if (event.getFeature().value().place(p_221774_, p_221774_.getChunkSource().getGenerator(), p_221777_, p_221775_)) { - return true; - } else { - p_221774_.setBlock(p_221775_, p_221776_, 3); + } + ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(level, random, pos, feature.get()); ++ if (event.getResult().isDenied()) return false; + level.removeBlock(pos, false); +- if (feature.get().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { ++ if (event.getFeature().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { + return true; + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/NetherFungusBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/NetherFungusBlock.java.patch new file mode 100644 index 0000000000..6aea05dc2f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/NetherFungusBlock.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/level/block/NetherFungusBlock.java ++++ b/net/minecraft/world/level/block/NetherFungusBlock.java +@@ -81,5 +_,10 @@ + @Override + public void performBonemeal(final ServerLevel level, final RandomSource random, final BlockPos pos, final BlockState state) { + this.getFeature(level).ifPresent(feature -> feature.value().place(level, level.getChunkSource().getGenerator(), random, pos)); ++ this.getFeature(level).ifPresent(feature -> { ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(level, random, pos, feature); ++ if (event.getResult().isDenied()) return; ++ event.getFeature().value().place(level, level.getChunkSource().getGenerator(), random, pos); ++ }); + } + } diff --git a/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch index 7e84ccf5f1..c42fe54bec 100644 --- a/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/block/NetherWartBlock.java +++ b/net/minecraft/world/level/block/NetherWartBlock.java -@@ -50,9 +_,10 @@ +@@ -51,9 +_,10 @@ @Override - protected void randomTick(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { - int i = p_221806_.getValue(AGE); -- if (i < 3 && p_221809_.nextInt(10) == 0) { -+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221807_, p_221808_, p_221806_, p_221809_.nextInt(10) == 0)) { - p_221806_ = p_221806_.setValue(AGE, i + 1); - p_221807_.setBlock(p_221808_, p_221806_, 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221807_, p_221808_, p_221806_); + protected void randomTick(BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + int age = state.getValue(AGE); +- if (age < 3 && random.nextInt(10) == 0) { ++ if (age < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, random.nextInt(10) == 0)) { + state = state.setValue(AGE, age + 1); + level.setBlock(pos, state, 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } 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 83c9a6f116..96515ff319 100644 --- a/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch @@ -1,23 +1,29 @@ --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java -@@ -115,7 +_,9 @@ +@@ -123,7 +_,9 @@ @Override - protected InteractionResult useWithoutItem(BlockState p_331116_, Level p_332131_, BlockPos p_333586_, Player p_329332_, BlockHitResult p_331978_) { - if (!p_332131_.isClientSide()) { -- p_331116_ = p_331116_.cycle(NOTE); -+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_332131_, p_333586_, p_331116_, p_331116_.getValue(NOTE), p_331116_.cycle(NOTE).getValue(NOTE)); + protected InteractionResult useWithoutItem(BlockState state, final Level level, final BlockPos pos, final Player player, final BlockHitResult hitResult) { + if (!level.isClientSide()) { +- state = state.cycle(NOTE); ++ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(level, pos, state, state.getValue(NOTE), state.cycle(NOTE).getValue(NOTE)); + if (_new == -1) return InteractionResult.FAIL; -+ p_331116_ = p_331116_.setValue(NOTE, _new); - p_332131_.setBlock(p_333586_, p_331116_, 3); - this.playNote(p_329332_, p_331116_, p_332131_, p_333586_); - p_329332_.awardStat(Stats.TUNE_NOTEBLOCK); -@@ -138,6 +_,9 @@ ++ state = state.setValue(NOTE, _new); + level.setBlock(pos, state, 3); + this.playNote(player, state, level, pos); + player.awardStat(Stats.TUNE_NOTEBLOCK); +@@ -146,10 +_,13 @@ @Override - protected boolean triggerEvent(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { -+ var event = net.minecraftforge.event.ForgeEventFactory.onNotePlay(p_55024_, p_55025_, p_55023_, p_55023_.getValue(NOTE), p_55023_.getValue(INSTRUMENT)); + protected boolean triggerEvent(final BlockState state, final Level level, final BlockPos pos, final int b0, final int b1) { +- NoteBlockInstrument instrument = state.getValue(INSTRUMENT); ++ var event = net.minecraftforge.event.ForgeEventFactory.onNotePlay(level, pos, state, state.getValue(NOTE), state.getValue(INSTRUMENT)); + if (event == null) return false; -+ p_55023_ = p_55023_.setValue(NOTE, event.getVanillaNoteId()).setValue(INSTRUMENT, event.getInstrument()); - NoteBlockInstrument noteblockinstrument = p_55023_.getValue(INSTRUMENT); - float f; - if (noteblockinstrument.isTunable()) { ++ var newState = state.setValue(NOTE, event.getVanillaNoteId()).setValue(INSTRUMENT, event.getInstrument()); ++ NoteBlockInstrument instrument = newState.getValue(INSTRUMENT); + float pitch; + if (instrument.isTunable()) { +- int note = state.getValue(NOTE); ++ int note = newState.getValue(NOTE); + pitch = getPitchFromNote(note); + level.addParticle(ParticleTypes.NOTE, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, note / 24.0, 0.0, 0.0); + } else { diff --git a/patches/minecraft/net/minecraft/world/level/block/PitcherCropBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PitcherCropBlock.java.patch index b0989645a5..5364f59da5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PitcherCropBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PitcherCropBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -106,7 +_,7 @@ +@@ -107,7 +_,7 @@ @Override - protected boolean mayPlaceOn(BlockState p_277418_, BlockGetter p_277461_, BlockPos p_277608_) { -- return p_277418_.is(Blocks.FARMLAND); -+ return p_277418_.getBlock() instanceof net.minecraft.world.level.block.FarmBlock; + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { +- return state.is(BlockTags.SUPPORTS_CROPS); ++ return state.getBlock() instanceof FarmlandBlock; } @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch index a5fc424b97..96ba84c66a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/net/minecraft/world/level/block/PowderSnowBlock.java -@@ -138,7 +_,7 @@ - if (p_154256_.getType().is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)) { +@@ -145,7 +_,7 @@ + if (entity.is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)) { return true; } else { -- return p_154256_ instanceof LivingEntity ? ((LivingEntity)p_154256_).getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS) : false; -+ return p_154256_ instanceof LivingEntity ? ((LivingEntity)p_154256_).getItemBySlot(EquipmentSlot.FEET).canWalkOnPowderedSnow((LivingEntity)p_154256_) : false; +- return entity instanceof LivingEntity livingEntity ? livingEntity.getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS) : false; ++ return entity instanceof LivingEntity livingEntity ? livingEntity.getItemBySlot(EquipmentSlot.FEET).canWalkOnPowderedSnow((LivingEntity)entity) : false; } } 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 08e6a86491..f487481ef3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -11,12 +11,12 @@ @@ -23,7 +_,16 @@ } - public PoweredRailBlock(BlockBehaviour.Properties p_55218_) { -+ this(p_55218_, false); + public PoweredRailBlock(final BlockBehaviour.Properties properties) { ++ this(properties, false); + } + -+ protected PoweredRailBlock(BlockBehaviour.Properties p_55218_, boolean isPoweredRail) { - super(true, p_55218_); ++ protected PoweredRailBlock(final BlockBehaviour.Properties properties, boolean isPoweredRail) { + super(true, properties); + this.isActivator = !isPoweredRail; + this.registerDefaultState(); + } @@ -25,52 +25,51 @@ this.registerDefaultState(this.stateDefinition.any().setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(POWERED, false).setValue(WATERLOGGED, false)); } -@@ -35,7 +_,7 @@ - int j = p_55221_.getY(); - int k = p_55221_.getZ(); - boolean flag = true; -- RailShape railshape = p_55222_.getValue(SHAPE); -+ RailShape railshape = p_55222_.getValue(getShapeProperty()); - switch (railshape) { - case NORTH_SOUTH: - if (p_55223_) { -@@ -104,10 +_,10 @@ +@@ -36,7 +_,7 @@ + int y = pos.getY(); + int z = pos.getZ(); + boolean checkBelow = true; +- RailShape shape = state.getValue(SHAPE); ++ RailShape shape = state.getValue(getShapeProperty()); + switch (shape) { + case NORTH_SOUTH: + if (forward) { +@@ -104,17 +_,17 @@ - protected boolean isSameRailWithPower(Level p_55226_, BlockPos p_55227_, boolean p_55228_, int p_55229_, RailShape p_55230_) { - BlockState blockstate = p_55226_.getBlockState(p_55227_); -- if (!blockstate.is(this)) { -+ if (!(blockstate.getBlock() instanceof PoweredRailBlock other) || this.isActivatorRail() != other.isActivatorRail()) { + protected boolean isSameRailWithPower(final Level level, final BlockPos pos, final boolean forward, final int searchDepth, final RailShape dir) { + BlockState state = level.getBlockState(pos); +- if (!state.is(this)) { ++ if (!(state.getBlock() instanceof PoweredRailBlock other) || this.isActivatorRail() != other.isActivatorRail()) { return false; - } else { -- RailShape railshape = blockstate.getValue(SHAPE); -+ RailShape railshape = other.getRailDirection(blockstate, p_55226_, p_55227_, null); - if (p_55230_ != RailShape.EAST_WEST - || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) { - if (p_55230_ != RailShape.NORTH_SOUTH -@@ -115,7 +_,7 @@ - if (!blockstate.getValue(POWERED)) { - return false; - } else { -- return p_55226_.hasNeighborSignal(p_55227_) ? true : this.findPoweredRailSignal(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); -+ return p_55226_.hasNeighborSignal(p_55227_) ? true : other.findPoweredRailSignal(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); - } - } else { + } + +- RailShape myShape = state.getValue(SHAPE); ++ RailShape myShape = other.getRailDirection(state, level, pos, null); + if (dir != RailShape.EAST_WEST || myShape != RailShape.NORTH_SOUTH && myShape != RailShape.ASCENDING_NORTH && myShape != RailShape.ASCENDING_SOUTH) { + if (dir != RailShape.NORTH_SOUTH || myShape != RailShape.EAST_WEST && myShape != RailShape.ASCENDING_EAST && myShape != RailShape.ASCENDING_WEST) { + if (!state.getValue(POWERED)) { return false; -@@ -135,7 +_,7 @@ - if (flag1 != flag) { - p_55233_.setBlock(p_55234_, p_55232_.setValue(POWERED, flag1), 3); - p_55233_.updateNeighborsAt(p_55234_.below(), this); -- if (p_55232_.getValue(SHAPE).isSlope()) { -+ if (p_55232_.getValue(getShapeProperty()).isSlope()) { - p_55233_.updateNeighborsAt(p_55234_.above(), this); + } else { +- return level.hasNeighborSignal(pos) ? true : this.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); ++ return level.hasNeighborSignal(pos) ? true : other.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); + } + } else { + return false; +@@ -133,7 +_,7 @@ + if (shouldPower != isPowered) { + level.setBlock(pos, state.setValue(POWERED, shouldPower), 3); + level.updateNeighborsAt(pos.below(), this); +- if (state.getValue(SHAPE).isSlope()) { ++ if (state.getValue(getShapeProperty()).isSlope()) { + level.updateNeighborsAt(pos.above(), this); } } -@@ -162,6 +_,10 @@ +@@ -160,6 +_,10 @@ @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_55243_) { -- p_55243_.add(SHAPE, POWERED, WATERLOGGED); -+ p_55243_.add(getShapeProperty(), POWERED, WATERLOGGED); + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { +- builder.add(SHAPE, POWERED, WATERLOGGED); ++ builder.add(getShapeProperty(), POWERED, WATERLOGGED); + } + + public boolean isActivatorRail() { diff --git a/patches/minecraft/net/minecraft/world/level/block/PumpkinBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PumpkinBlock.java.patch index a0cff8e709..524f64ecd0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PumpkinBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PumpkinBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/PumpkinBlock.java +++ b/net/minecraft/world/level/block/PumpkinBlock.java -@@ -36,7 +_,7 @@ - protected InteractionResult useItemOn( - ItemStack p_330568_, BlockState p_330263_, Level p_327756_, BlockPos p_328675_, Player p_334049_, InteractionHand p_331851_, BlockHitResult p_329008_ +@@ -43,7 +_,7 @@ + final InteractionHand hand, + final BlockHitResult hitResult ) { -- if (!p_330568_.is(Items.SHEARS)) { -+ if (p_330568_.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_CARVE)) { - return super.useItemOn(p_330568_, p_330263_, p_327756_, p_328675_, p_334049_, p_331851_, p_329008_); - } else if (p_327756_ instanceof ServerLevel serverlevel) { - Direction direction = p_329008_.getDirection(); +- if (!itemStack.is(Items.SHEARS)) { ++ if (!itemStack.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_CARVE)) { + return super.useItemOn(itemStack, state, level, pos, player, hand, hitResult); + } else if (level instanceof ServerLevel serverLevel) { + Direction clickedDirection = hitResult.getDirection(); diff --git a/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch b/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch index a87024673a..d952dad891 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch @@ -6,73 +6,73 @@ private final List connections = Lists.newArrayList(); + private final boolean canMakeSlopes; - public RailState(Level p_55421_, BlockPos p_55422_, BlockState p_55423_) { - this.level = p_55421_; - this.pos = p_55422_; - this.state = p_55423_; - this.block = (BaseRailBlock)p_55423_.getBlock(); -- RailShape railshape = p_55423_.getValue(this.block.getShapeProperty()); + public RailState(final Level level, final BlockPos pos, final BlockState state) { + this.level = level; + this.pos = pos; + this.state = state; + this.block = (BaseRailBlock)state.getBlock(); +- RailShape direction = state.getValue(this.block.getShapeProperty()); - this.isStraight = this.block.isStraight(); -+ RailShape railshape = this.block.getRailDirection(state, p_55421_, p_55422_, null); -+ this.isStraight = !this.block.isFlexibleRail(state, p_55421_, p_55422_); -+ this.canMakeSlopes = this.block.canMakeSlopes(state, p_55421_, p_55422_); - this.updateConnections(railshape); ++ RailShape direction = this.block.getRailDirection(state, level, pos, null); ++ this.isStraight = !this.block.isFlexibleRail(state, level, pos); ++ this.canMakeSlopes = this.block.canMakeSlopes(state, level, pos); + this.updateConnections(direction); } -@@ -178,7 +_,7 @@ +@@ -177,7 +_,7 @@ } } -- if (railshape == RailShape.NORTH_SOUTH) { -+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (BaseRailBlock.isRail(this.level, blockpos.above())) { - railshape = RailShape.ASCENDING_NORTH; +- if (shape == RailShape.NORTH_SOUTH) { ++ if (shape == RailShape.NORTH_SOUTH && canMakeSlopes) { + if (BaseRailBlock.isRail(this.level, north.above())) { + shape = RailShape.ASCENDING_NORTH; } -@@ -188,7 +_,7 @@ +@@ -187,7 +_,7 @@ } } -- if (railshape == RailShape.EAST_WEST) { -+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (BaseRailBlock.isRail(this.level, blockpos3.above())) { - railshape = RailShape.ASCENDING_EAST; +- if (shape == RailShape.EAST_WEST) { ++ if (shape == RailShape.EAST_WEST && canMakeSlopes) { + if (BaseRailBlock.isRail(this.level, east.above())) { + shape = RailShape.ASCENDING_EAST; } -@@ -200,6 +_,11 @@ +@@ -199,6 +_,11 @@ - if (railshape == null) { - railshape = RailShape.NORTH_SOUTH; + if (shape == null) { + shape = RailShape.NORTH_SOUTH; + } + -+ if (!this.block.isValidRailShape(railshape)) { // Forge: allow rail block to decide if the new shape is valid -+ this.connections.remove(p_55442_.pos); ++ if (!this.block.isValidRailShape(shape)) { // Forge: allow rail block to decide if the new shape is valid ++ this.connections.remove(rail.pos); + return; } - this.state = this.state.setValue(this.block.getShapeProperty(), railshape); -@@ -304,7 +_,7 @@ + this.state = this.state.setValue(this.block.getShapeProperty(), shape); +@@ -303,7 +_,7 @@ } } -- if (railshape == RailShape.NORTH_SOUTH) { -+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (BaseRailBlock.isRail(this.level, blockpos.above())) { - railshape = RailShape.ASCENDING_NORTH; +- if (shape == RailShape.NORTH_SOUTH) { ++ if (shape == RailShape.NORTH_SOUTH && canMakeSlopes) { + if (BaseRailBlock.isRail(this.level, north.above())) { + shape = RailShape.ASCENDING_NORTH; } -@@ -314,7 +_,7 @@ +@@ -313,7 +_,7 @@ } } -- if (railshape == RailShape.EAST_WEST) { -+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (BaseRailBlock.isRail(this.level, blockpos3.above())) { - railshape = RailShape.ASCENDING_EAST; +- if (shape == RailShape.EAST_WEST) { ++ if (shape == RailShape.EAST_WEST && canMakeSlopes) { + if (BaseRailBlock.isRail(this.level, east.above())) { + shape = RailShape.ASCENDING_EAST; } -@@ -324,7 +_,7 @@ +@@ -323,7 +_,7 @@ } } -- if (railshape == null) { -+ if (railshape == null || !this.block.isValidRailShape(railshape)) { // Forge: allow rail block to decide if the new shape is valid - railshape = p_55434_; +- if (shape == null) { ++ if (shape == null || !this.block.isValidRailShape(shape)) { // Forge: allow rail block to decide if the new shape is valid + shape = defaultShape; } diff --git a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch index b9d8f1c263..0f803fc4b1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -87,7 +_,7 @@ +@@ -93,7 +_,7 @@ @Override - protected void spawnAfterBreak(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { - super.spawnAfterBreak(p_221907_, p_221908_, p_221909_, p_221910_, p_221911_); -- if (p_221911_) { -+ if (false && p_221911_) { // Forge: moved to getExpDrop - this.tryDropExperience(p_221908_, p_221909_, p_221910_, UniformInt.of(1, 5)); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge: moved to getExpDrop + this.tryDropExperience(level, pos, tool, UniformInt.of(1, 5)); } } -@@ -119,4 +_,10 @@ - protected void createBlockStateDefinition(StateDefinition.Builder p_55484_) { - p_55484_.add(LIT); +@@ -125,4 +_,10 @@ + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + builder.add(LIT); } + + @Override 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 7a6dd0f0ef..87973efc87 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch @@ -1,28 +1,29 @@ --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -238,7 +_,7 @@ - BlockState blockstate = p_55523_.getBlockState(blockpos); - if (p_55526_) { - boolean flag = blockstate.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(p_55523_, blockpos, blockstate); -- if (flag && shouldConnectTo(p_55523_.getBlockState(blockpos.above()))) { -+ if (flag && p_55523_.getBlockState(blockpos.above()).canRedstoneConnectTo(p_55523_, blockpos.above(), null)) { - if (blockstate.isFaceSturdy(p_55523_, blockpos, p_55525_.getOpposite())) { +@@ -242,7 +_,7 @@ + BlockState relativeState = level.getBlockState(relativePos); + if (canConnectUp) { + boolean isPlaceableAbove = relativeState.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(level, relativePos, relativeState); +- if (isPlaceableAbove && shouldConnectTo(level.getBlockState(relativePos.above()))) { ++ if (isPlaceableAbove && level.getBlockState(relativePos.above()).canRedstoneConnectTo(level, relativePos.above(), null)) { + if (relativeState.isFaceSturdy(level, relativePos, direction.getOpposite())) { return RedstoneSide.UP; } -@@ -247,9 +_,14 @@ +@@ -251,10 +_,14 @@ } } -- return !shouldConnectTo(blockstate, p_55525_) && (blockstate.isRedstoneConductor(p_55523_, blockpos) || !shouldConnectTo(p_55523_.getBlockState(blockpos.below()))) +- return !shouldConnectTo(relativeState, direction) +- && (relativeState.isRedstoneConductor(level, relativePos) || !shouldConnectTo(level.getBlockState(relativePos.below()))) - ? RedstoneSide.NONE - : RedstoneSide.SIDE; -+ if (blockstate.canRedstoneConnectTo(p_55523_, blockpos, p_55525_)) { ++ if (relativeState.canRedstoneConnectTo(level, relativePos, direction)) { + return RedstoneSide.SIDE; -+ } else if (blockstate.isRedstoneConductor(p_55523_, blockpos)) { ++ } else if (relativeState.isRedstoneConductor(level, relativePos)) { + return RedstoneSide.NONE; + } else { -+ BlockPos blockPosBelow = blockpos.below(); -+ return p_55523_.getBlockState(blockPosBelow).canRedstoneConnectTo(p_55523_, blockPosBelow, null) ? RedstoneSide.SIDE : RedstoneSide.NONE; ++ BlockPos blockPosBelow = relativePos.below(); ++ return level.getBlockState(blockPosBelow).canRedstoneConnectTo(level, blockPosBelow, null) ? RedstoneSide.SIDE : RedstoneSide.NONE; + } } diff --git a/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch index e1f462acdd..84dea3faff 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/SaplingBlock.java +++ b/net/minecraft/world/level/block/SaplingBlock.java -@@ -45,6 +_,7 @@ +@@ -43,6 +_,7 @@ @Override - protected void randomTick(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { -+ if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_222012_.getMaxLocalRawBrightness(p_222013_.above()) >= 9 && p_222014_.nextInt(7) == 0) { - this.advanceTree(p_222012_, p_222013_, p_222011_, p_222014_); + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ if (!level.isAreaLoaded(pos, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (level.getMaxLocalRawBrightness(pos.above()) >= 9 && random.nextInt(7) == 0) { + this.advanceTree(level, pos, state, random); } 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 ba6a3d25cc..5800c0472c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/SculkCatalystBlock.java +++ b/net/minecraft/world/level/block/SculkCatalystBlock.java -@@ -59,8 +_,13 @@ +@@ -60,8 +_,13 @@ @Override - protected void spawnAfterBreak(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { - super.spawnAfterBreak(p_222109_, p_222110_, p_222111_, p_222112_, p_222113_); -- if (p_222113_) { -+ if (false && p_222113_) { // Forge Moved to getExpDrop - this.tryDropExperience(p_222110_, p_222111_, p_222112_, this.xpRange); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge Moved to getExpDrop + this.tryDropExperience(level, pos, tool, this.xpRange); } + } + 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 1eafb2b4ec..faaa52905c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -280,8 +_,13 @@ +@@ -288,8 +_,13 @@ @Override - protected void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { - super.spawnAfterBreak(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); -- if (p_222146_) { -+ if (false && p_222146_) { // Forge: Moved to getExpDrop - this.tryDropExperience(p_222143_, p_222144_, p_222145_, ConstantInt.of(5)); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge: Moved to getExpDrop + this.tryDropExperience(level, pos, tool, ConstantInt.of(5)); } + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch index 86d8ae810e..a04576377c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/level/block/SculkShriekerBlock.java +++ b/net/minecraft/world/level/block/SculkShriekerBlock.java -@@ -126,7 +_,7 @@ +@@ -127,7 +_,7 @@ @Override - protected void spawnAfterBreak(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { - super.spawnAfterBreak(p_222192_, p_222193_, p_222194_, p_222195_, p_222196_); -- if (p_222196_) { -+ if (false && p_222196_) { // Forge: Moved to getExpDrop - this.tryDropExperience(p_222193_, p_222194_, p_222195_, ConstantInt.of(5)); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge: Moved to getExpDrop + this.tryDropExperience(level, pos, tool, ConstantInt.of(5)); } } -@@ -140,5 +_,10 @@ - (p_281134_, p_281135_, p_281136_, p_281137_) -> VibrationSystem.Ticker.tick(p_281134_, p_281137_.getVibrationData(), p_281137_.getVibrationUser()) +@@ -141,5 +_,10 @@ + (innerLevel, pos, state, entity) -> VibrationSystem.Ticker.tick(innerLevel, entity.getVibrationData(), entity.getVibrationUser()) ) : null; + } diff --git a/patches/minecraft/net/minecraft/world/level/block/SeagrassBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SeagrassBlock.java.patch deleted file mode 100644 index ebc600e967..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/SeagrassBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/SeagrassBlock.java -+++ b/net/minecraft/world/level/block/SeagrassBlock.java -@@ -23,7 +_,7 @@ - import net.minecraft.world.phys.shapes.VoxelShape; - import org.jspecify.annotations.Nullable; - --public class SeagrassBlock extends VegetationBlock implements BonemealableBlock, LiquidBlockContainer { -+public class SeagrassBlock extends VegetationBlock implements BonemealableBlock, LiquidBlockContainer, net.minecraftforge.common.IForgeShearable { - public static final MapCodec CODEC = simpleCodec(SeagrassBlock::new); - private static final VoxelShape SHAPE = Block.column(12.0, 0.0, 12.0); - 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 402e3f848c..f1b8ad2ee5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java -@@ -381,6 +_,7 @@ +@@ -855,6 +_,7 @@ private final SoundEvent hitSound; private final SoundEvent fallSound; -+ @Deprecated // Forge: Use {@link net.minecraftforge.common.util.ForgeSoundType} instead for suppliers - public SoundType(float p_56766_, float p_56767_, SoundEvent p_56768_, SoundEvent p_56769_, SoundEvent p_56770_, SoundEvent p_56771_, SoundEvent p_56772_) { - this.volume = p_56766_; - this.pitch = p_56767_; ++ /** @deprecated Forge: Use {@link net.minecraftforge.common.util.ForgeSoundType} instead for suppliers */ + public SoundType( + final float volume, + final float pitch, diff --git a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch index db83564374..19424b9a3a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/world/level/block/SpawnerBlock.java +++ b/net/minecraft/world/level/block/SpawnerBlock.java -@@ -38,9 +_,14 @@ +@@ -40,10 +_,15 @@ @Override - protected void spawnAfterBreak(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { - super.spawnAfterBreak(p_222477_, p_222478_, p_222479_, p_222480_, p_222481_); -- if (p_222481_) { -+ if (false && p_222481_) { // Forge: moved to getExpDrop - int i = 15 + p_222478_.random.nextInt(15) + p_222478_.random.nextInt(15); - this.popExperience(p_222478_, p_222479_, i); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { + super.spawnAfterBreak(state, level, pos, tool, dropExperience); +- if (dropExperience) { ++ if (false && dropExperience) { // Forge: moved to getExpDrop + RandomSource random = level.getRandom(); + int magicCount = 15 + random.nextInt(15) + random.nextInt(15); + this.popExperience(level, pos, magicCount); } + } + 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 4b053b12c7..6adf106c89 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 -@@ -51,6 +_,7 @@ +@@ -52,6 +_,7 @@ } - private boolean removeWaterBreadthFirstSearch(Level p_56808_, BlockPos p_56809_) { -+ BlockState spongeState = p_56808_.getBlockState(p_56809_); - return BlockPos.breadthFirstTraversal( - p_56809_, - 6, -@@ -66,7 +_,7 @@ - } else { - BlockState blockstate = p_56808_.getBlockState(p_296944_); - FluidState fluidstate = p_56808_.getFluidState(p_296944_); -- if (!fluidstate.is(FluidTags.WATER)) { -+ if (!spongeState.canBeHydrated(p_56808_, p_56809_, fluidstate, p_296944_)) { - return BlockPos.TraversalNodeStatus.SKIP; - } else if (blockstate.getBlock() instanceof BucketPickup bucketpickup - && !bucketpickup.pickupBlock(null, p_56808_, p_296944_, blockstate).isEmpty()) { + private boolean removeWaterBreadthFirstSearch(final Level level, final BlockPos startPos) { ++ BlockState spongeState = level.getBlockState(startPos); + return BlockPos.breadthFirstTraversal(startPos, 6, 65, (pos, consumer) -> { + for (Direction direction : ALL_DIRECTIONS) { + consumer.accept(pos.relative(direction)); +@@ -62,7 +_,7 @@ + } else { + BlockState state = level.getBlockState(pos); + FluidState fluidState = level.getFluidState(pos); +- if (!fluidState.is(FluidTags.WATER)) { ++ if (!spongeState.canBeHydrated(level, startPos, fluidState, pos)) { + return BlockPos.TraversalNodeStatus.SKIP; + } else if (state.getBlock() instanceof BucketPickup bucketPickup && !bucketPickup.pickupBlock(null, level, pos, state).isEmpty()) { + return BlockPos.TraversalNodeStatus.ACCEPT; diff --git a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch new file mode 100644 index 0000000000..dfb893448b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/level/block/SpreadingSnowyBlock.java ++++ b/net/minecraft/world/level/block/SpreadingSnowyBlock.java +@@ -52,8 +_,10 @@ + Optional baseBlock = blocks.getOptional(this.baseBlock); + if (!baseBlock.isEmpty()) { + if (!canStayAlive(state, level, pos)) { ++ if (!level.isAreaLoaded(pos, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + level.setBlockAndUpdate(pos, baseBlock.get().defaultBlockState()); + } else { ++ if (!level.isAreaLoaded(pos, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + if (level.getMaxLocalRawBrightness(pos.above()) >= 9) { + BlockState defaultBlockState = this.defaultBlockState(); + diff --git a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch deleted file mode 100644 index 0c7f4162b8..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -+++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -@@ -40,8 +_,10 @@ - @Override - protected void randomTick(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { - if (!canBeGrass(p_222508_, p_222509_, p_222510_)) { -+ if (!p_222509_.isAreaLoaded(p_222510_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - p_222509_.setBlockAndUpdate(p_222510_, Blocks.DIRT.defaultBlockState()); - } else { -+ if (!p_222509_.isAreaLoaded(p_222510_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - if (p_222509_.getMaxLocalRawBrightness(p_222510_.above()) >= 9) { - BlockState blockstate = this.defaultBlockState(); - diff --git a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch index e20f611ea8..f254b11706 100644 --- a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch @@ -1,45 +1,45 @@ --- a/net/minecraft/world/level/block/StemBlock.java +++ b/net/minecraft/world/level/block/StemBlock.java -@@ -64,14 +_,16 @@ +@@ -76,14 +_,16 @@ @Override - protected boolean mayPlaceOn(BlockState p_57053_, BlockGetter p_57054_, BlockPos p_57055_) { -- return p_57053_.is(Blocks.FARMLAND); -+ return p_57053_.getBlock() instanceof net.minecraft.world.level.block.FarmBlock; + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { +- return state.is(this.stemSupportBlocks); ++ return state.is(this.stemSupportBlocks) || state.getBlock() instanceof FarmlandBlock; } @Override - protected void randomTick(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) { -+ if (!p_222539_.isAreaLoaded(p_222540_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_222539_.getRawBrightness(p_222540_, 0) >= 9) { - float f = CropBlock.getGrowthSpeed(this, p_222539_, p_222540_); -- if (p_222541_.nextInt((int)(25.0F / f) + 1) == 0) { -+ var vanilla = p_222541_.nextInt((int)(25.0F / f) + 1) == 0; -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222539_, p_222540_, p_222538_, vanilla)) { - int i = p_222538_.getValue(AGE); - if (i < 7) { - p_222538_ = p_222538_.setValue(AGE, i + 1); -@@ -80,7 +_,7 @@ - Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(p_222541_); - BlockPos blockpos = p_222540_.relative(direction); - BlockState blockstate = p_222539_.getBlockState(blockpos.below()); -- if (p_222539_.getBlockState(blockpos).isAir() && (blockstate.is(Blocks.FARMLAND) || blockstate.is(BlockTags.DIRT))) { -+ if (p_222539_.getBlockState(blockpos).isAir() && (blockstate.getBlock() instanceof net.minecraft.world.level.block.FarmBlock || blockstate.is(BlockTags.DIRT))) { - Registry registry = p_222539_.registryAccess().lookupOrThrow(Registries.BLOCK); - Optional optional = registry.getOptional(this.fruit); - Optional optional1 = registry.getOptional(this.attachedStem); -@@ -90,6 +_,7 @@ + protected void randomTick(BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ if (!level.isAreaLoaded(pos, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (level.getRawBrightness(pos, 0) >= 9) { + float growthSpeed = CropBlock.getGrowthSpeed(this, level, pos); +- if (random.nextInt((int)(25.0F / growthSpeed) + 1) == 0) { ++ var vanilla = random.nextInt((int)(25.0F / growthSpeed) + 1) == 0; ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, vanilla)) { + int age = state.getValue(AGE); + if (age < 7) { + state = state.setValue(AGE, age + 1); +@@ -92,7 +_,7 @@ + Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random); + BlockPos relative = pos.relative(direction); + BlockState stateBelow = level.getBlockState(relative.below()); +- if (level.getBlockState(relative).isAir() && stateBelow.is(this.fruitSupportBlocks)) { ++ if (level.getBlockState(relative).isAir() && (stateBelow.is(this.fruitSupportBlocks) || stateBelow.getBlock() instanceof FarmlandBlock)) { + Registry blocks = level.registryAccess().lookupOrThrow(Registries.BLOCK); + Optional fruit = blocks.getOptional(this.fruit); + Optional stem = blocks.getOptional(this.attachedStem); +@@ -102,6 +_,7 @@ } } } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_222539_, p_222540_, p_222538_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } } -@@ -122,5 +_,10 @@ +@@ -134,5 +_,10 @@ @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_57040_) { - p_57040_.add(AGE); + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + builder.add(AGE); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch index b3df9ca591..9da411aa67 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -11,15 +11,15 @@ private static final VoxelShape SHAPE = Block.column(12.0, 0.0, 16.0); @@ -57,12 +_,15 @@ - if (i < 3) { - int j = p_222548_.getValue(AGE); -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222549_, p_222550_, p_222548_, true)) { - if (j == 15) { - p_222549_.setBlockAndUpdate(p_222550_.above(), this.defaultBlockState()); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_222549_, p_222550_.above(), this.defaultBlockState()); - p_222549_.setBlock(p_222550_, p_222548_.setValue(AGE, 0), 260); + if (height < 3) { + int age = state.getValue(AGE); ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, true)) { + if (age == 15) { + level.setBlockAndUpdate(pos.above(), this.defaultBlockState()); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos.above(), this.defaultBlockState()); + level.setBlock(pos, state.setValue(AGE, 0), 260); } else { - p_222549_.setBlock(p_222550_, p_222548_.setValue(AGE, j + 1), 260); + level.setBlock(pos, state.setValue(AGE, age + 1), 260); } + } } @@ -28,25 +28,25 @@ @@ -87,6 +_,8 @@ @Override - protected boolean canSurvive(BlockState p_57175_, LevelReader p_57176_, BlockPos p_57177_) { -+ BlockState soil = p_57176_.getBlockState(p_57177_.below()); -+ if (soil.canSustainPlant(p_57176_, p_57177_.below(), Direction.UP, this)) return true; - BlockState blockstate = p_57176_.getBlockState(p_57177_.below()); - if (blockstate.is(this)) { + protected boolean canSurvive(final BlockState state, final LevelReader level, final BlockPos pos) { ++ BlockState soil = level.getBlockState(pos.below()); ++ if (soil.canSustainPlant(level, pos.below(), Direction.UP, this)) return true; + BlockState stateBelow = level.getBlockState(pos.below()); + if (stateBelow.is(this)) { return true; -@@ -97,7 +_,7 @@ - for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockState blockstate1 = p_57176_.getBlockState(blockpos.relative(direction)); - FluidState fluidstate = p_57176_.getFluidState(blockpos.relative(direction)); -- if (fluidstate.is(FluidTags.WATER) || blockstate1.is(Blocks.FROSTED_ICE)) { -+ if (p_57175_.canBeHydrated(p_57176_, p_57177_, fluidstate, blockpos.relative(direction)) || blockstate1.is(Blocks.FROSTED_ICE)) { - return true; - } +@@ -98,7 +_,7 @@ + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockState blockState = level.getBlockState(below.relative(direction)); + FluidState fluidState = level.getFluidState(below.relative(direction)); +- if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY)) { ++ if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || state.canBeHydrated(level, pos, fluidState, below.relative(direction))) { + return true; } + } @@ -110,5 +_,15 @@ @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_57186_) { - p_57186_.add(AGE); + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + builder.add(AGE); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch index 7a53fe205a..1319def1dc 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java @@ -71,10 +_,11 @@ @Override - protected void randomTick(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { - int i = p_222563_.getValue(AGE); -- if (i < 3 && p_222566_.nextInt(5) == 0 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9) { -+ if (i < 3 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222564_, p_222565_, p_222563_, p_222566_.nextInt(5) == 0)) { - BlockState blockstate = p_222563_.setValue(AGE, i + 1); - p_222564_.setBlock(p_222565_, blockstate, 2); - p_222564_.gameEvent(GameEvent.BLOCK_CHANGE, p_222565_, GameEvent.Context.of(blockstate)); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_222564_, p_222565_, p_222563_); + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + int age = state.getValue(AGE); +- if (age < 3 && random.nextInt(5) == 0 && level.getRawBrightness(pos.above(), 0) >= 9) { ++ if (age < 3 && level.getRawBrightness(pos.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(level, pos, state, random.nextInt(5) == 0)) { + BlockState newState = state.setValue(AGE, age + 1); + level.setBlock(pos, newState, 2); + level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(newState)); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(level, pos, state); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/TallGrassBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TallGrassBlock.java.patch deleted file mode 100644 index ae8704af63..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/TallGrassBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/TallGrassBlock.java -+++ b/net/minecraft/world/level/block/TallGrassBlock.java -@@ -12,7 +_,7 @@ - import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.VoxelShape; - --public class TallGrassBlock extends VegetationBlock implements BonemealableBlock { -+public class TallGrassBlock extends VegetationBlock implements BonemealableBlock, net.minecraftforge.common.IForgeShearable { - public static final MapCodec CODEC = simpleCodec(TallGrassBlock::new); - private static final VoxelShape SHAPE = Block.column(12.0, 0.0, 13.0); - 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 63964f8641..5536967c13 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch @@ -2,69 +2,69 @@ +++ b/net/minecraft/world/level/block/TntBlock.java @@ -47,7 +_,7 @@ @Override - protected void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { - if (!p_57469_.is(p_57466_.getBlock())) { -- if (p_57467_.hasNeighborSignal(p_57468_) && prime(p_57467_, p_57468_)) { -+ if (p_57467_.hasNeighborSignal(p_57468_) && onCaughtFire(p_57466_, p_57467_, p_57468_, null, null)) { - p_57467_.removeBlock(p_57468_, false); + protected void onPlace(final BlockState state, final Level level, final BlockPos pos, final BlockState oldState, final boolean movedByPiston) { + if (!oldState.is(state.getBlock())) { +- if (level.hasNeighborSignal(pos) && prime(level, pos)) { ++ if (level.hasNeighborSignal(pos) && onCaughtFire(state, level, pos, null, null)) { + level.removeBlock(pos, false); } } -@@ -55,7 +_,7 @@ - - @Override - protected void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, @Nullable Orientation p_362896_, boolean p_57462_) { -- if (p_57458_.hasNeighborSignal(p_57459_) && prime(p_57458_, p_57459_)) { -+ if (p_57458_.hasNeighborSignal(p_57459_) && onCaughtFire(p_57457_, p_57458_, p_57459_, null, null)) { - p_57458_.removeBlock(p_57459_, false); +@@ -57,7 +_,7 @@ + protected void neighborChanged( + final BlockState state, final Level level, final BlockPos pos, final Block block, final @Nullable Orientation orientation, final boolean movedByPiston + ) { +- if (level.hasNeighborSignal(pos) && prime(level, pos)) { ++ if (level.hasNeighborSignal(pos) && onCaughtFire(state, level, pos, null, null)) { + level.removeBlock(pos, false); } } -@@ -63,7 +_,7 @@ +@@ -65,7 +_,7 @@ @Override - public BlockState playerWillDestroy(Level p_57445_, BlockPos p_57446_, BlockState p_57447_, Player p_57448_) { - if (!p_57445_.isClientSide() && !p_57448_.getAbilities().instabuild && p_57447_.getValue(UNSTABLE)) { -- prime(p_57445_, p_57446_); -+ onCaughtFire(p_57447_, p_57445_, p_57446_, null, null); + public BlockState playerWillDestroy(final Level level, final BlockPos pos, final BlockState state, final Player player) { + if (!level.isClientSide() && !player.getAbilities().instabuild && state.getValue(UNSTABLE)) { +- prime(level, pos); ++ onCaughtFire(state, level, pos, null, null); } - return super.playerWillDestroy(p_57445_, p_57446_, p_57447_, p_57448_); -@@ -79,10 +_,12 @@ + return super.playerWillDestroy(level, pos, state, player); +@@ -80,10 +_,12 @@ } } + @Deprecated //Forge: Prefer using IForgeBlock#onCaughtFire - public static boolean prime(Level p_392759_, BlockPos p_392607_) { - return prime(p_392759_, p_392607_, null); + public static boolean prime(final Level level, final BlockPos pos) { + return prime(level, pos, null); } + @Deprecated //Forge: Prefer using IForgeBlock#onCaughtFire - private static boolean prime(Level p_396831_, BlockPos p_393566_, @Nullable LivingEntity p_395667_) { - if (p_396831_ instanceof ServerLevel serverlevel && serverlevel.getGameRules().get(GameRules.TNT_EXPLODES)) { - PrimedTnt primedtnt = new PrimedTnt(p_396831_, p_393566_.getX() + 0.5, p_393566_.getY(), p_393566_.getZ() + 0.5, p_395667_); -@@ -102,7 +_,7 @@ - if (!p_329029_.is(Items.FLINT_AND_STEEL) && !p_329029_.is(Items.FIRE_CHARGE)) { - return super.useItemOn(p_329029_, p_331413_, p_329038_, p_333168_, p_335932_, p_331663_, p_330020_); - } else { -- if (prime(p_329038_, p_333168_, p_335932_)) { -+ if (onCaughtFire(p_331413_, p_329038_, p_333168_, p_330020_.getDirection(), p_335932_)) { - p_329038_.setBlock(p_333168_, Blocks.AIR.defaultBlockState(), 11); - Item item = p_329029_.getItem(); - if (p_329029_.is(Items.FLINT_AND_STEEL)) { -@@ -128,7 +_,7 @@ - Entity entity = p_57432_.getOwner(); - if (p_57432_.isOnFire() - && p_57432_.mayInteract(serverlevel, blockpos) -- && prime(p_57429_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null)) { -+ && onCaughtFire(p_57430_, p_57429_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null)) { - p_57429_.removeBlock(blockpos, false); + private static boolean prime(final Level level, final BlockPos pos, final @Nullable LivingEntity source) { + if (level instanceof ServerLevel serverLevel && serverLevel.getGameRules().get(GameRules.TNT_EXPLODES)) { + PrimedTnt tnt = new PrimedTnt(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, source); +@@ -110,7 +_,7 @@ + return super.useItemOn(itemStack, state, level, pos, player, hand, hitResult); + } + +- if (prime(level, pos, player)) { ++ if (onCaughtFire(state, level, pos, hitResult.getDirection(), player)) { + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); + Item item = itemStack.getItem(); + if (itemStack.is(Items.FLINT_AND_STEEL)) { +@@ -135,7 +_,7 @@ + Entity owner = projectile.getOwner(); + if (projectile.isOnFire() + && projectile.mayInteract(serverLevel, pos) +- && prime(level, pos, owner instanceof LivingEntity livingEntity ? livingEntity : null)) { ++ && onCaughtFire(state, level, pos, null, owner instanceof LivingEntity livingEntity ? livingEntity : null)) { + level.removeBlock(pos, false); } } -@@ -142,5 +_,9 @@ +@@ -149,5 +_,9 @@ @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_57464_) { - p_57464_.add(UNSTABLE); + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + builder.add(UNSTABLE); + } + -+ public boolean onCaughtFire(BlockState state, Level level, BlockPos pos, net.minecraft.core.@Nullable Direction face, @Nullable LivingEntity igniter) { ++ public boolean onCaughtFire(final BlockState state, final Level level, final BlockPos pos, final net.minecraft.core.@Nullable Direction face, final @Nullable LivingEntity igniter) { + return prime(level, pos, igniter); } } 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 4b74bd3eb0..14dbaea906 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 -@@ -199,4 +_,14 @@ +@@ -192,4 +_,14 @@ protected BlockSetType getType() { return this.type; } diff --git a/patches/minecraft/net/minecraft/world/level/block/TripWireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TripWireBlock.java.patch index 2c92f09ff9..6a3705dd27 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TripWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TripWireBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/TripWireBlock.java +++ b/net/minecraft/world/level/block/TripWireBlock.java -@@ -115,7 +_,7 @@ +@@ -113,7 +_,7 @@ @Override - public BlockState playerWillDestroy(Level p_57615_, BlockPos p_57616_, BlockState p_57617_, Player p_57618_) { -- if (!p_57615_.isClientSide() && !p_57618_.getMainHandItem().isEmpty() && p_57618_.getMainHandItem().is(Items.SHEARS)) { -+ if (!p_57615_.isClientSide() && !p_57618_.getMainHandItem().isEmpty() && p_57618_.getMainHandItem().canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_DISARM)) { - p_57615_.setBlock(p_57616_, p_57617_.setValue(DISARMED, true), 260); - p_57615_.gameEvent(p_57618_, GameEvent.SHEAR, p_57616_); + public BlockState playerWillDestroy(final Level level, final BlockPos pos, final BlockState state, final Player player) { +- if (!level.isClientSide() && !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) { ++ if (!level.isClientSide() && !player.getMainHandItem().isEmpty() && player.getMainHandItem().canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_DISARM)) { + level.setBlock(pos, state.setValue(DISARMED, true), 260); + level.gameEvent(player, GameEvent.SHEAR, pos); } diff --git a/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch index cb2efac4ce..df863bdede 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/net/minecraft/world/level/block/TurtleEggBlock.java -@@ -171,7 +_,7 @@ - if (p_57769_ instanceof Turtle || p_57769_ instanceof Bat) { +@@ -178,7 +_,7 @@ + if (entity instanceof Turtle || entity instanceof Bat) { return false; } else { -- return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || p_366354_.getGameRules().get(GameRules.MOB_GRIEFING); -+ return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_366354_, p_57769_); +- return !(entity instanceof LivingEntity) ? false : entity instanceof Player || level.getGameRules().get(GameRules.MOB_GRIEFING); ++ return !(entity instanceof LivingEntity) ? false : entity instanceof Player || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, entity); } } } diff --git a/patches/minecraft/net/minecraft/world/level/block/VegetationBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/VegetationBlock.java.patch index 9bc1678f90..07acf2acd8 100644 --- a/patches/minecraft/net/minecraft/world/level/block/VegetationBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/VegetationBlock.java.patch @@ -6,32 +6,32 @@ -public abstract class VegetationBlock extends Block { +public abstract class VegetationBlock extends Block implements net.minecraftforge.common.IPlantable { - protected VegetationBlock(BlockBehaviour.Properties p_395394_) { - super(p_395394_); + protected VegetationBlock(final BlockBehaviour.Properties properties) { + super(properties); } @@ -21,7 +_,7 @@ protected abstract MapCodec codec(); - protected boolean mayPlaceOn(BlockState p_395950_, BlockGetter p_394817_, BlockPos p_393668_) { -- return p_395950_.is(BlockTags.DIRT) || p_395950_.is(Blocks.FARMLAND); -+ return p_395950_.is(BlockTags.DIRT) || p_395950_.getBlock() instanceof net.minecraft.world.level.block.FarmBlock; + protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) { +- return state.is(BlockTags.SUPPORTS_VEGETATION); ++ return state.is(BlockTags.SUPPORTS_VEGETATION) || state.getBlock() instanceof FarmlandBlock; } @Override @@ -43,6 +_,9 @@ @Override - protected boolean canSurvive(BlockState p_397664_, LevelReader p_395119_, BlockPos p_393561_) { - BlockPos blockpos = p_393561_.below(); -+ if (p_397664_.getBlock() == this) { //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ return p_395119_.getBlockState(blockpos).canSustainPlant(p_395119_, blockpos, Direction.UP, this); + protected boolean canSurvive(final BlockState state, final LevelReader level, final BlockPos pos) { + BlockPos below = pos.below(); ++ if (state.getBlock() == this) { //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ return level.getBlockState(below).canSustainPlant(level, below, Direction.UP, this); + } - return this.mayPlaceOn(p_395119_.getBlockState(blockpos), p_395119_, blockpos); + return this.mayPlaceOn(level.getBlockState(below), level, below); } @@ -54,5 +_,11 @@ @Override - protected boolean isPathfindable(BlockState p_392416_, PathComputationType p_395772_) { - return p_395772_ == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(p_392416_, p_395772_); + protected boolean isPathfindable(final BlockState state, final PathComputationType type) { + return type == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(state, type); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch index 87477d0b46..c9fe2eac9c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch @@ -1,20 +1,11 @@ --- a/net/minecraft/world/level/block/VineBlock.java +++ b/net/minecraft/world/level/block/VineBlock.java -@@ -23,7 +_,7 @@ - import net.minecraft.world.phys.shapes.VoxelShape; - import org.jspecify.annotations.Nullable; - --public class VineBlock extends Block { -+public class VineBlock extends Block implements net.minecraftforge.common.IForgeShearable { - public static final MapCodec CODEC = simpleCodec(VineBlock::new); - public static final BooleanProperty UP = PipeBlock.UP; - public static final BooleanProperty NORTH = PipeBlock.NORTH; -@@ -172,7 +_,7 @@ +@@ -168,7 +_,7 @@ @Override - protected void randomTick(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { - if (p_222656_.getGameRules().get(GameRules.SPREAD_VINES)) { -- if (p_222658_.nextInt(4) == 0) { -+ if (p_222656_.random.nextInt(4) == 0 && p_222656_.isAreaLoaded(p_222657_, 4)) { // Forge: check area to prevent loading unloaded chunks - Direction direction = Direction.getRandom(p_222658_); - BlockPos blockpos = p_222657_.above(); - if (direction.getAxis().isHorizontal() && !p_222655_.getValue(getPropertyForFace(direction))) { + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + if (level.getGameRules().get(GameRules.SPREAD_VINES)) { +- if (random.nextInt(4) == 0) { ++ if (random.nextInt(4) == 0 && level.isAreaLoaded(pos, 4)) { // Forge: check area to prevent loading unloaded chunks + Direction testDirection = Direction.getRandom(random); + BlockPos abovePos = pos.above(); + if (testDirection.getAxis().isHorizontal() && !state.getValue(getPropertyForFace(testDirection))) { diff --git a/patches/minecraft/net/minecraft/world/level/block/WebBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/WebBlock.java.patch deleted file mode 100644 index dd6b57ba4c..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/WebBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/WebBlock.java -+++ b/net/minecraft/world/level/block/WebBlock.java -@@ -11,7 +_,7 @@ - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.phys.Vec3; - --public class WebBlock extends Block { -+public class WebBlock extends Block implements net.minecraftforge.common.IForgeShearable { - public static final MapCodec CODEC = simpleCodec(WebBlock::new); - - @Override 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 47d1fe2db8..e82a4b0746 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 @@ -1,129 +1,110 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -58,6 +_,7 @@ +@@ -57,6 +_,7 @@ private static final short DEFAULT_COOKING_TOTAL_TIME = 0; private static final short DEFAULT_LIT_TIME_REMAINING = 0; private static final short DEFAULT_LIT_TOTAL_TIME = 0; + private final RecipeType recipeType; protected NonNullList items = NonNullList.withSize(3, ItemStack.EMPTY); - int litTimeRemaining; - int litTotalTime; -@@ -110,6 +_,7 @@ + private int litTimeRemaining; + private int litTotalTime; +@@ -109,6 +_,7 @@ ) { - super(p_154991_, p_154992_, p_154993_); - this.quickCheck = RecipeManager.createCheck((RecipeType)p_154994_); -+ this.recipeType = p_154994_; + super(type, worldPosition, blockState); + this.quickCheck = RecipeManager.createCheck(recipeType); ++ this.recipeType = recipeType; } - private boolean isLit() { -@@ -121,10 +_,10 @@ - super.loadAdditional(p_405853_); - this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); - ContainerHelper.loadAllItems(p_405853_, this.items); -- this.cookingTimer = p_405853_.getShortOr("cooking_time_spent", (short)0); -- this.cookingTotalTime = p_405853_.getShortOr("cooking_total_time", (short)0); -- this.litTimeRemaining = p_405853_.getShortOr("lit_time_remaining", (short)0); -- this.litTotalTime = p_405853_.getShortOr("lit_total_time", (short)0); -+ this.cookingTimer = p_405853_.getIntOr("cooking_time_spent", (short)0); -+ this.cookingTotalTime = p_405853_.getIntOr("cooking_total_time", (short)0); -+ this.litTimeRemaining = p_405853_.getIntOr("lit_time_remaining", (short)0); -+ this.litTotalTime = p_405853_.getIntOr("lit_total_time", (short)0); - this.recipesUsed.clear(); - this.recipesUsed.putAll(p_405853_.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of())); - } -@@ -132,10 +_,10 @@ @Override - protected void saveAdditional(ValueOutput p_406502_) { - super.saveAdditional(p_406502_); -- p_406502_.putShort("cooking_time_spent", (short)this.cookingTimer); -- p_406502_.putShort("cooking_total_time", (short)this.cookingTotalTime); -- p_406502_.putShort("lit_time_remaining", (short)this.litTimeRemaining); -- p_406502_.putShort("lit_total_time", (short)this.litTotalTime); -+ p_406502_.putInt("cooking_time_spent", this.cookingTimer); -+ p_406502_.putInt("cooking_total_time", this.cookingTotalTime); -+ p_406502_.putInt("lit_time_remaining", this.litTimeRemaining); -+ p_406502_.putInt("lit_total_time", this.litTotalTime); - ContainerHelper.saveAllItems(p_406502_, this.items); - p_406502_.store("RecipesUsed", RECIPES_USED_CODEC, this.recipesUsed); +@@ -116,10 +_,10 @@ + super.loadAdditional(input); + this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + ContainerHelper.loadAllItems(input, this.items); +- this.cookingTimer = input.getShortOr("cooking_time_spent", (short)0); +- this.cookingTotalTime = input.getShortOr("cooking_total_time", (short)0); +- this.litTimeRemaining = input.getShortOr("lit_time_remaining", (short)0); +- this.litTotalTime = input.getShortOr("lit_total_time", (short)0); ++ this.cookingTimer = input.getIntOr("cooking_time_spent", (short)0); ++ this.cookingTotalTime = input.getIntOr("cooking_total_time", (short)0); ++ this.litTimeRemaining = input.getIntOr("lit_time_remaining", (short)0); ++ this.litTotalTime = input.getIntOr("lit_total_time", (short)0); + this.recipesUsed.clear(); + this.recipesUsed.putAll(input.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of())); } -@@ -161,27 +_,31 @@ - } - - int i = p_155017_.getMaxStackSize(); -- if (!p_155017_.isLit() && canBurn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { -+ if (!p_155017_.isLit() && p_155017_.canBurn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { - p_155017_.litTimeRemaining = p_155017_.getBurnDuration(p_364207_.fuelValues(), itemstack); - p_155017_.litTotalTime = p_155017_.litTimeRemaining; - if (p_155017_.isLit()) { - flag1 = true; -+ var remainder = itemstack.getCraftingRemainder(); -+ if (!remainder.isEmpty()) { -+ p_155017_.items.set(1, remainder); -+ } else - if (flag3) { - Item item = itemstack.getItem(); - itemstack.shrink(1); - if (itemstack.isEmpty()) { -- p_155017_.items.set(1, item.getCraftingRemainder()); -+ p_155017_.items.set(1, remainder); - } - } - } - } - -- if (p_155017_.isLit() && canBurn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { -+ if (p_155017_.isLit() && p_155017_.canBurn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { - p_155017_.cookingTimer++; - if (p_155017_.cookingTimer == p_155017_.cookingTotalTime) { - p_155017_.cookingTimer = 0; - p_155017_.cookingTotalTime = getTotalCookTime(p_364207_, p_155017_); -- if (burn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { -+ if (p_155017_.burn(p_364207_.registryAccess(), recipeholder, singlerecipeinput, p_155017_.items, i)) { - p_155017_.setRecipeUsed(recipeholder); - } - -@@ -205,7 +_,7 @@ +@@ -127,10 +_,10 @@ + @Override + protected void saveAdditional(final ValueOutput output) { + super.saveAdditional(output); +- output.putShort("cooking_time_spent", (short)this.cookingTimer); +- output.putShort("cooking_total_time", (short)this.cookingTotalTime); +- output.putShort("lit_time_remaining", (short)this.litTimeRemaining); +- output.putShort("lit_total_time", (short)this.litTotalTime); ++ output.putInt("cooking_time_spent", this.cookingTimer); ++ output.putInt("cooking_total_time", this.cookingTotalTime); ++ output.putInt("lit_time_remaining", this.litTimeRemaining); ++ output.putInt("lit_total_time", this.litTotalTime); + ContainerHelper.saveAllItems(output, this.items); + output.store("RecipesUsed", RECIPES_USED_CODEC, this.recipesUsed); + } +@@ -159,13 +_,13 @@ + if (recipe != null) { + int maxStackSize = entity.getMaxStackSize(); + ItemStack burnResult = recipe.value().assemble(input); +- if (!burnResult.isEmpty() && canBurn(entity.items, maxStackSize, burnResult)) { ++ if (!burnResult.isEmpty() && entity.canBurn(entity.items, maxStackSize, burnResult)) { + if (!isLit) { + int newLitTime = entity.getBurnDuration(level.fuelValues(), fuel); + entity.litTimeRemaining = newLitTime; + entity.litTotalTime = newLitTime; + if (newLitTime > 0) { +- consumeFuel(entity.items, fuel); ++ entity.consumeFuel(entity.items, fuel); + isLit = true; + changed = true; + } +@@ -176,7 +_,7 @@ + if (entity.cookingTimer == entity.cookingTotalTime) { + entity.cookingTimer = 0; + entity.cookingTotalTime = recipe.value().cookingTime(); +- burn(entity.items, ingredient, burnResult); ++ entity.burn(entity.items, ingredient, burnResult); + entity.setRecipeUsed(recipe); + changed = true; + } +@@ -205,16 +_,16 @@ } } -- private static boolean canBurn( -+ private boolean canBurn( - RegistryAccess p_266924_, - @Nullable RecipeHolder p_299207_, - SingleRecipeInput p_364069_, -@@ -223,9 +_,9 @@ - } else if (!ItemStack.isSameItemSameComponents(itemstack1, itemstack)) { - return false; - } else { -- return itemstack1.getCount() < p_155008_ && itemstack1.getCount() < itemstack1.getMaxStackSize() -+ return (itemstack1.getCount() + itemstack.getCount() <= p_155008_ && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize()) // Forge fix: make furnace respect stack sizes in furnace recipes - ? true -- : itemstack1.getCount() < itemstack.getMaxStackSize(); -+ : itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes - } - } - } else { -@@ -233,7 +_,7 @@ +- private static void consumeFuel(final NonNullList items, final ItemStack fuel) { ++ protected void consumeFuel(final NonNullList items, final ItemStack fuel) { + Item fuelItem = fuel.getItem(); +- fuel.shrink(1); +- if (fuel.isEmpty()) { +- ItemStackTemplate remainder = fuelItem.getCraftingRemainder(); ++ if (fuel.count() == 1) { ++ ItemStackTemplate remainder = fuel.getCraftingRemainder(); + items.set(1, remainder != null ? remainder.create() : ItemStack.EMPTY); } ++ fuel.shrink(1); } -- private static boolean burn( -+ private boolean burn( - RegistryAccess p_266740_, - @Nullable RecipeHolder p_299450_, - SingleRecipeInput p_364092_, -@@ -247,7 +_,7 @@ - if (itemstack2.isEmpty()) { - p_267073_.set(2, itemstack1.copy()); - } else if (ItemStack.isSameItemSameComponents(itemstack2, itemstack1)) { -- itemstack2.grow(1); -+ itemstack2.grow(itemstack1.getCount()); - } +- private static boolean canBurn(final NonNullList items, final int maxStackSize, final ItemStack burnResult) { ++ protected boolean canBurn(final NonNullList items, final int maxStackSize, final ItemStack burnResult) { + ItemStack resultItemStack = items.get(2); + if (resultItemStack.isEmpty()) { + return true; +@@ -229,7 +_,7 @@ + return resultCount <= maxResultCount; + } - if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !p_267073_.get(1).isEmpty() && p_267073_.get(1).is(Items.BUCKET)) { -@@ -385,6 +_,35 @@ - for (ItemStack itemstack : this.items) { - p_363325_.accountStack(itemstack); +- private static void burn(final NonNullList items, final ItemStack inputItemStack, final ItemStack result) { ++ protected void burn(final NonNullList items, final ItemStack inputItemStack, final ItemStack result) { + ItemStack resultItemStack = items.get(2); + if (resultItemStack.isEmpty()) { + items.set(2, result.copy()); +@@ -370,6 +_,35 @@ + for (ItemStack itemStack : this.items) { + contents.accountStack(itemStack); } + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch index f302f8ba12..a0b2d6e1d1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java @@ -170,4 +_,27 @@ - p_407613_.discard("lock"); - p_407613_.discard("Items"); + output.discard("lock"); + output.discard("Items"); } + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> createUnSidedHandler()); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index 8687f0cde2..cab4941038 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -135,8 +_,8 @@ +@@ -138,8 +_,8 @@ - for (int i1 = 0; i1 < 10 && blockpos.getY() <= l; i1++) { - BlockState blockstate = p_155108_.getBlockState(blockpos); -- if (blockstate.getBlock() instanceof BeaconBeamBlock beaconbeamblock) { -- int j1 = beaconbeamblock.getColor().getTextureDiffuseColor(); -+ int j1 = blockstate.getBeaconColorMultiplier(p_155108_, blockpos, p_155109_); -+ if (j1 != -1) { - if (p_155111_.checkingBeamSections.size() <= 1) { - beaconbeamowner$section = new BeaconBeamOwner.Section(j1); - p_155111_.checkingBeamSections.add(beaconbeamowner$section); + for (int i = 0; i < 10 && checkPos.getY() <= lastSetBlock; i++) { + BlockState state = level.getBlockState(checkPos); +- if (state.getBlock() instanceof BeaconBeamBlock beaconBeamBlock) { +- int color = beaconBeamBlock.getColor().getTextureDiffuseColor(); ++ int color = state.getBeaconColorMultiplier(level, checkPos, pos); ++ if (color != -1) { + if (entity.checkingBeamSections.size() <= 1) { + lastBeamSection = new BeaconBeamOwner.Section(color); + entity.checkingBeamSections.add(lastBeamSection); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch index 44c7795464..688d43d928 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -1,53 +1,48 @@ --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -36,7 +_,7 @@ +@@ -38,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; --public abstract class BlockEntity implements DebugValueSource { -+public abstract class BlockEntity extends net.minecraftforge.common.capabilities.CapabilityProvider.BlockEntities implements DebugValueSource, net.minecraftforge.common.extensions.IForgeBlockEntity { +-public abstract class BlockEntity implements DebugValueSource, TypedInstance> { ++public abstract class BlockEntity extends net.minecraftforge.common.capabilities.CapabilityProvider.BlockEntities implements DebugValueSource, TypedInstance>, net.minecraftforge.common.extensions.IForgeBlockEntity { private static final Codec> TYPE_CODEC = BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec(); private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; -@@ -47,10 +_,12 @@ - private DataComponentMap components = DataComponentMap.EMPTY; - - public BlockEntity(BlockEntityType p_155228_, BlockPos p_155229_, BlockState p_155230_) { -+ super(); - this.type = p_155228_; - this.worldPosition = p_155229_.immutable(); - this.validateBlockState(p_155230_); - this.blockState = p_155230_; +@@ -53,6 +_,7 @@ + this.worldPosition = worldPosition.immutable(); + this.validateBlockState(blockState); + this.blockState = blockState; + this.gatherCapabilities(); } - private void validateBlockState(BlockState p_345558_) { -@@ -60,7 +_,7 @@ + private void validateBlockState(final BlockState blockState) { +@@ -62,7 +_,7 @@ } - public boolean isValidBlockState(BlockState p_345570_) { -- return this.type.isValid(p_345570_); -+ return this.getType().isValid(p_345570_); + public boolean isValidBlockState(final BlockState blockState) { +- return this.type.isValid(blockState); ++ return this.getType().isValid(blockState); } - public static BlockPos getPosFromTag(ChunkPos p_396083_, CompoundTag p_187473_) { -@@ -91,6 +_,7 @@ + public static BlockPos getPosFromTag(final ChunkPos base, final CompoundTag entityTag) { +@@ -93,6 +_,7 @@ } - protected void loadAdditional(ValueInput p_409136_) { -+ if (getCapabilities() != null) p_409136_.read("ForgeCaps", CompoundTag.CODEC).ifPresent(caps -> deserializeCaps(p_409136_.lookup(), caps)); + protected void loadAdditional(final ValueInput input) { ++ if (getCapabilities() != null) input.read("ForgeCaps", CompoundTag.CODEC).ifPresent(caps -> deserializeCaps(input.lookup(), caps)); } - public final void loadWithComponents(ValueInput p_409893_) { -@@ -103,6 +_,7 @@ + public final void loadWithComponents(final ValueInput input) { +@@ -105,6 +_,7 @@ } - protected void saveAdditional(ValueOutput p_407573_) { -+ if (getCapabilities() != null) p_407573_.storeNullable("ForgeCaps", CompoundTag.CODEC, serializeCaps(this.level.registryAccess())); + protected void saveAdditional(final ValueOutput output) { ++ if (getCapabilities() != null) output.storeNullable("ForgeCaps", CompoundTag.CODEC, serializeCaps(output)); } - public final CompoundTag saveWithFullMetadata(HolderLookup.Provider p_331193_) { -@@ -236,6 +_,13 @@ + public final CompoundTag saveWithFullMetadata(final HolderLookup.Provider registries) { +@@ -224,6 +_,13 @@ public void setRemoved() { this.remove = true; diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index 7bddbf19eb..7bc20415f3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,40 +1,31 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -174,15 +_,18 @@ - for (int i = 0; i < 3; i++) { - p_155293_.set(i, potionbrewing.mix(itemstack, p_155293_.get(i))); +@@ -177,9 +_,10 @@ + for (int dest = 0; dest < 3; dest++) { + items.set(dest, potionBrewing.mix(ingredient, items.get(dest))); } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(p_155293_); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(items); -- itemstack.shrink(1); -- ItemStack itemstack1 = itemstack.getItem().getCraftingRemainder(); -+ ItemStack itemstack1 = itemstack.getCraftingRemainder(); - if (!itemstack1.isEmpty()) { -+ itemstack.shrink(1); - if (itemstack.isEmpty()) { - itemstack = itemstack1; - } else { - Containers.dropItemStack(p_155291_, p_155292_.getX(), p_155292_.getY(), p_155292_.getZ(), itemstack1); - } -+ } else { -+ itemstack.shrink(1); - } - - p_155293_.set(3, itemstack); -@@ -215,6 +_,9 @@ - if (p_59017_ == 3) { - PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; - return potionbrewing.isIngredient(p_59018_); -+ } else if (p_59017_ != 4) { ++ ItemStackTemplate remainder = ingredient.getCraftingRemainder(); + ingredient.shrink(1); +- ItemStackTemplate remainder = ingredient.getItem().getCraftingRemainder(); + if (remainder != null) { + if (ingredient.isEmpty()) { + ingredient = remainder.create(); +@@ -218,6 +_,9 @@ + if (slot == 3) { + PotionBrewing potionBrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; + return potionBrewing.isIngredient(itemStack); ++ } else if (slot != 4) { + PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; -+ return this.getItem(p_59017_).isEmpty() && potionbrewing.isValidInput(p_59018_); ++ return this.getItem(slot).isEmpty() && potionbrewing.isValidInput(itemStack); } else { - return p_59017_ == 4 - ? p_59018_.is(ItemTags.BREWING_FUEL) -@@ -250,5 +_,34 @@ + return slot == 4 + ? itemStack.is(ItemTags.BREWING_FUEL) +@@ -248,5 +_,34 @@ @Override - protected AbstractContainerMenu createMenu(int p_58990_, Inventory p_58991_) { - return new BrewingStandMenu(p_58990_, p_58991_, this, this.dataAccess); + protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) { + return new BrewingStandMenu(containerId, inventory, this, this.dataAccess); + } + + net.minecraftforge.common.util.LazyOptional[] handlers = diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index 43631d1675..248134efc3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -194,4 +_,43 @@ - Block block = p_155335_.getBlock(); - p_155333_.blockEvent(p_155334_, block, 1, p_155337_); +@@ -192,4 +_,43 @@ + Block block = blockState.getBlock(); + level.blockEvent(pos, block, 1, current); } + + private net.minecraftforge.common.util.LazyOptional chestHandler; diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch index b23a9cf71f..9d1dca33bf 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java @@ -135,4 +_,28 @@ - public void removeComponentsFromTag(ValueOutput p_405909_) { - p_405909_.discard("Items"); + public void removeComponentsFromTag(final ValueOutput output) { + output.discard("Items"); } + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(this::createUnSidedHandler); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index 97e6cf97fb..9bae0e2987 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java -@@ -148,8 +_,8 @@ - BlockPos blockpos1 = p_155416_.offset(j1, k1, l1); - BlockState blockstate = p_155415_.getBlockState(blockpos1); +@@ -150,8 +_,8 @@ + BlockPos testPos = worldPosition.offset(ox, oy, oz); + BlockState testBlock = level.getBlockState(testPos); -- for (Block block : VALID_BLOCKS) { -- if (blockstate.is(block)) { +- for (Block type : VALID_BLOCKS) { +- if (testBlock.is(type)) { + { -+ if (blockstate.isConduitFrame(p_155415_, blockpos1, p_155416_)) { - p_155417_.add(blockpos1); ++ if (testBlock.isConduitFrame(level, testPos, worldPosition)) { + effectBlocks.add(testPos); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/FuelValues.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/FuelValues.java.patch index 27435798a9..405f8ffafc 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/FuelValues.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/FuelValues.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/entity/FuelValues.java +++ b/net/minecraft/world/level/block/entity/FuelValues.java -@@ -25,7 +_,11 @@ +@@ -24,7 +_,11 @@ } - public boolean isFuel(ItemStack p_369912_) { -- return this.values.containsKey(p_369912_.getItem()); -+ return isFuel(p_369912_, null); + public boolean isFuel(final ItemStack itemStack) { +- return this.values.containsKey(itemStack.getItem()); ++ return isFuel(itemStack, null); + } + + public boolean isFuel(ItemStack stack, @org.jetbrains.annotations.Nullable net.minecraft.world.item.crafting.RecipeType type) { @@ -13,21 +13,21 @@ } public SequencedSet fuelItems() { -@@ -33,7 +_,16 @@ +@@ -32,7 +_,16 @@ } - public int burnDuration(ItemStack p_368393_) { -- return p_368393_.isEmpty() ? 0 : this.values.getInt(p_368393_.getItem()); -+ return burnDuration(p_368393_, null); + public int burnDuration(final ItemStack itemStack) { +- return itemStack.isEmpty() ? 0 : this.values.getInt(itemStack.getItem()); ++ return burnDuration(itemStack, null); + } + -+ public int burnDuration(ItemStack stack, @org.jetbrains.annotations.Nullable net.minecraft.world.item.crafting.RecipeType type) { -+ if (stack.isEmpty()) ++ public int burnDuration(final ItemStack itemStack, final @org.jetbrains.annotations.Nullable net.minecraft.world.item.crafting.RecipeType type) { ++ if (itemStack.isEmpty()) + return 0; -+ int ret = stack.getBurnTime(type); ++ int ret = itemStack.getBurnTime(type); + if (ret == -1) -+ ret = this.values.getInt(stack.getItem()); -+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack, ret, type); ++ ret = this.values.getInt(itemStack.getItem()); ++ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(itemStack, ret, type); } - public static FuelValues vanillaBurnTimes(HolderLookup.Provider p_363816_, FeatureFlagSet p_367705_) { + public static FuelValues vanillaBurnTimes(final HolderLookup.Provider registries, final FeatureFlagSet enabledFeatures) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch index a8b66f875e..7a66fc7704 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java @@ -13,6 +_,10 @@ - super(BlockEntityType.HANGING_SIGN, p_250603_, p_251674_); + super(BlockEntityTypes.HANGING_SIGN, worldPosition, blockState); } -+ public HangingSignBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { ++ public HangingSignBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + 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 36a3dfd7ec..1854dd3606 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 @@ -1,26 +1,26 @@ --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -139,6 +_,7 @@ +@@ -141,6 +_,7 @@ } - private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, HopperBlockEntity p_329427_) { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(p_329427_)) return true; - Container container = getAttachedContainer(p_155563_, p_155564_, p_329427_); + private static boolean ejectItems(final Level level, final BlockPos blockPos, final HopperBlockEntity self) { ++ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(self)) return true; + Container container = getAttachedContainer(level, blockPos, self); if (container == null) { return false; -@@ -214,6 +_,8 @@ +@@ -216,6 +_,8 @@ } - public static boolean suckInItems(Level p_155553_, Hopper p_155554_) { -+ Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_155553_, p_155554_); + public static boolean suckInItems(final Level level, final Hopper hopper) { ++ Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(level, hopper); + if (ret != null) return ret; - BlockPos blockpos = BlockPos.containing(p_155554_.getLevelX(), p_155554_.getLevelY() + 1.0, p_155554_.getLevelZ()); - BlockState blockstate = p_155553_.getBlockState(blockpos); - Container container = getSourceContainer(p_155553_, p_155554_, blockpos, blockstate); -@@ -446,5 +_,14 @@ + BlockPos blockPos = BlockPos.containing(hopper.getLevelX(), hopper.getLevelY() + 1.0, hopper.getLevelZ()); + BlockState blockState = level.getBlockState(blockPos); + Container container = getSourceContainer(level, hopper, blockPos, blockState); +@@ -454,5 +_,14 @@ @Override - protected AbstractContainerMenu createMenu(int p_59312_, Inventory p_59313_) { - return new HopperMenu(p_59312_, p_59313_, this); + protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) { + return new HopperMenu(containerId, inventory, this); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch index 5777676d36..e1909e1b8b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -@@ -234,7 +_,7 @@ +@@ -240,7 +_,7 @@ @Override - public boolean canPlaceItemThroughFace(int p_59663_, ItemStack p_59664_, @Nullable Direction p_59665_) { -- return !(Block.byItem(p_59664_.getItem()) instanceof ShulkerBoxBlock); -+ return !(Block.byItem(p_59664_.getItem()) instanceof ShulkerBoxBlock) && p_59664_.getItem().canFitInsideContainerItems(); // FORGE: Make shulker boxes respect Item#canFitInsideContainerItems + public boolean canPlaceItemThroughFace(final int slot, final ItemStack itemStack, final @Nullable Direction direction) { +- return !(Block.byItem(itemStack.getItem()) instanceof ShulkerBoxBlock); ++ return !(Block.byItem(itemStack.getItem()) instanceof ShulkerBoxBlock) && itemStack.getItem().canFitInsideContainerItems(); // FORGE: Make shulker boxes respect Item#canFitInsideContainerItems } @Override -@@ -257,6 +_,11 @@ +@@ -263,6 +_,11 @@ public boolean isClosed() { return this.animationStatus == ShulkerBoxBlockEntity.AnimationStatus.CLOSED; @@ -20,4 +20,4 @@ + return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, Direction.UP); } - public static enum AnimationStatus { + public enum AnimationStatus { 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 index 56359d16a1..70241aed4a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -281,6 +_,11 @@ +@@ -275,6 +_,11 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch index 9f014a24a4..caf9bdce3c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java @@ -32,6 +_,13 @@ - p_155771_.sendBlockUpdated(p_155772_, blockstate, blockstate, 260); + level.sendBlockUpdated(pos, state, state, 260); } } + @@ -13,4 +13,4 @@ + } }; - public SpawnerBlockEntity(BlockPos p_155752_, BlockState p_155753_) { + public SpawnerBlockEntity(final BlockPos worldPosition, final BlockState blockState) { diff --git a/patches/minecraft/net/minecraft/world/level/block/grower/TreeGrower.java.patch b/patches/minecraft/net/minecraft/world/level/block/grower/TreeGrower.java.patch index f27797fe79..264e201f4d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/grower/TreeGrower.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/grower/TreeGrower.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java -@@ -128,6 +_,9 @@ - ResourceKey> resourcekey = this.getConfiguredMegaFeature(p_309951_); - if (resourcekey != null) { - Holder> holder = p_309830_.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(resourcekey).orElse(null); -+ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_309830_, p_309951_, p_310327_, holder); -+ holder = event.getFeature(); +@@ -131,6 +_,9 @@ + .lookupOrThrow(Registries.CONFIGURED_FEATURE) + .get(megaFeatureKey) + .orElse(null); ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(level, random, pos, featureHolder); ++ featureHolder = event.getFeature(); + if (event.getResult().isDenied()) return false; - if (holder != null) { - for (int i = 0; i >= -1; i--) { - for (int j = 0; j >= -1; j--) { + if (featureHolder != null) { + for (int dx = 0; dx >= -1; dx--) { + for (int dz = 0; dz >= -1; dz--) { 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 b0ae6d3617..2cfc4dc425 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,33 +1,33 @@ --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -166,6 +_,7 @@ - } +@@ -164,6 +_,7 @@ - if (p_60195_ == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_60193_, p_60194_, direction, true)) return false; - if (!this.moveBlocks(p_60193_, p_60194_, direction, true)) { + RandomSource random = level.getRandom(); + if (b0 == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(level, pos, direction, true)) return false; + if (!this.moveBlocks(level, pos, direction, true)) { return false; } -@@ -174,6 +_,7 @@ - p_60193_.playSound(null, p_60194_, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 0.5F, p_60193_.random.nextFloat() * 0.25F + 0.6F); - p_60193_.gameEvent(GameEvent.BLOCK_ACTIVATE, p_60194_, GameEvent.Context.of(blockstate)); - } else if (p_60195_ == 1 || p_60195_ == 2) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_60193_, p_60194_, direction, false)) return false; - BlockEntity blockentity = p_60193_.getBlockEntity(p_60194_.relative(direction)); - if (blockentity instanceof PistonMovingBlockEntity) { - ((PistonMovingBlockEntity)blockentity).finalTick(); -@@ -221,6 +_,7 @@ - p_60193_.gameEvent(GameEvent.BLOCK_DEACTIVATE, p_60194_, GameEvent.Context.of(blockstate1)); +@@ -172,6 +_,7 @@ + level.playSound(null, pos, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 0.5F, random.nextFloat() * 0.25F + 0.6F); + level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(extendedState)); + } else if (b0 == 1 || b0 == 2) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(level, pos, direction, false)) return false; + if (level.getBlockEntity(pos.relative(direction)) instanceof PistonMovingBlockEntity pistonMovingBlockEntity) { + pistonMovingBlockEntity.finalTick(); + } +@@ -220,6 +_,7 @@ + level.gameEvent(GameEvent.BLOCK_DEACTIVATE, pos, GameEvent.Context.of(movingPistonState)); } -+ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_60193_, p_60194_, direction, (p_60195_ == 0)); ++ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(level, pos, direction, (b0 == 0)); return true; } -@@ -365,6 +_,11 @@ +@@ -376,6 +_,11 @@ @Override - protected BlockState rotate(BlockState p_60215_, Rotation p_60216_) { - return p_60215_.setValue(FACING, p_60216_.rotate(p_60215_.getValue(FACING))); + protected BlockState rotate(final BlockState state, final Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch index 7b571e917b..8f66434ff9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -119,7 +_,7 @@ - List list = p_155911_.getEntities(null, PistonMath.getMovementArea(aabb, direction, d0).minmax(aabb)); - if (!list.isEmpty()) { - List list1 = voxelshape.toAabbs(); -- boolean flag = p_155914_.movedState.is(Blocks.SLIME_BLOCK); -+ boolean flag = p_155914_.movedState.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later - Iterator iterator = list.iterator(); +@@ -126,7 +_,7 @@ + List entities = level.getEntities(null, PistonMath.getMovementArea(aabb, movement, deltaProgress).minmax(aabb)); + if (!entities.isEmpty()) { + List shapeAabbs = shape.toAabbs(); +- boolean causeBounce = self.movedState.is(Blocks.SLIME_BLOCK); ++ boolean causeBounce = self.movedState.isSlimeBlock(); + Iterator var12 = entities.iterator(); while (true) { diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch index 776b3d8a74..929b482de9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch @@ -1,67 +1,67 @@ --- a/net/minecraft/world/level/block/piston/PistonStructureResolver.java +++ b/net/minecraft/world/level/block/piston/PistonStructureResolver.java -@@ -50,7 +_,7 @@ - } else { +@@ -52,7 +_,7 @@ + for (int i = 0; i < this.toPush.size(); i++) { - BlockPos blockpos = this.toPush.get(i); -- if (isSticky(this.level.getBlockState(blockpos)) && !this.addBranchingBlocks(blockpos)) { -+ if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) { + BlockPos pos = this.toPush.get(i); +- if (isSticky(this.level.getBlockState(pos)) && !this.addBranchingBlocks(pos)) { ++ if (this.level.getBlockState(pos).isStickyBlock() && !this.addBranchingBlocks(pos)) { return false; } } -@@ -59,21 +_,9 @@ +@@ -61,21 +_,9 @@ } } -- private static boolean isSticky(BlockState p_155938_) { -- return p_155938_.is(Blocks.SLIME_BLOCK) || p_155938_.is(Blocks.HONEY_BLOCK); +- private static boolean isSticky(final BlockState state) { +- return state.is(Blocks.SLIME_BLOCK) || state.is(Blocks.HONEY_BLOCK); - } - -- private static boolean canStickToEachOther(BlockState p_155940_, BlockState p_155941_) { -- if (p_155940_.is(Blocks.HONEY_BLOCK) && p_155941_.is(Blocks.SLIME_BLOCK)) { +- private static boolean canStickToEachOther(final BlockState state1, final BlockState state2) { +- if (state1.is(Blocks.HONEY_BLOCK) && state2.is(Blocks.SLIME_BLOCK)) { - return false; - } else { -- return p_155940_.is(Blocks.SLIME_BLOCK) && p_155941_.is(Blocks.HONEY_BLOCK) ? false : isSticky(p_155940_) || isSticky(p_155941_); +- return state1.is(Blocks.SLIME_BLOCK) && state2.is(Blocks.HONEY_BLOCK) ? false : isSticky(state1) || isSticky(state2); - } - } - - private boolean addBlockLine(BlockPos p_60434_, Direction p_60435_) { - BlockState blockstate = this.level.getBlockState(p_60434_); -- if (blockstate.isAir()) { -+ if (level.isEmptyBlock(p_60434_)) { + private boolean addBlockLine(final BlockPos start, final Direction direction) { + BlockState nextState = this.level.getBlockState(start); +- if (nextState.isAir()) { ++ if (level.isEmptyBlock(start)) { return true; - } else if (!PistonBaseBlock.isPushable(blockstate, this.level, p_60434_, this.pushDirection, false, p_60435_)) { - return true; -@@ -86,12 +_,12 @@ - if (i + this.toPush.size() > 12) { - return false; - } else { -- while (isSticky(blockstate)) { -+ while (blockstate.isStickyBlock()) { - BlockPos blockpos = p_60434_.relative(this.pushDirection.getOpposite(), i); - BlockState blockstate1 = blockstate; - blockstate = this.level.getBlockState(blockpos); - if (blockstate.isAir() -- || !canStickToEachOther(blockstate1, blockstate) -+ || !(blockstate1.canStickTo(blockstate) && blockstate.canStickTo(blockstate1)) - || !PistonBaseBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) - || blockpos.equals(this.pistonPos)) { - break; -@@ -119,7 +_,7 @@ + } - for (int k = 0; k <= j + l; k++) { - BlockPos blockpos2 = this.toPush.get(k); -- if (isSticky(this.level.getBlockState(blockpos2)) && !this.addBranchingBlocks(blockpos2)) { -+ if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) { - return false; - } - } -@@ -173,7 +_,7 @@ +@@ -96,12 +_,12 @@ + return false; + } + +- while (isSticky(nextState)) { ++ while (nextState.isStickyBlock()) { + BlockPos pos = start.relative(this.pushDirection.getOpposite(), blockCount); + BlockState previousState = nextState; + nextState = this.level.getBlockState(pos); + if (nextState.isAir() +- || !canStickToEachOther(previousState, nextState) ++ || !(previousState.canStickTo(nextState) && nextState.canStickTo(previousState)) + || !PistonBaseBlock.isPushable(nextState, this.level, pos, this.pushDirection, false, this.pushDirection.getOpposite()) + || pos.equals(this.pistonPos)) { + break; +@@ -129,7 +_,7 @@ + + for (int j = 0; j <= collisionPos + blocksAdded; j++) { + BlockPos blockPos = this.toPush.get(j); +- if (isSticky(this.level.getBlockState(blockPos)) && !this.addBranchingBlocks(blockPos)) { ++ if (this.level.getBlockState(blockPos).isStickyBlock() && !this.addBranchingBlocks(blockPos)) { + return false; + } + } +@@ -181,7 +_,7 @@ if (direction.getAxis() != this.pushDirection.getAxis()) { - BlockPos blockpos = p_60432_.relative(direction); - BlockState blockstate1 = this.level.getBlockState(blockpos); -- if (canStickToEachOther(blockstate1, blockstate) && !this.addBlockLine(blockpos, direction)) { -+ if (blockstate1.canStickTo(blockstate) && blockstate.canStickTo(blockstate1) && !this.addBlockLine(blockpos, direction)) { + BlockPos neighbourPos = fromPos.relative(direction); + BlockState neighbourState = this.level.getBlockState(neighbourPos); +- if (canStickToEachOther(neighbourState, fromState) && !this.addBlockLine(neighbourPos, direction)) { ++ if (neighbourState.canStickTo(fromState) && fromState.canStickTo(neighbourState) && !this.addBlockLine(neighbourPos, direction)) { return false; } } 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 ca9befbd7d..4017a55bf9 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 @@ -1,52 +1,51 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -177,7 +_,7 @@ - if (!p_310712_.isAir() && p_312709_.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { - Block block = p_310712_.getBlock(); - boolean flag = p_312709_.getIndirectSourceEntity() instanceof Player; -- if (block.dropFromExplosion(p_312709_)) { -+ if (p_310712_.canDropFromExplosion(p_367589_, p_311490_, p_312709_)) { - BlockEntity blockentity = p_310712_.hasBlockEntity() ? p_367589_.getBlockEntity(p_311490_) : null; - LootParams.Builder lootparams$builder = new LootParams.Builder(p_367589_) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(p_311490_)) -@@ -192,8 +_,7 @@ - p_310712_.getDrops(lootparams$builder).forEach(p_309419_ -> p_311277_.accept(p_309419_, p_311490_)); +@@ -178,7 +_,7 @@ + if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { + Block block = state.getBlock(); + boolean doDropExperienceHack = explosion.getIndirectSourceEntity() instanceof Player; +- if (block.dropFromExplosion(explosion)) { ++ if (state.canDropFromExplosion(level, pos, explosion)) { + BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(pos) : null; + LootParams.Builder params = new LootParams.Builder(level) + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) +@@ -193,8 +_,7 @@ + state.getDrops(params).forEach(stack -> onHit.accept(stack, pos)); } -- p_367589_.setBlock(p_311490_, Blocks.AIR.defaultBlockState(), 3); -- block.wasExploded(p_367589_, p_311490_, p_312709_); -+ p_310712_.onBlockExploded(p_367589_, p_311490_, p_312709_); +- level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); +- block.wasExploded(level, pos, explosion); ++ state.onBlockExploded(level, pos, explosion); } } -@@ -346,12 +_,15 @@ - if (f == -1.0F) { +@@ -352,11 +_,14 @@ return 0.0F; - } else { -- int i = p_60467_.hasCorrectToolForDrops(p_60466_) ? 30 : 100; -- return p_60467_.getDestroySpeed(p_60466_) / f / i; -+ int i = net.minecraftforge.common.ForgeHooks.isCorrectToolForDrops(p_60466_, p_60467_) ? 30 : 100; -+ return p_60467_.getDestroySpeed(p_60466_, p_60469_) / f / (float)i; } + +- int modifier = player.hasCorrectToolForDrops(state) ? 30 : 100; +- return player.getDestroySpeed(state) / destroySpeed / modifier; ++ int modifier = net.minecraftforge.common.ForgeHooks.isCorrectToolForDrops(state, player) ? 30 : 100; ++ return player.getDestroySpeed(state, pos) / destroySpeed / (float)modifier; } - protected void spawnAfterBreak(BlockState p_222949_, ServerLevel p_222950_, BlockPos p_222951_, ItemStack p_222952_, boolean p_222953_) { -+ if (p_222953_) { -+ net.minecraftforge.common.ForgeHooks.dropXpForBlock(p_222949_, p_222950_, p_222951_, p_222952_); + protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { ++ if (dropExperience) { ++ net.minecraftforge.common.ForgeHooks.dropXpForBlock(state, level, pos, tool); + } } - protected void attack(BlockState p_60499_, Level p_60500_, BlockPos p_60501_, Player p_60502_) { -@@ -387,6 +_,8 @@ + protected void attack(final BlockState state, final Level level, final BlockPos pos, final Player player) { +@@ -407,6 +_,8 @@ return this.isRandomlyTicking; } + /** @deprecated Forge: Use more sensitive version {@link net.minecraftforge.common.extensions.IForgeBlockState#getSoundType(LevelReader, BlockPos, Entity) } */ + @Deprecated - protected SoundType getSoundType(BlockState p_328629_) { + protected SoundType getSoundType(final BlockState state) { return this.soundType; } -@@ -407,6 +_,10 @@ +@@ -427,6 +_,10 @@ return this.properties.destroyTime; } @@ -54,10 +53,10 @@ + return ((BlockStateBase)state).isAir; + } + - public abstract static class BlockStateBase extends StateHolder { + public abstract static class BlockStateBase extends StateHolder implements TypedInstance { private static final Direction[] DIRECTIONS = Direction.values(); - private static final VoxelShape[] EMPTY_OCCLUSION_SHAPES = Util.make(new VoxelShape[DIRECTIONS.length], p_368402_ -> Arrays.fill(p_368402_, Shapes.empty())); -@@ -557,12 +_,14 @@ + private static final VoxelShape[] EMPTY_OCCLUSION_SHAPES = Util.make(new VoxelShape[DIRECTIONS.length], s -> Arrays.fill(s, Shapes.empty())); +@@ -582,12 +_,14 @@ return this.useShapeForLightOcclusion; } @@ -73,20 +72,20 @@ } public boolean ignitedByLava() { -@@ -575,9 +_,11 @@ +@@ -600,9 +_,11 @@ } - public MapColor getMapColor(BlockGetter p_285002_, BlockPos p_285293_) { + public MapColor getMapColor(final BlockGetter level, final BlockPos pos) { - return this.mapColor; -+ return getBlock().getMapColor(this.asState(), p_285002_, p_285293_, this.mapColor); ++ return getBlock().getMapColor(this.asState(), level, pos, this.mapColor); } + /** @deprecated use {@link BlockState#rotate(LevelAccessor, BlockPos, Rotation)} */ + @Deprecated - public BlockState rotate(Rotation p_60718_) { - return this.getBlock().rotate(this.asState(), p_60718_); + public BlockState rotate(final Rotation rotation) { + return this.getBlock().rotate(this.asState(), rotation); } -@@ -631,6 +_,8 @@ +@@ -660,6 +_,8 @@ } public PushReaction getPistonPushReaction() { @@ -95,12 +94,12 @@ return this.pushReaction; } -@@ -996,7 +_,7 @@ - BlockBehaviour.StateArgumentPredicate> isValidSpawn = (p_360542_, p_360543_, p_360544_, p_360545_) -> p_360542_.isFaceSturdy( - p_360543_, p_360544_, Direction.UP +@@ -1013,7 +_,7 @@ + private BlockBehaviour.StateArgumentPredicate> isValidSpawn = (state, level, pos, entityType) -> state.isFaceSturdy( + level, pos, Direction.UP ) -- && p_360542_.getLightEmission() < 14; -+ && p_360542_.getLightEmission(p_360543_, p_360544_) < 14; - BlockBehaviour.StatePredicate isRedstoneConductor = (p_360546_, p_360547_, p_360548_) -> p_360546_.isCollisionShapeFullBlock(p_360547_, p_360548_); - BlockBehaviour.StatePredicate isSuffocating = (p_360539_, p_360540_, p_360541_) -> p_360539_.blocksMotion() && p_360539_.isCollisionShapeFullBlock(p_360540_, p_360541_); - BlockBehaviour.StatePredicate isViewBlocking = this.isSuffocating; +- && state.getLightEmission() < 14; ++ && state.getLightEmission(level, pos) < 14; + private BlockBehaviour.StatePredicate isRedstoneConductor = BlockBehaviour.BlockStateBase::isCollisionShapeFullBlock; + private BlockBehaviour.StatePredicate isSuffocating = (state, level, pos) -> state.blocksMotion() && state.isCollisionShapeFullBlock(level, pos); + private BlockBehaviour.StatePredicate isViewBlocking = this.isSuffocating; diff --git a/patches/minecraft/net/minecraft/world/level/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/BlockState.java.patch index f068008450..217df8df28 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/BlockState.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/state/BlockState.java +++ b/net/minecraft/world/level/block/state/BlockState.java -@@ -7,7 +_,7 @@ +@@ -5,7 +_,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.properties.Property; -public class BlockState extends BlockBehaviour.BlockStateBase { +public class BlockState extends BlockBehaviour.BlockStateBase implements net.minecraftforge.common.extensions.IForgeBlockState { - public static final Codec CODEC = codec(BuiltInRegistries.BLOCK.byNameCodec(), Block::defaultBlockState).stable(); + public static final Codec CODEC = codec(BuiltInRegistries.BLOCK.byNameCodec(), Block::defaultBlockState, Block::getStateDefinition).stable(); - public BlockState(Block p_61042_, Reference2ObjectArrayMap, Comparable> p_328252_, MapCodec p_61044_) { + public BlockState(final Block owner, final Property[] propertyKeys, final Comparable[] propertyValues) { 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 701236a2cd..55fbda9d78 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch @@ -3,37 +3,37 @@ @@ -318,23 +_,28 @@ @Override - public final void findBlockLightSources(BiConsumer p_285269_) { -- this.findBlocks(p_360555_ -> p_360555_.getLightEmission() != 0, p_285269_); -+ this.findBlocks((p_360555_, pos) -> p_360555_.getLightEmission(this, pos) != 0, p_285269_); + public final void findBlockLightSources(final BiConsumer consumer) { +- this.findBlocks(state -> state.getLightEmission() != 0, consumer); ++ this.findBlocks((state, pos) -> state.getLightEmission(this, pos) != 0, consumer); } - public void findBlocks(Predicate p_285343_, BiConsumer p_285030_) { -+ findBlocks((state, pos) -> p_285343_.test(state), p_285030_); + public void findBlocks(final Predicate predicate, final BiConsumer consumer) { ++ findBlocks((state, pos) -> predicate.test(state), consumer); + } + -+ public void findBlocks(java.util.function.BiPredicate p_285343_, BiConsumer p_285030_) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); ++ public void findBlocks(final java.util.function.BiPredicate predicate, final BiConsumer consumer) { + BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); - for (int i = this.getMinSectionY(); i <= this.getMaxSectionY(); i++) { - LevelChunkSection levelchunksection = this.getSection(this.getSectionIndexFromSectionY(i)); -- if (levelchunksection.maybeHas(p_285343_)) { -+ if (levelchunksection.maybeHas(state -> p_285343_.test(state, BlockPos.ZERO))) { - BlockPos blockpos = SectionPos.of(this.chunkPos, i).origin(); + for (int sectionY = this.getMinSectionY(); sectionY <= this.getMaxSectionY(); sectionY++) { + LevelChunkSection section = this.getSection(this.getSectionIndexFromSectionY(sectionY)); +- if (section.maybeHas(predicate)) { ++ if (section.maybeHas(state -> predicate.test(state, BlockPos.ZERO))) { + BlockPos origin = SectionPos.of(this.chunkPos, sectionY).origin(); - for (int j = 0; j < 16; j++) { - for (int k = 0; k < 16; k++) { - for (int l = 0; l < 16; l++) { - BlockState blockstate = levelchunksection.getBlockState(l, j, k); -- if (p_285343_.test(blockstate)) { -- p_285030_.accept(blockpos$mutableblockpos.setWithOffset(blockpos, l, j, k), blockstate); -+ blockpos$mutableblockpos.setWithOffset(blockpos, l, j, k); -+ if (p_285343_.test(blockstate, blockpos$mutableblockpos.immutable())) { -+ p_285030_.accept(blockpos$mutableblockpos, blockstate); + for (int y = 0; y < 16; y++) { + for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { + BlockState state = section.getBlockState(x, y, z); +- if (predicate.test(state)) { +- consumer.accept(mutablePos.setWithOffset(origin, x, y, z), state); ++ mutablePos.setWithOffset(origin, x, y, z); ++ if (predicate.test(state, mutablePos.immutable())) { ++ consumer.accept(mutablePos, state); } } } -@@ -493,5 +_,9 @@ +@@ -499,5 +_,9 @@ } public record PackedTicks(List> blocks, List> fluids) { diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkGenerator.java.patch index 81c159a836..76bbd27b2d 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkGenerator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkGenerator.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -81,7 +_,7 @@ - public abstract class ChunkGenerator { - public static final Codec CODEC = BuiltInRegistries.CHUNK_GENERATOR.byNameCodec().dispatchStable(ChunkGenerator::codec, Function.identity()); +@@ -84,7 +_,7 @@ + .byNameCodec() + .dispatchStable(ChunkGenerator::codec, Function.identity()); protected final BiomeSource biomeSource; - private final Supplier> featuresPerStep; + private final net.minecraftforge.common.util.ClearableLazy> featuresPerStep; private final Function, BiomeGenerationSettings> generationSettingsGetter; - public ChunkGenerator(BiomeSource p_256133_) { -@@ -91,9 +_,14 @@ - public ChunkGenerator(BiomeSource p_255838_, Function, BiomeGenerationSettings> p_256216_) { - this.biomeSource = p_255838_; - this.generationSettingsGetter = p_256216_; + public ChunkGenerator(final BiomeSource biomeSource) { +@@ -94,9 +_,14 @@ + public ChunkGenerator(final BiomeSource biomeSource, final Function, BiomeGenerationSettings> generationSettingsGetter) { + this.biomeSource = biomeSource; + this.generationSettingsGetter = generationSettingsGetter; - this.featuresPerStep = Suppliers.memoize( + this.featuresPerStep = net.minecraftforge.common.util.ClearableLazy.concurrentOf( - () -> FeatureSorter.buildFeaturesPerStep(List.copyOf(p_255838_.possibleBiomes()), p_223216_ -> p_256216_.apply(p_223216_).features(), true) + () -> FeatureSorter.buildFeaturesPerStep(List.copyOf(biomeSource.possibleBiomes()), b -> generationSettingsGetter.apply(b).features(), true) ); + } + 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 8f33ba71eb..3de8c270aa 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -6,102 +6,99 @@ -public class LevelChunk extends ChunkAccess implements DebugValueSource { +public class LevelChunk extends ChunkAccess implements DebugValueSource, net.minecraftforge.common.capabilities.ICapabilityProviderImpl { - static final Logger LOGGER = LogUtils.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final TickingBlockEntity NULL_TICKER = new TickingBlockEntity() { @Override @@ -123,6 +_,7 @@ - this.postLoad = p_196861_; - this.blockTicks = p_196857_; - this.fluidTicks = p_196858_; + this.postLoad = postLoad; + this.blockTicks = blockTicks; + this.fluidTicks = fluidTicks; + this.capProvider.initInternal(); } - public LevelChunk(ServerLevel p_196850_, ProtoChunk p_196851_, LevelChunk.@Nullable PostLoadProcessor p_196852_) { -@@ -319,7 +_,7 @@ - if (!levelchunksection.getBlockState(j, k, l).is(block)) { - return null; - } else { -- if (!this.level.isClientSide() && (p_393998_ & 512) == 0) { -+ if (!this.level.isClientSide() && (p_393998_ & 512) == 0 && !this.level.captureBlockSnapshots) { - p_62866_.onPlace(this.level, p_62865_, blockstate, flag2); - } + public LevelChunk(final ServerLevel level, final ProtoChunk protoChunk, final LevelChunk.@Nullable PostLoadProcessor postLoad) { +@@ -323,7 +_,7 @@ + return null; + } -@@ -371,6 +_,12 @@ +- if (!this.level.isClientSide() && (flags & 512) == 0) { ++ if (!this.level.isClientSide() && (flags & 512) == 0 && !this.level.captureBlockSnapshots) { + state.onPlace(this.level, pos, oldState, movedByPiston); + } - public @Nullable BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { - BlockEntity blockentity = this.blockEntities.get(p_62868_); +@@ -367,6 +_,12 @@ + + public @Nullable BlockEntity getBlockEntity(final BlockPos pos, final LevelChunk.EntityCreationType creationType) { + BlockEntity blockEntity = this.blockEntities.get(pos); + -+ if (blockentity != null && blockentity.isRemoved()) { -+ blockEntities.remove(p_62868_); -+ blockentity = null; ++ if (blockEntity != null && blockEntity.isRemoved()) { ++ blockEntities.remove(pos); ++ blockEntity = null; + } + - if (blockentity == null) { - CompoundTag compoundtag = this.pendingBlockEntities.remove(p_62868_); - if (compoundtag != null) { -@@ -388,9 +_,6 @@ - this.addAndRegisterBlockEntity(blockentity); + if (blockEntity == null) { + CompoundTag tag = this.pendingBlockEntities.remove(pos); + if (tag != null) { +@@ -384,9 +_,6 @@ + this.addAndRegisterBlockEntity(blockEntity); } } -- } else if (blockentity.isRemoved()) { -- this.blockEntities.remove(p_62868_); +- } else if (blockEntity.isRemoved()) { +- this.blockEntities.remove(pos); - return null; } - return blockentity; -@@ -405,6 +_,7 @@ + return blockEntity; +@@ -401,6 +_,7 @@ - this.level.onBlockEntityAdded(p_156391_); - this.updateBlockEntityTicker(p_156391_); -+ p_156391_.onLoad(); + this.level.onBlockEntityAdded(blockEntity); + this.updateBlockEntityTicker(blockEntity); ++ blockEntity.onLoad(); } } -@@ -456,9 +_,14 @@ - public @Nullable CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_, HolderLookup.Provider p_329605_) { - BlockEntity blockentity = this.getBlockEntity(p_62932_); - if (blockentity != null && !blockentity.isRemoved()) { +@@ -452,9 +_,14 @@ + public @Nullable CompoundTag getBlockEntityNbtForSaving(final BlockPos blockPos, final HolderLookup.Provider registryAccess) { + BlockEntity blockEntity = this.getBlockEntity(blockPos); + if (blockEntity != null && !blockEntity.isRemoved()) { + try { - CompoundTag compoundtag1 = blockentity.saveWithFullMetadata(this.level.registryAccess()); - compoundtag1.putBoolean("keepPacked", false); - return compoundtag1; + CompoundTag result = blockEntity.saveWithFullMetadata(this.level.registryAccess()); + result.putBoolean("keepPacked", false); + return result; + } catch (Exception e) { -+ LOGGER.error("A BlockEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", blockentity.getClass().getName(), e); ++ LOGGER.error("A BlockEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", blockEntity.getClass().getName(), e); + return null; + } - } else { - CompoundTag compoundtag = this.pendingBlockEntities.get(p_62932_); - if (compoundtag != null) { -@@ -538,9 +_,10 @@ - (p_405747_, p_405748_, p_405749_) -> { - BlockEntity blockentity = this.getBlockEntity(p_405747_, LevelChunk.EntityCreationType.IMMEDIATE); - if (blockentity != null && p_405749_ != null && blockentity.getType() == p_405748_) { -- blockentity.loadWithComponents( -+ var input = ( - TagValueInput.create(problemreporter$scopedcollector.forChild(blockentity.problemPath()), this.level.registryAccess(), p_405749_) - ); -+ blockentity.handleUpdateTag(input, this.level.registryAccess()); - } + } + + CompoundTag result = this.pendingBlockEntities.get(blockPos); +@@ -534,7 +_,7 @@ + blockEntities.accept((pos, type, tag) -> { + BlockEntity blockEntity = this.getBlockEntity(pos, LevelChunk.EntityCreationType.IMMEDIATE); + if (blockEntity != null && tag != null && blockEntity.getType() == type) { +- blockEntity.loadWithComponents(TagValueInput.create(reporter.forChild(blockEntity.problemPath()), this.level.registryAccess(), tag)); ++ blockEntity.handleUpdateTag(TagValueInput.create(reporter.forChild(blockEntity.problemPath()), this.level.registryAccess(), tag), this.level.registryAccess()); } - ); -@@ -678,6 +_,7 @@ + }); + } +@@ -673,6 +_,7 @@ } public void clearAllBlockEntities() { + this.blockEntities.values().forEach(BlockEntity::onChunkUnloaded); this.blockEntities.values().forEach(BlockEntity::setRemoved); this.blockEntities.clear(); - this.tickersInLevel.values().forEach(p_187966_ -> p_187966_.rebind(NULL_TICKER)); -@@ -685,6 +_,7 @@ + this.tickersInLevel.values().forEach(ticker -> ticker.rebind(NULL_TICKER)); +@@ -680,6 +_,7 @@ } public void registerAllBlockEntitiesAfterLevelLoad() { + this.level.addFreshBlockEntities(this.blockEntities.values()); - this.blockEntities.values().forEach(p_405750_ -> { - if (this.level instanceof ServerLevel serverlevel) { - this.addGameEventListener(p_405750_, serverlevel); -@@ -737,6 +_,24 @@ - return new LevelChunk.BoundTickingBlockEntity<>(p_156376_, p_156377_); + this.blockEntities.values().forEach(blockEntity -> { + if (this.level instanceof ServerLevel serverLevel) { + this.addGameEventListener(blockEntity, serverLevel); +@@ -725,6 +_,24 @@ + return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, ticker); } + private final net.minecraftforge.common.capabilities.CapabilityProvider.AsField.LevelChunks capProvider = new net.minecraftforge.common.capabilities.CapabilityProvider.AsField.LevelChunks(this); @@ -122,30 +119,30 @@ + capProvider.reviveCaps(); + } + - class BoundTickingBlockEntity implements TickingBlockEntity { + private class BoundTickingBlockEntity implements TickingBlockEntity { private final T blockEntity; private final BlockEntityTicker ticker; -@@ -754,6 +_,7 @@ - if (LevelChunk.this.isTicking(blockpos)) { +@@ -742,6 +_,7 @@ + if (LevelChunk.this.isTicking(pos)) { try { - ProfilerFiller profilerfiller = Profiler.get(); + ProfilerFiller profiler = Profiler.get(); + net.minecraftforge.server.timings.TimeTracker.BLOCK_ENTITY_UPDATE.trackStart(blockEntity); - profilerfiller.push(this::getType); - BlockState blockstate = LevelChunk.this.getBlockState(blockpos); - if (this.blockEntity.getType().isValid(blockstate)) { -@@ -775,6 +_,11 @@ - CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Block entity being ticked"); - this.blockEntity.fillCrashReportCategory(crashreportcategory); + profiler.push(this::getType); + BlockState blockState = LevelChunk.this.getBlockState(pos); + if (this.blockEntity.getType().isValid(blockState)) { +@@ -763,6 +_,11 @@ + CrashReport report = CrashReport.forThrowable(t, "Ticking block entity"); + CrashReportCategory category = report.addCategory("Block entity being ticked"); + this.blockEntity.fillCrashReportCategory(category); + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringBlockEntities.get()) { -+ LOGGER.error("{}", crashreport.getFriendlyReport(net.minecraft.ReportType.CRASH)); ++ LOGGER.error("{}", report.getFriendlyReport(net.minecraft.ReportType.CRASH)); + blockEntity.setRemoved(); + LevelChunk.this.removeBlockEntity(blockEntity.getBlockPos()); + } else - throw new ReportedException(crashreport); + throw new ReportedException(report); } } -@@ -848,6 +_,33 @@ +@@ -836,6 +_,33 @@ public String toString() { return this.ticker + " "; } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch index d5fa13b353..71dc0443e4 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -@@ -203,9 +_,15 @@ - levelchunk.setFullStatus(generationchunkholder::getFullStatus); - levelchunk.runPostLoad(); - levelchunk.setLoaded(true); -+ try { -+ generationchunkholder.currentlyLoading = levelchunk; // Forge - bypass the future chain when getChunk is called, this prevents deadlocks. - levelchunk.registerAllBlockEntitiesAfterLevelLoad(); - levelchunk.registerTickContainerInLevel(serverlevel); - levelchunk.setUnsavedListener(p_342042_.unsavedListener()); -+ net.minecraftforge.event.ForgeEventFactory.onChunkLoad(levelchunk, !(protochunk instanceof ImposterProtoChunk)); -+ } finally { -+ generationchunkholder.currentlyLoading = null; // Forge - Stop bypassing the future chain. -+ } - return levelchunk; - }, - p_342042_.mainThreadExecutor() +@@ -201,9 +_,15 @@ + levelChunk.setFullStatus(holder::getFullStatus); + levelChunk.runPostLoad(); + levelChunk.setLoaded(true); ++ try { ++ holder.currentlyLoading = levelChunk; // Forge - bypass the future chain when getChunk is called, this prevents deadlocks. + levelChunk.registerAllBlockEntitiesAfterLevelLoad(); + levelChunk.registerTickContainerInLevel(level); + levelChunk.setUnsavedListener(context.unsavedListener()); ++ net.minecraftforge.event.ForgeEventFactory.onChunkLoad(levelChunk, !(protoChunk instanceof ImposterProtoChunk)); ++ } finally { ++ holder.currentlyLoading = null; // Forge - Stop bypassing the future chain. ++ } + return levelChunk; + }, context.mainThreadExecutor()); + } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch index ee3e56961e..3a32c4b84a 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -108,9 +_,13 @@ - TagValueOutput tagvalueoutput = TagValueOutput.createWithContext( - problemreporter$scopedcollector.forChild(p_405760_.problemPath()), p_405760_.registryAccess() - ); -+ try { - if (p_405760_.save(tagvalueoutput)) { - CompoundTag compoundtag1 = tagvalueoutput.buildResult(); - listtag.add(compoundtag1); -+ } -+ } catch (Exception e) { -+ LOGGER.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", p_405760_.getType(), e); - } - } - ); +@@ -94,9 +_,13 @@ + ListTag entities = new ListTag(); + chunk.getEntities().forEach(e -> { + TagValueOutput output = TagValueOutput.createWithContext(reporter.forChild(e.problemPath()), e.registryAccess()); ++ try { + if (e.save(output)) { + CompoundTag result = output.buildResult(); + entities.add(result); ++ } ++ } catch (Exception exception) { ++ LOGGER.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", e.getType(), exception); + } + }); + CompoundTag chunkTag = NbtUtils.addCurrentDataVersion(new CompoundTag()); diff --git a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch rename to patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch index 20e99700e9..d20866b88c 100644 --- a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch +++ b/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/world/level/dimension/end/EndDragonFight.java -+++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -535,6 +_,14 @@ +--- a/net/minecraft/world/level/dimension/end/EnderDragonFight.java ++++ b/net/minecraft/world/level/dimension/end/EnderDragonFight.java +@@ -580,6 +_,14 @@ } } @@ -12,6 +12,6 @@ + this.dragonEvent.removePlayer(player); + } + - public @Nullable UUID getDragonUUID() { + public @Nullable UUID dragonUUID() { return this.dragonUUID; } 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 1fa9fe6938..02b0eda36e 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -1,59 +1,59 @@ --- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -71,7 +_,18 @@ - return this.addEntity(p_157534_, false); + return this.addEntity(entity, false); } + public boolean addNewEntityWithoutEvent(T entity) { + return this.addEntityWithoutEvent(entity, false); + } + - private boolean addEntity(T p_157539_, boolean p_157540_) { -+ if (p_157539_ instanceof Entity entity && net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel(entity, entity.level(), p_157540_)) { + private boolean addEntity(final T entity, final boolean loaded) { ++ if (entity instanceof Entity && net.minecraftforge.event.ForgeEventFactory.onEntityJoinLevel((Entity)entity, ((Entity)entity).level(), loaded)) { + return false; + } -+ return addEntityWithoutEvent(p_157539_, p_157540_); ++ return addEntityWithoutEvent(entity, loaded); + } + -+ private boolean addEntityWithoutEvent(T p_157539_, boolean p_157540_) { - if (!this.addEntityUuid(p_157539_)) { ++ private boolean addEntityWithoutEvent(final T entity, final boolean loaded) { + if (!this.addEntityUuid(entity)) { return false; - } else { -@@ -92,6 +_,10 @@ - this.startTicking(p_157539_); - } + } +@@ -93,6 +_,10 @@ + this.startTicking(entity); + } -+ if (p_157539_ instanceof Entity entity) { -+ entity.onAddedToWorld(); ++ if (entity instanceof Entity) { ++ ((Entity)entity).onAddedToLevel(); + } + - return true; - } + return true; } + @@ -369,11 +_,13 @@ - class Callback implements EntityInLevelCallback { + private class Callback implements EntityInLevelCallback { private final T entity; + private final Entity realEntity; private long currentSectionKey; private EntitySection currentSection; - Callback(final T p_157614_, final long p_157615_, final EntitySection p_157616_) { - this.entity = p_157614_; -+ this.realEntity = p_157614_ instanceof Entity e ? e : null; - this.currentSectionKey = p_157615_; - this.currentSection = p_157616_; + private Callback(final T entity, final long currentSectionKey, final EntitySection currentSection) { + this.entity = entity; ++ this.realEntity = entity instanceof Entity e ? e : null; + this.currentSectionKey = currentSectionKey; + this.currentSection = currentSection; } @@ -392,9 +_,13 @@ PersistentEntitySectionManager.this.removeSectionIfEmpty(this.currentSectionKey, this.currentSection); - EntitySection entitysection = PersistentEntitySectionManager.this.sectionStorage.getOrCreateSection(i); - entitysection.add(this.entity); + EntitySection newSection = PersistentEntitySectionManager.this.sectionStorage.getOrCreateSection(newSectionPos); + newSection.add(this.entity); + long oldSectionKey = currentSectionKey; - this.currentSection = entitysection; - this.currentSectionKey = i; - this.updateStatus(visibility, entitysection.getStatus()); + this.currentSection = newSection; + this.currentSectionKey = newSectionPos; + this.updateStatus(previousStatus, newSection.getStatus()); + if (this.realEntity != null) { -+ net.minecraftforge.event.ForgeEventFactory.onEntityEnterSection(this.realEntity, oldSectionKey, i); ++ net.minecraftforge.event.ForgeEventFactory.onEntityEnterSection(this.realEntity, oldSectionKey, newSectionPos); + } } } diff --git a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch index 6048c4e89c..2c05951f46 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch @@ -2,33 +2,33 @@ +++ b/net/minecraft/world/level/entity/TransientEntitySectionManager.java @@ -82,11 +_,13 @@ - class Callback implements EntityInLevelCallback { + private class Callback implements EntityInLevelCallback { private final T entity; + private final Entity realEntity; private long currentSectionKey; private EntitySection currentSection; - Callback(final T p_157673_, final long p_157674_, final EntitySection p_157675_) { - this.entity = p_157673_; -+ this.realEntity = p_157673_ instanceof Entity ? (Entity) p_157673_ : null; - this.currentSectionKey = p_157674_; - this.currentSection = p_157675_; + private Callback(final T entity, final long currentSectionKey, final EntitySection currentSection) { + this.entity = entity; ++ this.realEntity = entity instanceof Entity ? (Entity)entity : null; + this.currentSectionKey = currentSectionKey; + this.currentSection = currentSection; } @@ -105,6 +_,7 @@ TransientEntitySectionManager.this.removeSectionIfEmpty(this.currentSectionKey, this.currentSection); - EntitySection entitysection = TransientEntitySectionManager.this.sectionStorage.getOrCreateSection(i); - entitysection.add(this.entity); + EntitySection newSection = TransientEntitySectionManager.this.sectionStorage.getOrCreateSection(newSectionPos); + newSection.add(this.entity); + long oldSectionKey = currentSectionKey; - this.currentSection = entitysection; - this.currentSectionKey = i; + this.currentSection = newSection; + this.currentSectionKey = newSectionPos; TransientEntitySectionManager.this.callbacks.onSectionChange(this.entity); @@ -116,6 +_,9 @@ - } else if (!flag && flag1) { + } else if (!wasTicking && isTicking) { TransientEntitySectionManager.this.callbacks.onTickingStart(this.entity); } + } + if (this.realEntity != null) { -+ net.minecraftforge.event.ForgeEventFactory.onEntityEnterSection(this.realEntity, oldSectionKey, i); ++ net.minecraftforge.event.ForgeEventFactory.onEntityEnterSection(this.realEntity, oldSectionKey, newSectionPos); } } } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch index fe7162dca5..7f345cfec7 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/world/level/levelgen/Beardifier.java @@ -52,6 +_,11 @@ - for (StructurePiece structurepiece : structurestart.getPieces()) { - if (structurepiece.isCloseToChunk(p_223939_, 12)) { -+ if (structurepiece instanceof net.minecraftforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { -+ if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { -+ list1.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); -+ } -+ } else - if (structurepiece instanceof PoolElementStructurePiece poolelementstructurepiece) { - StructureTemplatePool.Projection structuretemplatepool$projection = poolelementstructurepiece.getElement().getProjection(); - if (structuretemplatepool$projection == StructureTemplatePool.Projection.RIGID) { + for (StructurePiece piece : start.getPieces()) { + if (piece.isCloseToChunk(chunkPos, 12)) { ++ if (piece instanceof net.minecraftforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { ++ if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { ++ rigids.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); ++ } ++ } else + if (piece instanceof PoolElementStructurePiece poolPiece) { + StructureTemplatePool.Projection projection = poolPiece.getElement().getProjection(); + if (projection == StructureTemplatePool.Projection.RIGID) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch index 0d33c3dcf3..bf5d375d8f 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/DebugLevelSource.java +++ b/net/minecraft/world/level/levelgen/DebugLevelSource.java -@@ -135,4 +_,10 @@ +@@ -140,4 +_,10 @@ public int getSeaLevel() { return 63; } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch index 7f227935d9..7f39b11522 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -33,13 +_,18 @@ - for (ServerPlayer serverplayer : p_64576_.players()) { - if (!serverplayer.isSpectator()) { - BlockPos blockpos = serverplayer.blockPosition(); -- if (!p_64576_.dimensionType().hasSkyLight() || blockpos.getY() >= p_64576_.getSeaLevel() && p_64576_.canSeeSky(blockpos)) { - DifficultyInstance difficultyinstance = p_64576_.getCurrentDifficultyAt(blockpos); -+ var vanillaPosition = (!p_64576_.dimensionType().hasSkyLight() || blockpos.getY() >= p_64576_.getSeaLevel() && p_64576_.canSeeSky(blockpos)); -+ var count = 1 + randomsource.nextInt(difficultyinstance.getDifficulty().getId() + 1); -+ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnPhantom(serverplayer, count); + for (ServerPlayer player : level.players()) { + if (!player.isSpectator()) { + BlockPos playerPos = player.blockPosition(); +- if (!level.dimensionType().hasSkyLight() || playerPos.getY() >= level.getSeaLevel() && level.canSeeSky(playerPos)) { + DifficultyInstance difficulty = level.getCurrentDifficultyAt(playerPos); ++ var vanillaPosition = (!level.dimensionType().hasSkyLight() || playerPos.getY() >= level.getSeaLevel() && level.canSeeSky(playerPos)); ++ var count = 1 + random.nextInt(difficulty.getDifficulty().getId() + 1); ++ var event = net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnPhantom(player, count); + var eventResult = event.getResult(); + if (eventResult.isDenied()) continue; + if (vanillaPosition || eventResult.isAllowed()) { - if (difficultyinstance.isHarderThan(randomsource.nextFloat() * 3.0F)) { - ServerStatsCounter serverstatscounter = serverplayer.getStats(); - int i = Mth.clamp(serverstatscounter.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE); - int j = 24000; -- if (randomsource.nextInt(i) >= 72000) { -+ if (eventResult.isAllowed() || randomsource.nextInt(i) >= 72000) { - BlockPos blockpos1 = blockpos.above(20 + randomsource.nextInt(15)) - .east(-10 + randomsource.nextInt(21)) - .south(-10 + randomsource.nextInt(21)); + if (difficulty.isHarderThan(random.nextFloat() * 3.0F)) { + ServerStatsCounter stats = player.getStats(); + int value = Mth.clamp(stats.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE); + int dayLength = 24000; +- if (random.nextInt(value) >= 72000) { ++ if (eventResult.isAllowed() || random.nextInt(value) >= 72000) { + BlockPos spawnPos = playerPos.above(20 + random.nextInt(15)) + .east(-10 + random.nextInt(21)) + .south(-10 + random.nextInt(21)); @@ -47,7 +_,7 @@ - FluidState fluidstate = p_64576_.getFluidState(blockpos1); - if (NaturalSpawner.isValidEmptySpawnBlock(p_64576_, blockpos1, blockstate, fluidstate, EntityType.PHANTOM)) { - SpawnGroupData spawngroupdata = null; -- int k = 1 + randomsource.nextInt(difficultyinstance.getDifficulty().getId() + 1); -+ int k = event.getPhantomsToSpawn(); + FluidState fluidState = level.getFluidState(spawnPos); + if (NaturalSpawner.isValidEmptySpawnBlock(level, spawnPos, blockState, fluidState, EntityTypes.PHANTOM)) { + SpawnGroupData groupData = null; +- int groupSize = 1 + random.nextInt(difficulty.getDifficulty().getId() + 1); ++ int groupSize = event.getPhantomsToSpawn(); - for (int l = 0; l < k; l++) { - Phantom phantom = EntityType.PHANTOM.create(p_64576_, EntitySpawnReason.NATURAL); + for (int i = 0; i < groupSize; i++) { + Phantom phantom = EntityTypes.PHANTOM.create(level, EntitySpawnReason.NATURAL); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/WorldDimensions.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/WorldDimensions.java.patch index a2e8a52a41..be4ef92502 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/WorldDimensions.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/WorldDimensions.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/levelgen/WorldDimensions.java +++ b/net/minecraft/world/level/levelgen/WorldDimensions.java -@@ -37,7 +_,7 @@ +@@ -36,7 +_,7 @@ + public record WorldDimensions(Map, LevelStem> dimensions) { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - p_327457_ -> p_327457_.group( -- Codec.unboundedMap(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) -+ new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) // FORGE: Fix MC-197860 - ) - .apply(p_327457_, p_327457_.stable(WorldDimensions::new)) +- i -> i.group(Codec.unboundedMap(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions)) ++ i -> i.group(new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions)) // FORGE: Fix MC-197860 + .apply(i, i.stable(WorldDimensions::new)) ); + private static final Set> BUILTIN_ORDER = ImmutableSet.of(LevelStem.OVERWORLD, LevelStem.NETHER, LevelStem.END); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch deleted file mode 100644 index 98244132c1..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/Feature.java -+++ b/net/minecraft/world/level/levelgen/feature/Feature.java -@@ -189,7 +_,9 @@ - } - - protected static boolean isStone(BlockState p_159748_) { -- return p_159748_.is(BlockTags.BASE_STONE_OVERWORLD); -+ // Forge deprecation notice: this patch is deprecated for removal since 1.21. -+ // After that version, Vanilla behaviour will be used (checking against BlockTags.BASE_STONE_OVERWORLD) to better align with other loaders -+ return p_159748_.is(net.minecraftforge.common.Tags.Blocks.STONES); - } - - public static boolean isDirt(BlockState p_159760_) { 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 013c85cdb3..23d9227307 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 @@ -3,8 +3,8 @@ @@ -129,6 +_,6 @@ } - private EntityType randomEntityId(RandomSource p_225154_) { -- return Util.getRandom(MOBS, p_225154_); -+ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_225154_); + private EntityType randomEntityId(final RandomSource random) { +- return Util.getRandom(MOBS, random); ++ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(random); } } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch index aacdc8fa61..eee77ce551 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch @@ -1,13 +1,10 @@ --- a/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java -@@ -59,7 +_,9 @@ - for (int i = 2; i >= -3; i--) { - BlockPos blockpos = p_225975_.above(i); - if (Feature.isGrassOrDirt(p_225974_.level(), blockpos)) { -- p_225974_.setBlock(blockpos, this.provider.getState(p_225974_.random(), p_225975_)); -+ var state = this.provider.getState(p_225974_.random(), p_225975_); -+ state = net.minecraftforge.event.ForgeEventFactory.alterGround(p_225974_.level(), p_225974_.random(), blockpos, state); -+ p_225974_.setBlock(blockpos, state); +@@ -58,6 +_,7 @@ + BlockPos cursor = pos.above(dy); + BlockState replaceWith = this.provider.getOptionalState(context.level(), context.random(), cursor); + if (replaceWith != null) { ++ replaceWith = net.minecraftforge.event.ForgeEventFactory.alterGround(context.level(), context.random(), cursor, replaceWith); + context.setBlock(cursor, replaceWith); break; } - diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java.patch index 4474b72c74..36b7e245d8 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java +++ b/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java -@@ -64,6 +_,8 @@ - protected static void setDirtAt( - LevelSimulatedReader p_226170_, BiConsumer p_226171_, RandomSource p_226172_, BlockPos p_226173_, TreeConfiguration p_226174_ +@@ -68,6 +_,8 @@ ) { -+ var levelReader = (net.minecraft.world.level.LevelReader)p_226170_; -+ if (!levelReader.getBlockState(p_226173_).onTreeGrow(levelReader, p_226171_, p_226172_, p_226173_, p_226174_)) - if (p_226174_.forceDirt || !isDirt(p_226170_, p_226173_)) { - p_226171_.accept(p_226173_, p_226174_.dirtProvider.getState(p_226172_, p_226173_)); + BlockState blockBelowTrunk = config.belowTrunkProvider.getOptionalState(level, random, pos); + if (blockBelowTrunk != null) { ++ var levelReader = (net.minecraft.world.level.LevelReader)level; ++ if (!levelReader.getBlockState(pos).onTreeGrow(levelReader, trunkSetter, random, pos, config)) + trunkSetter.accept(pos, blockBelowTrunk); } + } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/Structure.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/Structure.java.patch index a4c8518628..49ebcafab9 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/Structure.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/Structure.java.patch @@ -10,17 +10,17 @@ + private final Structure.StructureSettings settings; + private final net.minecraftforge.common.world.ModifiableStructureInfo modifiableStructureInfo; - public static RecordCodecBuilder settingsCodec(Instance p_226568_) { -- return Structure.StructureSettings.CODEC.forGetter(p_226595_ -> p_226595_.settings); -+ return Structure.StructureSettings.CODEC.forGetter(p_226595_ -> p_226595_.modifiableStructureInfo().getOriginalStructureInfo().structureSettings()); // FORGE: Patch codec to ignore field redirect coremods. + public static RecordCodecBuilder settingsCodec(final Instance i) { +- return Structure.StructureSettings.CODEC.forGetter(e -> e.settings); ++ return Structure.StructureSettings.CODEC.forGetter(e -> e.modifiableStructureInfo().getOriginalStructureInfo().structureSettings()); // FORGE: Patch codec to ignore field redirect coremods. } - public static MapCodec simpleCodec(Function p_226608_) { + public static MapCodec simpleCodec(final Function constructor) { @@ -58,22 +_,23 @@ - protected Structure(Structure.StructureSettings p_226558_) { - this.settings = p_226558_; -+ this.modifiableStructureInfo = new net.minecraftforge.common.world.ModifiableStructureInfo(new net.minecraftforge.common.world.ModifiableStructureInfo.StructureInfo(p_226558_)); // FORGE: cache original structure info on construction so we can bypass our field read coremods where necessary + protected Structure(final Structure.StructureSettings settings) { + this.settings = settings; ++ this.modifiableStructureInfo = new net.minecraftforge.common.world.ModifiableStructureInfo(new net.minecraftforge.common.world.ModifiableStructureInfo.StructureInfo(settings)); // FORGE: cache original structure info on construction so we can bypass our field read coremods where necessary } public HolderSet biomes() { @@ -43,7 +43,7 @@ + return this.getModifiedStructureSettings().terrainAdaptation; } - public BoundingBox adjustBoundingBox(BoundingBox p_226570_) { + public BoundingBox adjustBoundingBox(final BoundingBox boundingBox) { @@ -209,6 +_,22 @@ } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 8d0ec8177a..6c40ecea1b 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java -@@ -80,6 +_,9 @@ +@@ -81,6 +_,9 @@ } - public final CompoundTag createTag(StructurePieceSerializationContext p_192645_) { + public final CompoundTag createTag(final StructurePieceSerializationContext context) { + if (BuiltInRegistries.STRUCTURE_PIECE.getKey(this.getType()) == null) { // FORGE: Friendlier error then the Null String error below. + throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.getType() + "\" unregistered, serializing impossible."); + } - CompoundTag compoundtag = new CompoundTag(); - compoundtag.putString("id", BuiltInRegistries.STRUCTURE_PIECE.getKey(this.getType()).toString()); - compoundtag.store("BB", BoundingBox.CODEC, this.boundingBox); + CompoundTag tag = new CompoundTag(); + tag.putString("id", BuiltInRegistries.STRUCTURE_PIECE.getKey(this.getType()).toString()); + tag.store("BB", BoundingBox.CODEC, this.boundingBox); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch index b105dc649d..4122d3467d 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java -@@ -98,6 +_,9 @@ - public CompoundTag createTag(StructurePieceSerializationContext p_192661_, ChunkPos p_192662_) { - CompoundTag compoundtag = new CompoundTag(); +@@ -103,6 +_,9 @@ + public CompoundTag createTag(final StructurePieceSerializationContext context, final ChunkPos chunkPos) { + CompoundTag tag = new CompoundTag(); if (this.isValid()) { -+ if (p_192661_.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.getStructure()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below ++ if (context.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.getStructure()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below + throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.getStructure() + "\" unregistered, serializing impossible."); + } - compoundtag.putString("id", p_192661_.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.structure).toString()); - compoundtag.putInt("ChunkX", p_192662_.x); - compoundtag.putInt("ChunkZ", p_192662_.z); + tag.putString("id", context.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.structure).toString()); + tag.putInt("ChunkX", chunkPos.x()); + tag.putInt("ChunkZ", chunkPos.z()); 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 3aa259379b..22b4f887fa 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,36 +1,51 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java -@@ -7,6 +_,11 @@ +@@ -8,6 +_,7 @@ import org.jspecify.annotations.Nullable; - public abstract class StructureProcessor { + public interface StructureProcessor { ++ /** @deprecated Use variant with StructureTemplate argument */ + default StructureTemplate.@Nullable StructureBlockInfo processBlock( + final LevelReader level, + final BlockPos targetPosition, +@@ -19,6 +_,18 @@ + return processedBlockInfo; + } + ++ default StructureTemplate.@Nullable StructureBlockInfo processBlock( ++ final LevelReader level, ++ final BlockPos targetPosition, ++ final BlockPos referencePos, ++ final BlockPos templateRelativePos, ++ final StructureTemplate.StructureBlockInfo processedBlockInfo, ++ final StructurePlaceSettings settings, ++ final @Nullable StructureTemplate template ++ ) { ++ return processBlock(level, targetPosition, referencePos, templateRelativePos, processedBlockInfo, settings); ++ } + -+ /** -+ * @deprecated Forge: Use {@link #process(LevelReader, BlockPos, BlockPos, StructureTemplate.StructureBlockInfo, StructureTemplate.StructureBlockInfo, StructurePlaceSettings, StructureTemplate)} instead. -+ */ -+ @Deprecated - public StructureTemplate.@Nullable StructureBlockInfo processBlock( - LevelReader p_74416_, - BlockPos p_74417_, -@@ -29,5 +_,21 @@ - StructurePlaceSettings p_277497_ + MapCodec codec(); + + default List finalizeProcessing( +@@ -30,6 +_,21 @@ + final StructurePlaceSettings settings ) { - return p_278053_; + return processedBlockInfoList; + } + + /** -+ * FORGE: Add entity processing. -+ *

+ * Use this method to process entities from a structure in much the same way as + * blocks, parameters are analogous. -+ * -+ * @see #process(LevelReader, BlockPos, BlockPos, StructureTemplate.StructureBlockInfo, StructureTemplate.StructureBlockInfo, StructurePlaceSettings, StructureTemplate) + */ -+ public StructureTemplate.StructureEntityInfo processEntity(LevelReader world, BlockPos seedPos, StructureTemplate.StructureEntityInfo rawEntityInfo, StructureTemplate.StructureEntityInfo entityInfo, StructurePlaceSettings placementSettings, StructureTemplate template) { -+ return entityInfo; -+ } -+ -+ public StructureTemplate.@Nullable StructureBlockInfo process(LevelReader level, BlockPos seed, BlockPos offset, StructureTemplate.StructureBlockInfo rawBlock, StructureTemplate.StructureBlockInfo block, StructurePlaceSettings settings, @Nullable StructureTemplate template) { -+ return processBlock(level, seed, offset, rawBlock, block, settings); ++ default StructureTemplate.@Nullable StructureEntityInfo processEntity( ++ final LevelReader level, ++ final BlockPos targetPosition, ++ final StructureTemplate.StructureEntityInfo originalEntityInfo, ++ final StructureTemplate.StructureEntityInfo processedEntityInfo, ++ final StructurePlaceSettings settings, ++ final @Nullable StructureTemplate template ++ ) { ++ return processedEntityInfo; } - } + + default boolean evaluatesEntirePieceState() { 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 41829fb986..6678e7627e 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,7 +1,7 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -262,6 +_,10 @@ - return transform(p_74565_, p_74564_.getMirror(), p_74564_.getRotation(), p_74564_.getRotationPivot()); +@@ -249,6 +_,10 @@ + return transform(pos, settings.getMirror(), settings.getRotation(), settings.getRotationPivot()); } + public static Vec3 transformedVec3d(StructurePlaceSettings placementIn, Vec3 pos) { @@ -9,99 +9,105 @@ + } + public boolean placeInWorld( - ServerLevelAccessor p_230329_, - BlockPos p_230330_, -@@ -288,7 +_,7 @@ - int l = Integer.MIN_VALUE; - int i1 = Integer.MIN_VALUE; - int j1 = Integer.MIN_VALUE; -- List list4 = processBlockInfos(p_230329_, p_230330_, p_230331_, p_230332_, list); -+ List list4 = processBlockInfos(p_230329_, p_230330_, p_230331_, p_230332_, list, this); + final ServerLevelAccessor level, + final BlockPos position, +@@ -276,7 +_,7 @@ + int maxX = Integer.MIN_VALUE; + int maxY = Integer.MIN_VALUE; + int maxZ = Integer.MIN_VALUE; +- List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList); ++ List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList, this); - try (ProblemReporter.ScopedCollector problemreporter$scopedcollector = new ProblemReporter.ScopedCollector(LOGGER)) { - for (StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : list4) { -@@ -412,10 +_,10 @@ - p_230330_, - p_230332_.getMirror(), - p_230332_.getRotation(), -- p_230332_.getRotationPivot(), - boundingbox, - p_230332_.shouldFinalizeEntities(), -- problemreporter$scopedcollector -+ problemreporter$scopedcollector, -+ p_230332_ - ); - } + try (ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(LOGGER)) { + for (StructureTemplate.StructureBlockInfo blockInfo : processedBlockInfoList) { +@@ -395,10 +_,10 @@ + position, + settings.getMirror(), + settings.getRotation(), +- settings.getRotationPivot(), + boundingBox, + settings.shouldFinalizeEntities(), +- reporter ++ reporter, ++ settings + ); } -@@ -457,12 +_,21 @@ - ); + } +@@ -440,12 +_,21 @@ + }); } + /** + * @deprecated Forge: Use {@link #processBlockInfos(ServerLevelAccessor, BlockPos, BlockPos, StructurePlaceSettings, List, StructureTemplate)} instead. + */ + @Deprecated -+ public static List processBlockInfos(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(final ServerLevelAccessor level, final BlockPos position, final BlockPos referencePos, final StructurePlaceSettings settings, final List blockInfoList) { ++ return processBlockInfos(level, position, referencePos, settings, blockInfoList, null); + } + public static List processBlockInfos( - ServerLevelAccessor p_278297_, - BlockPos p_74519_, - BlockPos p_74520_, - StructurePlaceSettings p_74521_, -- List p_74522_ -+ List p_74522_, + final ServerLevelAccessor level, + final BlockPos position, + final BlockPos referencePos, + final StructurePlaceSettings settings, +- final List blockInfoList ++ List blockInfoList, + @Nullable StructureTemplate template ) { - List list = new ArrayList<>(); - List list1 = new ArrayList<>(); -@@ -478,7 +_,7 @@ + List originalBlockInfoList = new ArrayList<>(); + List processedBlockInfoList = new ArrayList<>(); +@@ -469,7 +_,7 @@ + Iterator iterator = settings.getProcessors().iterator(); - while (structuretemplate$structureblockinfo1 != null && iterator.hasNext()) { - structuretemplate$structureblockinfo1 = iterator.next() -- .processBlock(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_); -+ .process(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_, template); - } + while (processedBlockInfo != null && iterator.hasNext()) { +- processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo.pos, processedBlockInfo, settings); ++ processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo.pos, processedBlockInfo, settings, template); + } - if (structuretemplate$structureblockinfo1 != null) { -@@ -499,17 +_,17 @@ - BlockPos p_74525_, - Mirror p_74526_, - Rotation p_74527_, -- BlockPos p_74528_, - @Nullable BoundingBox p_74529_, - boolean p_74530_, -- ProblemReporter p_408312_ -+ ProblemReporter p_408312_, -+ StructurePlaceSettings placementIn + if (processedBlockInfo != null) { +@@ -491,17 +_,17 @@ + final BlockPos position, + final Mirror mirror, + final Rotation rotation, +- final BlockPos pivot, + final @Nullable BoundingBox boundingBox, + final boolean finalizeEntities, +- final ProblemReporter problemReporter ++ final ProblemReporter problemReporter, ++ final StructurePlaceSettings placementIn ) { -- for (StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) { -- BlockPos blockpos = transform(structuretemplate$structureentityinfo.blockPos, p_74526_, p_74527_, p_74528_).offset(p_74525_); -+ var entities = processEntityInfos(this, p_74524_, p_74525_, placementIn, this.entityInfoList); -+ for (StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : entities) { -+ BlockPos blockpos = structuretemplate$structureentityinfo.blockPos; // FORGE: Position will have already been transformed by processEntityInfos - if (p_74529_ == null || p_74529_.isInside(blockpos)) { - CompoundTag compoundtag = structuretemplate$structureentityinfo.nbt.copy(); -- Vec3 vec3 = transform(structuretemplate$structureentityinfo.pos, p_74526_, p_74527_, p_74528_); -- Vec3 vec31 = vec3.add(p_74525_.getX(), p_74525_.getY(), p_74525_.getZ()); -+ Vec3 vec31 = structuretemplate$structureentityinfo.pos; // FORGE: Position will have already been transformed by processEntityInfos - ListTag listtag = new ListTag(); - listtag.add(DoubleTag.valueOf(vec31.x)); - listtag.add(DoubleTag.valueOf(vec31.y)); -@@ -531,6 +_,24 @@ +- for (StructureTemplate.StructureEntityInfo entityInfo : this.entityInfoList) { +- BlockPos blockPos = transform(entityInfo.blockPos, mirror, rotation, pivot).offset(position); ++ var entities = processEntityInfos(this, level, position, placementIn, this.entityInfoList); ++ for (StructureTemplate.StructureEntityInfo entityInfo : entities) { ++ BlockPos blockPos = entityInfo.blockPos; // FORGE: Position will have already been transformed by processEntityInfos + if (boundingBox == null || boundingBox.isInside(blockPos)) { + CompoundTag tag = entityInfo.nbt.copy(); +- Vec3 relativePos = transform(entityInfo.pos, mirror, rotation, pivot); +- Vec3 pos = relativePos.add(position.getX(), position.getY(), position.getZ()); ++ Vec3 pos = entityInfo.pos; // FORGE: Position will have already been transformed by processEntityInfos + ListTag posTag = new ListTag(); + posTag.add(DoubleTag.valueOf(pos.x)); + posTag.add(DoubleTag.valueOf(pos.y)); +@@ -523,6 +_,30 @@ } } } + -+ public static List processEntityInfos(@Nullable StructureTemplate template, LevelAccessor level, BlockPos seedPos, StructurePlaceSettings settings, List entities) { ++ public static List processEntityInfos( ++ @Nullable StructureTemplate template, ++ final LevelAccessor level, ++ final BlockPos targetPos, ++ final StructurePlaceSettings settings, ++ final List entities ++ ) { + var list = new ArrayList(); + for (var entityInfo : entities) { -+ var pos = transformedVec3d(settings, entityInfo.pos).add(Vec3.atLowerCornerOf(seedPos)); -+ var blockpos = calculateRelativePosition(settings, entityInfo.blockPos).offset(seedPos); ++ var pos = transformedVec3d(settings, entityInfo.pos).add(Vec3.atLowerCornerOf(targetPos)); ++ var blockpos = calculateRelativePosition(settings, entityInfo.blockPos).offset(targetPos); + var info = new StructureTemplate.StructureEntityInfo(pos, blockpos, entityInfo.nbt); + for (var proc : settings.getProcessors()) { -+ info = proc.processEntity(level, seedPos, entityInfo, info, settings, template); ++ info = proc.processEntity(level, targetPos, entityInfo, info, settings, template); + if (info == null) + break; + } @@ -112,5 +118,5 @@ + } + - private static Optional createEntityIgnoreException(ProblemReporter p_410558_, ServerLevelAccessor p_74544_, CompoundTag p_74545_) { + private static Optional createEntityIgnoreException(final ProblemReporter reporter, final ServerLevelAccessor level, final CompoundTag tag) { try { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch index 2670169129..fbc7da494b 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java -@@ -78,6 +_,7 @@ +@@ -77,6 +_,7 @@ } - builder.add(new StructureTemplateManager.Source(this::loadFromResource, this::listResources)); -+ builder.add(new StructureTemplateManager.Source(net.minecraftforge.common.ForgeHooks::createEmptyStructure, Stream::empty)); - this.sources = builder.build(); + sources.add(this.resourceManagerSource); ++ sources.add(net.minecraftforge.common.ForgeHooks.emptyStructureSource()); + this.sources = sources.build(); } 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 2825019033..d84e29b260 100644 --- a/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/lighting/BlockLightEngine.java +++ b/net/minecraft/world/level/lighting/BlockLightEngine.java -@@ -107,7 +_,7 @@ +@@ -110,7 +_,7 @@ } - private int getEmission(long p_285243_, BlockState p_284973_) { -- int i = p_284973_.getLightEmission(); -+ int i = p_284973_.getLightEmission(chunkSource.getLevel(), mutablePos); - return i > 0 && this.storage.lightOnInSection(SectionPos.blockToSection(p_285243_)) ? i : 0; + private int getEmission(final long blockNode, final BlockState state) { +- int emission = state.getLightEmission(); ++ int emission = state.getLightEmission(chunkSource.getLevel(), mutablePos); + return emission > 0 && this.storage.lightOnInSection(SectionPos.blockToSection(blockNode)) ? emission : 0; } -@@ -117,7 +_,7 @@ - LightChunk lightchunk = this.chunkSource.getChunkForLighting(p_285274_.x, p_285274_.z); - if (lightchunk != null) { - lightchunk.findBlockLightSources((p_360638_, p_360639_) -> { -- int i = p_360639_.getLightEmission(); -+ int i = p_360639_.getLightEmission(chunkSource.getLevel(), p_360638_); - this.enqueueIncrease(p_360638_.asLong(), LightEngine.QueueEntry.increaseLightFromEmission(i, isEmptyShape(p_360639_))); +@@ -120,7 +_,7 @@ + LightChunk chunk = this.chunkSource.getChunkForLighting(pos.x(), pos.z()); + if (chunk != null) { + chunk.findBlockLightSources((lightPos, state) -> { +- int lightEmission = state.getLightEmission(); ++ int lightEmission = state.getLightEmission(chunkSource.getLevel(), lightPos); + this.enqueueIncrease(lightPos.asLong(), LightEngine.QueueEntry.increaseLightFromEmission(lightEmission, isEmptyShape(state))); }); } 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 8b5b2cf18b..afd6d6b12b 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -171,7 +_,7 @@ - BlockState blockstate = p_369574_.getBlockState(blockpos); - FluidState fluidstate = blockstate.getFluidState(); - if (fluidstate.getType().isSame(this) && canPassThroughWall(direction, p_369574_, p_76037_, p_76038_, blockpos, blockstate)) { -- if (fluidstate.isSource()) { -+ if (fluidstate.isSource() && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(p_369574_, blockpos, blockstate, fluidstate.canConvertToSource(p_369574_, blockpos))) { - j++; +@@ -168,7 +_,7 @@ + BlockState blockState = level.getBlockState(relativePos); + FluidState fluidState = blockState.getFluidState(); + if (fluidState.getType().isSame(this) && canPassThroughWall(direction, level, pos, state, relativePos, blockState)) { +- if (fluidState.isSource()) { ++ if (fluidState.isSource() && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(level, relativePos, blockState, fluidState.canConvertToSource(level, relativePos))) { + neighbourSources++; } -@@ -179,7 +_,7 @@ +@@ -176,7 +_,7 @@ } } -- if (j >= 2 && this.canConvertToSource(p_369574_)) { -+ if (j >= 2) { - BlockState blockstate1 = p_369574_.getBlockState(blockpos$mutableblockpos.setWithOffset(p_76037_, Direction.DOWN)); - FluidState fluidstate1 = blockstate1.getFluidState(); - if (blockstate1.isSolid() || this.isSourceBlockOfThisType(fluidstate1)) { -@@ -257,6 +_,15 @@ - return this.getSource().defaultFluidState().setValue(FALLING, p_76069_); +- if (neighbourSources >= 2 && this.canConvertToSource(level)) { ++ if (neighbourSources >= 2) { + BlockState belowState = level.getBlockState(mutablePos.setWithOffset(pos, Direction.DOWN)); + FluidState belowFluid = belowState.getFluidState(); + if (belowState.isSolid() || this.isSourceBlockOfThisType(belowFluid)) { +@@ -263,6 +_,15 @@ + return this.getSource().defaultFluidState().setValue(FALLING, falling); } + @Override @@ -31,6 +31,6 @@ + * @deprecated Forge: Use {@link #canConvertToSource(FluidState, Level, BlockPos)} instead. + */ + @Deprecated - protected abstract boolean canConvertToSource(ServerLevel p_369955_); + protected abstract boolean canConvertToSource(ServerLevel level); - protected void spreadTo(LevelAccessor p_76005_, BlockPos p_76006_, BlockState p_76007_, Direction p_76008_, FluidState p_76009_) { + protected void spreadTo(final LevelAccessor level, final BlockPos pos, final BlockState state, final Direction direction, final FluidState target) { diff --git a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch index 6a9de15436..40013d245b 100644 --- a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch @@ -12,13 +12,13 @@ @@ -64,6 +_,8 @@ } - protected void entityInside(Level p_394813_, BlockPos p_394655_, Entity p_396881_, InsideBlockEffectApplier p_395108_) { -+ if (p_396881_.canFluidExtinguish(getFluidType())) -+ p_395108_.apply(net.minecraft.world.entity.InsideBlockEffectType.EXTINGUISH); + protected void entityInside(final Level level, final BlockPos pos, final Entity entity, final InsideBlockEffectApplier effectApplier) { ++ if (entity.canFluidExtinguish(getFluidType())) ++ effectApplier.apply(net.minecraft.world.entity.InsideBlockEffectType.EXTINGUISH); } protected @Nullable ParticleOptions getDripParticle() { -@@ -130,5 +_,12 @@ +@@ -123,5 +_,12 @@ @Deprecated public Holder.Reference builtInRegistryHolder() { return this.builtInRegistryHolder; diff --git a/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch b/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch index 74725d9260..d92d39eccc 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/level/material/FluidState.java +++ b/net/minecraft/world/level/material/FluidState.java -@@ -25,7 +_,7 @@ +@@ -21,7 +_,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.jspecify.annotations.Nullable; --public final class FluidState extends StateHolder { -+public final class FluidState extends StateHolder implements net.minecraftforge.common.extensions.IForgeFluidState { - public static final Codec CODEC = codec(BuiltInRegistries.FLUID.byNameCodec(), Fluid::defaultFluidState).stable(); +-public final class FluidState extends StateHolder implements TypedInstance { ++public final class FluidState extends StateHolder implements TypedInstance, net.minecraftforge.common.extensions.IForgeFluidState { + public static final Codec CODEC = codec(BuiltInRegistries.FLUID.byNameCodec(), Fluid::defaultFluidState, Fluid::getStateDefinition).stable(); public static final int AMOUNT_MAX = 9; public static final int AMOUNT_FULL = 8; -@@ -116,6 +_,7 @@ - return this.getType() == p_192918_; +@@ -109,6 +_,7 @@ + return this.getType().builtInRegistryHolder(); } + @Deprecated //Forge: Use more sensitive version 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 520a3faf73..63a2dcba5e 100644 --- a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch @@ -1,59 +1,58 @@ --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -92,7 +_,7 @@ - BlockState blockstate = p_367000_.getBlockState(blockpos); - if (blockstate.isAir()) { - if (this.hasFlammableNeighbours(p_367000_, blockpos)) { -- p_367000_.setBlockAndUpdate(blockpos, BaseFireBlock.getState(p_367000_, blockpos)); -+ p_367000_.setBlockAndUpdate(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_367000_, blockpos, p_230573_, Blocks.FIRE.defaultBlockState())); +@@ -93,7 +_,7 @@ + BlockState blockState = level.getBlockState(testPos); + if (blockState.isAir()) { + if (this.hasFlammableNeighbours(level, testPos)) { +- level.setBlockAndUpdate(testPos, BaseFireBlock.getState(level, testPos)); ++ level.setBlockAndUpdate(testPos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(level, testPos, pos, Blocks.FIRE.defaultBlockState())); return; } - } else if (blockstate.blocksMotion()) { -@@ -106,8 +_,8 @@ + } else if (blockState.blocksMotion()) { +@@ -107,8 +_,8 @@ return; } -- if (p_367000_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_367000_, blockpos1)) { -- p_367000_.setBlockAndUpdate(blockpos1.above(), BaseFireBlock.getState(p_367000_, blockpos1)); -+ if (p_367000_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_367000_, blockpos1, Direction.UP)) { -+ p_367000_.setBlockAndUpdate(blockpos1.above(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_367000_, blockpos1.above(), p_230573_, Blocks.FIRE.defaultBlockState())); +- if (level.isEmptyBlock(testPos.above()) && this.isFlammable(level, testPos)) { +- level.setBlockAndUpdate(testPos.above(), BaseFireBlock.getState(level, testPos)); ++ if (level.isEmptyBlock(testPos.above()) && this.isFlammable(level, testPos, Direction.UP)) { ++ level.setBlockAndUpdate(testPos.above(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(level, testPos.above(), pos, Blocks.FIRE.defaultBlockState())); } } } -@@ -123,7 +_,7 @@ +@@ -124,7 +_,7 @@ - private boolean hasFlammableNeighbours(LevelReader p_76228_, BlockPos p_76229_) { + private boolean hasFlammableNeighbours(final LevelReader level, final BlockPos pos) { for (Direction direction : Direction.values()) { -- if (this.isFlammable(p_76228_, p_76229_.relative(direction))) { -+ if (this.isFlammable(p_76228_, p_76229_.relative(direction), direction.getOpposite())) { +- if (this.isFlammable(level, pos.relative(direction))) { ++ if (this.isFlammable(level, pos.relative(direction), direction.getOpposite())) { return true; } } -@@ -131,10 +_,17 @@ +@@ -132,10 +_,17 @@ return false; } + /** @deprecated Forge: use {@link LavaFluid#isFlammable(LevelReader,BlockPos,Direction)} instead */ - private boolean isFlammable(LevelReader p_76246_, BlockPos p_76247_) { - return p_76246_.isInsideBuildHeight(p_76247_.getY()) && !p_76246_.hasChunkAt(p_76247_) ? false : p_76246_.getBlockState(p_76247_).ignitedByLava(); + private boolean isFlammable(final LevelReader level, final BlockPos pos) { + return level.isInsideBuildHeight(pos.getY()) && !level.hasChunkAt(pos) ? false : level.getBlockState(pos).ignitedByLava(); } -+ private boolean isFlammable(LevelReader p_76246_, BlockPos p_76247_, Direction face) { -+ return p_76246_.isInsideBuildHeight(p_76247_.getY()) && !p_76246_.hasChunkAt(p_76247_) ++ private boolean isFlammable(final LevelReader level, final BlockPos pos, Direction face) { ++ return level.isInsideBuildHeight(pos.getY()) && !level.hasChunkAt(pos) + ? false -+ : p_76246_.getBlockState(p_76247_).ignitedByLava() && p_76246_.getBlockState(p_76247_).isFlammable(p_76246_, p_76247_, face); ++ : level.getBlockState(pos).ignitedByLava() && level.getBlockState(pos).isFlammable(level, pos, face); + } + @Override public @Nullable ParticleOptions getDripParticle() { return ParticleTypes.DRIPPING_LAVA; -@@ -205,7 +_,8 @@ - FluidState fluidstate = p_76220_.getFluidState(p_76221_); - if (this.is(FluidTags.LAVA) && fluidstate.is(FluidTags.WATER)) { - if (p_76222_.getBlock() instanceof LiquidBlock) { -- p_76220_.setBlock(p_76221_, Blocks.STONE.defaultBlockState(), 3); -+ p_76220_.setBlock(p_76221_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_76220_, p_76221_, p_76221_, Blocks.STONE.defaultBlockState()), 3); -+ +@@ -206,7 +_,7 @@ + FluidState fluidState = level.getFluidState(pos); + if (this.is(FluidTags.LAVA) && fluidState.is(FluidTags.WATER)) { + if (state.getBlock() instanceof LiquidBlock) { +- level.setBlock(pos, Blocks.STONE.defaultBlockState(), 3); ++ level.setBlock(pos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(level, pos, pos, Blocks.STONE.defaultBlockState()), 3); } - this.fizz(p_76220_, p_76221_); + this.fizz(level, pos); diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/PathType.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/PathType.java.patch index 410f737542..afe10d46ef 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/PathType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/PathType.java.patch @@ -8,20 +8,12 @@ BLOCKED(-1.0F), OPEN(0.0F), WALKABLE(0.0F), -@@ -36,5 +_,17 @@ +@@ -37,5 +_,9 @@ public float getMalus() { return this.malus; + } + -+ @org.jetbrains.annotations.Nullable -+ public PathType getDanger() { -+ return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE : -+ (this == DAMAGE_OTHER || this == DANGER_OTHER ) ? DANGER_OTHER : -+ (this == LAVA) ? DAMAGE_FIRE : -+ null; -+ } -+ + public static PathType create(String name, float malus) { + throw new IllegalArgumentException("Enum not extended"); } 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 b69c4f1bc6..48ec5af73f 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,48 +1,48 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -471,6 +_,16 @@ - for (int k = -1; k <= 1; k++) { - if (i != 0 || k != 0) { - PathType pathtype = p_334221_.getPathTypeFromState(p_336062_ + i, p_335259_ + j, p_336315_ + k); +@@ -494,6 +_,16 @@ + for (int dz = -1; dz <= 1; dz++) { + if (dx != 0 || dz != 0) { + PathType pathType = context.getPathTypeFromState(x + dx, y + dy, z + dz); + -+ var pos = new BlockPos(p_336062_ + i, p_335259_ + j, p_336315_ + k); -+ var blockstate = p_334221_.level().getBlockState(pos); ++ var pos = new BlockPos(x + dx, y + dy, z + dz); ++ var blockstate = context.level().getBlockState(pos); + -+ var blockPathType = blockstate.getAdjacentBlockPathType(p_334221_.level(), pos, null, p_333971_); -+ if (blockPathType != null) return blockPathType; ++ var adjacentBlockPathType = blockstate.getAdjacentBlockPathType(context.level(), pos, null, blockPathType); ++ if (adjacentBlockPathType != null) return adjacentBlockPathType; + -+ var fluidPathType = blockstate.getFluidState().getAdjacentBlockPathType(p_334221_.level(), pos, null, p_333971_); -+ if (fluidPathType != null) return fluidPathType; ++ var adjacentFluidPathType = blockstate.getFluidState().getAdjacentBlockPathType(context.level(), pos, null, blockPathType); ++ if (adjacentFluidPathType != null) return adjacentFluidPathType; + - if (pathtype == PathType.DAMAGE_OTHER) { - return PathType.DANGER_OTHER; + if (pathType == PathType.DAMAGING) { + return PathType.DAMAGING_IN_NEIGHBOR; } -@@ -497,6 +_,10 @@ - protected static PathType getPathTypeFromState(BlockGetter p_335222_, BlockPos p_331935_) { - BlockState blockstate = p_335222_.getBlockState(p_331935_); - Block block = blockstate.getBlock(); +@@ -520,6 +_,10 @@ + protected static PathType getPathTypeFromState(final BlockGetter level, final BlockPos pos) { + BlockState blockState = level.getBlockState(pos); + Block block = blockState.getBlock(); + -+ var type = blockstate.getBlockPathType(p_335222_, p_331935_, null); ++ var type = blockState.getBlockPathType(level, pos, null); + if (type != null) return type; + - if (blockstate.isAir()) { + if (blockState.isAir()) { return PathType.OPEN; - } else if (blockstate.is(BlockTags.TRAPDOORS) || blockstate.is(Blocks.LILY_PAD) || blockstate.is(Blocks.BIG_DRIPLEAF)) { -@@ -511,6 +_,8 @@ - return PathType.COCOA; - } else if (!blockstate.is(Blocks.WITHER_ROSE) && !blockstate.is(Blocks.POINTED_DRIPSTONE)) { - FluidState fluidstate = blockstate.getFluidState(); -+ var nonLoggableFluidPathType = fluidstate.getBlockPathType(p_335222_, p_331935_, null, false); + } +@@ -546,6 +_,8 @@ + + if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(BlockTags.SPELEOTHEMS)) { + FluidState fluidState = blockState.getFluidState(); ++ var nonLoggableFluidPathType = fluidState.getBlockPathType(level, pos, null, false); + if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; - if (fluidstate.is(FluidTags.LAVA)) { + if (fluidState.is(FluidTags.LAVA)) { return PathType.LAVA; - } else if (isBurningBlock(blockstate)) { -@@ -531,6 +_,8 @@ - if (!blockstate.isPathfindable(PathComputationType.LAND)) { - return PathType.BLOCKED; + } +@@ -558,6 +_,8 @@ + if (blockState.getValue(DoorBlock.OPEN)) { + return PathType.DOOR_OPEN; } else { -+ var loggableFluidPathType = fluidstate.getBlockPathType(p_335222_, p_331935_, null, true); ++ var loggableFluidPathType = fluidState.getBlockPathType(level, pos, null, true); + if (loggableFluidPathType != null) return loggableFluidPathType; - return fluidstate.is(FluidTags.WATER) ? PathType.WATER : PathType.OPEN; + return door.type().canOpenByHand() ? PathType.DOOR_WOOD_CLOSED : PathType.DOOR_IRON_CLOSED; } } else { diff --git a/patches/minecraft/net/minecraft/world/level/portal/PortalShape.java.patch b/patches/minecraft/net/minecraft/world/level/portal/PortalShape.java.patch index eb09eeb89d..3d5eded0bd 100644 --- a/patches/minecraft/net/minecraft/world/level/portal/PortalShape.java.patch +++ b/patches/minecraft/net/minecraft/world/level/portal/PortalShape.java.patch @@ -4,8 +4,8 @@ public static final int MAX_WIDTH = 21; private static final int MIN_HEIGHT = 3; public static final int MAX_HEIGHT = 21; -- private static final BlockBehaviour.StatePredicate FRAME = (p_77720_, p_77721_, p_77722_) -> p_77720_.is(Blocks.OBSIDIAN); -+ private static final BlockBehaviour.StatePredicate FRAME = (p_77720_, p_77721_, p_77722_) -> p_77720_.isPortalFrame(p_77721_, p_77722_); +- private static final BlockBehaviour.StatePredicate FRAME = (state, level, pos) -> state.is(Blocks.OBSIDIAN); ++ private static final BlockBehaviour.StatePredicate FRAME = (state, level, pos) -> state.isPortalFrame(level, pos); private static final float SAFE_TRAVEL_MAX_ENTITY_XY = 4.0F; private static final double SAFE_TRAVEL_MAX_VERTICAL_DELTA = 1.0; private final Direction.Axis axis; diff --git a/patches/minecraft/net/minecraft/world/level/storage/DimensionDataStorage.java.patch b/patches/minecraft/net/minecraft/world/level/storage/DimensionDataStorage.java.patch deleted file mode 100644 index 3221b7d6e7..0000000000 --- a/patches/minecraft/net/minecraft/world/level/storage/DimensionDataStorage.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/level/storage/DimensionDataStorage.java -+++ b/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -114,6 +_,10 @@ - } - - int i = NbtUtils.getDataVersion(compoundtag, 1343); -+ // Forge: Allow the data fixer to be null, leaving the modder responsible for keeping track of their own data formats -+ if (p_301060_ == null) -+ compoundtag1 = compoundtag; -+ else - compoundtag1 = p_301060_.update(this.fixerUpper, compoundtag, i, p_78160_); - } - 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 70a7d40342..48ba3f73e7 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -475,6 +_,11 @@ - return this.getDataTag(true); +@@ -566,6 +_,11 @@ + return unfixedDataTag; } -+ public CompoundTag getDataTagRaw(boolean fallback) throws IOException { ++ public CompoundTag getDataTagRaw(final boolean useFallback) throws IOException { + this.checkLock(); -+ return LevelStorageSource.readLevelDataTagRaw(fallback ? this.levelDirectory.oldDataFile() : this.levelDirectory.dataFile()); ++ return LevelStorageSource.readLevelDataTagRaw(this.getDataFile(useFallback)); + } + - private Dynamic getDataTag(boolean p_310699_) throws IOException { + public Dynamic getUnfixedDataTag(final boolean useFallback) throws IOException { this.checkLock(); - return LevelStorageSource.readLevelDataTagFixed(p_310699_ ? this.levelDirectory.oldDataFile() : this.levelDirectory.dataFile(), LevelStorageSource.this.fixerUpper); -@@ -488,6 +_,7 @@ - CompoundTag compoundtag = p_78292_.createTag(p_78291_, p_78293_); - CompoundTag compoundtag1 = new CompoundTag(); - compoundtag1.put("Data", compoundtag); -+ net.minecraftforge.common.ForgeHooks.writeAdditionalLevelSaveData(p_78292_, compoundtag1); - this.saveLevelData(compoundtag1); + Path dataFile = this.getDataFile(useFallback); +@@ -585,6 +_,7 @@ + CompoundTag dataTag = levelData.createTag(singleplayerUUID); + CompoundTag root = new CompoundTag(); + root.put("Data", dataTag); ++ net.minecraftforge.common.ForgeHooks.writeAdditionalLevelSaveData(levelData, root); + this.saveLevelData(root); } -@@ -507,6 +_,10 @@ +@@ -611,6 +_,10 @@ public Optional getIconFile() { return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); 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 4c69b872bf..981ea03650 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch @@ -7,18 +7,5 @@ -public class LevelSummary implements Comparable { +public class LevelSummary implements Comparable, net.minecraftforge.common.extensions.IForgeLevelSummary { public static final Component PLAY_WORLD = Component.translatable("selectWorld.select"); + public static final Component UPGRADE_AND_PLAY_WORLD = Component.translatable("selectWorld.upgrade_and_play"); private final LevelSettings settings; - private final LevelVersion levelVersion; -@@ -274,6 +_,12 @@ - public boolean canRecreate() { - return false; - } -+ } -+ -+ // TODO Forge: Remove in 1.22. It is kept here for binary compatibility, but already exists in IForgeLevelSummary -+ @Deprecated(forRemoval = true, since = "1.21.4") -+ public boolean isLifecycleExperimental() { -+ return net.minecraftforge.common.extensions.IForgeLevelSummary.super.isLifecycleExperimental(); - } - - public static class SymlinkLevelSummary extends LevelSummary { diff --git a/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch b/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch index 2161bb9b81..f2d7fc24aa 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -41,6 +_,7 @@ - Path path2 = path.resolve(p_78434_.getStringUUID() + ".dat"); - Path path3 = path.resolve(p_78434_.getStringUUID() + ".dat_old"); - Util.safeReplaceFile(path2, path1, path3); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_78434_, playerDir, p_78434_.getStringUUID()); - } catch (Exception exception) { - LOGGER.warn("Failed to save player data for {}", p_78434_.getPlainTextName()); + Path realFile = playerDirPath.resolve(player.getStringUUID() + ".dat"); + Path oldFile = playerDirPath.resolve(player.getStringUUID() + ".dat_old"); + Util.safeReplaceFile(realFile, tmpFile, oldFile); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, playerDir, player.getStringUUID()); + } catch (Exception ignored) { + LOGGER.warn("Failed to save player data for {}", player.getPlainTextName()); } @@ -83,5 +_,9 @@ - int i = NbtUtils.getDataVersion(p_450065_); - return DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, p_450065_, i); + int version = NbtUtils.getDataVersion(tag); + return DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, tag, version); }); + } + 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 bfe7ef6f73..c9d019189c 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -70,6 +_,7 @@ +@@ -42,6 +_,7 @@ + private final Set knownServerBrands; private boolean wasModded; private final Set removedFeatureFlags; - private final TimerQueue scheduledEvents; + private boolean confirmedExperimentalWarning = false; private PrimaryLevelData( - @Nullable CompoundTag p_277888_, -@@ -192,7 +_,7 @@ - p_251864_, - p_250651_, - p_78538_ + final @Nullable UUID singlePlayerUUID, +@@ -105,7 +_,7 @@ + settings, + specialWorldProperty, + worldGenSettingsLifecycle - ); -+ ).withConfirmedWarning(p_78538_ != Lifecycle.stable() && p_78531_.get("confirmedExperimentalSettings").asBoolean(false)); ++ ).withConfirmedWarning(worldGenSettingsLifecycle != Lifecycle.stable() && input.get("confirmedExperimentalSettings").asBoolean(false)); } @Override -@@ -257,6 +_,8 @@ - p_78547_.putInt("WanderingTraderSpawnDelay", this.wanderingTraderSpawnDelay); - p_78547_.putInt("WanderingTraderSpawnChance", this.wanderingTraderSpawnChance); - p_78547_.storeNullable("WanderingTraderId", UUIDUtil.CODEC, this.wanderingTraderId); -+ p_78547_.putString("forgeLifecycle", net.minecraftforge.common.ForgeHooks.encodeLifecycle(this.settings.getLifecycle())); -+ p_78547_.putBoolean("confirmedExperimentalSettings", this.confirmedExperimentalWarning); +@@ -142,6 +_,8 @@ + } + + tag.store(WorldDataConfiguration.MAP_CODEC, this.settings.dataConfiguration()); ++ tag.putString("forgeLifecycle", net.minecraftforge.common.ForgeHooks.encodeLifecycle(this.settings.lifecycle())); ++ tag.putBoolean("confirmedExperimentalSettings", this.confirmedExperimentalWarning); } - private static ListTag stringCollectionToTag(Set p_277880_) { -@@ -546,6 +_,16 @@ + public static void writeLastPlayed(final CompoundTag tag) { +@@ -327,6 +_,16 @@ public LevelSettings getLevelSettings() { return this.settings.copy(); } @@ -42,4 +42,4 @@ + @Deprecated - public static enum SpecialWorldProperty { + public enum SpecialWorldProperty { diff --git a/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch b/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch new file mode 100644 index 0000000000..d24788744b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/level/storage/SavedDataStorage.java ++++ b/net/minecraft/world/level/storage/SavedDataStorage.java +@@ -121,6 +_,9 @@ + } + + int version = NbtUtils.getDataVersion(tag, 1343); ++ // Forge: Allow the data fixer to be null, leaving the modder responsible for keeping track of their own data formats ++ if (type == null) ++ return tag; + return type.update(this.fixerUpper, tag, version, newVersion); + } + } diff --git a/patches/minecraft/net/minecraft/world/level/storage/TagValueOutput.java.patch b/patches/minecraft/net/minecraft/world/level/storage/TagValueOutput.java.patch new file mode 100644 index 0000000000..09edaa2282 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/TagValueOutput.java.patch @@ -0,0 +1,25 @@ +--- a/net/minecraft/world/level/storage/TagValueOutput.java ++++ b/net/minecraft/world/level/storage/TagValueOutput.java +@@ -17,15 +_,21 @@ + private final ProblemReporter problemReporter; + private final DynamicOps ops; + private final CompoundTag output; ++ public final HolderLookup.@org.jspecify.annotations.Nullable Provider lookup; + + private TagValueOutput(final ProblemReporter problemReporter, final DynamicOps ops, final CompoundTag output) { ++ this(problemReporter, ops, output, null); ++ } ++ ++ TagValueOutput(final ProblemReporter problemReporter, final DynamicOps ops, final CompoundTag output, final HolderLookup.@org.jspecify.annotations.Nullable Provider lookup) { + this.problemReporter = problemReporter; + this.ops = ops; + this.output = output; ++ this.lookup = lookup; + } + + public static TagValueOutput createWithContext(final ProblemReporter problemReporter, final HolderLookup.Provider provider) { +- return new TagValueOutput(problemReporter, provider.createSerializationContext(NbtOps.INSTANCE), new CompoundTag()); ++ return new TagValueOutput(problemReporter, provider.createSerializationContext(NbtOps.INSTANCE), new CompoundTag(), provider); + } + + public static TagValueOutput createWithoutContext(final ProblemReporter problemReporter) { 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 509d91bd07..7a75d879de 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,24 +1,24 @@ --- a/net/minecraft/world/level/storage/loot/LootContext.java +++ b/net/minecraft/world/level/storage/loot/LootContext.java -@@ -24,11 +_,17 @@ +@@ -25,11 +_,17 @@ private final RandomSource random; private final HolderGetter.Provider lootDataResolver; private final Set> visitedElements = Sets.newLinkedHashSet(); + private Identifier queriedLootTableId; - LootContext(LootParams p_287722_, RandomSource p_287702_, HolderGetter.Provider p_330439_) { -+ this(p_287722_, p_287702_, p_330439_, null); + private LootContext(final LootParams params, final RandomSource random, final HolderGetter.Provider lootDataResolver) { ++ this(params, random, lootDataResolver, null); + } + -+ LootContext(LootParams p_287722_, RandomSource p_287702_, HolderGetter.Provider p_330439_, Identifier queriedLootTableId) { - this.params = p_287722_; - this.random = p_287702_; - this.lootDataResolver = p_330439_; ++ LootContext(final LootParams params, final RandomSource random, final HolderGetter.Provider lootDataResolver, final Identifier queriedLootTableId) { + this.params = params; + this.random = random; + this.lootDataResolver = lootDataResolver; + this.queriedLootTableId = queriedLootTableId; } - public boolean hasParameter(ContextKey p_368930_) { -@@ -75,6 +_,10 @@ + public boolean hasParameter(final ContextKey key) { +@@ -76,6 +_,10 @@ return this.params.getLevel(); } @@ -26,11 +26,11 @@ + return this.params; + } + - public static LootContext.VisitedEntry createVisitedEntry(LootTable p_279327_) { - return new LootContext.VisitedEntry<>(LootDataType.TABLE, p_279327_); + public static LootContext.VisitedEntry createVisitedEntry(final LootTable table) { + return new LootContext.VisitedEntry<>(LootDataType.TABLE, table); } -@@ -87,6 +_,18 @@ - return new LootContext.VisitedEntry<>(LootDataType.MODIFIER, p_279163_); +@@ -88,6 +_,18 @@ + return new LootContext.VisitedEntry<>(LootDataType.MODIFIER, table); } + public int getLootingModifier() { @@ -45,17 +45,17 @@ + return this.queriedLootTableId == null ? net.minecraftforge.common.loot.LootTableIdCondition.UNKNOWN_LOOT_TABLE : this.queriedLootTableId; + } + - public static enum BlockEntityTarget implements StringRepresentable, LootContextArg.SimpleGetter { + public enum BlockEntityTarget implements StringRepresentable, LootContextArg.SimpleGetter { BLOCK_ENTITY("block_entity", LootContextParams.BLOCK_ENTITY); -@@ -112,11 +_,18 @@ +@@ -113,11 +_,18 @@ public static class Builder { private final LootParams params; private @Nullable RandomSource random; + private Identifier queriedLootTableId; // Forge: correctly pass around loot table ID with copy constructor - public Builder(LootParams p_287628_) { - this.params = p_287628_; + public Builder(final LootParams params) { + this.params = params; } + public Builder(LootContext context) { @@ -64,10 +64,10 @@ + this.queriedLootTableId = context.queriedLootTableId; + } + - public LootContext.Builder withOptionalRandomSeed(long p_78966_) { - if (p_78966_ != 0L) { - this.random = RandomSource.create(p_78966_); -@@ -130,6 +_,11 @@ + public LootContext.Builder withOptionalRandomSeed(final long seed) { + if (seed != 0L) { + this.random = RandomSource.create(seed); +@@ -131,6 +_,11 @@ return this; } @@ -79,12 +79,12 @@ public ServerLevel getLevel() { return this.params.getLevel(); } -@@ -138,7 +_,7 @@ - ServerLevel serverlevel = this.getLevel(); - MinecraftServer minecraftserver = serverlevel.getServer(); - RandomSource randomsource = Optional.ofNullable(this.random).or(() -> p_299315_.map(serverlevel::getRandomSequence)).orElseGet(serverlevel::getRandom); -- return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup()); -+ return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup(), queriedLootTableId); +@@ -139,7 +_,7 @@ + ServerLevel level = this.getLevel(); + MinecraftServer server = level.getServer(); + RandomSource random = Optional.ofNullable(this.random).or(() -> randomSequenceKey.map(server::getRandomSequence)).orElseGet(level::getRandom); +- return new LootContext(this.params, random, server.reloadableRegistries().lookup()); ++ return new LootContext(this.params, random, server.reloadableRegistries().lookup(), queriedLootTableId); } } 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 index 1c1ee23ac2..0a2c7fd3e0 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootParams.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootParams.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/storage/loot/LootParams.java +++ b/net/minecraft/world/level/storage/loot/LootParams.java @@ -53,6 +_,15 @@ - this.level = p_287594_; + this.level = level; } + @SuppressWarnings("unchecked") @@ -17,9 +17,9 @@ return this.level; } @@ -92,6 +_,10 @@ - public LootParams create(ContextKeySet p_367827_) { - ContextMap contextmap = this.params.create(p_367827_); - return new LootParams(this.level, contextmap, this.dynamicDrops, this.luck); + public LootParams create(final ContextKeySet contextKeySet) { + ContextMap keySet = this.params.create(contextKeySet); + return new LootParams(this.level, keySet, this.dynamicDrops, this.luck); + } + + public LootParams create() { 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 9d73e9ffa0..f0e1a9f4d9 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,53 +1,58 @@ --- a/net/minecraft/world/level/storage/loot/LootPool.java +++ b/net/minecraft/world/level/storage/loot/LootPool.java -@@ -34,10 +_,13 @@ - LootItemCondition.DIRECT_CODEC.listOf().optionalFieldOf("conditions", List.of()).forGetter(p_297008_ -> p_297008_.conditions), - LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_297009_ -> p_297009_.functions), - NumberProviders.CODEC.fieldOf("rolls").forGetter(p_297004_ -> p_297004_.rolls), -- NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297006_ -> p_297006_.bonusRolls) -+ NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297006_ -> p_297006_.bonusRolls), +@@ -33,10 +_,13 @@ + LootItemCondition.DIRECT_CODEC.listOf().optionalFieldOf("conditions", List.of()).forGetter(p -> p.conditions), + LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p -> p.functions), + NumberProviders.CODEC.fieldOf("rolls").forGetter(p -> p.rolls), +- NumberProviders.CODEC.optionalFieldOf("bonus_rolls", ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls) ++ NumberProviders.CODEC.optionalFieldOf("bonus_rolls", ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls), + Codec.STRING.optionalFieldOf("name").forGetter(p -> p.name.filter(n -> !n.startsWith("custom#"))), + net.minecraftforge.common.crafting.conditions.ICondition.OPTIONAL_FEILD_CODEC.forGetter(p -> p.forge_condition) ) - .apply(p_341975_, LootPool::new) + .apply(i, LootPool::new) ); + public static final Codec CONDITIONAL_CODEC = net.minecraftforge.common.crafting.conditions.ConditionCodec.checkingDecode(CODEC, () -> lootPool().build()); private final List entries; private final List conditions; private final Predicate compositeCondition; -@@ -45,13 +_,21 @@ +@@ -44,6 +_,8 @@ private final BiFunction compositeFunction; private NumberProvider rolls; private NumberProvider bonusRolls; + private java.util.Optional name; + private java.util.Optional forge_condition; -+ -+ LootPool(List p_298341_, List p_297697_, List p_299722_, NumberProvider p_165131_, NumberProvider p_165132_) { -+ this(p_298341_, p_297697_, p_299722_, p_165131_, p_165132_, java.util.Optional.empty(), java.util.Optional.empty()); -+ } - LootPool( - List p_298341_, - List p_297697_, - List p_299722_, - NumberProvider p_165131_, -- NumberProvider p_165132_ -+ NumberProvider p_165132_, -+ java.util.Optional name, -+ java.util.Optional forge_condition + private LootPool( + final List entries, +@@ -52,6 +_,18 @@ + final NumberProvider rolls, + final NumberProvider bonusRolls ) { - this.entries = p_298341_; - this.conditions = p_297697_; -@@ -60,6 +_,8 @@ - this.compositeFunction = LootItemFunctions.compose(p_299722_); - this.rolls = p_165131_; - this.bonusRolls = p_165132_; ++ this(entries, conditions, functions, rolls, bonusRolls, java.util.Optional.empty(), java.util.Optional.empty()); ++ } ++ ++ private LootPool( ++ final List entries, ++ final List conditions, ++ final List functions, ++ final NumberProvider rolls, ++ final NumberProvider bonusRolls, ++ final java.util.Optional name, ++ final java.util.Optional forge_condition ++ ) { + this.entries = entries; + this.conditions = conditions; + this.compositeCondition = Util.allOf(conditions); +@@ -59,6 +_,8 @@ + this.compositeFunction = LootItemFunctions.compose(functions); + this.rolls = rolls; + this.bonusRolls = bonusRolls; + this.name = name; + this.forge_condition = forge_condition; } - private void addRandomItem(Consumer p_79059_, LootContext p_79060_) { -@@ -127,12 +_,35 @@ + private void addRandomItem(final Consumer result, final LootContext context) { +@@ -118,12 +_,35 @@ return new LootPool.Builder(); } @@ -81,9 +86,9 @@ + @org.jetbrains.annotations.Nullable + private net.minecraftforge.common.crafting.conditions.ICondition forge_condition; - public LootPool.Builder setRolls(NumberProvider p_165134_) { - this.rolls = p_165134_; -@@ -163,8 +_,18 @@ + public LootPool.Builder setRolls(final NumberProvider rolls) { + this.rolls = rolls; +@@ -162,8 +_,18 @@ return this; } 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 76f70d25ed..7f9008ce24 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,66 +1,71 @@ --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java -@@ -41,7 +_,7 @@ - p_450068_ -> p_450068_.group( - LootContextParamSets.CODEC.lenientOptionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(p_297013_ -> p_297013_.paramSet), - Identifier.CODEC.optionalFieldOf("random_sequence").forGetter(p_297014_ -> p_297014_.randomSequence), -- LootPool.CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(p_297012_ -> p_297012_.pools), -+ LootPool.CONDITIONAL_CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(p_297012_ -> p_297012_.pools), - LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_297010_ -> p_297010_.functions) +@@ -39,7 +_,7 @@ + i -> i.group( + LootContextParamSets.CODEC.lenientOptionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(t -> t.paramSet), + Identifier.CODEC.optionalFieldOf("random_sequence").forGetter(t -> t.randomSequence), +- LootPool.CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(t -> t.pools), ++ LootPool.CONDITIONAL_CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(t -> t.pools), + LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(t -> t.functions) ) - .apply(p_450068_, LootTable::new) + .apply(i, LootTable::new) @@ -58,7 +_,7 @@ - LootTable(ContextKeySet p_365565_, Optional p_298628_, List p_298771_, List p_301234_) { - this.paramSet = p_365565_; - this.randomSequence = p_298628_; -- this.pools = p_298771_; -+ this.pools = Lists.newArrayList(p_298771_); - this.functions = p_301234_; - this.compositeFunction = LootItemFunctions.compose(p_301234_); + ) { + this.paramSet = paramSet; + this.randomSequence = randomSequence; +- this.pools = pools; ++ this.pools = Lists.newArrayList(pools); + this.functions = functions; + this.compositeFunction = LootItemFunctions.compose(functions); } @@ -81,10 +_,12 @@ }; } + @Deprecated // Use a non-'Raw' version of 'getRandomItems', so that the Forge Global Loot Modifiers will be applied - public void getRandomItemsRaw(LootParams p_287669_, Consumer p_287781_) { - this.getRandomItemsRaw(new LootContext.Builder(p_287669_).create(this.randomSequence), p_287781_); + public void getRandomItemsRaw(final LootParams params, final Consumer output) { + this.getRandomItemsRaw(new LootContext.Builder(params).create(this.randomSequence), output); } + @Deprecated // Use a non-'Raw' version of 'getRandomItems', so that the Forge Global Loot Modifiers will be applied - public void getRandomItemsRaw(LootContext p_79132_, Consumer p_79133_) { - LootContext.VisitedEntry visitedentry = LootContext.createVisitedEntry(this); - if (p_79132_.pushVisitedElement(visitedentry)) { -@@ -101,15 +_,15 @@ + public void getRandomItemsRaw(final LootContext context, final Consumer output) { + LootContext.VisitedEntry breadcrumb = LootContext.createVisitedEntry(this); + if (context.pushVisitedElement(breadcrumb)) { +@@ -101,18 +_,19 @@ } - public void getRandomItems(LootParams p_287748_, long p_287729_, Consumer p_287583_) { -- this.getRandomItemsRaw(new LootContext.Builder(p_287748_).withOptionalRandomSeed(p_287729_).create(this.randomSequence), createStackSplitter(p_287748_.getLevel(), p_287583_)); -+ this.getRandomItems(new LootContext.Builder(p_287748_).withOptionalRandomSeed(p_287729_).create(this.randomSequence)).forEach(p_287583_); + public void getRandomItems(final LootParams params, final long optionalLootTableSeed, final Consumer output) { +- this.getRandomItemsRaw( +- new LootContext.Builder(params).withOptionalRandomSeed(optionalLootTableSeed).create(this.randomSequence), ++ this.getRandomItems( ++ new LootContext.Builder(params).withOptionalRandomSeed(optionalLootTableSeed).create(this.randomSequence) ++ ).forEach( + createStackSplitter(params.getLevel(), output) + ); } - public void getRandomItems(LootParams p_287704_, Consumer p_287617_) { -- this.getRandomItemsRaw(p_287704_, createStackSplitter(p_287704_.getLevel(), p_287617_)); -+ this.getRandomItems(p_287704_).forEach(p_287617_); + public void getRandomItems(final LootParams params, final Consumer output) { +- this.getRandomItemsRaw(params, createStackSplitter(params.getLevel(), output)); ++ this.getRandomItems(params).forEach(createStackSplitter(params.getLevel(), output)); } - public void getRandomItems(LootContext p_79149_, Consumer p_79150_) { -- this.getRandomItemsRaw(p_79149_, createStackSplitter(p_79149_.getLevel(), p_79150_)); -+ this.getRandomItems(p_79149_).forEach(p_79150_); + public void getRandomItems(final LootContext context, final Consumer output) { +- this.getRandomItemsRaw(context, createStackSplitter(context.getLevel(), output)); ++ this.getRandomItems(context).forEach(createStackSplitter(context.getLevel(), output)); } - public ObjectArrayList getRandomItems(LootParams p_345012_, RandomSource p_344559_) { -@@ -126,7 +_,8 @@ + public ObjectArrayList getRandomItems(final LootParams params, final RandomSource randomSource) { +@@ -129,7 +_,8 @@ - private ObjectArrayList getRandomItems(LootContext p_230923_) { - ObjectArrayList objectarraylist = new ObjectArrayList<>(); -- this.getRandomItems(p_230923_, objectarraylist::add); -+ this.getRandomItemsRaw(p_230923_, createStackSplitter(p_230923_.getLevel(), objectarraylist::add)); -+ objectarraylist = net.minecraftforge.common.ForgeHooks.modifyLoot(this, objectarraylist, p_230923_); - return objectarraylist; + private ObjectArrayList getRandomItems(final LootContext context) { + ObjectArrayList result = new ObjectArrayList<>(); +- this.getRandomItems(context, result::add); ++ this.getRandomItemsRaw(context, createStackSplitter(context.getLevel(), result::add)); ++ result = net.minecraftforge.common.ForgeHooks.modifyLoot(this, result, context); + return result; } -@@ -215,6 +_,68 @@ +@@ -214,6 +_,68 @@ public static LootTable.Builder lootTable() { return new LootTable.Builder(); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java.patch index 1b36a1be69..86b37b2817 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java -@@ -65,8 +_,12 @@ +@@ -72,8 +_,12 @@ @Override - public ItemStack run(ItemStack p_344964_, LootContext p_345394_) { - Entity entity = p_345394_.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); -- if (entity instanceof LivingEntity livingentity) { -- int i = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity); -+ int i = 0; + public ItemStack run(final ItemStack itemStack, final LootContext context) { + Entity killer = context.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); +- if (killer instanceof LivingEntity entity) { +- int level = EnchantmentHelper.getEnchantmentLevel(this.enchantment, entity); ++ int level = 0; + if (this.enchantment.is(Enchantments.LOOTING)) -+ i = p_345394_.getLootingModifier(); -+ else if (entity instanceof LivingEntity livingentity) -+ i = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity); ++ level = context.getLootingModifier(); ++ else if (killer instanceof LivingEntity livingentity) ++ level = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity); + - if (i == 0) { - return p_344964_; + if (level == 0) { + return itemStack; } -@@ -76,7 +_,6 @@ +@@ -83,7 +_,6 @@ if (this.hasLimit()) { - p_344964_.limitSize(this.limit); + itemStack.limitSize(this.limit); } - } - return p_344964_; + return itemStack; } 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 deleted file mode 100644 index 0851d8d1ab..0000000000 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java -+++ b/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java -@@ -42,7 +_,7 @@ - if (optional.isPresent()) { - ItemStack itemstack = optional.get().value().assemble(singlerecipeinput, p_81269_.getLevel().registryAccess()); - if (!itemstack.isEmpty()) { -- return itemstack.copyWithCount(p_81268_.getCount()); -+ return itemstack.copyWithCount(p_81268_.getCount() * itemstack.getCount()); // Forge: Support smelting returning multiple - } - } - diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch index 3c14722dfa..6613f8eca5 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java +++ b/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java -@@ -20,7 +_,7 @@ +@@ -19,7 +_,7 @@ + REGISTRY.inverse()::get ); - public static final ContextKeySet EMPTY = register("empty", p_367081_ -> {}); - public static final ContextKeySet CHEST = register( -- "chest", p_360697_ -> p_360697_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) -+ "chest", p_360697_ -> p_360697_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.ATTACKING_ENTITY) //Forge: Chest Minecarts can have killers. - ); + public static final ContextKeySet EMPTY = register("empty", builder -> {}); +- public static final ContextKeySet CHEST = register("chest", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY)); ++ public static final ContextKeySet CHEST = register("chest", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.ATTACKING_ENTITY)); //Forge: Chest Minecarts can have killers. public static final ContextKeySet COMMAND = register( - "command", p_360688_ -> p_360688_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) -@@ -29,7 +_,7 @@ - "selector", p_360687_ -> p_360687_.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY) + "command", builder -> builder.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + ); +@@ -33,7 +_,7 @@ + .required(LootContextParams.ADDITIONAL_COST_COMPONENT_ALLOWED) ); public static final ContextKeySet FISHING = register( -- "fishing", p_360682_ -> p_360682_.required(LootContextParams.ORIGIN).required(LootContextParams.TOOL).optional(LootContextParams.THIS_ENTITY) -+ "fishing", p_360682_ -> p_360682_.required(LootContextParams.ORIGIN).required(LootContextParams.TOOL).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.ATTACKING_ENTITY).optional(LootContextParams.THIS_ENTITY) //Forge: Allow fisher, and bobber +- "fishing", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.TOOL).optional(LootContextParams.THIS_ENTITY) ++ "fishing", builder -> builder.required(LootContextParams.ORIGIN).required(LootContextParams.TOOL).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.ATTACKING_ENTITY).optional(LootContextParams.THIS_ENTITY) //Forge: Allow fisher, and bobber ); public static final ContextKeySet ENTITY = register( "entity", diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java.patch index 0eb94cd445..c85a4d3836 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithEnchantedBonusCondition.java -@@ -41,7 +_,11 @@ +@@ -40,7 +_,11 @@ - public boolean test(LootContext p_343845_) { - Entity entity = p_343845_.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); -- int i = entity instanceof LivingEntity livingentity ? EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity) : 0; -+ int i = 0; + public boolean test(final LootContext context) { + Entity killerEntity = context.getOptionalParameter(LootContextParams.ATTACKING_ENTITY); +- int enchantmentLevel = killerEntity instanceof LivingEntity livingKiller ? EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingKiller) : 0; ++ int enchantmentLevel = 0; + if (this.enchantment.is(Enchantments.LOOTING)) -+ i = p_343845_.getLootingModifier(); -+ else if (entity instanceof LivingEntity livingentity) -+ i = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity); - float f = i > 0 ? this.enchantedChance.calculate(i) : this.unenchantedChance; - return p_343845_.getRandom().nextFloat() < f; ++ enchantmentLevel = context.getLootingModifier(); ++ else if (killerEntity instanceof LivingEntity livingentity) ++ enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingentity); + float chance = enchantmentLevel > 0 ? this.enchantedChance.calculate(enchantmentLevel) : this.unenchantedChance; + return context.getRandom().nextFloat() < chance; } diff --git a/server_files/args.txt b/server_files/args.txt index 0437f563a2..af830f6a54 100644 --- a/server_files/args.txt +++ b/server_files/args.txt @@ -1 +1 @@ --Djava.net.preferIPv6Addresses=system -jar @SHIM_JAR_FILE@ +-Djava.net.preferIPv6Addresses=system -XX:+UseCompactObjectHeaders -jar @SHIM_JAR_FILE@ diff --git a/settings.gradle b/settings.gradle index 61fbb746c3..66b94fb4cd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,119 +1,34 @@ -pluginManagement { - repositories { - gradlePluginPortal() - //mavenLocal() - maven { url = 'https://maven.minecraftforge.net/' } - } -} +import groovy.transform.Field -buildscript { - dependencies { - classpath('com.google.code.gson:gson') { - version { - strictly '2.11.0' +pluginManagement { + private static final @Field String FORGEDEV_VERSION = '7.0.0-beta.51' + + if (new File('forgedev/settings.gradle').exists()) { + includeBuild 'forgedev' + } else { + resolutionStrategy.eachPlugin { + // TODO [ForgeDev] Consolidate these entry-points + switch (requested.id.id) { + case 'net.minecraftforge.forgedev': + case 'net.minecraftforge.forge.build.convention': + useVersion(FORGEDEV_VERSION) + break } } } + + repositories { + gradlePluginPortal() + maven { url = 'https://maven.minecraftforge.net/' } + //mavenLocal() + } } plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' } -dependencyResolutionManagement { - versionCatalogs { - libs { - plugin('apt', 'com.diffplug.eclipse.apt').version('4.2.0') - - library('forgespi', 'net.minecraftforge:forgespi:7.1.5') // Needs modlauncher - library('modlauncher', 'net.minecraftforge:modlauncher:10.2.4') // Needs securemodules - library('securemodules', 'net.minecraftforge:securemodules:2.2.23') // Needs unsafe - library('unsafe', 'net.minecraftforge:unsafe:0.9.2') - library('accesstransformers', 'net.minecraftforge:accesstransformers:8.2.2') - library('coremods', 'net.minecraftforge:coremods:5.2.6') - library('nashorn', 'org.openjdk.nashorn:nashorn-core:15.4') // Needed by coremods, because the JRE no longer ships JS - library('eventbus', 'net.minecraftforge:eventbus:7.0-beta.12') - library('eventbus-validator', 'net.minecraftforge:eventbus-validator:7.0-beta.12') - library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0') - - library('roimfs', 'net.minecraftforge:roimfs:1.0.0') // ReadOnlyInMemoryFileSystem - Used for JarInJar extraction at runtime - library('mixin', 'org.spongepowered:mixin:0.8.7') - version('mixinextras', '0.5.0') - library('mixinextras-forge', 'io.github.llamalad7', 'mixinextras-forge').versionRef('mixinextras') - library('mixinextras-common', 'io.github.llamalad7', 'mixinextras-common').versionRef('mixinextras') - library('jetbrains-annotations', 'org.jetbrains:annotations:24.1.0') // for ApiStatus annotations - library('jspecify', 'org.jspecify:jspecify:1.0.0') // for nullability annotations - library('slf4j-api', 'org.slf4j:slf4j-api:2.0.7') - library('maven-artifact', 'org.apache.maven:maven-artifact:3.8.8') - - // Google's InMemory File System. Used by ForgeDev Tests for now, but could be useful for a lot of things. - library('jimfs', 'com.google.jimfs:jimfs:1.3.0') - bundle('jimfs', ['guava', 'failureaccess']) - - version('bootstrap', '2.1.8') - library('bootstrap', 'net.minecraftforge', 'bootstrap' ).versionRef('bootstrap') // Needs modlauncher - library('bootstrap-api', 'net.minecraftforge', 'bootstrap-api' ).versionRef('bootstrap') - library('bootstrap-dev', 'net.minecraftforge', 'bootstrap-dev' ).versionRef('bootstrap') - library('bootstrap-shim', 'net.minecraftforge', 'bootstrap-shim').versionRef('bootstrap') - - // ASM it's used for so many of our hacks - version('asm', '9.8') - library('asm', 'org.ow2.asm', 'asm' ).versionRef('asm') - library('asm-tree', 'org.ow2.asm', 'asm-tree' ).versionRef('asm') - library('asm-util', 'org.ow2.asm', 'asm-util' ).versionRef('asm') - library('asm-commons', 'org.ow2.asm', 'asm-commons' ).versionRef('asm') - library('asm-analysis', 'org.ow2.asm', 'asm-analysis').versionRef('asm') - bundle('asm', ['asm', 'asm-tree', 'asm-util', 'asm-commons', 'asm-analysis']) - - // Terminal Console Appender.. essentually make pretty colors in the console, but it's been a PITA - library('terminalconsoleappender', 'net.minecrell:terminalconsoleappender:1.2.0') - version('jline', '3.25.1') - library('jline-reader', 'org.jline', 'jline-reader' ).versionRef('jline') - library('jline-terminal', 'org.jline', 'jline-terminal' ).versionRef('jline') - library('jline-terminal-jna', 'org.jline', 'jline-terminal-jna').versionRef('jline') // Colors and tab completeion - bundle('terminalconsoleappender', ['terminalconsoleappender', 'jline-reader', 'jline-terminal', 'jline-terminal-jna']) - - // The core of our configuration system, it has many flaws, but it works for the most part - version('night-config', '3.7.4') - library('night-config-toml', 'com.electronwill.night-config', 'toml').versionRef('night-config') - library('night-config-core', 'com.electronwill.night-config', 'core').versionRef('night-config') - bundle('night-config', ['night-config-toml', 'night-config-core']) - - // Jar in Jar FileSystem - version('jarjar', '0.4.2') - library('jarjar-fs', 'net.minecraftforge', 'JarJarFileSystems').versionRef('jarjar') - library('jarjar-meta', 'net.minecraftforge', 'JarJarMetadata' ).versionRef('jarjar') - library('jarjar-selector', 'net.minecraftforge', 'JarJarSelector' ).versionRef('jarjar') - bundle('jarjar', ['jarjar-fs', 'jarjar-selector', 'jarjar-meta']) - - // These are libraries shipped by the MC launcher, try and keep them in sync with the manifest - // but honestly if we don't it just means we ship them as normal libraries by adding them to the installer config in the forge project - library('gson', 'com.google.code.gson:gson:2.11.0') - library('guava', 'com.google.guava:guava:33.3.1-jre') - library('failureaccess', 'com.google.guava:failureaccess:1.0.2') - - version('log4j', '2.24.3') - library('log4j-api', 'org.apache.logging.log4j', 'log4j-api' ).versionRef('log4j') - library('log4j-core', 'org.apache.logging.log4j', 'log4j-core').versionRef('log4j') - bundle('log4j', ['log4j-api', 'log4j-core']) - - library('apache-commons', 'org.apache.commons:commons-lang3:3.17.0') - library('mojang-logging', 'com.mojang:logging:1.5.10') - library('jopt-simple', 'net.sf.jopt-simple:jopt-simple:5.0.4') - library('commons-io', 'commons-io:commons-io:2.17.0') - - version('lwjgl', '3.3.3') - library('lwjgl', 'org.lwjgl', 'lwjgl' ).versionRef('lwjgl') - library('lwjgl-glfw', 'org.lwjgl', 'lwjgl-glfw' ).versionRef('lwjgl') - library('lwjgl-opengl', 'org.lwjgl', 'lwjgl-opengl').versionRef('lwjgl') - library('lwjgl-stb', 'org.lwjgl', 'lwjgl-stb' ).versionRef('lwjgl') - library('lwjgl-tinyfd', 'org.lwjgl', 'lwjgl-tinyfd').versionRef('lwjgl') - bundle('lwjgl', ['lwjgl', 'lwjgl-glfw', 'lwjgl-opengl', 'lwjgl-stb', 'lwjgl-tinyfd']) - } - } -} - -rootProject.name = 'ForgeRoot' +rootProject.name = 'forge' include 'fmlloader' include 'fmlcore' @@ -123,15 +38,175 @@ include 'lowcodelanguage' include 'fmlearlydisplay' include 'forge-transformers' -include ':mcp' -project(":mcp").projectDir = file("projects/mcp") +enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS' -include ':forge' -project(":forge").projectDir = file("projects/forge") -project(':forge').buildFileName = '../../build_forge.gradle' +gradle.beforeProject { Project project -> + project.pluginManager.withPlugin('net.minecraftforge.forge.build.convention') { + // NOTE: We are defining these variables in here so that the projects can stay isolated, increasing build time. + // See minecraft.versions.toml for the versions where you can change these values. + //@formatter:off + project.ext.javaVersion = project.gradleutils.unpack(project.bootLibs.versions.java) + project.ext.minecraftVersion = project.gradleutils.unpack(project.bootLibs.versions.minecraft) + project.version = project.gitversion.getMCTagOffsetBranch(project.ext.minecraftVersion) + project.ext.forgeVersion = project.version.substring(project.ext.minecraftVersion.length() + 1) + project.ext.minecraftNextVersion = project.gradleutils.unpack(project.bootLibs.versions.minecraft.next) + project.ext.mcpVersion = project.gradleutils.unpack(project.bootLibs.versions.mcp) + project.ext.changelogBase = project.gradleutils.unpack(project.bootLibs.versions.changelog.base) + //@formatter:on + } -if (false && !System.env.TEAMCITY_VERSION) { - include ':clean' - project(':clean').projectDir = file('projects/clean') - project(':clean').buildFileName = '../../build_clean.gradle' + // NOTE: We are adding dependencies to projects instead of through settings, so we don't have to apply forgedev in settings. + // Applying forgedev in settings will break IDE linting support, which makes it very hard to work with. + // We can reconsider this if/when switching to Kotlin DSL, or if JetBrains gets their shit together. + project.repositories { + // Libraries has to be before maven central because Mojang hosts a classifer that central doesn't (org.lwjgl:lwjgl-freetype:3.3.3:natives-macos-patch) + maven { url = 'https://libraries.minecraft.net/' } + mavenCentral() + + project.pluginManager.withPlugin('net.minecraftforge.gradleutils') { + maven project.gradleutils.forgeMaven + } + + project.pluginManager.withPlugin('net.minecraftforge.forgedev') { + maven project.forgedev.mavenizer + } + + mavenLocal() + } +} + +dependencyResolutionManagement.versionCatalogs { + register('bootLibs') { + description = 'Important version numbers that are externally declared for easy modification.' + + // Contains Java, Minecraft, and MCP versions + from(files('minecraft.versions.toml')) + } + + register('buildLibs') { + description = 'Libraries used solely during the build and publish process.' + + library 'binarypatcher', 'net.minecraftforge', 'binarypatcher' version '1.3.4' + library 'installer', 'net.minecraftforge', 'installer' version '2.2.+' + library 'installertools', 'net.minecraftforge', 'installertools' version '1.4.5' + library 'srg2source', 'net.minecraftforge', 'Srg2Source' version '8.2.0' + } + + //@formatter:off + register('libs') { + description = 'Libraries used by Forge and its subprojects.' + + plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' + plugin 'versions', 'com.github.ben-manes.versions' version '0.54.0' + plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.4.5' + plugin 'gitversion', 'net.minecraftforge.gitversion' version '3.1.7' + plugin 'changelog', 'net.minecraftforge.changelog' version '3.2.2' + plugin 'download', 'de.undercouch.download' version '5.6.0' + plugin 'jarsigner', 'net.minecraftforge.gradlejarsigner' version '1.2.1' + plugin 'apt', 'com.diffplug.eclipse.apt' version '4.4.1' + + // TODO [Forge][Buildscript We should not be needing to manually add transitive dependencies + // If we need to make strict versions for dependencies, we should do so using dependency constraints + library 'forgespi', 'net.minecraftforge', 'forgespi' version '8.0.0' // Needs modlauncher + library 'modlauncher', 'net.minecraftforge', 'modlauncher' version '10.2.6' // Needs securemodules + library 'securemodules', 'net.minecraftforge', 'securemodules' version '2.2.24' // Needs unsafe + library 'unsafe', 'net.minecraftforge', 'unsafe' version '0.9.2' + library 'accesstransformers', 'net.minecraftforge', 'accesstransformers' version '8.2.17' + library 'coremods-api', 'net.minecraftforge', 'coremods-api' version '5.3.1' + version 'eventbus', '7.0.5' + library 'eventbus', 'net.minecraftforge', 'eventbus' versionRef 'eventbus' + library 'eventbus-validator', 'net.minecraftforge', 'eventbus-validator' versionRef 'eventbus' + library 'mergetool-api', 'net.minecraftforge', 'mergetool-api' version '1.0' + + library 'roimfs', 'net.minecraftforge', 'roimfs' version '1.0.0' // ReadOnlyInMemoryFileSystem - Used for JarInJar extraction at runtime + library 'mixin', 'org.spongepowered', 'mixin' version '0.8.7' + version 'mixinextras', '0.5.4' + library 'mixinextras-forge', 'io.github.llamalad7', 'mixinextras-forge' versionRef 'mixinextras' + library 'mixinextras-common', 'io.github.llamalad7', 'mixinextras-common' versionRef 'mixinextras' + library 'jetbrains-annotations', 'org.jetbrains', 'annotations' version '24.0.1' // for ApiStatus annotations + library 'jspecify', 'org.jspecify', 'jspecify' version '1.0.0' // for nullability annotations + library 'slf4j-api', 'org.slf4j', 'slf4j-api' version '2.0.17' + library 'maven-artifact', 'org.apache.maven', 'maven-artifact' version '3.8.8' + + // Google's InMemory File System. Used by ForgeDev Tests for now, but could be useful for a lot of things. + library 'jimfs', 'com.google.jimfs:jimfs:1.3.0' + bundle 'jimfs', ['guava', 'failureaccess'] + + version 'bootstrap', '2.1.8' + library 'bootstrap', 'net.minecraftforge', 'bootstrap' versionRef 'bootstrap' // Needs modlauncher + library 'bootstrap-api', 'net.minecraftforge', 'bootstrap-api' versionRef 'bootstrap' + library 'bootstrap-dev', 'net.minecraftforge', 'bootstrap-dev' versionRef 'bootstrap' + library 'bootstrap-shim', 'net.minecraftforge', 'bootstrap-shim' versionRef 'bootstrap' + + // ASM it's used for so many of our hacks + version 'asm', '9.10.1' + library 'asm', 'org.ow2.asm', 'asm' versionRef 'asm' + library 'asm-tree', 'org.ow2.asm', 'asm-tree' versionRef 'asm' + library 'asm-util', 'org.ow2.asm', 'asm-util' versionRef 'asm' + library 'asm-commons', 'org.ow2.asm', 'asm-commons' versionRef 'asm' + library 'asm-analysis', 'org.ow2.asm', 'asm-analysis' versionRef 'asm' + bundle 'asm', ['asm', 'asm-tree', 'asm-util', 'asm-commons', 'asm-analysis'] + + // Terminal Console Appender. essentially make pretty colors in the console, but it's been a PITA + library 'terminalconsoleappender', 'net.minecrell', 'terminalconsoleappender' version '1.2.0' + version 'jline', '3.25.1' + library 'jline-reader', 'org.jline', 'jline-reader' versionRef 'jline' + library 'jline-terminal', 'org.jline', 'jline-terminal' versionRef 'jline' + library 'jline-terminal-jna', 'org.jline', 'jline-terminal-jna' versionRef 'jline' // Colors and tab completeion + bundle 'terminalconsoleappender', ['terminalconsoleappender', 'jline-reader', 'jline-terminal', 'jline-terminal-jna'] + + // The core of our configuration system, it has many flaws, but it works for the most part + version 'night-config', '3.7.4' + library 'night-config-toml', 'com.electronwill.night-config', 'toml' versionRef 'night-config' + library 'night-config-core', 'com.electronwill.night-config', 'core' versionRef 'night-config' + bundle 'night-config', ['night-config-toml', 'night-config-core'] + + // Jar in Jar FileSystem + version 'jarjar', '0.4.2' + library 'jarjar-fs', 'net.minecraftforge', 'JarJarFileSystems' versionRef 'jarjar' + library 'jarjar-meta', 'net.minecraftforge', 'JarJarMetadata' versionRef 'jarjar' + library 'jarjar-selector', 'net.minecraftforge', 'JarJarSelector' versionRef 'jarjar' + bundle 'jarjar', ['jarjar-fs', 'jarjar-selector', 'jarjar-meta'] + + // These are libraries shipped by the MC launcher, try and keep them in sync with the manifest + // but honestly if we don't it just means we ship them as normal libraries by adding them to the installer config in the forge project + library 'gson', 'com.google.code.gson', 'gson' version '2.14.0' + library 'guava', 'com.google.guava', 'guava' version '33.6.0-jre' + library 'failureaccess', 'com.google.guava', 'failureaccess' version '1.0.3' + + version 'log4j', '2.26.0' + library 'log4j-api', 'org.apache.logging.log4j', 'log4j-api' versionRef 'log4j' + library 'log4j-core', 'org.apache.logging.log4j', 'log4j-core' versionRef 'log4j' + bundle 'log4j', ['log4j-api', 'log4j-core'] + + library 'apache-commons', 'org.apache.commons', 'commons-lang3' version '3.20.0' + library 'mojang-logging', 'com.mojang', 'logging' version '1.7.12' + library 'jopt-simple', 'net.sf.jopt-simple', 'jopt-simple' version '5.0.4' + library 'commons-io', 'commons-io', 'commons-io' version '2.20.0' + + version 'lwjgl', '3.4.1' + library 'lwjgl', 'org.lwjgl', 'lwjgl' versionRef 'lwjgl' + library 'lwjgl-glfw', 'org.lwjgl', 'lwjgl-glfw' versionRef 'lwjgl' + library 'lwjgl-opengl', 'org.lwjgl', 'lwjgl-opengl' versionRef 'lwjgl' + library 'lwjgl-stb', 'org.lwjgl', 'lwjgl-stb' versionRef 'lwjgl' + library 'lwjgl-tinyfd', 'org.lwjgl', 'lwjgl-tinyfd' versionRef 'lwjgl' + bundle 'lwjgl', ['lwjgl', 'lwjgl-glfw', 'lwjgl-opengl', 'lwjgl-stb', 'lwjgl-tinyfd'] + } + + register('earlyDisplayLibs') { + version 'slf4j', '2.0.17' + library 'slf4j-api', 'org.slf4j', 'slf4j-api' versionRef 'slf4j' + library 'slf4j-jdk14', 'org.slf4j', 'slf4j-jdk14' versionRef 'slf4j' + } + + register('earlyDisplayTestLibs') { + library 'powermock-core', 'org.powermock', 'powermock-core' version '2.0.9' + + library 'lwjgl', 'org.lwjgl', 'lwjgl' withoutVersion() + library 'lwjgl-glfw', 'org.lwjgl', 'lwjgl-glfw' withoutVersion() + library 'lwjgl-opengl', 'org.lwjgl', 'lwjgl-opengl' withoutVersion() + library 'lwjgl-stb', 'org.lwjgl', 'lwjgl-stb' withoutVersion() + bundle 'lwjgl', ['lwjgl', 'lwjgl-glfw', 'lwjgl-opengl', 'lwjgl-stb'] + } + //@formatter:on } diff --git a/src/main/generated/assets/minecraft/atlases/items.json b/src/main/generated/assets/minecraft/atlases/items.json new file mode 100644 index 0000000000..6dd66854ab --- /dev/null +++ b/src/main/generated/assets/minecraft/atlases/items.json @@ -0,0 +1,14 @@ +{ + "sources": [ + { + "type": "minecraft:single", + "resource": "minecraft:block/lava_still", + "sprite": "minecraft:item/lava_still" + }, + { + "type": "minecraft:single", + "resource": "minecraft:block/water_still", + "sprite": "minecraft:item/water_still" + } + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/barrels.json b/src/main/generated/data/c/tags/block/barrels.json index 94bded15d8..5e84e807f6 100644 --- a/src/main/generated/data/c/tags/block/barrels.json +++ b/src/main/generated/data/c/tags/block/barrels.json @@ -1,9 +1,5 @@ { "values": [ - "#c:barrels/wooden", - { - "id": "#forge:barrels", - "required": false - } + "#c:barrels/wooden" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/barrels/wooden.json b/src/main/generated/data/c/tags/block/barrels/wooden.json index fedbc8ac53..b07daae1c0 100644 --- a/src/main/generated/data/c/tags/block/barrels/wooden.json +++ b/src/main/generated/data/c/tags/block/barrels/wooden.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:barrel", - { - "id": "#forge:barrels/wooden", - "required": false - } + "minecraft:barrel" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/bars.json b/src/main/generated/data/c/tags/block/bars.json new file mode 100644 index 0000000000..4f62bc5ffc --- /dev/null +++ b/src/main/generated/data/c/tags/block/bars.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#c:bars/copper", + "#c:bars/iron", + "#minecraft:bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/bars/copper.json b/src/main/generated/data/c/tags/block/bars/copper.json new file mode 100644 index 0000000000..f11b169128 --- /dev/null +++ b/src/main/generated/data/c/tags/block/bars/copper.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:copper_bars", + "minecraft:exposed_copper_bars", + "minecraft:weathered_copper_bars", + "minecraft:oxidized_copper_bars", + "minecraft:waxed_copper_bars", + "minecraft:waxed_exposed_copper_bars", + "minecraft:waxed_weathered_copper_bars", + "minecraft:waxed_oxidized_copper_bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/bars/iron.json b/src/main/generated/data/c/tags/block/bars/iron.json new file mode 100644 index 0000000000..ba12ec6f5a --- /dev/null +++ b/src/main/generated/data/c/tags/block/bars/iron.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:iron_bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/bookshelves.json b/src/main/generated/data/c/tags/block/bookshelves.json index 68f756dba9..c09b2185bd 100644 --- a/src/main/generated/data/c/tags/block/bookshelves.json +++ b/src/main/generated/data/c/tags/block/bookshelves.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:bookshelf", - { - "id": "#forge:bookshelves", - "required": false - } + "minecraft:bookshelf" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/chains.json b/src/main/generated/data/c/tags/block/chains.json index 58c2b30a5a..daba291fc0 100644 --- a/src/main/generated/data/c/tags/block/chains.json +++ b/src/main/generated/data/c/tags/block/chains.json @@ -2,12 +2,12 @@ "values": [ "minecraft:iron_chain", "minecraft:copper_chain", - "minecraft:waxed_copper_chain", "minecraft:exposed_copper_chain", - "minecraft:waxed_exposed_copper_chain", "minecraft:weathered_copper_chain", - "minecraft:waxed_weathered_copper_chain", "minecraft:oxidized_copper_chain", + "minecraft:waxed_copper_chain", + "minecraft:waxed_exposed_copper_chain", + "minecraft:waxed_weathered_copper_chain", "minecraft:waxed_oxidized_copper_chain" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/chests.json b/src/main/generated/data/c/tags/block/chests.json index b5adbfcc12..192ace8c7f 100644 --- a/src/main/generated/data/c/tags/block/chests.json +++ b/src/main/generated/data/c/tags/block/chests.json @@ -1,11 +1,15 @@ { "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#c:chests/wooden", - { - "id": "#forge:chests", - "required": false - } + "minecraft:copper_chest", + "minecraft:exposed_copper_chest", + "minecraft:weathered_copper_chest", + "minecraft:oxidized_copper_chest", + "minecraft:waxed_copper_chest", + "minecraft:waxed_exposed_copper_chest", + "minecraft:waxed_weathered_copper_chest", + "minecraft:waxed_oxidized_copper_chest", + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/chests/ender.json b/src/main/generated/data/c/tags/block/chests/ender.json similarity index 100% rename from src/main/generated/data/forge/tags/block/chests/ender.json rename to src/main/generated/data/c/tags/block/chests/ender.json diff --git a/src/main/generated/data/forge/tags/block/chests/trapped.json b/src/main/generated/data/c/tags/block/chests/trapped.json similarity index 100% rename from src/main/generated/data/forge/tags/block/chests/trapped.json rename to src/main/generated/data/c/tags/block/chests/trapped.json diff --git a/src/main/generated/data/c/tags/block/chests/wooden.json b/src/main/generated/data/c/tags/block/chests/wooden.json index 0659e860e6..86533f935b 100644 --- a/src/main/generated/data/c/tags/block/chests/wooden.json +++ b/src/main/generated/data/c/tags/block/chests/wooden.json @@ -1,10 +1,6 @@ { "values": [ "minecraft:chest", - "minecraft:trapped_chest", - { - "id": "#forge:chests/wooden", - "required": false - } + "minecraft:trapped_chest" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/cobblestones.json b/src/main/generated/data/c/tags/block/cobblestones.json index 3e7ff322a0..6019d0d40e 100644 --- a/src/main/generated/data/c/tags/block/cobblestones.json +++ b/src/main/generated/data/c/tags/block/cobblestones.json @@ -1,12 +1,8 @@ { "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate", - { - "id": "#forge:cobblestone", - "required": false - } + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/cobblestone/deepslate.json b/src/main/generated/data/c/tags/block/cobblestones/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/block/cobblestone/deepslate.json rename to src/main/generated/data/c/tags/block/cobblestones/deepslate.json diff --git a/src/main/generated/data/forge/tags/block/cobblestone/infested.json b/src/main/generated/data/c/tags/block/cobblestones/infested.json similarity index 100% rename from src/main/generated/data/forge/tags/block/cobblestone/infested.json rename to src/main/generated/data/c/tags/block/cobblestones/infested.json diff --git a/src/main/generated/data/forge/tags/block/cobblestone/mossy.json b/src/main/generated/data/c/tags/block/cobblestones/mossy.json similarity index 100% rename from src/main/generated/data/forge/tags/block/cobblestone/mossy.json rename to src/main/generated/data/c/tags/block/cobblestones/mossy.json diff --git a/src/main/generated/data/forge/tags/block/cobblestone/normal.json b/src/main/generated/data/c/tags/block/cobblestones/normal.json similarity index 100% rename from src/main/generated/data/forge/tags/block/cobblestone/normal.json rename to src/main/generated/data/c/tags/block/cobblestones/normal.json diff --git a/src/main/generated/data/forge/tags/block/end_stones.json b/src/main/generated/data/c/tags/block/end_stones.json similarity index 100% rename from src/main/generated/data/forge/tags/block/end_stones.json rename to src/main/generated/data/c/tags/block/end_stones.json diff --git a/src/main/generated/data/c/tags/block/fence_gates.json b/src/main/generated/data/c/tags/block/fence_gates.json new file mode 100644 index 0000000000..42dca6b914 --- /dev/null +++ b/src/main/generated/data/c/tags/block/fence_gates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:fence_gates/wooden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/fence_gates/wooden.json b/src/main/generated/data/c/tags/block/fence_gates/wooden.json similarity index 100% rename from src/main/generated/data/forge/tags/block/fence_gates/wooden.json rename to src/main/generated/data/c/tags/block/fence_gates/wooden.json diff --git a/src/main/generated/data/c/tags/block/fences.json b/src/main/generated/data/c/tags/block/fences.json new file mode 100644 index 0000000000..3185a1f46b --- /dev/null +++ b/src/main/generated/data/c/tags/block/fences.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/fences/nether_brick.json b/src/main/generated/data/c/tags/block/fences/nether_brick.json similarity index 100% rename from src/main/generated/data/forge/tags/block/fences/nether_brick.json rename to src/main/generated/data/c/tags/block/fences/nether_brick.json diff --git a/src/main/generated/data/forge/tags/block/fences/wooden.json b/src/main/generated/data/c/tags/block/fences/wooden.json similarity index 100% rename from src/main/generated/data/forge/tags/block/fences/wooden.json rename to src/main/generated/data/c/tags/block/fences/wooden.json diff --git a/src/main/generated/data/c/tags/block/flowers/small.json b/src/main/generated/data/c/tags/block/flowers/small.json index bdd6b47dd1..f2252429ca 100644 --- a/src/main/generated/data/c/tags/block/flowers/small.json +++ b/src/main/generated/data/c/tags/block/flowers/small.json @@ -15,10 +15,6 @@ "minecraft:wither_rose", "minecraft:torchflower", "minecraft:open_eyeblossom", - "minecraft:closed_eyeblossom", - { - "id": "#minecraft:small_flowers", - "required": false - } + "minecraft:closed_eyeblossom" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/flowers/tall.json b/src/main/generated/data/c/tags/block/flowers/tall.json index 156bf722ac..144eb89e0a 100644 --- a/src/main/generated/data/c/tags/block/flowers/tall.json +++ b/src/main/generated/data/c/tags/block/flowers/tall.json @@ -4,10 +4,6 @@ "minecraft:lilac", "minecraft:peony", "minecraft:rose_bush", - "minecraft:pitcher_plant", - { - "id": "#minecraft:tall_flowers", - "required": false - } + "minecraft:pitcher_plant" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_blocks.json b/src/main/generated/data/c/tags/block/glass_blocks.json index 55b243f654..61618a7498 100644 --- a/src/main/generated/data/c/tags/block/glass_blocks.json +++ b/src/main/generated/data/c/tags/block/glass_blocks.json @@ -2,10 +2,6 @@ "values": [ "#c:glass_blocks/colorless", "#c:glass_blocks/cheap", - "#c:glass_blocks/tinted", - { - "id": "#forge:glass", - "required": false - } + "#c:glass_blocks/tinted" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_blocks/cheap.json b/src/main/generated/data/c/tags/block/glass_blocks/cheap.json index 067bd8f78d..3465b3884b 100644 --- a/src/main/generated/data/c/tags/block/glass_blocks/cheap.json +++ b/src/main/generated/data/c/tags/block/glass_blocks/cheap.json @@ -16,10 +16,6 @@ "minecraft:brown_stained_glass", "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:black_stained_glass", - { - "id": "#forge:glass/silica", - "required": false - } + "minecraft:black_stained_glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_blocks/colorless.json b/src/main/generated/data/c/tags/block/glass_blocks/colorless.json index e46e8e25ba..ac8b5e5086 100644 --- a/src/main/generated/data/c/tags/block/glass_blocks/colorless.json +++ b/src/main/generated/data/c/tags/block/glass_blocks/colorless.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:glass", - { - "id": "#forge:glass/colorless", - "required": false - } + "minecraft:glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_blocks/tinted.json b/src/main/generated/data/c/tags/block/glass_blocks/tinted.json index e7fe6f40f0..4075a1556b 100644 --- a/src/main/generated/data/c/tags/block/glass_blocks/tinted.json +++ b/src/main/generated/data/c/tags/block/glass_blocks/tinted.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:tinted_glass", - { - "id": "#forge:glass/tinted", - "required": false - } + "minecraft:tinted_glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_panes.json b/src/main/generated/data/c/tags/block/glass_panes.json index 869c6fe993..c4bdf8ea3f 100644 --- a/src/main/generated/data/c/tags/block/glass_panes.json +++ b/src/main/generated/data/c/tags/block/glass_panes.json @@ -16,10 +16,6 @@ "minecraft:brown_stained_glass_pane", "minecraft:green_stained_glass_pane", "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane", - { - "id": "#forge:glass_panes", - "required": false - } + "minecraft:black_stained_glass_pane" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/glass_panes/colorless.json b/src/main/generated/data/c/tags/block/glass_panes/colorless.json index 5390c3bbd6..eb5756f964 100644 --- a/src/main/generated/data/c/tags/block/glass_panes/colorless.json +++ b/src/main/generated/data/c/tags/block/glass_panes/colorless.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:glass_pane", - { - "id": "#forge:glass_panes/colorless", - "required": false - } + "minecraft:glass_pane" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/gravel.json b/src/main/generated/data/c/tags/block/gravels.json similarity index 100% rename from src/main/generated/data/forge/tags/block/gravel.json rename to src/main/generated/data/c/tags/block/gravels.json diff --git a/src/main/generated/data/c/tags/block/natural_logs.json b/src/main/generated/data/c/tags/block/natural_logs.json new file mode 100644 index 0000000000..e03c0c2a6a --- /dev/null +++ b/src/main/generated/data/c/tags/block/natural_logs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:natural_logs/nether", + "#c:natural_logs/overworld" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/natural_logs/nether.json b/src/main/generated/data/c/tags/block/natural_logs/nether.json new file mode 100644 index 0000000000..192679af78 --- /dev/null +++ b/src/main/generated/data/c/tags/block/natural_logs/nether.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:crimson_stem", + "minecraft:warped_stem" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/natural_logs/overworld.json b/src/main/generated/data/c/tags/block/natural_logs/overworld.json new file mode 100644 index 0000000000..c351b11bb3 --- /dev/null +++ b/src/main/generated/data/c/tags/block/natural_logs/overworld.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:acacia_log", + "minecraft:birch_log", + "minecraft:cherry_log", + "minecraft:dark_oak_log", + "minecraft:jungle_log", + "minecraft:mangrove_log", + "minecraft:oak_log", + "minecraft:pale_oak_log", + "minecraft:spruce_log" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/natural_woods.json b/src/main/generated/data/c/tags/block/natural_woods.json new file mode 100644 index 0000000000..46efd3c3f6 --- /dev/null +++ b/src/main/generated/data/c/tags/block/natural_woods.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:acacia_wood", + "minecraft:birch_wood", + "minecraft:cherry_wood", + "minecraft:crimson_hyphae", + "minecraft:dark_oak_wood", + "minecraft:jungle_wood", + "minecraft:mangrove_wood", + "minecraft:oak_wood", + "minecraft:pale_oak_wood", + "minecraft:spruce_wood", + "minecraft:warped_hyphae" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/netherrack.json b/src/main/generated/data/c/tags/block/netherracks.json similarity index 100% rename from src/main/generated/data/forge/tags/block/netherrack.json rename to src/main/generated/data/c/tags/block/netherracks.json diff --git a/src/main/generated/data/c/tags/block/obsidians.json b/src/main/generated/data/c/tags/block/obsidians.json index 3986b73df1..5df539fb0e 100644 --- a/src/main/generated/data/c/tags/block/obsidians.json +++ b/src/main/generated/data/c/tags/block/obsidians.json @@ -1,10 +1,6 @@ { "values": [ "#c:obsidians/normal", - "#c:obsidians/crying", - { - "id": "#forge:obsidian", - "required": false - } + "#c:obsidians/crying" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ore_bearing_ground/deepslate.json b/src/main/generated/data/c/tags/block/ore_bearing_ground/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_bearing_ground/deepslate.json rename to src/main/generated/data/c/tags/block/ore_bearing_ground/deepslate.json diff --git a/src/main/generated/data/forge/tags/block/ore_bearing_ground/netherrack.json b/src/main/generated/data/c/tags/block/ore_bearing_ground/netherrack.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_bearing_ground/netherrack.json rename to src/main/generated/data/c/tags/block/ore_bearing_ground/netherrack.json diff --git a/src/main/generated/data/forge/tags/block/ore_bearing_ground/stone.json b/src/main/generated/data/c/tags/block/ore_bearing_ground/stone.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_bearing_ground/stone.json rename to src/main/generated/data/c/tags/block/ore_bearing_ground/stone.json diff --git a/src/main/generated/data/forge/tags/block/ore_rates/dense.json b/src/main/generated/data/c/tags/block/ore_rates/dense.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_rates/dense.json rename to src/main/generated/data/c/tags/block/ore_rates/dense.json diff --git a/src/main/generated/data/forge/tags/block/ore_rates/singular.json b/src/main/generated/data/c/tags/block/ore_rates/singular.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_rates/singular.json rename to src/main/generated/data/c/tags/block/ore_rates/singular.json diff --git a/src/main/generated/data/forge/tags/block/ore_rates/sparse.json b/src/main/generated/data/c/tags/block/ore_rates/sparse.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ore_rates/sparse.json rename to src/main/generated/data/c/tags/block/ore_rates/sparse.json diff --git a/src/main/generated/data/c/tags/block/ores.json b/src/main/generated/data/c/tags/block/ores.json index 7397864c1a..3b2293aa8d 100644 --- a/src/main/generated/data/c/tags/block/ores.json +++ b/src/main/generated/data/c/tags/block/ores.json @@ -1,18 +1,14 @@ { "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", "#c:ores/netherite_scrap", - "#forge:ores/redstone", - "#c:ores/quartz", - { - "id": "#forge:ores", - "required": false - } + "#c:ores/redstone", + "#c:ores/quartz" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ores/coal.json b/src/main/generated/data/c/tags/block/ores/coal.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/coal.json rename to src/main/generated/data/c/tags/block/ores/coal.json diff --git a/src/main/generated/data/forge/tags/block/ores/copper.json b/src/main/generated/data/c/tags/block/ores/copper.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/copper.json rename to src/main/generated/data/c/tags/block/ores/copper.json diff --git a/src/main/generated/data/forge/tags/block/ores/diamond.json b/src/main/generated/data/c/tags/block/ores/diamond.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/diamond.json rename to src/main/generated/data/c/tags/block/ores/diamond.json diff --git a/src/main/generated/data/forge/tags/block/ores/emerald.json b/src/main/generated/data/c/tags/block/ores/emerald.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/emerald.json rename to src/main/generated/data/c/tags/block/ores/emerald.json diff --git a/src/main/generated/data/forge/tags/block/ores/gold.json b/src/main/generated/data/c/tags/block/ores/gold.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/gold.json rename to src/main/generated/data/c/tags/block/ores/gold.json diff --git a/src/main/generated/data/forge/tags/block/ores/iron.json b/src/main/generated/data/c/tags/block/ores/iron.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/iron.json rename to src/main/generated/data/c/tags/block/ores/iron.json diff --git a/src/main/generated/data/forge/tags/block/ores/lapis.json b/src/main/generated/data/c/tags/block/ores/lapis.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/lapis.json rename to src/main/generated/data/c/tags/block/ores/lapis.json diff --git a/src/main/generated/data/c/tags/block/ores/netherite_scrap.json b/src/main/generated/data/c/tags/block/ores/netherite_scrap.json index 6cc208db8e..910d1fb8e6 100644 --- a/src/main/generated/data/c/tags/block/ores/netherite_scrap.json +++ b/src/main/generated/data/c/tags/block/ores/netherite_scrap.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:ancient_debris", - { - "id": "#forge:ores/netherite_scrap", - "required": false - } + "minecraft:ancient_debris" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/ores/quartz.json b/src/main/generated/data/c/tags/block/ores/quartz.json index 5433b2ed6f..f0bc7a4657 100644 --- a/src/main/generated/data/c/tags/block/ores/quartz.json +++ b/src/main/generated/data/c/tags/block/ores/quartz.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:nether_quartz_ore", - { - "id": "#forge:ores/quartz", - "required": false - } + "minecraft:nether_quartz_ore" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ores/redstone.json b/src/main/generated/data/c/tags/block/ores/redstone.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores/redstone.json rename to src/main/generated/data/c/tags/block/ores/redstone.json diff --git a/src/main/generated/data/forge/tags/block/ores_in_ground/deepslate.json b/src/main/generated/data/c/tags/block/ores_in_ground/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores_in_ground/deepslate.json rename to src/main/generated/data/c/tags/block/ores_in_ground/deepslate.json diff --git a/src/main/generated/data/forge/tags/block/ores_in_ground/netherrack.json b/src/main/generated/data/c/tags/block/ores_in_ground/netherrack.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores_in_ground/netherrack.json rename to src/main/generated/data/c/tags/block/ores_in_ground/netherrack.json diff --git a/src/main/generated/data/forge/tags/block/ores_in_ground/stone.json b/src/main/generated/data/c/tags/block/ores_in_ground/stone.json similarity index 100% rename from src/main/generated/data/forge/tags/block/ores_in_ground/stone.json rename to src/main/generated/data/c/tags/block/ores_in_ground/stone.json diff --git a/src/main/generated/data/c/tags/block/sands.json b/src/main/generated/data/c/tags/block/sands.json new file mode 100644 index 0000000000..f4b6e6a769 --- /dev/null +++ b/src/main/generated/data/c/tags/block/sands.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/sand/colorless.json b/src/main/generated/data/c/tags/block/sands/colorless.json similarity index 100% rename from src/main/generated/data/forge/tags/block/sand/colorless.json rename to src/main/generated/data/c/tags/block/sands/colorless.json diff --git a/src/main/generated/data/forge/tags/block/sand/red.json b/src/main/generated/data/c/tags/block/sands/red.json similarity index 100% rename from src/main/generated/data/forge/tags/block/sand/red.json rename to src/main/generated/data/c/tags/block/sands/red.json diff --git a/src/main/generated/data/c/tags/block/sandstone/blocks.json b/src/main/generated/data/c/tags/block/sandstone/blocks.json index 5684db6caf..df1b934e5c 100644 --- a/src/main/generated/data/c/tags/block/sandstone/blocks.json +++ b/src/main/generated/data/c/tags/block/sandstone/blocks.json @@ -1,10 +1,6 @@ { "values": [ "#c:sandstone/red_blocks", - "#c:sandstone/uncolored_blocks", - { - "id": "#forge:sandstone", - "required": false - } + "#c:sandstone/uncolored_blocks" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/skulls.json b/src/main/generated/data/c/tags/block/skulls.json index a9820b074f..063402cdbf 100644 --- a/src/main/generated/data/c/tags/block/skulls.json +++ b/src/main/generated/data/c/tags/block/skulls.json @@ -1,18 +1,18 @@ { "values": [ "minecraft:skeleton_skull", - "minecraft:skeleton_wall_skull", "minecraft:wither_skeleton_skull", - "minecraft:wither_skeleton_wall_skull", "minecraft:player_head", - "minecraft:player_wall_head", "minecraft:zombie_head", - "minecraft:zombie_wall_head", "minecraft:creeper_head", - "minecraft:creeper_wall_head", "minecraft:piglin_head", - "minecraft:piglin_wall_head", "minecraft:dragon_head", + "minecraft:skeleton_wall_skull", + "minecraft:wither_skeleton_wall_skull", + "minecraft:player_wall_head", + "minecraft:zombie_wall_head", + "minecraft:creeper_wall_head", + "minecraft:piglin_wall_head", "minecraft:dragon_wall_head" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks.json b/src/main/generated/data/c/tags/block/storage_blocks.json index 4354b34619..54cd9d84ad 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks.json +++ b/src/main/generated/data/c/tags/block/storage_blocks.json @@ -16,53 +16,6 @@ "#c:storage_blocks/redstone", "#c:storage_blocks/slime", "#c:storage_blocks/wheat", - { - "id": "#forge:storage_blocks/coal", - "required": false - }, - { - "id": "#forge:storage_blocks/copper", - "required": false - }, - { - "id": "#forge:storage_blocks/diamond", - "required": false - }, - { - "id": "#forge:storage_blocks/emerald", - "required": false - }, - { - "id": "#forge:storage_blocks/gold", - "required": false - }, - { - "id": "#forge:storage_blocks/iron", - "required": false - }, - { - "id": "#forge:storage_blocks/lapis", - "required": false - }, - { - "id": "#forge:storage_blocks/netherite", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_copper", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_gold", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_iron", - "required": false - }, - { - "id": "#forge:storage_blocks/redstone", - "required": false - } + "#c:storage_blocks/resin" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/coal.json b/src/main/generated/data/c/tags/block/storage_blocks/coal.json index b8479ced38..4b7921705b 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/coal.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/coal.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:coal_block", - { - "id": "#forge:storage_blocks/coal", - "required": false - } + "minecraft:coal_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/copper.json b/src/main/generated/data/c/tags/block/storage_blocks/copper.json index acd2a6a7a4..538486501f 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/copper.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/copper.json @@ -1,9 +1,12 @@ { "values": [ "minecraft:copper_block", - { - "id": "#forge:storage_blocks/copper", - "required": false - } + "minecraft:exposed_copper", + "minecraft:weathered_copper", + "minecraft:oxidized_copper", + "minecraft:waxed_copper_block", + "minecraft:waxed_exposed_copper", + "minecraft:waxed_weathered_copper", + "minecraft:waxed_oxidized_copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/diamond.json b/src/main/generated/data/c/tags/block/storage_blocks/diamond.json index 76426ba425..acd7f52de5 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/diamond.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/diamond.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:diamond_block", - { - "id": "#forge:storage_blocks/diamond", - "required": false - } + "minecraft:diamond_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/emerald.json b/src/main/generated/data/c/tags/block/storage_blocks/emerald.json index 7a41454d94..152063ec6c 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/emerald.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/emerald.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:emerald_block", - { - "id": "#forge:storage_blocks/emerald", - "required": false - } + "minecraft:emerald_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/gold.json b/src/main/generated/data/c/tags/block/storage_blocks/gold.json index a4116fc77f..546dde03c9 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/gold.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:gold_block", - { - "id": "#forge:storage_blocks/gold", - "required": false - } + "minecraft:gold_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/iron.json b/src/main/generated/data/c/tags/block/storage_blocks/iron.json index f0e9fcca1f..01fb2965f2 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/iron.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:iron_block", - { - "id": "#forge:storage_blocks/iron", - "required": false - } + "minecraft:iron_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/lapis.json b/src/main/generated/data/c/tags/block/storage_blocks/lapis.json index b5f41d8d4e..f4ca82bbd4 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/lapis.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/lapis.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:lapis_block", - { - "id": "#forge:storage_blocks/lapis", - "required": false - } + "minecraft:lapis_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/netherite.json b/src/main/generated/data/c/tags/block/storage_blocks/netherite.json index a3dfe0d53c..83433d44eb 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/netherite.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/netherite.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:netherite_block", - { - "id": "#forge:storage_blocks/netherite", - "required": false - } + "minecraft:netherite_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/raw_copper.json b/src/main/generated/data/c/tags/block/storage_blocks/raw_copper.json index 8f12fb63a7..1a21e230ef 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/raw_copper.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/raw_copper.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_copper_block", - { - "id": "#forge:storage_blocks/raw_copper", - "required": false - } + "minecraft:raw_copper_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/raw_gold.json b/src/main/generated/data/c/tags/block/storage_blocks/raw_gold.json index dcee1e225b..80781ce667 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/raw_gold.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/raw_gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_gold_block", - { - "id": "#forge:storage_blocks/raw_gold", - "required": false - } + "minecraft:raw_gold_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/raw_iron.json b/src/main/generated/data/c/tags/block/storage_blocks/raw_iron.json index 3f0ecf27ad..13ed9fc651 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/raw_iron.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/raw_iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_iron_block", - { - "id": "#forge:storage_blocks/raw_iron", - "required": false - } + "minecraft:raw_iron_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/redstone.json b/src/main/generated/data/c/tags/block/storage_blocks/redstone.json index 49fa7a5a26..f5fd89c541 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/redstone.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/redstone.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:redstone_block", - { - "id": "#forge:storage_blocks/redstone", - "required": false - } + "minecraft:redstone_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/resin.json b/src/main/generated/data/c/tags/block/storage_blocks/resin.json new file mode 100644 index 0000000000..7b95c08f1f --- /dev/null +++ b/src/main/generated/data/c/tags/block/storage_blocks/resin.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:resin_block" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/stripped_logs.json b/src/main/generated/data/c/tags/block/stripped_logs.json index ae69c996ad..95f74cbc5e 100644 --- a/src/main/generated/data/c/tags/block/stripped_logs.json +++ b/src/main/generated/data/c/tags/block/stripped_logs.json @@ -4,10 +4,13 @@ "minecraft:stripped_bamboo_block", "minecraft:stripped_birch_log", "minecraft:stripped_cherry_log", + "minecraft:stripped_crimson_stem", "minecraft:stripped_dark_oak_log", "minecraft:stripped_jungle_log", "minecraft:stripped_mangrove_log", "minecraft:stripped_oak_log", - "minecraft:stripped_spruce_log" + "minecraft:stripped_pale_oak_log", + "minecraft:stripped_spruce_log", + "minecraft:stripped_warped_stem" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/stripped_woods.json b/src/main/generated/data/c/tags/block/stripped_woods.json index 197542891d..0336fc751d 100644 --- a/src/main/generated/data/c/tags/block/stripped_woods.json +++ b/src/main/generated/data/c/tags/block/stripped_woods.json @@ -3,10 +3,13 @@ "minecraft:stripped_acacia_wood", "minecraft:stripped_birch_wood", "minecraft:stripped_cherry_wood", + "minecraft:stripped_crimson_hyphae", "minecraft:stripped_dark_oak_wood", "minecraft:stripped_jungle_wood", "minecraft:stripped_mangrove_wood", "minecraft:stripped_oak_wood", - "minecraft:stripped_spruce_wood" + "minecraft:stripped_pale_oak_wood", + "minecraft:stripped_spruce_wood", + "minecraft:stripped_warped_hyphae" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/villager_job_sites.json b/src/main/generated/data/c/tags/block/villager_job_sites.json index 859c128fce..714e373cca 100644 --- a/src/main/generated/data/c/tags/block/villager_job_sites.json +++ b/src/main/generated/data/c/tags/block/villager_job_sites.json @@ -5,9 +5,6 @@ "minecraft:brewing_stand", "minecraft:cartography_table", "minecraft:cauldron", - "minecraft:water_cauldron", - "minecraft:lava_cauldron", - "minecraft:powder_snow_cauldron", "minecraft:composter", "minecraft:fletching_table", "minecraft:grindstone", @@ -15,6 +12,9 @@ "minecraft:loom", "minecraft:smithing_table", "minecraft:smoker", - "minecraft:stonecutter" + "minecraft:stonecutter", + "minecraft:water_cauldron", + "minecraft:lava_cauldron", + "minecraft:powder_snow_cauldron" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/entity_type/boats.json b/src/main/generated/data/c/tags/entity_type/boats.json index 1e97228009..728a29826c 100644 --- a/src/main/generated/data/c/tags/entity_type/boats.json +++ b/src/main/generated/data/c/tags/entity_type/boats.json @@ -2,6 +2,8 @@ "values": [ "minecraft:acacia_boat", "minecraft:acacia_chest_boat", + "minecraft:bamboo_chest_raft", + "minecraft:bamboo_raft", "minecraft:birch_boat", "minecraft:birch_chest_boat", "minecraft:cherry_boat", diff --git a/src/main/generated/data/c/tags/entity_type/bosses.json b/src/main/generated/data/c/tags/entity_type/bosses.json index 5b52cfe527..4be4cce831 100644 --- a/src/main/generated/data/c/tags/entity_type/bosses.json +++ b/src/main/generated/data/c/tags/entity_type/bosses.json @@ -1,10 +1,6 @@ { "values": [ "minecraft:ender_dragon", - "minecraft:wither", - { - "id": "#forge:bosses", - "required": false - } + "minecraft:wither" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/entity_type/item_frames.json b/src/main/generated/data/c/tags/entity_type/item_frames.json new file mode 100644 index 0000000000..245eede509 --- /dev/null +++ b/src/main/generated/data/c/tags/entity_type/item_frames.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:item_frame", + "minecraft:glow_item_frame" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/fluid/beetroot_soup.json b/src/main/generated/data/c/tags/fluid/beetroot_soup.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/beetroot_soup.json rename to src/main/generated/data/c/tags/fluid/beetroot_soup.json diff --git a/src/main/generated/data/forge/tags/fluid/gaseous.json b/src/main/generated/data/c/tags/fluid/experience.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/gaseous.json rename to src/main/generated/data/c/tags/fluid/experience.json diff --git a/src/main/generated/data/forge/tags/fluid/mushroom_stew.json b/src/main/generated/data/c/tags/fluid/gaseous.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/mushroom_stew.json rename to src/main/generated/data/c/tags/fluid/gaseous.json diff --git a/src/main/generated/data/forge/tags/fluid/potion.json b/src/main/generated/data/c/tags/fluid/mushroom_stew.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/potion.json rename to src/main/generated/data/c/tags/fluid/mushroom_stew.json diff --git a/src/main/generated/data/forge/tags/fluid/rabbit_stew.json b/src/main/generated/data/c/tags/fluid/potion.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/rabbit_stew.json rename to src/main/generated/data/c/tags/fluid/potion.json diff --git a/src/main/generated/data/forge/tags/fluid/suspicious_stew.json b/src/main/generated/data/c/tags/fluid/rabbit_stew.json similarity index 100% rename from src/main/generated/data/forge/tags/fluid/suspicious_stew.json rename to src/main/generated/data/c/tags/fluid/rabbit_stew.json diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_cold/nether.json b/src/main/generated/data/c/tags/fluid/suspicious_stew.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_cold/nether.json rename to src/main/generated/data/c/tags/fluid/suspicious_stew.json diff --git a/src/main/generated/data/c/tags/item/armors.json b/src/main/generated/data/c/tags/item/armors.json index a1f3ac1ce1..34e6862f93 100644 --- a/src/main/generated/data/c/tags/item/armors.json +++ b/src/main/generated/data/c/tags/item/armors.json @@ -4,9 +4,9 @@ "#minecraft:chest_armor", "#minecraft:leg_armor", "#minecraft:foot_armor", - { - "id": "#forge:armors", - "required": false - } + "#c:armors/horse", + "#c:armors/nautilus", + "#c:armors/wolf", + "#c:armors/humanoid" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/armors/horse.json b/src/main/generated/data/c/tags/item/armors/horse.json new file mode 100644 index 0000000000..7f6b8ff97e --- /dev/null +++ b/src/main/generated/data/c/tags/item/armors/horse.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:copper_horse_armor", + "minecraft:diamond_horse_armor", + "minecraft:golden_horse_armor", + "minecraft:iron_horse_armor", + "minecraft:leather_horse_armor", + "minecraft:netherite_horse_armor" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/armors/humanoid.json b/src/main/generated/data/c/tags/item/armors/humanoid.json new file mode 100644 index 0000000000..5eb7c77a36 --- /dev/null +++ b/src/main/generated/data/c/tags/item/armors/humanoid.json @@ -0,0 +1,33 @@ +{ + "values": [ + "minecraft:chainmail_boots", + "minecraft:chainmail_chestplate", + "minecraft:chainmail_helmet", + "minecraft:chainmail_leggings", + "minecraft:copper_boots", + "minecraft:copper_chestplate", + "minecraft:copper_helmet", + "minecraft:copper_leggings", + "minecraft:diamond_boots", + "minecraft:diamond_chestplate", + "minecraft:diamond_helmet", + "minecraft:diamond_leggings", + "minecraft:golden_boots", + "minecraft:golden_chestplate", + "minecraft:golden_helmet", + "minecraft:golden_leggings", + "minecraft:iron_boots", + "minecraft:iron_chestplate", + "minecraft:iron_helmet", + "minecraft:iron_leggings", + "minecraft:leather_boots", + "minecraft:leather_chestplate", + "minecraft:leather_helmet", + "minecraft:leather_leggings", + "minecraft:netherite_boots", + "minecraft:netherite_chestplate", + "minecraft:netherite_helmet", + "minecraft:netherite_leggings", + "minecraft:turtle_helmet" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/armors/nautilus.json b/src/main/generated/data/c/tags/item/armors/nautilus.json new file mode 100644 index 0000000000..6b3bfa1f26 --- /dev/null +++ b/src/main/generated/data/c/tags/item/armors/nautilus.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_nautilus_armor", + "minecraft:diamond_nautilus_armor", + "minecraft:golden_nautilus_armor", + "minecraft:iron_nautilus_armor", + "minecraft:netherite_nautilus_armor" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/armors/wolf.json b/src/main/generated/data/c/tags/item/armors/wolf.json new file mode 100644 index 0000000000..1aed8bde94 --- /dev/null +++ b/src/main/generated/data/c/tags/item/armors/wolf.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:wolf_armor" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/barrels.json b/src/main/generated/data/c/tags/item/barrels.json index 94bded15d8..5e84e807f6 100644 --- a/src/main/generated/data/c/tags/item/barrels.json +++ b/src/main/generated/data/c/tags/item/barrels.json @@ -1,9 +1,5 @@ { "values": [ - "#c:barrels/wooden", - { - "id": "#forge:barrels", - "required": false - } + "#c:barrels/wooden" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/barrels/wooden.json b/src/main/generated/data/c/tags/item/barrels/wooden.json index fedbc8ac53..b07daae1c0 100644 --- a/src/main/generated/data/c/tags/item/barrels/wooden.json +++ b/src/main/generated/data/c/tags/item/barrels/wooden.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:barrel", - { - "id": "#forge:barrels/wooden", - "required": false - } + "minecraft:barrel" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bars.json b/src/main/generated/data/c/tags/item/bars.json new file mode 100644 index 0000000000..4f62bc5ffc --- /dev/null +++ b/src/main/generated/data/c/tags/item/bars.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#c:bars/copper", + "#c:bars/iron", + "#minecraft:bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bars/copper.json b/src/main/generated/data/c/tags/item/bars/copper.json new file mode 100644 index 0000000000..f11b169128 --- /dev/null +++ b/src/main/generated/data/c/tags/item/bars/copper.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:copper_bars", + "minecraft:exposed_copper_bars", + "minecraft:weathered_copper_bars", + "minecraft:oxidized_copper_bars", + "minecraft:waxed_copper_bars", + "minecraft:waxed_exposed_copper_bars", + "minecraft:waxed_weathered_copper_bars", + "minecraft:waxed_oxidized_copper_bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bars/iron.json b/src/main/generated/data/c/tags/item/bars/iron.json new file mode 100644 index 0000000000..ba12ec6f5a --- /dev/null +++ b/src/main/generated/data/c/tags/item/bars/iron.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:iron_bars" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/bones.json b/src/main/generated/data/c/tags/item/bones.json similarity index 100% rename from src/main/generated/data/forge/tags/item/bones.json rename to src/main/generated/data/c/tags/item/bones.json diff --git a/src/main/generated/data/c/tags/item/bookshelves.json b/src/main/generated/data/c/tags/item/bookshelves.json index 68f756dba9..c09b2185bd 100644 --- a/src/main/generated/data/c/tags/item/bookshelves.json +++ b/src/main/generated/data/c/tags/item/bookshelves.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:bookshelf", - { - "id": "#forge:bookshelves", - "required": false - } + "minecraft:bookshelf" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bricks.json b/src/main/generated/data/c/tags/item/bricks.json index ba6a10fc02..49e3c14ed5 100644 --- a/src/main/generated/data/c/tags/item/bricks.json +++ b/src/main/generated/data/c/tags/item/bricks.json @@ -1,6 +1,7 @@ { "values": [ "#c:bricks/normal", - "#c:bricks/nether" + "#c:bricks/nether", + "#c:bricks/resin" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bricks/resin.json b/src/main/generated/data/c/tags/item/bricks/resin.json new file mode 100644 index 0000000000..56a6448fb1 --- /dev/null +++ b/src/main/generated/data/c/tags/item/bricks/resin.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:resin_brick" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/chains.json b/src/main/generated/data/c/tags/item/chains.json index 58c2b30a5a..daba291fc0 100644 --- a/src/main/generated/data/c/tags/item/chains.json +++ b/src/main/generated/data/c/tags/item/chains.json @@ -2,12 +2,12 @@ "values": [ "minecraft:iron_chain", "minecraft:copper_chain", - "minecraft:waxed_copper_chain", "minecraft:exposed_copper_chain", - "minecraft:waxed_exposed_copper_chain", "minecraft:weathered_copper_chain", - "minecraft:waxed_weathered_copper_chain", "minecraft:oxidized_copper_chain", + "minecraft:waxed_copper_chain", + "minecraft:waxed_exposed_copper_chain", + "minecraft:waxed_weathered_copper_chain", "minecraft:waxed_oxidized_copper_chain" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/chests.json b/src/main/generated/data/c/tags/item/chests.json index b5adbfcc12..192ace8c7f 100644 --- a/src/main/generated/data/c/tags/item/chests.json +++ b/src/main/generated/data/c/tags/item/chests.json @@ -1,11 +1,15 @@ { "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#c:chests/wooden", - { - "id": "#forge:chests", - "required": false - } + "minecraft:copper_chest", + "minecraft:exposed_copper_chest", + "minecraft:weathered_copper_chest", + "minecraft:oxidized_copper_chest", + "minecraft:waxed_copper_chest", + "minecraft:waxed_exposed_copper_chest", + "minecraft:waxed_weathered_copper_chest", + "minecraft:waxed_oxidized_copper_chest", + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/chests/ender.json b/src/main/generated/data/c/tags/item/chests/ender.json similarity index 100% rename from src/main/generated/data/forge/tags/item/chests/ender.json rename to src/main/generated/data/c/tags/item/chests/ender.json diff --git a/src/main/generated/data/forge/tags/item/chests/trapped.json b/src/main/generated/data/c/tags/item/chests/trapped.json similarity index 100% rename from src/main/generated/data/forge/tags/item/chests/trapped.json rename to src/main/generated/data/c/tags/item/chests/trapped.json diff --git a/src/main/generated/data/c/tags/item/chests/wooden.json b/src/main/generated/data/c/tags/item/chests/wooden.json index 0659e860e6..86533f935b 100644 --- a/src/main/generated/data/c/tags/item/chests/wooden.json +++ b/src/main/generated/data/c/tags/item/chests/wooden.json @@ -1,10 +1,6 @@ { "values": [ "minecraft:chest", - "minecraft:trapped_chest", - { - "id": "#forge:chests/wooden", - "required": false - } + "minecraft:trapped_chest" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/clumps.json b/src/main/generated/data/c/tags/item/clumps.json new file mode 100644 index 0000000000..b5b9c68a30 --- /dev/null +++ b/src/main/generated/data/c/tags/item/clumps.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:clumps/resin" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/clumps/resin.json b/src/main/generated/data/c/tags/item/clumps/resin.json new file mode 100644 index 0000000000..a3986bda86 --- /dev/null +++ b/src/main/generated/data/c/tags/item/clumps/resin.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:resin_clump" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/cobblestones.json b/src/main/generated/data/c/tags/item/cobblestones.json index 3e7ff322a0..6019d0d40e 100644 --- a/src/main/generated/data/c/tags/item/cobblestones.json +++ b/src/main/generated/data/c/tags/item/cobblestones.json @@ -1,12 +1,8 @@ { "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate", - { - "id": "#forge:cobblestone", - "required": false - } + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/cobblestone/deepslate.json b/src/main/generated/data/c/tags/item/cobblestones/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/item/cobblestone/deepslate.json rename to src/main/generated/data/c/tags/item/cobblestones/deepslate.json diff --git a/src/main/generated/data/forge/tags/item/cobblestone/infested.json b/src/main/generated/data/c/tags/item/cobblestones/infested.json similarity index 100% rename from src/main/generated/data/forge/tags/item/cobblestone/infested.json rename to src/main/generated/data/c/tags/item/cobblestones/infested.json diff --git a/src/main/generated/data/forge/tags/item/cobblestone/mossy.json b/src/main/generated/data/c/tags/item/cobblestones/mossy.json similarity index 100% rename from src/main/generated/data/forge/tags/item/cobblestone/mossy.json rename to src/main/generated/data/c/tags/item/cobblestones/mossy.json diff --git a/src/main/generated/data/forge/tags/item/cobblestone/normal.json b/src/main/generated/data/c/tags/item/cobblestones/normal.json similarity index 100% rename from src/main/generated/data/forge/tags/item/cobblestone/normal.json rename to src/main/generated/data/c/tags/item/cobblestones/normal.json diff --git a/src/main/generated/data/c/tags/item/crops.json b/src/main/generated/data/c/tags/item/crops.json index 7a0bad9cab..452317ff33 100644 --- a/src/main/generated/data/c/tags/item/crops.json +++ b/src/main/generated/data/c/tags/item/crops.json @@ -9,10 +9,6 @@ "#c:crops/potato", "#c:crops/pumpkin", "#c:crops/sugar_cane", - "#c:crops/wheat", - { - "id": "#forge:crops", - "required": false - } + "#c:crops/wheat" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/crops/beetroot.json b/src/main/generated/data/c/tags/item/crops/beetroot.json index cc56242351..b28b723c4b 100644 --- a/src/main/generated/data/c/tags/item/crops/beetroot.json +++ b/src/main/generated/data/c/tags/item/crops/beetroot.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:beetroot", - { - "id": "#forge:crops/beetroot", - "required": false - } + "minecraft:beetroot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/crops/carrot.json b/src/main/generated/data/c/tags/item/crops/carrot.json index 9a637ed3cc..f9630d1347 100644 --- a/src/main/generated/data/c/tags/item/crops/carrot.json +++ b/src/main/generated/data/c/tags/item/crops/carrot.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:carrot", - { - "id": "#forge:crops/carrot", - "required": false - } + "minecraft:carrot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/crops/nether_wart.json b/src/main/generated/data/c/tags/item/crops/nether_wart.json index 9e8eb9e036..5960d80cb9 100644 --- a/src/main/generated/data/c/tags/item/crops/nether_wart.json +++ b/src/main/generated/data/c/tags/item/crops/nether_wart.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:nether_wart", - { - "id": "#forge:crops/nether_wart", - "required": false - } + "minecraft:nether_wart" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/crops/potato.json b/src/main/generated/data/c/tags/item/crops/potato.json index fca8ec880c..47fc151cd1 100644 --- a/src/main/generated/data/c/tags/item/crops/potato.json +++ b/src/main/generated/data/c/tags/item/crops/potato.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:potato", - { - "id": "#forge:crops/potato", - "required": false - } + "minecraft:potato" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/crops/wheat.json b/src/main/generated/data/c/tags/item/crops/wheat.json index 05dac35cc1..498cb445f6 100644 --- a/src/main/generated/data/c/tags/item/crops/wheat.json +++ b/src/main/generated/data/c/tags/item/crops/wheat.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:wheat", - { - "id": "#forge:crops/wheat", - "required": false - } + "minecraft:wheat" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drink_containing/bottle.json b/src/main/generated/data/c/tags/item/drink_containing/bottle.json new file mode 100644 index 0000000000..068ca91291 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drink_containing/bottle.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:potion", + "minecraft:honey_bottle", + "minecraft:ominous_bottle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drink_containing/bucket.json b/src/main/generated/data/c/tags/item/drink_containing/bucket.json new file mode 100644 index 0000000000..899451cb24 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drink_containing/bucket.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:milk_bucket" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drinks.json b/src/main/generated/data/c/tags/item/drinks.json new file mode 100644 index 0000000000..47b197fc27 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:drinks/honey", + "#c:drinks/juice", + "#c:drinks/magic", + "#c:drinks/milk", + "#c:drinks/ominous", + "#c:drinks/water", + "#c:drinks/watery" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drinks/honey.json b/src/main/generated/data/c/tags/item/drinks/honey.json new file mode 100644 index 0000000000..6049f1a5d4 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks/honey.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:honey_bottle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dead.json b/src/main/generated/data/c/tags/item/drinks/juice.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_dead.json rename to src/main/generated/data/c/tags/item/drinks/juice.json diff --git a/src/main/generated/data/c/tags/item/drinks/magic.json b/src/main/generated/data/c/tags/item/drinks/magic.json new file mode 100644 index 0000000000..01667a1a94 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks/magic.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:ominous_bottle", + "minecraft:potion" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drinks/milk.json b/src/main/generated/data/c/tags/item/drinks/milk.json new file mode 100644 index 0000000000..899451cb24 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks/milk.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:milk_bucket" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/drinks/ominous.json b/src/main/generated/data/c/tags/item/drinks/ominous.json new file mode 100644 index 0000000000..0f2f793e75 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks/ominous.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:ominous_bottle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dense/end.json b/src/main/generated/data/c/tags/item/drinks/water.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_dense/end.json rename to src/main/generated/data/c/tags/item/drinks/water.json diff --git a/src/main/generated/data/c/tags/item/drinks/watery.json b/src/main/generated/data/c/tags/item/drinks/watery.json new file mode 100644 index 0000000000..c7307d8407 --- /dev/null +++ b/src/main/generated/data/c/tags/item/drinks/watery.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:potion" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/dusts/glowstone.json b/src/main/generated/data/c/tags/item/dusts/glowstone.json index b7bd60b026..668258c523 100644 --- a/src/main/generated/data/c/tags/item/dusts/glowstone.json +++ b/src/main/generated/data/c/tags/item/dusts/glowstone.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:glowstone_dust", - { - "id": "#forge:dusts/glowstone", - "required": false - } + "minecraft:glowstone_dust" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/dusts/redstone.json b/src/main/generated/data/c/tags/item/dusts/redstone.json index ec7a3ceb0a..a096239ec1 100644 --- a/src/main/generated/data/c/tags/item/dusts/redstone.json +++ b/src/main/generated/data/c/tags/item/dusts/redstone.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:redstone", - { - "id": "#forge:dusts/redstone", - "required": false - } + "minecraft:redstone" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/eggs.json b/src/main/generated/data/c/tags/item/eggs.json new file mode 100644 index 0000000000..828fbcc152 --- /dev/null +++ b/src/main/generated/data/c/tags/item/eggs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:egg", + "minecraft:blue_egg", + "minecraft:brown_egg" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/end_stones.json b/src/main/generated/data/c/tags/item/end_stones.json similarity index 100% rename from src/main/generated/data/forge/tags/item/end_stones.json rename to src/main/generated/data/c/tags/item/end_stones.json diff --git a/src/main/generated/data/c/tags/item/ender_pearls.json b/src/main/generated/data/c/tags/item/ender_pearls.json index bd8b93cf85..135cd1d776 100644 --- a/src/main/generated/data/c/tags/item/ender_pearls.json +++ b/src/main/generated/data/c/tags/item/ender_pearls.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:ender_pearl", - { - "id": "#forge:ender_pearls", - "required": false - } + "minecraft:ender_pearl" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/feathers.json b/src/main/generated/data/c/tags/item/feathers.json new file mode 100644 index 0000000000..8086200700 --- /dev/null +++ b/src/main/generated/data/c/tags/item/feathers.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:feather" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/fence_gates.json b/src/main/generated/data/c/tags/item/fence_gates.json new file mode 100644 index 0000000000..42dca6b914 --- /dev/null +++ b/src/main/generated/data/c/tags/item/fence_gates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:fence_gates/wooden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/fence_gates/wooden.json b/src/main/generated/data/c/tags/item/fence_gates/wooden.json similarity index 100% rename from src/main/generated/data/forge/tags/item/fence_gates/wooden.json rename to src/main/generated/data/c/tags/item/fence_gates/wooden.json diff --git a/src/main/generated/data/c/tags/item/fences.json b/src/main/generated/data/c/tags/item/fences.json new file mode 100644 index 0000000000..3185a1f46b --- /dev/null +++ b/src/main/generated/data/c/tags/item/fences.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/fences/nether_brick.json b/src/main/generated/data/c/tags/item/fences/nether_brick.json similarity index 100% rename from src/main/generated/data/forge/tags/item/fences/nether_brick.json rename to src/main/generated/data/c/tags/item/fences/nether_brick.json diff --git a/src/main/generated/data/forge/tags/item/fences/wooden.json b/src/main/generated/data/c/tags/item/fences/wooden.json similarity index 100% rename from src/main/generated/data/forge/tags/item/fences/wooden.json rename to src/main/generated/data/c/tags/item/fences/wooden.json diff --git a/src/main/generated/data/c/tags/item/flowers/small.json b/src/main/generated/data/c/tags/item/flowers/small.json index bdd6b47dd1..f2252429ca 100644 --- a/src/main/generated/data/c/tags/item/flowers/small.json +++ b/src/main/generated/data/c/tags/item/flowers/small.json @@ -15,10 +15,6 @@ "minecraft:wither_rose", "minecraft:torchflower", "minecraft:open_eyeblossom", - "minecraft:closed_eyeblossom", - { - "id": "#minecraft:small_flowers", - "required": false - } + "minecraft:closed_eyeblossom" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/flowers/tall.json b/src/main/generated/data/c/tags/item/flowers/tall.json index 156bf722ac..144eb89e0a 100644 --- a/src/main/generated/data/c/tags/item/flowers/tall.json +++ b/src/main/generated/data/c/tags/item/flowers/tall.json @@ -4,10 +4,6 @@ "minecraft:lilac", "minecraft:peony", "minecraft:rose_bush", - "minecraft:pitcher_plant", - { - "id": "#minecraft:tall_flowers", - "required": false - } + "minecraft:pitcher_plant" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dense/nether.json b/src/main/generated/data/c/tags/item/foods/dough.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_dense/nether.json rename to src/main/generated/data/c/tags/item/foods/dough.json diff --git a/src/main/generated/data/c/tags/item/foods/pie.json b/src/main/generated/data/c/tags/item/foods/pie.json index 35482dd5e2..7589c5f241 100644 --- a/src/main/generated/data/c/tags/item/foods/pie.json +++ b/src/main/generated/data/c/tags/item/foods/pie.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:pumpkin_pie", - { - "id": "#forge:foods/pie", - "required": false - } + "minecraft:pumpkin_pie" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/foods/vegetable.json b/src/main/generated/data/c/tags/item/foods/vegetable.json index 17ecdb1ca6..d48dd4228c 100644 --- a/src/main/generated/data/c/tags/item/foods/vegetable.json +++ b/src/main/generated/data/c/tags/item/foods/vegetable.json @@ -1,8 +1,8 @@ { "values": [ - "minecraft:carrot", "minecraft:golden_carrot", - "minecraft:potato", - "minecraft:beetroot" + "minecraft:beetroot", + "minecraft:carrot", + "minecraft:potato" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems.json b/src/main/generated/data/c/tags/item/gems.json index 6f340c553c..fb57888221 100644 --- a/src/main/generated/data/c/tags/item/gems.json +++ b/src/main/generated/data/c/tags/item/gems.json @@ -5,10 +5,6 @@ "#c:gems/emerald", "#c:gems/lapis", "#c:gems/prismarine", - "#c:gems/quartz", - { - "id": "#forge:gems", - "required": false - } + "#c:gems/quartz" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/amethyst.json b/src/main/generated/data/c/tags/item/gems/amethyst.json index d222353687..742ef896d5 100644 --- a/src/main/generated/data/c/tags/item/gems/amethyst.json +++ b/src/main/generated/data/c/tags/item/gems/amethyst.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:amethyst_shard", - { - "id": "#forge:gems/amethyst", - "required": false - } + "minecraft:amethyst_shard" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/diamond.json b/src/main/generated/data/c/tags/item/gems/diamond.json index 1ca2673f21..f44f30dd55 100644 --- a/src/main/generated/data/c/tags/item/gems/diamond.json +++ b/src/main/generated/data/c/tags/item/gems/diamond.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:diamond", - { - "id": "#forge:gems/diamond", - "required": false - } + "minecraft:diamond" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/emerald.json b/src/main/generated/data/c/tags/item/gems/emerald.json index de1e12af1b..07a0982118 100644 --- a/src/main/generated/data/c/tags/item/gems/emerald.json +++ b/src/main/generated/data/c/tags/item/gems/emerald.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:emerald", - { - "id": "#forge:gems/emerald", - "required": false - } + "minecraft:emerald" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/lapis.json b/src/main/generated/data/c/tags/item/gems/lapis.json index 0e92612548..614441df46 100644 --- a/src/main/generated/data/c/tags/item/gems/lapis.json +++ b/src/main/generated/data/c/tags/item/gems/lapis.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:lapis_lazuli", - { - "id": "#forge:gems/lapis", - "required": false - } + "minecraft:lapis_lazuli" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/prismarine.json b/src/main/generated/data/c/tags/item/gems/prismarine.json index df7aa66312..150e7ff711 100644 --- a/src/main/generated/data/c/tags/item/gems/prismarine.json +++ b/src/main/generated/data/c/tags/item/gems/prismarine.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:prismarine_crystals", - { - "id": "#forge:gems/prismarine", - "required": false - } + "minecraft:prismarine_crystals" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/gems/quartz.json b/src/main/generated/data/c/tags/item/gems/quartz.json index d0604485bd..aad2eef95b 100644 --- a/src/main/generated/data/c/tags/item/gems/quartz.json +++ b/src/main/generated/data/c/tags/item/gems/quartz.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:quartz", - { - "id": "#forge:gems/quartz", - "required": false - } + "minecraft:quartz" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_blocks.json b/src/main/generated/data/c/tags/item/glass_blocks.json index 55b243f654..61618a7498 100644 --- a/src/main/generated/data/c/tags/item/glass_blocks.json +++ b/src/main/generated/data/c/tags/item/glass_blocks.json @@ -2,10 +2,6 @@ "values": [ "#c:glass_blocks/colorless", "#c:glass_blocks/cheap", - "#c:glass_blocks/tinted", - { - "id": "#forge:glass", - "required": false - } + "#c:glass_blocks/tinted" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_blocks/cheap.json b/src/main/generated/data/c/tags/item/glass_blocks/cheap.json index 067bd8f78d..3465b3884b 100644 --- a/src/main/generated/data/c/tags/item/glass_blocks/cheap.json +++ b/src/main/generated/data/c/tags/item/glass_blocks/cheap.json @@ -16,10 +16,6 @@ "minecraft:brown_stained_glass", "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:black_stained_glass", - { - "id": "#forge:glass/silica", - "required": false - } + "minecraft:black_stained_glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_blocks/colorless.json b/src/main/generated/data/c/tags/item/glass_blocks/colorless.json index e46e8e25ba..ac8b5e5086 100644 --- a/src/main/generated/data/c/tags/item/glass_blocks/colorless.json +++ b/src/main/generated/data/c/tags/item/glass_blocks/colorless.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:glass", - { - "id": "#forge:glass/colorless", - "required": false - } + "minecraft:glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_blocks/tinted.json b/src/main/generated/data/c/tags/item/glass_blocks/tinted.json index e7fe6f40f0..4075a1556b 100644 --- a/src/main/generated/data/c/tags/item/glass_blocks/tinted.json +++ b/src/main/generated/data/c/tags/item/glass_blocks/tinted.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:tinted_glass", - { - "id": "#forge:glass/tinted", - "required": false - } + "minecraft:tinted_glass" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_panes.json b/src/main/generated/data/c/tags/item/glass_panes.json index 869c6fe993..c4bdf8ea3f 100644 --- a/src/main/generated/data/c/tags/item/glass_panes.json +++ b/src/main/generated/data/c/tags/item/glass_panes.json @@ -16,10 +16,6 @@ "minecraft:brown_stained_glass_pane", "minecraft:green_stained_glass_pane", "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane", - { - "id": "#forge:glass_panes", - "required": false - } + "minecraft:black_stained_glass_pane" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/glass_panes/colorless.json b/src/main/generated/data/c/tags/item/glass_panes/colorless.json index 5390c3bbd6..eb5756f964 100644 --- a/src/main/generated/data/c/tags/item/glass_panes/colorless.json +++ b/src/main/generated/data/c/tags/item/glass_panes/colorless.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:glass_pane", - { - "id": "#forge:glass_panes/colorless", - "required": false - } + "minecraft:glass_pane" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gravel.json b/src/main/generated/data/c/tags/item/gravels.json similarity index 100% rename from src/main/generated/data/forge/tags/item/gravel.json rename to src/main/generated/data/c/tags/item/gravels.json diff --git a/src/main/generated/data/forge/tags/item/gunpowder.json b/src/main/generated/data/c/tags/item/gunpowders.json similarity index 63% rename from src/main/generated/data/forge/tags/item/gunpowder.json rename to src/main/generated/data/c/tags/item/gunpowders.json index 7120fe3fba..d5835ce7f9 100644 --- a/src/main/generated/data/forge/tags/item/gunpowder.json +++ b/src/main/generated/data/c/tags/item/gunpowders.json @@ -1,6 +1,5 @@ { "values": [ - "minecraft:gunpowder", "minecraft:gunpowder" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/ingots/copper.json b/src/main/generated/data/c/tags/item/ingots/copper.json index 2043a331d0..1cc1f065c5 100644 --- a/src/main/generated/data/c/tags/item/ingots/copper.json +++ b/src/main/generated/data/c/tags/item/ingots/copper.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:copper_ingot", - { - "id": "#forge:ingots/copper", - "required": false - } + "minecraft:copper_ingot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/ingots/gold.json b/src/main/generated/data/c/tags/item/ingots/gold.json index 70299fe304..07e9f66a30 100644 --- a/src/main/generated/data/c/tags/item/ingots/gold.json +++ b/src/main/generated/data/c/tags/item/ingots/gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:gold_ingot", - { - "id": "#forge:ingots/gold", - "required": false - } + "minecraft:gold_ingot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/ingots/iron.json b/src/main/generated/data/c/tags/item/ingots/iron.json index 7fa35c33e3..c656021bdb 100644 --- a/src/main/generated/data/c/tags/item/ingots/iron.json +++ b/src/main/generated/data/c/tags/item/ingots/iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:iron_ingot", - { - "id": "#forge:ingots/iron", - "required": false - } + "minecraft:iron_ingot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/ingots/netherite.json b/src/main/generated/data/c/tags/item/ingots/netherite.json index 61b250abae..bd6929df75 100644 --- a/src/main/generated/data/c/tags/item/ingots/netherite.json +++ b/src/main/generated/data/c/tags/item/ingots/netherite.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:netherite_ingot", - { - "id": "#forge:ingots/netherite", - "required": false - } + "minecraft:netherite_ingot" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/leathers.json b/src/main/generated/data/c/tags/item/leathers.json index 71f8c03e09..71b797d35b 100644 --- a/src/main/generated/data/c/tags/item/leathers.json +++ b/src/main/generated/data/c/tags/item/leathers.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:leather", - { - "id": "#forge:leather", - "required": false - } + "minecraft:leather" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/mushrooms.json b/src/main/generated/data/c/tags/item/mushrooms.json new file mode 100644 index 0000000000..471cd77f07 --- /dev/null +++ b/src/main/generated/data/c/tags/item/mushrooms.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:brown_mushroom", + "minecraft:red_mushroom" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/music_discs.json b/src/main/generated/data/c/tags/item/music_discs.json index 4cfc035e4f..b5626ae05b 100644 --- a/src/main/generated/data/c/tags/item/music_discs.json +++ b/src/main/generated/data/c/tags/item/music_discs.json @@ -18,6 +18,8 @@ "minecraft:music_disc_relic", "minecraft:music_disc_creator", "minecraft:music_disc_creator_music_box", - "minecraft:music_disc_precipice" + "minecraft:music_disc_precipice", + "minecraft:music_disc_lava_chicken", + "minecraft:music_disc_tears" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/natural_logs.json b/src/main/generated/data/c/tags/item/natural_logs.json new file mode 100644 index 0000000000..e03c0c2a6a --- /dev/null +++ b/src/main/generated/data/c/tags/item/natural_logs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:natural_logs/nether", + "#c:natural_logs/overworld" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/natural_logs/nether.json b/src/main/generated/data/c/tags/item/natural_logs/nether.json new file mode 100644 index 0000000000..192679af78 --- /dev/null +++ b/src/main/generated/data/c/tags/item/natural_logs/nether.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:crimson_stem", + "minecraft:warped_stem" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/natural_logs/overworld.json b/src/main/generated/data/c/tags/item/natural_logs/overworld.json new file mode 100644 index 0000000000..c351b11bb3 --- /dev/null +++ b/src/main/generated/data/c/tags/item/natural_logs/overworld.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:acacia_log", + "minecraft:birch_log", + "minecraft:cherry_log", + "minecraft:dark_oak_log", + "minecraft:jungle_log", + "minecraft:mangrove_log", + "minecraft:oak_log", + "minecraft:pale_oak_log", + "minecraft:spruce_log" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/natural_woods.json b/src/main/generated/data/c/tags/item/natural_woods.json new file mode 100644 index 0000000000..46efd3c3f6 --- /dev/null +++ b/src/main/generated/data/c/tags/item/natural_woods.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:acacia_wood", + "minecraft:birch_wood", + "minecraft:cherry_wood", + "minecraft:crimson_hyphae", + "minecraft:dark_oak_wood", + "minecraft:jungle_wood", + "minecraft:mangrove_wood", + "minecraft:oak_wood", + "minecraft:pale_oak_wood", + "minecraft:spruce_wood", + "minecraft:warped_hyphae" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/nether_stars.json b/src/main/generated/data/c/tags/item/nether_stars.json new file mode 100644 index 0000000000..737a95d083 --- /dev/null +++ b/src/main/generated/data/c/tags/item/nether_stars.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:nether_star" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/netherrack.json b/src/main/generated/data/c/tags/item/netherracks.json similarity index 100% rename from src/main/generated/data/forge/tags/item/netherrack.json rename to src/main/generated/data/c/tags/item/netherracks.json diff --git a/src/main/generated/data/c/tags/item/nuggets.json b/src/main/generated/data/c/tags/item/nuggets.json index bc49078393..0cadd63785 100644 --- a/src/main/generated/data/c/tags/item/nuggets.json +++ b/src/main/generated/data/c/tags/item/nuggets.json @@ -2,10 +2,6 @@ "values": [ "#c:nuggets/gold", "#c:nuggets/iron", - "#c:nuggets/copper", - { - "id": "#forge:nuggets", - "required": false - } + "#c:nuggets/copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/nuggets/gold.json b/src/main/generated/data/c/tags/item/nuggets/gold.json index 77eb151909..4d94345957 100644 --- a/src/main/generated/data/c/tags/item/nuggets/gold.json +++ b/src/main/generated/data/c/tags/item/nuggets/gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:gold_nugget", - { - "id": "#forge:nuggets/gold", - "required": false - } + "minecraft:gold_nugget" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/nuggets/iron.json b/src/main/generated/data/c/tags/item/nuggets/iron.json index 0f529f154f..cbd20ac6e4 100644 --- a/src/main/generated/data/c/tags/item/nuggets/iron.json +++ b/src/main/generated/data/c/tags/item/nuggets/iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:iron_nugget", - { - "id": "#forge:nuggets/iron", - "required": false - } + "minecraft:iron_nugget" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/obsidians.json b/src/main/generated/data/c/tags/item/obsidians.json index 3986b73df1..5df539fb0e 100644 --- a/src/main/generated/data/c/tags/item/obsidians.json +++ b/src/main/generated/data/c/tags/item/obsidians.json @@ -1,10 +1,6 @@ { "values": [ "#c:obsidians/normal", - "#c:obsidians/crying", - { - "id": "#forge:obsidian", - "required": false - } + "#c:obsidians/crying" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ore_bearing_ground/deepslate.json b/src/main/generated/data/c/tags/item/ore_bearing_ground/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_bearing_ground/deepslate.json rename to src/main/generated/data/c/tags/item/ore_bearing_ground/deepslate.json diff --git a/src/main/generated/data/forge/tags/item/ore_bearing_ground/netherrack.json b/src/main/generated/data/c/tags/item/ore_bearing_ground/netherrack.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_bearing_ground/netherrack.json rename to src/main/generated/data/c/tags/item/ore_bearing_ground/netherrack.json diff --git a/src/main/generated/data/forge/tags/item/ore_bearing_ground/stone.json b/src/main/generated/data/c/tags/item/ore_bearing_ground/stone.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_bearing_ground/stone.json rename to src/main/generated/data/c/tags/item/ore_bearing_ground/stone.json diff --git a/src/main/generated/data/forge/tags/item/ore_rates/dense.json b/src/main/generated/data/c/tags/item/ore_rates/dense.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_rates/dense.json rename to src/main/generated/data/c/tags/item/ore_rates/dense.json diff --git a/src/main/generated/data/forge/tags/item/ore_rates/singular.json b/src/main/generated/data/c/tags/item/ore_rates/singular.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_rates/singular.json rename to src/main/generated/data/c/tags/item/ore_rates/singular.json diff --git a/src/main/generated/data/forge/tags/item/ore_rates/sparse.json b/src/main/generated/data/c/tags/item/ore_rates/sparse.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ore_rates/sparse.json rename to src/main/generated/data/c/tags/item/ore_rates/sparse.json diff --git a/src/main/generated/data/c/tags/item/ores.json b/src/main/generated/data/c/tags/item/ores.json index 7397864c1a..3b2293aa8d 100644 --- a/src/main/generated/data/c/tags/item/ores.json +++ b/src/main/generated/data/c/tags/item/ores.json @@ -1,18 +1,14 @@ { "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", "#c:ores/netherite_scrap", - "#forge:ores/redstone", - "#c:ores/quartz", - { - "id": "#forge:ores", - "required": false - } + "#c:ores/redstone", + "#c:ores/quartz" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ores/coal.json b/src/main/generated/data/c/tags/item/ores/coal.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/coal.json rename to src/main/generated/data/c/tags/item/ores/coal.json diff --git a/src/main/generated/data/forge/tags/item/ores/copper.json b/src/main/generated/data/c/tags/item/ores/copper.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/copper.json rename to src/main/generated/data/c/tags/item/ores/copper.json diff --git a/src/main/generated/data/forge/tags/item/ores/diamond.json b/src/main/generated/data/c/tags/item/ores/diamond.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/diamond.json rename to src/main/generated/data/c/tags/item/ores/diamond.json diff --git a/src/main/generated/data/forge/tags/item/ores/emerald.json b/src/main/generated/data/c/tags/item/ores/emerald.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/emerald.json rename to src/main/generated/data/c/tags/item/ores/emerald.json diff --git a/src/main/generated/data/forge/tags/item/ores/gold.json b/src/main/generated/data/c/tags/item/ores/gold.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/gold.json rename to src/main/generated/data/c/tags/item/ores/gold.json diff --git a/src/main/generated/data/forge/tags/item/ores/iron.json b/src/main/generated/data/c/tags/item/ores/iron.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/iron.json rename to src/main/generated/data/c/tags/item/ores/iron.json diff --git a/src/main/generated/data/forge/tags/item/ores/lapis.json b/src/main/generated/data/c/tags/item/ores/lapis.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/lapis.json rename to src/main/generated/data/c/tags/item/ores/lapis.json diff --git a/src/main/generated/data/c/tags/item/ores/netherite_scrap.json b/src/main/generated/data/c/tags/item/ores/netherite_scrap.json index 6cc208db8e..910d1fb8e6 100644 --- a/src/main/generated/data/c/tags/item/ores/netherite_scrap.json +++ b/src/main/generated/data/c/tags/item/ores/netherite_scrap.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:ancient_debris", - { - "id": "#forge:ores/netherite_scrap", - "required": false - } + "minecraft:ancient_debris" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/ores/quartz.json b/src/main/generated/data/c/tags/item/ores/quartz.json index 5433b2ed6f..f0bc7a4657 100644 --- a/src/main/generated/data/c/tags/item/ores/quartz.json +++ b/src/main/generated/data/c/tags/item/ores/quartz.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:nether_quartz_ore", - { - "id": "#forge:ores/quartz", - "required": false - } + "minecraft:nether_quartz_ore" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ores/redstone.json b/src/main/generated/data/c/tags/item/ores/redstone.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores/redstone.json rename to src/main/generated/data/c/tags/item/ores/redstone.json diff --git a/src/main/generated/data/forge/tags/item/ores_in_ground/deepslate.json b/src/main/generated/data/c/tags/item/ores_in_ground/deepslate.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores_in_ground/deepslate.json rename to src/main/generated/data/c/tags/item/ores_in_ground/deepslate.json diff --git a/src/main/generated/data/forge/tags/item/ores_in_ground/netherrack.json b/src/main/generated/data/c/tags/item/ores_in_ground/netherrack.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores_in_ground/netherrack.json rename to src/main/generated/data/c/tags/item/ores_in_ground/netherrack.json diff --git a/src/main/generated/data/forge/tags/item/ores_in_ground/stone.json b/src/main/generated/data/c/tags/item/ores_in_ground/stone.json similarity index 100% rename from src/main/generated/data/forge/tags/item/ores_in_ground/stone.json rename to src/main/generated/data/c/tags/item/ores_in_ground/stone.json diff --git a/src/main/generated/data/c/tags/item/potions.json b/src/main/generated/data/c/tags/item/potions.json new file mode 100644 index 0000000000..139353d5ad --- /dev/null +++ b/src/main/generated/data/c/tags/item/potions.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:potions/bottle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/potions/bottle.json b/src/main/generated/data/c/tags/item/potions/bottle.json new file mode 100644 index 0000000000..592e0eb9db --- /dev/null +++ b/src/main/generated/data/c/tags/item/potions/bottle.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:potion", + "minecraft:splash_potion", + "minecraft:lingering_potion" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/raw_materials.json b/src/main/generated/data/c/tags/item/raw_materials.json index de258a264b..d0b9991efe 100644 --- a/src/main/generated/data/c/tags/item/raw_materials.json +++ b/src/main/generated/data/c/tags/item/raw_materials.json @@ -2,10 +2,6 @@ "values": [ "#c:raw_materials/copper", "#c:raw_materials/gold", - "#c:raw_materials/iron", - { - "id": "#forge:raw_materials", - "required": false - } + "#c:raw_materials/iron" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/raw_materials/copper.json b/src/main/generated/data/c/tags/item/raw_materials/copper.json index ce2a8c25b9..3e03ab9ca8 100644 --- a/src/main/generated/data/c/tags/item/raw_materials/copper.json +++ b/src/main/generated/data/c/tags/item/raw_materials/copper.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_copper", - { - "id": "#forge:raw_materials/copper", - "required": false - } + "minecraft:raw_copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/raw_materials/gold.json b/src/main/generated/data/c/tags/item/raw_materials/gold.json index 555e287358..3d1252e5f9 100644 --- a/src/main/generated/data/c/tags/item/raw_materials/gold.json +++ b/src/main/generated/data/c/tags/item/raw_materials/gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_gold", - { - "id": "#forge:raw_materials/gold", - "required": false - } + "minecraft:raw_gold" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/raw_materials/iron.json b/src/main/generated/data/c/tags/item/raw_materials/iron.json index def08c1dac..8f9af48d8e 100644 --- a/src/main/generated/data/c/tags/item/raw_materials/iron.json +++ b/src/main/generated/data/c/tags/item/raw_materials/iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_iron", - { - "id": "#forge:raw_materials/iron", - "required": false - } + "minecraft:raw_iron" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/rods.json b/src/main/generated/data/c/tags/item/rods.json index 4bf89f59ff..84ee8864fc 100644 --- a/src/main/generated/data/c/tags/item/rods.json +++ b/src/main/generated/data/c/tags/item/rods.json @@ -2,10 +2,6 @@ "values": [ "#c:rods/wooden", "#c:rods/blaze", - "#c:rods/breeze", - { - "id": "#forge:rods", - "required": false - } + "#c:rods/breeze" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/rods/blaze.json b/src/main/generated/data/c/tags/item/rods/blaze.json index cda6278df8..5d2eff8311 100644 --- a/src/main/generated/data/c/tags/item/rods/blaze.json +++ b/src/main/generated/data/c/tags/item/rods/blaze.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:blaze_rod", - { - "id": "#forge:rods/blaze", - "required": false - } + "minecraft:blaze_rod" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/rods/wooden.json b/src/main/generated/data/c/tags/item/rods/wooden.json index 348d18d33d..019b63dd31 100644 --- a/src/main/generated/data/c/tags/item/rods/wooden.json +++ b/src/main/generated/data/c/tags/item/rods/wooden.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:stick", - { - "id": "#forge:rods/wooden", - "required": false - } + "minecraft:stick" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/sands.json b/src/main/generated/data/c/tags/item/sands.json new file mode 100644 index 0000000000..f4b6e6a769 --- /dev/null +++ b/src/main/generated/data/c/tags/item/sands.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/sand/colorless.json b/src/main/generated/data/c/tags/item/sands/colorless.json similarity index 100% rename from src/main/generated/data/forge/tags/item/sand/colorless.json rename to src/main/generated/data/c/tags/item/sands/colorless.json diff --git a/src/main/generated/data/forge/tags/item/sand/red.json b/src/main/generated/data/c/tags/item/sands/red.json similarity index 100% rename from src/main/generated/data/forge/tags/item/sand/red.json rename to src/main/generated/data/c/tags/item/sands/red.json diff --git a/src/main/generated/data/c/tags/item/sandstone/blocks.json b/src/main/generated/data/c/tags/item/sandstone/blocks.json index 5684db6caf..df1b934e5c 100644 --- a/src/main/generated/data/c/tags/item/sandstone/blocks.json +++ b/src/main/generated/data/c/tags/item/sandstone/blocks.json @@ -1,10 +1,6 @@ { "values": [ "#c:sandstone/red_blocks", - "#c:sandstone/uncolored_blocks", - { - "id": "#forge:sandstone", - "required": false - } + "#c:sandstone/uncolored_blocks" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/seeds.json b/src/main/generated/data/c/tags/item/seeds.json new file mode 100644 index 0000000000..e422d061f3 --- /dev/null +++ b/src/main/generated/data/c/tags/item/seeds.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:seeds/beetroot", + "#c:seeds/melon", + "#c:seeds/pumpkin", + "#c:seeds/wheat", + "#c:seeds/beetroot", + "#c:seeds/melon", + "#c:seeds/pumpkin", + "#c:seeds/wheat", + "#c:seeds/pitcher_plant", + "#c:seeds/torchflower" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/seeds/beetroot.json b/src/main/generated/data/c/tags/item/seeds/beetroot.json similarity index 100% rename from src/main/generated/data/forge/tags/item/seeds/beetroot.json rename to src/main/generated/data/c/tags/item/seeds/beetroot.json diff --git a/src/main/generated/data/forge/tags/item/seeds/melon.json b/src/main/generated/data/c/tags/item/seeds/melon.json similarity index 100% rename from src/main/generated/data/forge/tags/item/seeds/melon.json rename to src/main/generated/data/c/tags/item/seeds/melon.json diff --git a/src/main/generated/data/c/tags/item/seeds/pitcher_plant.json b/src/main/generated/data/c/tags/item/seeds/pitcher_plant.json new file mode 100644 index 0000000000..e81489b0df --- /dev/null +++ b/src/main/generated/data/c/tags/item/seeds/pitcher_plant.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pitcher_pod" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/seeds/pumpkin.json b/src/main/generated/data/c/tags/item/seeds/pumpkin.json similarity index 100% rename from src/main/generated/data/forge/tags/item/seeds/pumpkin.json rename to src/main/generated/data/c/tags/item/seeds/pumpkin.json diff --git a/src/main/generated/data/c/tags/item/seeds/torchflower.json b/src/main/generated/data/c/tags/item/seeds/torchflower.json new file mode 100644 index 0000000000..e02282a32c --- /dev/null +++ b/src/main/generated/data/c/tags/item/seeds/torchflower.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:torchflower_seeds" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/seeds/wheat.json b/src/main/generated/data/c/tags/item/seeds/wheat.json similarity index 100% rename from src/main/generated/data/forge/tags/item/seeds/wheat.json rename to src/main/generated/data/c/tags/item/seeds/wheat.json diff --git a/src/main/generated/data/c/tags/item/slime_balls.json b/src/main/generated/data/c/tags/item/slime_balls.json index e81d459385..533c25d916 100644 --- a/src/main/generated/data/c/tags/item/slime_balls.json +++ b/src/main/generated/data/c/tags/item/slime_balls.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:slime_ball", - { - "id": "#forge:slimeballs", - "required": false - } + "minecraft:slime_ball" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks.json b/src/main/generated/data/c/tags/item/storage_blocks.json index 4354b34619..54cd9d84ad 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks.json +++ b/src/main/generated/data/c/tags/item/storage_blocks.json @@ -16,53 +16,6 @@ "#c:storage_blocks/redstone", "#c:storage_blocks/slime", "#c:storage_blocks/wheat", - { - "id": "#forge:storage_blocks/coal", - "required": false - }, - { - "id": "#forge:storage_blocks/copper", - "required": false - }, - { - "id": "#forge:storage_blocks/diamond", - "required": false - }, - { - "id": "#forge:storage_blocks/emerald", - "required": false - }, - { - "id": "#forge:storage_blocks/gold", - "required": false - }, - { - "id": "#forge:storage_blocks/iron", - "required": false - }, - { - "id": "#forge:storage_blocks/lapis", - "required": false - }, - { - "id": "#forge:storage_blocks/netherite", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_copper", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_gold", - "required": false - }, - { - "id": "#forge:storage_blocks/raw_iron", - "required": false - }, - { - "id": "#forge:storage_blocks/redstone", - "required": false - } + "#c:storage_blocks/resin" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/coal.json b/src/main/generated/data/c/tags/item/storage_blocks/coal.json index b8479ced38..4b7921705b 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/coal.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/coal.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:coal_block", - { - "id": "#forge:storage_blocks/coal", - "required": false - } + "minecraft:coal_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/copper.json b/src/main/generated/data/c/tags/item/storage_blocks/copper.json index acd2a6a7a4..538486501f 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/copper.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/copper.json @@ -1,9 +1,12 @@ { "values": [ "minecraft:copper_block", - { - "id": "#forge:storage_blocks/copper", - "required": false - } + "minecraft:exposed_copper", + "minecraft:weathered_copper", + "minecraft:oxidized_copper", + "minecraft:waxed_copper_block", + "minecraft:waxed_exposed_copper", + "minecraft:waxed_weathered_copper", + "minecraft:waxed_oxidized_copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/diamond.json b/src/main/generated/data/c/tags/item/storage_blocks/diamond.json index 76426ba425..acd7f52de5 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/diamond.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/diamond.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:diamond_block", - { - "id": "#forge:storage_blocks/diamond", - "required": false - } + "minecraft:diamond_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/emerald.json b/src/main/generated/data/c/tags/item/storage_blocks/emerald.json index 7a41454d94..152063ec6c 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/emerald.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/emerald.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:emerald_block", - { - "id": "#forge:storage_blocks/emerald", - "required": false - } + "minecraft:emerald_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/gold.json b/src/main/generated/data/c/tags/item/storage_blocks/gold.json index a4116fc77f..546dde03c9 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/gold.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:gold_block", - { - "id": "#forge:storage_blocks/gold", - "required": false - } + "minecraft:gold_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/iron.json b/src/main/generated/data/c/tags/item/storage_blocks/iron.json index f0e9fcca1f..01fb2965f2 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/iron.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:iron_block", - { - "id": "#forge:storage_blocks/iron", - "required": false - } + "minecraft:iron_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/lapis.json b/src/main/generated/data/c/tags/item/storage_blocks/lapis.json index b5f41d8d4e..f4ca82bbd4 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/lapis.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/lapis.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:lapis_block", - { - "id": "#forge:storage_blocks/lapis", - "required": false - } + "minecraft:lapis_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/netherite.json b/src/main/generated/data/c/tags/item/storage_blocks/netherite.json index a3dfe0d53c..83433d44eb 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/netherite.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/netherite.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:netherite_block", - { - "id": "#forge:storage_blocks/netherite", - "required": false - } + "minecraft:netherite_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/raw_copper.json b/src/main/generated/data/c/tags/item/storage_blocks/raw_copper.json index 8f12fb63a7..1a21e230ef 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/raw_copper.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/raw_copper.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_copper_block", - { - "id": "#forge:storage_blocks/raw_copper", - "required": false - } + "minecraft:raw_copper_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/raw_gold.json b/src/main/generated/data/c/tags/item/storage_blocks/raw_gold.json index dcee1e225b..80781ce667 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/raw_gold.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/raw_gold.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_gold_block", - { - "id": "#forge:storage_blocks/raw_gold", - "required": false - } + "minecraft:raw_gold_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/raw_iron.json b/src/main/generated/data/c/tags/item/storage_blocks/raw_iron.json index 3f0ecf27ad..13ed9fc651 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/raw_iron.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/raw_iron.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:raw_iron_block", - { - "id": "#forge:storage_blocks/raw_iron", - "required": false - } + "minecraft:raw_iron_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/redstone.json b/src/main/generated/data/c/tags/item/storage_blocks/redstone.json index 49fa7a5a26..f5fd89c541 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/redstone.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/redstone.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:redstone_block", - { - "id": "#forge:storage_blocks/redstone", - "required": false - } + "minecraft:redstone_block" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/resin.json b/src/main/generated/data/c/tags/item/storage_blocks/resin.json new file mode 100644 index 0000000000..7b95c08f1f --- /dev/null +++ b/src/main/generated/data/c/tags/item/storage_blocks/resin.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:resin_block" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/strings.json b/src/main/generated/data/c/tags/item/strings.json index 89b40c31c5..d018256cf8 100644 --- a/src/main/generated/data/c/tags/item/strings.json +++ b/src/main/generated/data/c/tags/item/strings.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:string", - { - "id": "#forge:strings", - "required": false - } + "minecraft:string" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/stripped_logs.json b/src/main/generated/data/c/tags/item/stripped_logs.json index ae69c996ad..95f74cbc5e 100644 --- a/src/main/generated/data/c/tags/item/stripped_logs.json +++ b/src/main/generated/data/c/tags/item/stripped_logs.json @@ -4,10 +4,13 @@ "minecraft:stripped_bamboo_block", "minecraft:stripped_birch_log", "minecraft:stripped_cherry_log", + "minecraft:stripped_crimson_stem", "minecraft:stripped_dark_oak_log", "minecraft:stripped_jungle_log", "minecraft:stripped_mangrove_log", "minecraft:stripped_oak_log", - "minecraft:stripped_spruce_log" + "minecraft:stripped_pale_oak_log", + "minecraft:stripped_spruce_log", + "minecraft:stripped_warped_stem" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/stripped_woods.json b/src/main/generated/data/c/tags/item/stripped_woods.json index 197542891d..0336fc751d 100644 --- a/src/main/generated/data/c/tags/item/stripped_woods.json +++ b/src/main/generated/data/c/tags/item/stripped_woods.json @@ -3,10 +3,13 @@ "minecraft:stripped_acacia_wood", "minecraft:stripped_birch_wood", "minecraft:stripped_cherry_wood", + "minecraft:stripped_crimson_hyphae", "minecraft:stripped_dark_oak_wood", "minecraft:stripped_jungle_wood", "minecraft:stripped_mangrove_wood", "minecraft:stripped_oak_wood", - "minecraft:stripped_spruce_wood" + "minecraft:stripped_pale_oak_wood", + "minecraft:stripped_spruce_wood", + "minecraft:stripped_warped_hyphae" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools.json b/src/main/generated/data/c/tags/item/tools.json index 98a56516e0..8099500241 100644 --- a/src/main/generated/data/c/tags/item/tools.json +++ b/src/main/generated/data/c/tags/item/tools.json @@ -12,10 +12,11 @@ "#c:tools/shear", "#c:tools/igniter", "#c:tools/shield", - "#c:tools/spear", + "#c:tools/trident", "#c:tools/mace", "#c:tools/mining_tool", "#c:tools/melee_weapon", - "#c:tools/ranged_weapon" + "#c:tools/ranged_weapon", + "#c:tools/wrench" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/bow.json b/src/main/generated/data/c/tags/item/tools/bow.json index e46556b3d2..a1c8a443dc 100644 --- a/src/main/generated/data/c/tags/item/tools/bow.json +++ b/src/main/generated/data/c/tags/item/tools/bow.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:bow", - { - "id": "#forge:tools/bows", - "required": false - } + "minecraft:bow" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/crossbow.json b/src/main/generated/data/c/tags/item/tools/crossbow.json index d1e63bc584..848f97bc22 100644 --- a/src/main/generated/data/c/tags/item/tools/crossbow.json +++ b/src/main/generated/data/c/tags/item/tools/crossbow.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:crossbow", - { - "id": "#forge:tools/crossbows", - "required": false - } + "minecraft:crossbow" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/fishing_rod.json b/src/main/generated/data/c/tags/item/tools/fishing_rod.json index efafba4845..e97941e9dc 100644 --- a/src/main/generated/data/c/tags/item/tools/fishing_rod.json +++ b/src/main/generated/data/c/tags/item/tools/fishing_rod.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:fishing_rod", - { - "id": "#forge:tools/fishing_rods", - "required": false - } + "minecraft:fishing_rod" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/melee_weapon.json b/src/main/generated/data/c/tags/item/tools/melee_weapon.json index 1b166a3b4a..0f91924b7d 100644 --- a/src/main/generated/data/c/tags/item/tools/melee_weapon.json +++ b/src/main/generated/data/c/tags/item/tools/melee_weapon.json @@ -4,15 +4,24 @@ "minecraft:trident", "minecraft:wooden_sword", "minecraft:stone_sword", + "minecraft:copper_sword", "minecraft:golden_sword", "minecraft:iron_sword", "minecraft:diamond_sword", "minecraft:netherite_sword", "minecraft:wooden_axe", "minecraft:stone_axe", + "minecraft:copper_axe", "minecraft:golden_axe", "minecraft:iron_axe", "minecraft:diamond_axe", - "minecraft:netherite_axe" + "minecraft:netherite_axe", + "minecraft:wooden_spear", + "minecraft:stone_spear", + "minecraft:copper_spear", + "minecraft:iron_spear", + "minecraft:golden_spear", + "minecraft:diamond_spear", + "minecraft:netherite_spear" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/mining_tool.json b/src/main/generated/data/c/tags/item/tools/mining_tool.json index c10d395032..ec25c003e9 100644 --- a/src/main/generated/data/c/tags/item/tools/mining_tool.json +++ b/src/main/generated/data/c/tags/item/tools/mining_tool.json @@ -2,6 +2,7 @@ "values": [ "minecraft:wooden_pickaxe", "minecraft:stone_pickaxe", + "minecraft:copper_pickaxe", "minecraft:iron_pickaxe", "minecraft:golden_pickaxe", "minecraft:diamond_pickaxe", diff --git a/src/main/generated/data/c/tags/item/tools/shear.json b/src/main/generated/data/c/tags/item/tools/shear.json index 6ee404543e..2400078166 100644 --- a/src/main/generated/data/c/tags/item/tools/shear.json +++ b/src/main/generated/data/c/tags/item/tools/shear.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:shears", - { - "id": "#forge:tools/shears", - "required": false - } + "minecraft:shears" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/shield.json b/src/main/generated/data/c/tags/item/tools/shield.json index f0b441428b..0f2454ce04 100644 --- a/src/main/generated/data/c/tags/item/tools/shield.json +++ b/src/main/generated/data/c/tags/item/tools/shield.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:shield", - { - "id": "#forge:tools/shields", - "required": false - } + "minecraft:shield" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/tools/spear.json b/src/main/generated/data/c/tags/item/tools/trident.json similarity index 100% rename from src/main/generated/data/c/tags/item/tools/spear.json rename to src/main/generated/data/c/tags/item/tools/trident.json diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_hot/end.json b/src/main/generated/data/c/tags/item/tools/wrench.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_hot/end.json rename to src/main/generated/data/c/tags/item/tools/wrench.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_cave.json b/src/main/generated/data/c/tags/worldgen/biome/is_cave.json index 14acf097ed..21a70cfeec 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_cave.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_cave.json @@ -2,10 +2,6 @@ "values": [ "minecraft:lush_caves", "minecraft:dripstone_caves", - "minecraft:deep_dark", - { - "id": "#forge:is_cave", - "required": false - } + "minecraft:deep_dark" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_cold.json b/src/main/generated/data/c/tags/worldgen/biome/is_cold.json index 09882a2325..d58cc9f774 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_cold.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_cold.json @@ -1,10 +1,7 @@ { "values": [ "#c:is_cold/overworld", - { - "id": "#forge:is_cold/nether", - "required": false - }, + "#c:is_cold/nether", "#c:is_cold/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_cold/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_cold/end.json index 5598c65b7f..73d3eff3b0 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_cold/end.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_cold/end.json @@ -4,10 +4,6 @@ "minecraft:small_end_islands", "minecraft:end_midlands", "minecraft:end_highlands", - "minecraft:end_barrens", - { - "id": "#forge:is_cold/end", - "required": false - } + "minecraft:end_barrens" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_cold/nether.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_sparse/nether.json rename to src/main/generated/data/c/tags/worldgen/biome/is_cold/nether.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_cold/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_cold/overworld.json index 67e6574044..0a747bbcfe 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_cold/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_cold/overworld.json @@ -19,10 +19,6 @@ "minecraft:cold_ocean", "minecraft:frozen_ocean", "minecraft:deep_cold_ocean", - "minecraft:deep_frozen_ocean", - { - "id": "#forge:is_cold/overworld", - "required": false - } + "minecraft:deep_frozen_ocean" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dark_forest.json b/src/main/generated/data/c/tags/worldgen/biome/is_dark_forest.json new file mode 100644 index 0000000000..33519bb4c2 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dark_forest.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:dark_forest", + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dead.json b/src/main/generated/data/c/tags/worldgen/biome/is_dead.json index 019f7a17c7..f72d209df7 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dead.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dead.json @@ -1,8 +1,3 @@ { - "values": [ - { - "id": "#forge:is_dead", - "required": false - } - ] + "values": [] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation.json b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation.json index 078ef904dd..7d98565504 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation.json @@ -1,13 +1,7 @@ { "values": [ "#c:is_dense_vegetation/overworld", - { - "id": "#forge:is_dense/nether", - "required": false - }, - { - "id": "#forge:is_dense/end", - "required": false - } + "#c:is_dense_vegetation/nether", + "#c:is_dense_vegetation/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/end.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_sparse/end.json rename to src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/end.json diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_wet/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_wet/nether.json rename to src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json index 3af2bdd5e4..54f339aa4c 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json @@ -5,10 +5,6 @@ "minecraft:old_growth_spruce_taiga", "minecraft:jungle", "minecraft:bamboo_jungle", - "minecraft:mangrove_swamp", - { - "id": "#forge:is_dense/overworld", - "required": false - } + "minecraft:mangrove_swamp" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dry.json b/src/main/generated/data/c/tags/worldgen/biome/is_dry.json index d1e491ae50..fb8b1f1309 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dry.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dry.json @@ -2,10 +2,6 @@ "values": [ "#c:is_dry/overworld", "#c:is_dry/nether", - "#c:is_dry/end", - { - "id": "#forge:is_dry", - "required": false - } + "#c:is_dry/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dry/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_dry/end.json index ce1b28ee59..73d3eff3b0 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dry/end.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dry/end.json @@ -4,10 +4,6 @@ "minecraft:small_end_islands", "minecraft:end_midlands", "minecraft:end_highlands", - "minecraft:end_barrens", - { - "id": "#forge:is_dry/end", - "required": false - } + "minecraft:end_barrens" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dry/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_dry/nether.json index c490dcb1af..d8cf8f5e34 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dry/nether.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dry/nether.json @@ -4,10 +4,6 @@ "minecraft:crimson_forest", "minecraft:warped_forest", "minecraft:soul_sand_valley", - "minecraft:basalt_deltas", - { - "id": "#forge:is_dry/nether", - "required": false - } + "minecraft:basalt_deltas" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_dry/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_dry/overworld.json index 66049f8928..56ca6781da 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_dry/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_dry/overworld.json @@ -6,10 +6,6 @@ "minecraft:eroded_badlands", "minecraft:savanna", "minecraft:savanna_plateau", - "minecraft:windswept_savanna", - { - "id": "#forge:is_dry/overworld", - "required": false - } + "minecraft:windswept_savanna" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_hot.json b/src/main/generated/data/c/tags/worldgen/biome/is_hot.json index 5a591ca1bc..28dd24912a 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_hot.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_hot.json @@ -2,9 +2,6 @@ "values": [ "#c:is_hot/overworld", "#c:is_hot/nether", - { - "id": "#forge:is_hot/end", - "required": false - } + "#c:is_hot/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_wet/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_hot/end.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_wet/end.json rename to src/main/generated/data/c/tags/worldgen/biome/is_hot/end.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_hot/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_hot/nether.json index 48cf5e7bec..d8cf8f5e34 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_hot/nether.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_hot/nether.json @@ -4,10 +4,6 @@ "minecraft:crimson_forest", "minecraft:warped_forest", "minecraft:soul_sand_valley", - "minecraft:basalt_deltas", - { - "id": "#forge:is_hot/nether", - "required": false - } + "minecraft:basalt_deltas" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_hot/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_hot/overworld.json index 58a85ef951..bfba134fa9 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_hot/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_hot/overworld.json @@ -1,7 +1,6 @@ { "values": [ - "minecraft:swamp", - "minecraft:mangrove_swamp", + "minecraft:mushroom_fields", "minecraft:jungle", "minecraft:bamboo_jungle", "minecraft:sparse_jungle", @@ -13,10 +12,6 @@ "minecraft:savanna_plateau", "minecraft:windswept_savanna", "minecraft:stony_peaks", - "minecraft:warm_ocean", - { - "id": "#forge:is_hot/overworld", - "required": false - } + "minecraft:warm_ocean" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_lush.json b/src/main/generated/data/c/tags/worldgen/biome/is_lush.json similarity index 63% rename from src/main/generated/data/forge/tags/worldgen/biome/is_lush.json rename to src/main/generated/data/c/tags/worldgen/biome/is_lush.json index c91691a230..14035f0a54 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_lush.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_lush.json @@ -1,6 +1,5 @@ { "values": [ - "minecraft:lush_caves", "minecraft:lush_caves" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_magical.json b/src/main/generated/data/c/tags/worldgen/biome/is_magical.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_magical.json rename to src/main/generated/data/c/tags/worldgen/biome/is_magical.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_mountain/peak.json b/src/main/generated/data/c/tags/worldgen/biome/is_mountain/peak.json index 60454a4666..c9597b86d0 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_mountain/peak.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_mountain/peak.json @@ -2,10 +2,6 @@ "values": [ "minecraft:jagged_peaks", "minecraft:frozen_peaks", - "minecraft:stony_peaks", - { - "id": "#forge:is_peak", - "required": false - } + "minecraft:stony_peaks" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_plateau.json b/src/main/generated/data/c/tags/worldgen/biome/is_plateau.json similarity index 60% rename from src/main/generated/data/forge/tags/worldgen/biome/is_plateau.json rename to src/main/generated/data/c/tags/worldgen/biome/is_plateau.json index 0f5655a8c3..7228fbfd2b 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_plateau.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_plateau.json @@ -3,9 +3,6 @@ "minecraft:wooded_badlands", "minecraft:savanna_plateau", "minecraft:cherry_grove", - "minecraft:meadow", - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", "minecraft:meadow" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_rare.json b/src/main/generated/data/c/tags/worldgen/biome/is_rare.json similarity index 51% rename from src/main/generated/data/forge/tags/worldgen/biome/is_rare.json rename to src/main/generated/data/c/tags/worldgen/biome/is_rare.json index fa912d7481..2fc37cea54 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_rare.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_rare.json @@ -13,18 +13,6 @@ "minecraft:windswept_gravelly_hills", "minecraft:mushroom_fields", "minecraft:deep_dark", - "minecraft:mushroom_fields", - "minecraft:sparse_jungle", - "minecraft:savanna_plateau", - "minecraft:sunflower_plains", - "minecraft:windswept_gravelly_hills", - "minecraft:flower_forest", - "minecraft:ice_spikes", - "minecraft:old_growth_birch_forest", - "minecraft:old_growth_spruce_taiga", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:bamboo_jungle", - "minecraft:deep_dark" + "minecraft:pale_garden" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_sandy.json similarity index 60% rename from src/main/generated/data/forge/tags/worldgen/biome/is_dry/overworld.json rename to src/main/generated/data/c/tags/worldgen/biome/is_sandy.json index 5f0fa0bfee..5380f1372e 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_sandy.json @@ -3,7 +3,7 @@ "minecraft:desert", "minecraft:badlands", "minecraft:wooded_badlands", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands" + "minecraft:eroded_badlands", + "minecraft:beach" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation.json b/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation.json index 370b410454..3f05a1cd7a 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation.json @@ -1,13 +1,7 @@ { "values": [ "#c:is_sparse_vegetation/overworld", - { - "id": "#forge:is_sparse/nether", - "required": false - }, - { - "id": "#forge:is_sparse/end", - "required": false - } + "#c:is_sparse_vegetation/nether", + "#c:is_sparse_vegetation/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_modified.json b/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json similarity index 100% rename from src/main/generated/data/forge/tags/worldgen/biome/is_modified.json rename to src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_spooky.json b/src/main/generated/data/c/tags/worldgen/biome/is_spooky.json similarity index 58% rename from src/main/generated/data/forge/tags/worldgen/biome/is_spooky.json rename to src/main/generated/data/c/tags/worldgen/biome/is_spooky.json index 05c4f74dc5..138e9348a7 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_spooky.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_spooky.json @@ -2,7 +2,6 @@ "values": [ "minecraft:dark_forest", "minecraft:deep_dark", - "minecraft:dark_forest", - "minecraft:deep_dark" + "minecraft:pale_garden" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_temperate.json b/src/main/generated/data/c/tags/worldgen/biome/is_temperate.json new file mode 100644 index 0000000000..fe845d3378 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_temperate.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#c:is_temperate/overworld", + "#c:is_temperate/nether", + "#c:is_temperate/end" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_temperate/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/end.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/end.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_temperate/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/nether.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/nether.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_temperate/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/overworld.json new file mode 100644 index 0000000000..ce06201698 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_temperate/overworld.json @@ -0,0 +1,18 @@ +{ + "values": [ + "minecraft:beach", + "minecraft:birch_forest", + "minecraft:cherry_grove", + "minecraft:dark_forest", + "minecraft:deep_ocean", + "minecraft:flower_forest", + "minecraft:forest", + "minecraft:mangrove_swamp", + "minecraft:meadow", + "minecraft:ocean", + "minecraft:old_growth_birch_forest", + "minecraft:plains", + "minecraft:sunflower_plains", + "minecraft:swamp" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_tree/coniferous.json b/src/main/generated/data/c/tags/worldgen/biome/is_tree/coniferous.json index 490b4750b0..56f639f895 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_tree/coniferous.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_tree/coniferous.json @@ -1,10 +1,6 @@ { "values": [ "#c:is_taiga", - "minecraft:grove", - { - "id": "#forge:is_coniferous", - "required": false - } + "minecraft:grove" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_tree/deciduous.json b/src/main/generated/data/c/tags/worldgen/biome/is_tree/deciduous.json index 0db7a3e9b6..ecf64e56d0 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_tree/deciduous.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_tree/deciduous.json @@ -5,6 +5,7 @@ "minecraft:birch_forest", "minecraft:dark_forest", "minecraft:old_growth_birch_forest", + "minecraft:pale_garden", "minecraft:windswept_forest" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_wet.json b/src/main/generated/data/c/tags/worldgen/biome/is_wet.json index 259e57decf..c451f70640 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_wet.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_wet.json @@ -1,13 +1,7 @@ { "values": [ "#c:is_wet/overworld", - { - "id": "#forge:is_wet/nether", - "required": false - }, - { - "id": "#forge:is_wet/end", - "required": false - } + "#c:is_wet/nether", + "#c:is_wet/end" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_wet/end.json b/src/main/generated/data/c/tags/worldgen/biome/is_wet/end.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_wet/end.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_wet/nether.json b/src/main/generated/data/c/tags/worldgen/biome/is_wet/nether.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/is_wet/nether.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/is_wet/overworld.json b/src/main/generated/data/c/tags/worldgen/biome/is_wet/overworld.json index 6bb610406d..ee6eef2723 100644 --- a/src/main/generated/data/c/tags/worldgen/biome/is_wet/overworld.json +++ b/src/main/generated/data/c/tags/worldgen/biome/is_wet/overworld.json @@ -7,10 +7,6 @@ "minecraft:sparse_jungle", "minecraft:beach", "minecraft:lush_caves", - "minecraft:dripstone_caves", - { - "id": "#forge:is_wet/overworld", - "required": false - } + "minecraft:dripstone_caves" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type.json new file mode 100644 index 0000000000..4ff9f90241 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type.json @@ -0,0 +1,16 @@ +{ + "values": [ + "#c:primary_wood_type/acacia", + "#c:primary_wood_type/bamboo", + "#c:primary_wood_type/birch", + "#c:primary_wood_type/cherry", + "#c:primary_wood_type/crimson", + "#c:primary_wood_type/dark_oak", + "#c:primary_wood_type/jungle", + "#c:primary_wood_type/mangrove", + "#c:primary_wood_type/oak", + "#c:primary_wood_type/pale_oak", + "#c:primary_wood_type/spruce", + "#c:primary_wood_type/warped" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/acacia.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/acacia.json new file mode 100644 index 0000000000..fc71cb5235 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/acacia.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/bamboo.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/bamboo.json new file mode 100644 index 0000000000..8e983ce126 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/bamboo.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bamboo_jungle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/birch.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/birch.json new file mode 100644 index 0000000000..1d080779b6 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/birch.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:birch_forest", + "minecraft:old_growth_birch_forest" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/cherry.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/cherry.json new file mode 100644 index 0000000000..4c834357d6 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/cherry.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:cherry_grove" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/crimson.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/crimson.json new file mode 100644 index 0000000000..1189e61dc8 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/crimson.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:crimson_forest" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/dark_oak.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/dark_oak.json new file mode 100644 index 0000000000..2d31b9e8e4 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/dark_oak.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:dark_forest" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/jungle.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/jungle.json new file mode 100644 index 0000000000..a8108abf38 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/jungle.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:jungle", + "minecraft:sparse_jungle" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_swamp.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/mangrove.json similarity index 69% rename from src/main/generated/data/forge/tags/worldgen/biome/is_swamp.json rename to src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/mangrove.json index 0f5eb22e0c..d862033bbc 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_swamp.json +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/mangrove.json @@ -1,6 +1,5 @@ { "values": [ - "minecraft:swamp", "minecraft:mangrove_swamp" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/oak.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/oak.json new file mode 100644 index 0000000000..b8a2bbf20e --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/oak.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:flower_forest", + "minecraft:forest", + "minecraft:swamp", + "minecraft:wooded_badlands" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/pale_oak.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/pale_oak.json new file mode 100644 index 0000000000..16abb77c70 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/pale_oak.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:pale_garden" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_coniferous.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/spruce.json similarity index 50% rename from src/main/generated/data/forge/tags/worldgen/biome/is_coniferous.json rename to src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/spruce.json index 6c114dbc65..1e5262fe12 100644 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_coniferous.json +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/spruce.json @@ -1,8 +1,9 @@ { "values": [ - "minecraft:taiga", - "minecraft:snowy_taiga", + "minecraft:grove", "minecraft:old_growth_pine_taiga", - "minecraft:grove" + "minecraft:old_growth_spruce_taiga", + "minecraft:snowy_taiga", + "minecraft:taiga" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/warped.json b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/warped.json new file mode 100644 index 0000000000..42ad4efa88 --- /dev/null +++ b/src/main/generated/data/c/tags/worldgen/biome/primary_wood_type/warped.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:warped_forest" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/barrels.json b/src/main/generated/data/forge/tags/block/barrels.json deleted file mode 100644 index 1cfb5782c5..0000000000 --- a/src/main/generated/data/forge/tags/block/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/barrels/wooden.json b/src/main/generated/data/forge/tags/block/barrels/wooden.json deleted file mode 100644 index b07daae1c0..0000000000 --- a/src/main/generated/data/forge/tags/block/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/bookshelves.json b/src/main/generated/data/forge/tags/block/bookshelves.json deleted file mode 100644 index c09b2185bd..0000000000 --- a/src/main/generated/data/forge/tags/block/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/chests.json b/src/main/generated/data/forge/tags/block/chests.json deleted file mode 100644 index 9afff2b15a..0000000000 --- a/src/main/generated/data/forge/tags/block/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/chests/wooden.json b/src/main/generated/data/forge/tags/block/chests/wooden.json deleted file mode 100644 index 86533f935b..0000000000 --- a/src/main/generated/data/forge/tags/block/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/chorus_additionally_grows_on.json b/src/main/generated/data/forge/tags/block/chorus_additionally_grows_on.json deleted file mode 100644 index 4451697d12..0000000000 --- a/src/main/generated/data/forge/tags/block/chorus_additionally_grows_on.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:end_stones" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/cobblestone.json b/src/main/generated/data/forge/tags/block/cobblestone.json deleted file mode 100644 index f0ae95b5fc..0000000000 --- a/src/main/generated/data/forge/tags/block/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/fence_gates.json b/src/main/generated/data/forge/tags/block/fence_gates.json deleted file mode 100644 index b9a57ac0ef..0000000000 --- a/src/main/generated/data/forge/tags/block/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/fences.json b/src/main/generated/data/forge/tags/block/fences.json deleted file mode 100644 index 44358edb04..0000000000 --- a/src/main/generated/data/forge/tags/block/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass.json b/src/main/generated/data/forge/tags/block/glass.json deleted file mode 100644 index fec31169ee..0000000000 --- a/src/main/generated/data/forge/tags/block/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/black.json b/src/main/generated/data/forge/tags/block/glass/black.json deleted file mode 100644 index 9965b5e8b4..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/blue.json b/src/main/generated/data/forge/tags/block/glass/blue.json deleted file mode 100644 index f59e58c6bf..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/brown.json b/src/main/generated/data/forge/tags/block/glass/brown.json deleted file mode 100644 index 490015cbb5..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/colorless.json b/src/main/generated/data/forge/tags/block/glass/colorless.json deleted file mode 100644 index ac8b5e5086..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/cyan.json b/src/main/generated/data/forge/tags/block/glass/cyan.json deleted file mode 100644 index 24d84747fa..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/gray.json b/src/main/generated/data/forge/tags/block/glass/gray.json deleted file mode 100644 index 2f309170ca..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/green.json b/src/main/generated/data/forge/tags/block/glass/green.json deleted file mode 100644 index d7946c1aca..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/light_blue.json b/src/main/generated/data/forge/tags/block/glass/light_blue.json deleted file mode 100644 index dc8e6b7148..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/light_gray.json b/src/main/generated/data/forge/tags/block/glass/light_gray.json deleted file mode 100644 index f165a46c90..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/lime.json b/src/main/generated/data/forge/tags/block/glass/lime.json deleted file mode 100644 index b6bb1d9415..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/magenta.json b/src/main/generated/data/forge/tags/block/glass/magenta.json deleted file mode 100644 index aa6a4825e8..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/orange.json b/src/main/generated/data/forge/tags/block/glass/orange.json deleted file mode 100644 index 9322f51fe4..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/pink.json b/src/main/generated/data/forge/tags/block/glass/pink.json deleted file mode 100644 index 58b65891fc..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/purple.json b/src/main/generated/data/forge/tags/block/glass/purple.json deleted file mode 100644 index d75a9e7308..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/red.json b/src/main/generated/data/forge/tags/block/glass/red.json deleted file mode 100644 index 72af78c029..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/silica.json b/src/main/generated/data/forge/tags/block/glass/silica.json deleted file mode 100644 index 3465b3884b..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/silica.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "values": [ - "minecraft:glass", - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/tinted.json b/src/main/generated/data/forge/tags/block/glass/tinted.json deleted file mode 100644 index 4075a1556b..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/white.json b/src/main/generated/data/forge/tags/block/glass/white.json deleted file mode 100644 index fb180e703e..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass/yellow.json b/src/main/generated/data/forge/tags/block/glass/yellow.json deleted file mode 100644 index 0831bea4cc..0000000000 --- a/src/main/generated/data/forge/tags/block/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes.json b/src/main/generated/data/forge/tags/block/glass_panes.json deleted file mode 100644 index 4b95330d4f..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/black.json b/src/main/generated/data/forge/tags/block/glass_panes/black.json deleted file mode 100644 index ebda555dcd..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/blue.json b/src/main/generated/data/forge/tags/block/glass_panes/blue.json deleted file mode 100644 index 2762890aa9..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/brown.json b/src/main/generated/data/forge/tags/block/glass_panes/brown.json deleted file mode 100644 index 0b5b727491..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/colorless.json b/src/main/generated/data/forge/tags/block/glass_panes/colorless.json deleted file mode 100644 index eb5756f964..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/cyan.json b/src/main/generated/data/forge/tags/block/glass_panes/cyan.json deleted file mode 100644 index 9913e90a96..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/gray.json b/src/main/generated/data/forge/tags/block/glass_panes/gray.json deleted file mode 100644 index 9fe30b26a8..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/green.json b/src/main/generated/data/forge/tags/block/glass_panes/green.json deleted file mode 100644 index ab91321028..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/light_blue.json b/src/main/generated/data/forge/tags/block/glass_panes/light_blue.json deleted file mode 100644 index cd6d399022..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/light_gray.json b/src/main/generated/data/forge/tags/block/glass_panes/light_gray.json deleted file mode 100644 index 7be6a4ce81..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/lime.json b/src/main/generated/data/forge/tags/block/glass_panes/lime.json deleted file mode 100644 index 46dec64b22..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/magenta.json b/src/main/generated/data/forge/tags/block/glass_panes/magenta.json deleted file mode 100644 index 7504bc3fa3..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/orange.json b/src/main/generated/data/forge/tags/block/glass_panes/orange.json deleted file mode 100644 index 1c47e34616..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/pink.json b/src/main/generated/data/forge/tags/block/glass_panes/pink.json deleted file mode 100644 index 28e36b973f..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/purple.json b/src/main/generated/data/forge/tags/block/glass_panes/purple.json deleted file mode 100644 index a3cff33a14..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/red.json b/src/main/generated/data/forge/tags/block/glass_panes/red.json deleted file mode 100644 index 5edd855d71..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/white.json b/src/main/generated/data/forge/tags/block/glass_panes/white.json deleted file mode 100644 index b514a2839f..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/glass_panes/yellow.json b/src/main/generated/data/forge/tags/block/glass_panes/yellow.json deleted file mode 100644 index a293eb9dc8..0000000000 --- a/src/main/generated/data/forge/tags/block/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/obsidian.json b/src/main/generated/data/forge/tags/block/obsidian.json deleted file mode 100644 index 170248454b..0000000000 --- a/src/main/generated/data/forge/tags/block/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ores.json b/src/main/generated/data/forge/tags/block/ores.json deleted file mode 100644 index 2c4beabc55..0000000000 --- a/src/main/generated/data/forge/tags/block/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ores/netherite_scrap.json b/src/main/generated/data/forge/tags/block/ores/netherite_scrap.json deleted file mode 100644 index 910d1fb8e6..0000000000 --- a/src/main/generated/data/forge/tags/block/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/ores/quartz.json b/src/main/generated/data/forge/tags/block/ores/quartz.json deleted file mode 100644 index f0bc7a4657..0000000000 --- a/src/main/generated/data/forge/tags/block/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/sand.json b/src/main/generated/data/forge/tags/block/sand.json deleted file mode 100644 index 8b04916283..0000000000 --- a/src/main/generated/data/forge/tags/block/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/sandstone.json b/src/main/generated/data/forge/tags/block/sandstone.json deleted file mode 100644 index bb7fb03ee3..0000000000 --- a/src/main/generated/data/forge/tags/block/sandstone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", - "minecraft:red_sandstone", - "minecraft:cut_red_sandstone", - "minecraft:chiseled_red_sandstone", - "minecraft:smooth_red_sandstone" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/stained_glass.json b/src/main/generated/data/forge/tags/block/stained_glass.json deleted file mode 100644 index 2db7aef9df..0000000000 --- a/src/main/generated/data/forge/tags/block/stained_glass.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/stained_glass_panes.json b/src/main/generated/data/forge/tags/block/stained_glass_panes.json deleted file mode 100644 index 65f2adb8f9..0000000000 --- a/src/main/generated/data/forge/tags/block/stained_glass_panes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane", - "minecraft:orange_stained_glass_pane", - "minecraft:magenta_stained_glass_pane", - "minecraft:light_blue_stained_glass_pane", - "minecraft:yellow_stained_glass_pane", - "minecraft:lime_stained_glass_pane", - "minecraft:pink_stained_glass_pane", - "minecraft:gray_stained_glass_pane", - "minecraft:light_gray_stained_glass_pane", - "minecraft:cyan_stained_glass_pane", - "minecraft:purple_stained_glass_pane", - "minecraft:blue_stained_glass_pane", - "minecraft:brown_stained_glass_pane", - "minecraft:green_stained_glass_pane", - "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/stone.json b/src/main/generated/data/forge/tags/block/stone.json deleted file mode 100644 index 958f6e25c7..0000000000 --- a/src/main/generated/data/forge/tags/block/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks.json b/src/main/generated/data/forge/tags/block/storage_blocks.json deleted file mode 100644 index 5f2a7d417e..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/coal.json b/src/main/generated/data/forge/tags/block/storage_blocks/coal.json deleted file mode 100644 index 4b7921705b..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/copper.json b/src/main/generated/data/forge/tags/block/storage_blocks/copper.json deleted file mode 100644 index 015bec70c3..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/diamond.json b/src/main/generated/data/forge/tags/block/storage_blocks/diamond.json deleted file mode 100644 index acd7f52de5..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/emerald.json b/src/main/generated/data/forge/tags/block/storage_blocks/emerald.json deleted file mode 100644 index 152063ec6c..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/gold.json b/src/main/generated/data/forge/tags/block/storage_blocks/gold.json deleted file mode 100644 index 546dde03c9..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/iron.json b/src/main/generated/data/forge/tags/block/storage_blocks/iron.json deleted file mode 100644 index 01fb2965f2..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/lapis.json b/src/main/generated/data/forge/tags/block/storage_blocks/lapis.json deleted file mode 100644 index f4ca82bbd4..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/netherite.json b/src/main/generated/data/forge/tags/block/storage_blocks/netherite.json deleted file mode 100644 index 83433d44eb..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/raw_copper.json b/src/main/generated/data/forge/tags/block/storage_blocks/raw_copper.json deleted file mode 100644 index 1a21e230ef..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/raw_copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/raw_gold.json b/src/main/generated/data/forge/tags/block/storage_blocks/raw_gold.json deleted file mode 100644 index 80781ce667..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/raw_gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/raw_iron.json b/src/main/generated/data/forge/tags/block/storage_blocks/raw_iron.json deleted file mode 100644 index 13ed9fc651..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/raw_iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/block/storage_blocks/redstone.json b/src/main/generated/data/forge/tags/block/storage_blocks/redstone.json deleted file mode 100644 index f5fd89c541..0000000000 --- a/src/main/generated/data/forge/tags/block/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/entity_type/bosses.json b/src/main/generated/data/forge/tags/entity_type/bosses.json deleted file mode 100644 index 4be4cce831..0000000000 --- a/src/main/generated/data/forge/tags/entity_type/bosses.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:ender_dragon", - "minecraft:wither" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/fluid/milk.json b/src/main/generated/data/forge/tags/fluid/milk.json deleted file mode 100644 index 3bab1951b3..0000000000 --- a/src/main/generated/data/forge/tags/fluid/milk.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - { - "id": "minecraft:milk", - "required": false - }, - { - "id": "minecraft:flowing_milk", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/armors.json b/src/main/generated/data/forge/tags/item/armors.json deleted file mode 100644 index 1f895dcedf..0000000000 --- a/src/main/generated/data/forge/tags/item/armors.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:armors/helmets", - "#forge:armors/chestplates", - "#forge:armors/leggings", - "#forge:armors/boots" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/armors/boots.json b/src/main/generated/data/forge/tags/item/armors/boots.json deleted file mode 100644 index b68cf3908d..0000000000 --- a/src/main/generated/data/forge/tags/item/armors/boots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_boots", - "minecraft:chainmail_boots", - "minecraft:iron_boots", - "minecraft:golden_boots", - "minecraft:diamond_boots", - "minecraft:netherite_boots" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/armors/chestplates.json b/src/main/generated/data/forge/tags/item/armors/chestplates.json deleted file mode 100644 index 3f17463c56..0000000000 --- a/src/main/generated/data/forge/tags/item/armors/chestplates.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_chestplate", - "minecraft:chainmail_chestplate", - "minecraft:iron_chestplate", - "minecraft:golden_chestplate", - "minecraft:diamond_chestplate", - "minecraft:netherite_chestplate" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/armors/helmets.json b/src/main/generated/data/forge/tags/item/armors/helmets.json deleted file mode 100644 index 9c9b657c45..0000000000 --- a/src/main/generated/data/forge/tags/item/armors/helmets.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:leather_helmet", - "minecraft:turtle_helmet", - "minecraft:chainmail_helmet", - "minecraft:iron_helmet", - "minecraft:golden_helmet", - "minecraft:diamond_helmet", - "minecraft:netherite_helmet" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/armors/leggings.json b/src/main/generated/data/forge/tags/item/armors/leggings.json deleted file mode 100644 index 8969323c7c..0000000000 --- a/src/main/generated/data/forge/tags/item/armors/leggings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_leggings", - "minecraft:chainmail_leggings", - "minecraft:iron_leggings", - "minecraft:golden_leggings", - "minecraft:diamond_leggings", - "minecraft:netherite_leggings" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/barrels.json b/src/main/generated/data/forge/tags/item/barrels.json deleted file mode 100644 index 1cfb5782c5..0000000000 --- a/src/main/generated/data/forge/tags/item/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/barrels/wooden.json b/src/main/generated/data/forge/tags/item/barrels/wooden.json deleted file mode 100644 index b07daae1c0..0000000000 --- a/src/main/generated/data/forge/tags/item/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/bookshelves.json b/src/main/generated/data/forge/tags/item/bookshelves.json deleted file mode 100644 index c09b2185bd..0000000000 --- a/src/main/generated/data/forge/tags/item/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/chests.json b/src/main/generated/data/forge/tags/item/chests.json deleted file mode 100644 index 9afff2b15a..0000000000 --- a/src/main/generated/data/forge/tags/item/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/chests/wooden.json b/src/main/generated/data/forge/tags/item/chests/wooden.json deleted file mode 100644 index 86533f935b..0000000000 --- a/src/main/generated/data/forge/tags/item/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/cobblestone.json b/src/main/generated/data/forge/tags/item/cobblestone.json deleted file mode 100644 index f0ae95b5fc..0000000000 --- a/src/main/generated/data/forge/tags/item/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops.json b/src/main/generated/data/forge/tags/item/crops.json deleted file mode 100644 index ae5f647fbe..0000000000 --- a/src/main/generated/data/forge/tags/item/crops.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "#forge:crops/beetroot", - "#forge:crops/carrot", - "#forge:crops/nether_wart", - "#forge:crops/potato", - "#forge:crops/wheat" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops/beetroot.json b/src/main/generated/data/forge/tags/item/crops/beetroot.json deleted file mode 100644 index b28b723c4b..0000000000 --- a/src/main/generated/data/forge/tags/item/crops/beetroot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:beetroot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops/carrot.json b/src/main/generated/data/forge/tags/item/crops/carrot.json deleted file mode 100644 index f9630d1347..0000000000 --- a/src/main/generated/data/forge/tags/item/crops/carrot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:carrot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops/nether_wart.json b/src/main/generated/data/forge/tags/item/crops/nether_wart.json deleted file mode 100644 index 5960d80cb9..0000000000 --- a/src/main/generated/data/forge/tags/item/crops/nether_wart.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_wart" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops/potato.json b/src/main/generated/data/forge/tags/item/crops/potato.json deleted file mode 100644 index 47fc151cd1..0000000000 --- a/src/main/generated/data/forge/tags/item/crops/potato.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:potato" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/crops/wheat.json b/src/main/generated/data/forge/tags/item/crops/wheat.json deleted file mode 100644 index 498cb445f6..0000000000 --- a/src/main/generated/data/forge/tags/item/crops/wheat.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:wheat" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/dusts.json b/src/main/generated/data/forge/tags/item/dusts.json deleted file mode 100644 index 87f0fee447..0000000000 --- a/src/main/generated/data/forge/tags/item/dusts.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:dusts/glowstone", - "#forge:dusts/prismarine", - "#forge:dusts/redstone" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/dusts/glowstone.json b/src/main/generated/data/forge/tags/item/dusts/glowstone.json deleted file mode 100644 index 668258c523..0000000000 --- a/src/main/generated/data/forge/tags/item/dusts/glowstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glowstone_dust" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/dusts/prismarine.json b/src/main/generated/data/forge/tags/item/dusts/prismarine.json deleted file mode 100644 index 3773c1f116..0000000000 --- a/src/main/generated/data/forge/tags/item/dusts/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_shard" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/dusts/redstone.json b/src/main/generated/data/forge/tags/item/dusts/redstone.json deleted file mode 100644 index a096239ec1..0000000000 --- a/src/main/generated/data/forge/tags/item/dusts/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/eggs.json b/src/main/generated/data/forge/tags/item/eggs.json deleted file mode 100644 index 4cc54b7acb..0000000000 --- a/src/main/generated/data/forge/tags/item/eggs.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:egg", - "minecraft:egg" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/enchanting_fuels.json b/src/main/generated/data/forge/tags/item/enchanting_fuels.json index 5ee9fdf84e..9083586809 100644 --- a/src/main/generated/data/forge/tags/item/enchanting_fuels.json +++ b/src/main/generated/data/forge/tags/item/enchanting_fuels.json @@ -1,6 +1,5 @@ { "values": [ - "#c:gems/lapis", - "#forge:gems/lapis" + "#c:gems/lapis" ] } \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ender_pearls.json b/src/main/generated/data/forge/tags/item/ender_pearls.json deleted file mode 100644 index 135cd1d776..0000000000 --- a/src/main/generated/data/forge/tags/item/ender_pearls.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_pearl" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/feathers.json b/src/main/generated/data/forge/tags/item/feathers.json deleted file mode 100644 index 0a7bf89c15..0000000000 --- a/src/main/generated/data/forge/tags/item/feathers.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:feather", - { - "id": "#forge:feathers", - "required": false - }, - "minecraft:feather" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/fence_gates.json b/src/main/generated/data/forge/tags/item/fence_gates.json deleted file mode 100644 index b9a57ac0ef..0000000000 --- a/src/main/generated/data/forge/tags/item/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/fences.json b/src/main/generated/data/forge/tags/item/fences.json deleted file mode 100644 index 44358edb04..0000000000 --- a/src/main/generated/data/forge/tags/item/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/foods/pie.json b/src/main/generated/data/forge/tags/item/foods/pie.json deleted file mode 100644 index 7589c5f241..0000000000 --- a/src/main/generated/data/forge/tags/item/foods/pie.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pumpkin_pie" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems.json b/src/main/generated/data/forge/tags/item/gems.json deleted file mode 100644 index 60af4bab68..0000000000 --- a/src/main/generated/data/forge/tags/item/gems.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:gems/amethyst", - "#forge:gems/diamond", - "#forge:gems/emerald", - "#forge:gems/lapis", - "#forge:gems/prismarine", - "#forge:gems/quartz" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/amethyst.json b/src/main/generated/data/forge/tags/item/gems/amethyst.json deleted file mode 100644 index 742ef896d5..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_shard" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/diamond.json b/src/main/generated/data/forge/tags/item/gems/diamond.json deleted file mode 100644 index f44f30dd55..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/emerald.json b/src/main/generated/data/forge/tags/item/gems/emerald.json deleted file mode 100644 index 07a0982118..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/lapis.json b/src/main/generated/data/forge/tags/item/gems/lapis.json deleted file mode 100644 index 614441df46..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_lazuli" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/prismarine.json b/src/main/generated/data/forge/tags/item/gems/prismarine.json deleted file mode 100644 index 150e7ff711..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_crystals" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/gems/quartz.json b/src/main/generated/data/forge/tags/item/gems/quartz.json deleted file mode 100644 index aad2eef95b..0000000000 --- a/src/main/generated/data/forge/tags/item/gems/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass.json b/src/main/generated/data/forge/tags/item/glass.json deleted file mode 100644 index fec31169ee..0000000000 --- a/src/main/generated/data/forge/tags/item/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/black.json b/src/main/generated/data/forge/tags/item/glass/black.json deleted file mode 100644 index 9965b5e8b4..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/blue.json b/src/main/generated/data/forge/tags/item/glass/blue.json deleted file mode 100644 index f59e58c6bf..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/brown.json b/src/main/generated/data/forge/tags/item/glass/brown.json deleted file mode 100644 index 490015cbb5..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/colorless.json b/src/main/generated/data/forge/tags/item/glass/colorless.json deleted file mode 100644 index ac8b5e5086..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/cyan.json b/src/main/generated/data/forge/tags/item/glass/cyan.json deleted file mode 100644 index 24d84747fa..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/gray.json b/src/main/generated/data/forge/tags/item/glass/gray.json deleted file mode 100644 index 2f309170ca..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/green.json b/src/main/generated/data/forge/tags/item/glass/green.json deleted file mode 100644 index d7946c1aca..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/light_blue.json b/src/main/generated/data/forge/tags/item/glass/light_blue.json deleted file mode 100644 index dc8e6b7148..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/light_gray.json b/src/main/generated/data/forge/tags/item/glass/light_gray.json deleted file mode 100644 index f165a46c90..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/lime.json b/src/main/generated/data/forge/tags/item/glass/lime.json deleted file mode 100644 index b6bb1d9415..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/magenta.json b/src/main/generated/data/forge/tags/item/glass/magenta.json deleted file mode 100644 index aa6a4825e8..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/orange.json b/src/main/generated/data/forge/tags/item/glass/orange.json deleted file mode 100644 index 9322f51fe4..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/pink.json b/src/main/generated/data/forge/tags/item/glass/pink.json deleted file mode 100644 index 58b65891fc..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/purple.json b/src/main/generated/data/forge/tags/item/glass/purple.json deleted file mode 100644 index d75a9e7308..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/red.json b/src/main/generated/data/forge/tags/item/glass/red.json deleted file mode 100644 index 72af78c029..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/silica.json b/src/main/generated/data/forge/tags/item/glass/silica.json deleted file mode 100644 index 3465b3884b..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/silica.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "values": [ - "minecraft:glass", - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/tinted.json b/src/main/generated/data/forge/tags/item/glass/tinted.json deleted file mode 100644 index 4075a1556b..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/white.json b/src/main/generated/data/forge/tags/item/glass/white.json deleted file mode 100644 index fb180e703e..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass/yellow.json b/src/main/generated/data/forge/tags/item/glass/yellow.json deleted file mode 100644 index 0831bea4cc..0000000000 --- a/src/main/generated/data/forge/tags/item/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes.json b/src/main/generated/data/forge/tags/item/glass_panes.json deleted file mode 100644 index 4b95330d4f..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/black.json b/src/main/generated/data/forge/tags/item/glass_panes/black.json deleted file mode 100644 index ebda555dcd..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/blue.json b/src/main/generated/data/forge/tags/item/glass_panes/blue.json deleted file mode 100644 index 2762890aa9..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/brown.json b/src/main/generated/data/forge/tags/item/glass_panes/brown.json deleted file mode 100644 index 0b5b727491..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/colorless.json b/src/main/generated/data/forge/tags/item/glass_panes/colorless.json deleted file mode 100644 index eb5756f964..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/cyan.json b/src/main/generated/data/forge/tags/item/glass_panes/cyan.json deleted file mode 100644 index 9913e90a96..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/gray.json b/src/main/generated/data/forge/tags/item/glass_panes/gray.json deleted file mode 100644 index 9fe30b26a8..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/green.json b/src/main/generated/data/forge/tags/item/glass_panes/green.json deleted file mode 100644 index ab91321028..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/light_blue.json b/src/main/generated/data/forge/tags/item/glass_panes/light_blue.json deleted file mode 100644 index cd6d399022..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/light_gray.json b/src/main/generated/data/forge/tags/item/glass_panes/light_gray.json deleted file mode 100644 index 7be6a4ce81..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/lime.json b/src/main/generated/data/forge/tags/item/glass_panes/lime.json deleted file mode 100644 index 46dec64b22..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/magenta.json b/src/main/generated/data/forge/tags/item/glass_panes/magenta.json deleted file mode 100644 index 7504bc3fa3..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/orange.json b/src/main/generated/data/forge/tags/item/glass_panes/orange.json deleted file mode 100644 index 1c47e34616..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/pink.json b/src/main/generated/data/forge/tags/item/glass_panes/pink.json deleted file mode 100644 index 28e36b973f..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/purple.json b/src/main/generated/data/forge/tags/item/glass_panes/purple.json deleted file mode 100644 index a3cff33a14..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/red.json b/src/main/generated/data/forge/tags/item/glass_panes/red.json deleted file mode 100644 index 5edd855d71..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/white.json b/src/main/generated/data/forge/tags/item/glass_panes/white.json deleted file mode 100644 index b514a2839f..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/glass_panes/yellow.json b/src/main/generated/data/forge/tags/item/glass_panes/yellow.json deleted file mode 100644 index a293eb9dc8..0000000000 --- a/src/main/generated/data/forge/tags/item/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/heads.json b/src/main/generated/data/forge/tags/item/heads.json deleted file mode 100644 index 430af37ee5..0000000000 --- a/src/main/generated/data/forge/tags/item/heads.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:creeper_head", - "minecraft:dragon_head", - "minecraft:player_head", - "minecraft:skeleton_skull", - "minecraft:wither_skeleton_skull", - "minecraft:zombie_head" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots.json b/src/main/generated/data/forge/tags/item/ingots.json deleted file mode 100644 index e9756bb39c..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:ingots/brick", - "#forge:ingots/copper", - "#forge:ingots/gold", - "#forge:ingots/iron", - "#forge:ingots/netherite", - "#forge:ingots/nether_brick" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/brick.json b/src/main/generated/data/forge/tags/item/ingots/brick.json deleted file mode 100644 index 8f632e499a..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brick" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/copper.json b/src/main/generated/data/forge/tags/item/ingots/copper.json deleted file mode 100644 index 1cc1f065c5..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_ingot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/gold.json b/src/main/generated/data/forge/tags/item/ingots/gold.json deleted file mode 100644 index 07e9f66a30..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_ingot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/iron.json b/src/main/generated/data/forge/tags/item/ingots/iron.json deleted file mode 100644 index c656021bdb..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_ingot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/nether_brick.json b/src/main/generated/data/forge/tags/item/ingots/nether_brick.json deleted file mode 100644 index ec7ed3ee9a..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ingots/netherite.json b/src/main/generated/data/forge/tags/item/ingots/netherite.json deleted file mode 100644 index bd6929df75..0000000000 --- a/src/main/generated/data/forge/tags/item/ingots/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_ingot" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/leather.json b/src/main/generated/data/forge/tags/item/leather.json deleted file mode 100644 index 71b797d35b..0000000000 --- a/src/main/generated/data/forge/tags/item/leather.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:leather" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/mushrooms.json b/src/main/generated/data/forge/tags/item/mushrooms.json deleted file mode 100644 index 67f853554a..0000000000 --- a/src/main/generated/data/forge/tags/item/mushrooms.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:brown_mushroom", - "minecraft:red_mushroom", - { - "id": "#forge:mushrooms", - "required": false - }, - "minecraft:brown_mushroom", - "minecraft:red_mushroom" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/nether_stars.json b/src/main/generated/data/forge/tags/item/nether_stars.json deleted file mode 100644 index e28072445c..0000000000 --- a/src/main/generated/data/forge/tags/item/nether_stars.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:nether_star", - { - "id": "#forge:nether_stars", - "required": false - }, - "minecraft:nether_star" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/nuggets.json b/src/main/generated/data/forge/tags/item/nuggets.json deleted file mode 100644 index fb0dc26ecd..0000000000 --- a/src/main/generated/data/forge/tags/item/nuggets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:nuggets/iron", - "#forge:nuggets/gold" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/nuggets/gold.json b/src/main/generated/data/forge/tags/item/nuggets/gold.json deleted file mode 100644 index 4d94345957..0000000000 --- a/src/main/generated/data/forge/tags/item/nuggets/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_nugget" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/nuggets/iron.json b/src/main/generated/data/forge/tags/item/nuggets/iron.json deleted file mode 100644 index cbd20ac6e4..0000000000 --- a/src/main/generated/data/forge/tags/item/nuggets/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_nugget" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/obsidian.json b/src/main/generated/data/forge/tags/item/obsidian.json deleted file mode 100644 index 170248454b..0000000000 --- a/src/main/generated/data/forge/tags/item/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ores.json b/src/main/generated/data/forge/tags/item/ores.json deleted file mode 100644 index 2c4beabc55..0000000000 --- a/src/main/generated/data/forge/tags/item/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ores/netherite_scrap.json b/src/main/generated/data/forge/tags/item/ores/netherite_scrap.json deleted file mode 100644 index 910d1fb8e6..0000000000 --- a/src/main/generated/data/forge/tags/item/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/ores/quartz.json b/src/main/generated/data/forge/tags/item/ores/quartz.json deleted file mode 100644 index f0bc7a4657..0000000000 --- a/src/main/generated/data/forge/tags/item/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/raw_materials.json b/src/main/generated/data/forge/tags/item/raw_materials.json deleted file mode 100644 index 35208231e0..0000000000 --- a/src/main/generated/data/forge/tags/item/raw_materials.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:raw_materials/copper", - "#forge:raw_materials/gold", - "#forge:raw_materials/iron" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/raw_materials/copper.json b/src/main/generated/data/forge/tags/item/raw_materials/copper.json deleted file mode 100644 index 3e03ab9ca8..0000000000 --- a/src/main/generated/data/forge/tags/item/raw_materials/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/raw_materials/gold.json b/src/main/generated/data/forge/tags/item/raw_materials/gold.json deleted file mode 100644 index 3d1252e5f9..0000000000 --- a/src/main/generated/data/forge/tags/item/raw_materials/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/raw_materials/iron.json b/src/main/generated/data/forge/tags/item/raw_materials/iron.json deleted file mode 100644 index 8f9af48d8e..0000000000 --- a/src/main/generated/data/forge/tags/item/raw_materials/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/rods.json b/src/main/generated/data/forge/tags/item/rods.json deleted file mode 100644 index 11b8cb3844..0000000000 --- a/src/main/generated/data/forge/tags/item/rods.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:rods/blaze", - "#forge:rods/wooden" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/rods/blaze.json b/src/main/generated/data/forge/tags/item/rods/blaze.json deleted file mode 100644 index 5d2eff8311..0000000000 --- a/src/main/generated/data/forge/tags/item/rods/blaze.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blaze_rod" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/rods/wooden.json b/src/main/generated/data/forge/tags/item/rods/wooden.json deleted file mode 100644 index 019b63dd31..0000000000 --- a/src/main/generated/data/forge/tags/item/rods/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stick" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/sand.json b/src/main/generated/data/forge/tags/item/sand.json deleted file mode 100644 index 8b04916283..0000000000 --- a/src/main/generated/data/forge/tags/item/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/sandstone.json b/src/main/generated/data/forge/tags/item/sandstone.json deleted file mode 100644 index bb7fb03ee3..0000000000 --- a/src/main/generated/data/forge/tags/item/sandstone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", - "minecraft:red_sandstone", - "minecraft:cut_red_sandstone", - "minecraft:chiseled_red_sandstone", - "minecraft:smooth_red_sandstone" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/seeds.json b/src/main/generated/data/forge/tags/item/seeds.json deleted file mode 100644 index 756a7a4dab..0000000000 --- a/src/main/generated/data/forge/tags/item/seeds.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "#forge:seeds/beetroot", - "#forge:seeds/melon", - "#forge:seeds/pumpkin", - "#forge:seeds/wheat", - "#forge:seeds/beetroot", - "#forge:seeds/melon", - "#forge:seeds/pumpkin", - "#forge:seeds/wheat" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/shears.json b/src/main/generated/data/forge/tags/item/shears.json deleted file mode 100644 index 2400078166..0000000000 --- a/src/main/generated/data/forge/tags/item/shears.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shears" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/slimeballs.json b/src/main/generated/data/forge/tags/item/slimeballs.json deleted file mode 100644 index 533c25d916..0000000000 --- a/src/main/generated/data/forge/tags/item/slimeballs.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:slime_ball" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/stained_glass.json b/src/main/generated/data/forge/tags/item/stained_glass.json deleted file mode 100644 index 2db7aef9df..0000000000 --- a/src/main/generated/data/forge/tags/item/stained_glass.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/stained_glass_panes.json b/src/main/generated/data/forge/tags/item/stained_glass_panes.json deleted file mode 100644 index 65f2adb8f9..0000000000 --- a/src/main/generated/data/forge/tags/item/stained_glass_panes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane", - "minecraft:orange_stained_glass_pane", - "minecraft:magenta_stained_glass_pane", - "minecraft:light_blue_stained_glass_pane", - "minecraft:yellow_stained_glass_pane", - "minecraft:lime_stained_glass_pane", - "minecraft:pink_stained_glass_pane", - "minecraft:gray_stained_glass_pane", - "minecraft:light_gray_stained_glass_pane", - "minecraft:cyan_stained_glass_pane", - "minecraft:purple_stained_glass_pane", - "minecraft:blue_stained_glass_pane", - "minecraft:brown_stained_glass_pane", - "minecraft:green_stained_glass_pane", - "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/stone.json b/src/main/generated/data/forge/tags/item/stone.json deleted file mode 100644 index 958f6e25c7..0000000000 --- a/src/main/generated/data/forge/tags/item/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks.json b/src/main/generated/data/forge/tags/item/storage_blocks.json deleted file mode 100644 index 5f2a7d417e..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/coal.json b/src/main/generated/data/forge/tags/item/storage_blocks/coal.json deleted file mode 100644 index 4b7921705b..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/copper.json b/src/main/generated/data/forge/tags/item/storage_blocks/copper.json deleted file mode 100644 index 015bec70c3..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/diamond.json b/src/main/generated/data/forge/tags/item/storage_blocks/diamond.json deleted file mode 100644 index acd7f52de5..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/emerald.json b/src/main/generated/data/forge/tags/item/storage_blocks/emerald.json deleted file mode 100644 index 152063ec6c..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/gold.json b/src/main/generated/data/forge/tags/item/storage_blocks/gold.json deleted file mode 100644 index 546dde03c9..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/iron.json b/src/main/generated/data/forge/tags/item/storage_blocks/iron.json deleted file mode 100644 index 01fb2965f2..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/lapis.json b/src/main/generated/data/forge/tags/item/storage_blocks/lapis.json deleted file mode 100644 index f4ca82bbd4..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/netherite.json b/src/main/generated/data/forge/tags/item/storage_blocks/netherite.json deleted file mode 100644 index 83433d44eb..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/raw_copper.json b/src/main/generated/data/forge/tags/item/storage_blocks/raw_copper.json deleted file mode 100644 index 1a21e230ef..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/raw_copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/raw_gold.json b/src/main/generated/data/forge/tags/item/storage_blocks/raw_gold.json deleted file mode 100644 index 80781ce667..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/raw_gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/raw_iron.json b/src/main/generated/data/forge/tags/item/storage_blocks/raw_iron.json deleted file mode 100644 index 13ed9fc651..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/raw_iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/storage_blocks/redstone.json b/src/main/generated/data/forge/tags/item/storage_blocks/redstone.json deleted file mode 100644 index f5fd89c541..0000000000 --- a/src/main/generated/data/forge/tags/item/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/string.json b/src/main/generated/data/forge/tags/item/string.json deleted file mode 100644 index d018256cf8..0000000000 --- a/src/main/generated/data/forge/tags/item/string.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:string" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools.json b/src/main/generated/data/forge/tags/item/tools.json deleted file mode 100644 index acbfe2ae9d..0000000000 --- a/src/main/generated/data/forge/tags/item/tools.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#minecraft:swords", - "#minecraft:axes", - "#minecraft:pickaxes", - "#minecraft:shovels", - "#minecraft:hoes", - "#forge:tools/shields", - "#forge:tools/bows", - "#forge:tools/crossbows", - "#forge:tools/fishing_rods", - "#forge:tools/tridents" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools/bows.json b/src/main/generated/data/forge/tags/item/tools/bows.json deleted file mode 100644 index a1c8a443dc..0000000000 --- a/src/main/generated/data/forge/tags/item/tools/bows.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bow" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools/crossbows.json b/src/main/generated/data/forge/tags/item/tools/crossbows.json deleted file mode 100644 index 848f97bc22..0000000000 --- a/src/main/generated/data/forge/tags/item/tools/crossbows.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:crossbow" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools/fishing_rods.json b/src/main/generated/data/forge/tags/item/tools/fishing_rods.json deleted file mode 100644 index e97941e9dc..0000000000 --- a/src/main/generated/data/forge/tags/item/tools/fishing_rods.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:fishing_rod" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools/shields.json b/src/main/generated/data/forge/tags/item/tools/shields.json deleted file mode 100644 index 0f2454ce04..0000000000 --- a/src/main/generated/data/forge/tags/item/tools/shields.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shield" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/item/tools/tridents.json b/src/main/generated/data/forge/tags/item/tools/tridents.json deleted file mode 100644 index 7a2c450bc7..0000000000 --- a/src/main/generated/data/forge/tags/item/tools/tridents.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trident" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_cave.json b/src/main/generated/data/forge/tags/worldgen/biome/is_cave.json deleted file mode 100644 index 21a70cfeec..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_cave.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:lush_caves", - "minecraft:dripstone_caves", - "minecraft:deep_dark" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_cold.json b/src/main/generated/data/forge/tags/worldgen/biome/is_cold.json deleted file mode 100644 index 75f9c80b3d..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_cold.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:is_cold/overworld", - { - "id": "#forge:is_cold/nether", - "required": false - }, - "#forge:is_cold/end" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_cold/end.json b/src/main/generated/data/forge/tags/worldgen/biome/is_cold/end.json deleted file mode 100644 index 73d3eff3b0..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_cold/end.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:the_end", - "minecraft:small_end_islands", - "minecraft:end_midlands", - "minecraft:end_highlands", - "minecraft:end_barrens" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_cold/overworld.json b/src/main/generated/data/forge/tags/worldgen/biome/is_cold/overworld.json deleted file mode 100644 index 4d7cf8a957..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_cold/overworld.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "values": [ - "minecraft:taiga", - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", - "minecraft:snowy_beach", - "minecraft:snowy_taiga", - "minecraft:old_growth_pine_taiga", - "minecraft:grove", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:cold_ocean", - "minecraft:deep_cold_ocean", - "minecraft:deep_frozen_ocean", - "minecraft:ice_spikes" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dense.json b/src/main/generated/data/forge/tags/worldgen/biome/is_dense.json deleted file mode 100644 index fa16b4cc6b..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dense.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_dense/overworld", - { - "id": "#forge:is_dense/nether", - "required": false - }, - { - "id": "#forge:is_dense/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dense/overworld.json b/src/main/generated/data/forge/tags/worldgen/biome/is_dense/overworld.json deleted file mode 100644 index 9491a24bc8..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dense/overworld.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:jungle", - "minecraft:dark_forest", - "minecraft:old_growth_birch_forest", - "minecraft:old_growth_spruce_taiga" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_desert.json b/src/main/generated/data/forge/tags/worldgen/biome/is_desert.json deleted file mode 100644 index f1a8ccb642..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_desert.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:desert" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dry.json b/src/main/generated/data/forge/tags/worldgen/biome/is_dry.json deleted file mode 100644 index 28d35de201..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dry.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:is_dry/overworld", - "#forge:is_dry/nether", - "#forge:is_dry/end" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/end.json b/src/main/generated/data/forge/tags/worldgen/biome/is_dry/end.json deleted file mode 100644 index 73d3eff3b0..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/end.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:the_end", - "minecraft:small_end_islands", - "minecraft:end_midlands", - "minecraft:end_highlands", - "minecraft:end_barrens" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/nether.json b/src/main/generated/data/forge/tags/worldgen/biome/is_dry/nether.json deleted file mode 100644 index 340c9d161b..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_dry/nether.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:nether_wastes", - "minecraft:soul_sand_valley", - "minecraft:crimson_forest", - "minecraft:warped_forest", - "minecraft:basalt_deltas" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_hot.json b/src/main/generated/data/forge/tags/worldgen/biome/is_hot.json deleted file mode 100644 index 6559f017e6..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_hot.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:is_hot/overworld", - "#forge:is_hot/nether", - { - "id": "#forge:is_hot/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_hot/nether.json b/src/main/generated/data/forge/tags/worldgen/biome/is_hot/nether.json deleted file mode 100644 index 340c9d161b..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_hot/nether.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:nether_wastes", - "minecraft:soul_sand_valley", - "minecraft:crimson_forest", - "minecraft:warped_forest", - "minecraft:basalt_deltas" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_hot/overworld.json b/src/main/generated/data/forge/tags/worldgen/biome/is_hot/overworld.json deleted file mode 100644 index f283627eb9..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_hot/overworld.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:jungle", - "minecraft:sparse_jungle", - "minecraft:savanna", - "minecraft:savanna_plateau", - "minecraft:stony_peaks", - "minecraft:warm_ocean", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:bamboo_jungle", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_mountain.json b/src/main/generated/data/forge/tags/worldgen/biome/is_mountain.json deleted file mode 100644 index 859b350079..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_mountain.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:is_peak", - "#forge:is_slope" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_mushroom.json b/src/main/generated/data/forge/tags/worldgen/biome/is_mushroom.json deleted file mode 100644 index 05d85d951d..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_mushroom.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mushroom_fields" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_peak.json b/src/main/generated/data/forge/tags/worldgen/biome/is_peak.json deleted file mode 100644 index c9597b86d0..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_peak.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:stony_peaks" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_plains.json b/src/main/generated/data/forge/tags/worldgen/biome/is_plains.json deleted file mode 100644 index 9028b691af..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_plains.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:plains", - "minecraft:snowy_plains", - "minecraft:meadow", - "minecraft:sunflower_plains" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_sandy.json b/src/main/generated/data/forge/tags/worldgen/biome/is_sandy.json deleted file mode 100644 index 1dd432aa43..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_sandy.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:badlands", - "minecraft:wooded_badlands", - "minecraft:eroded_badlands", - "minecraft:beach", - "minecraft:desert", - "minecraft:beach", - "minecraft:badlands", - "minecraft:wooded_badlands" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_slope.json b/src/main/generated/data/forge/tags/worldgen/biome/is_slope.json deleted file mode 100644 index 453f828613..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_slope.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:meadow", - "minecraft:grove", - "minecraft:snowy_slopes" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_snowy.json b/src/main/generated/data/forge/tags/worldgen/biome/is_snowy.json deleted file mode 100644 index e1310e08ee..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_snowy.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", - "minecraft:snowy_beach", - "minecraft:snowy_taiga", - "minecraft:grove", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:ice_spikes" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse.json b/src/main/generated/data/forge/tags/worldgen/biome/is_sparse.json deleted file mode 100644 index 7680132431..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_sparse/overworld", - { - "id": "#forge:is_sparse/nether", - "required": false - }, - { - "id": "#forge:is_sparse/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse/overworld.json b/src/main/generated/data/forge/tags/worldgen/biome/is_sparse/overworld.json deleted file mode 100644 index e9652824e6..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_sparse/overworld.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:windswept_forest", - "minecraft:savanna", - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:windswept_gravelly_hills", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:dripstone_caves" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_underground.json b/src/main/generated/data/forge/tags/worldgen/biome/is_underground.json deleted file mode 100644 index c55f2d526e..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_underground.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:is_cave" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_void.json b/src/main/generated/data/forge/tags/worldgen/biome/is_void.json deleted file mode 100644 index f55aea6671..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_void.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:the_void" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_wasteland.json b/src/main/generated/data/forge/tags/worldgen/biome/is_wasteland.json deleted file mode 100644 index 05a22cb3c9..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_wasteland.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:snowy_plains" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_water.json b/src/main/generated/data/forge/tags/worldgen/biome/is_water.json deleted file mode 100644 index 800c17196b..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_water.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#minecraft:is_ocean", - "#minecraft:is_river" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_wet.json b/src/main/generated/data/forge/tags/worldgen/biome/is_wet.json deleted file mode 100644 index b355261275..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_wet.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_wet/overworld", - { - "id": "#forge:is_wet/nether", - "required": false - }, - { - "id": "#forge:is_wet/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/forge/tags/worldgen/biome/is_wet/overworld.json b/src/main/generated/data/forge/tags/worldgen/biome/is_wet/overworld.json deleted file mode 100644 index e5e5a885c5..0000000000 --- a/src/main/generated/data/forge/tags/worldgen/biome/is_wet/overworld.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:swamp", - "minecraft:jungle", - "minecraft:sparse_jungle", - "minecraft:beach", - "minecraft:bamboo_jungle", - "minecraft:lush_caves", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file diff --git a/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json index 6b168e6299..76b0651a2d 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json index 728ca83253..e2688d9d93 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json index bc635e84ac..d785dae910 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/bush.json b/src/main/generated/data/minecraft/loot_table/blocks/bush.json index f339200a8c..ec187ebbd4 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/bush.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/bush.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json index c5ffbbd7b3..2b06aae023 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json b/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json index 0fc81358f5..dccc612281 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json index c866e9aa27..835b4f54ba 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, @@ -128,7 +125,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json b/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json index 1f9d8b5378..fa44726bc4 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -21,7 +20,6 @@ "type": "minecraft:item", "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/fern.json b/src/main/generated/data/minecraft/loot_table/blocks/fern.json index e89145df53..de279d9d4e 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/fern.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/fern.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json index db47a087d9..d284eafbc5 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json b/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json index 5415d24862..56563b3457 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json b/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json index 6e84cafd44..da9a870588 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json index d56cdc0697..2901f7814f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -63,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -111,7 +109,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json b/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json index 22b7513724..4dbcfcfd5f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:large_fern", @@ -38,7 +37,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } @@ -64,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:large_fern", @@ -100,7 +97,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json index 4601627c2a..ab53c93864 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -54,7 +53,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json b/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json index d0aee8945e..67258724b2 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json index 59c4a3c458..69933a1855 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, @@ -128,7 +125,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json b/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json index a186e96ba4..ddaef52c33 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json index 8e75c5a242..7e9ae46ff0 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json b/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json index 383923d251..c806404eaa 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json index 84f1103b9b..073531704f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json index c75f40d2fe..6c1b1492fb 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json b/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json index e7bb2ff6d1..c7aa5e9724 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json index 70115ff27f..40d83f352e 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json index 0bf2a9912d..cfc332693c 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json index 4391e321ef..d0c7d31e68 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:tall_grass", @@ -38,7 +37,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } @@ -64,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:tall_grass", @@ -100,7 +97,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json index fa8d199f02..452880c35b 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", @@ -14,7 +13,6 @@ "type": "minecraft:item", "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json b/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json index add7780f43..543c463516 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/vine.json b/src/main/generated/data/minecraft/loot_table/blocks/vine.json index 94c46af2c1..5fc89d2081 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/vine.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/vine.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json b/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json index d782c26b41..ab00aeccc5 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json b/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json index 8b2b099633..eb2e6f98f0 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:acacia_boat" ], "result": { - "count": 1, "id": "minecraft:acacia_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/acacia_fence.json b/src/main/generated/data/minecraft/recipe/acacia_fence.json index abc4d37cba..6c6a000970 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_fence.json +++ b/src/main/generated/data/minecraft/recipe/acacia_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/acacia_fence_gate.json b/src/main/generated/data/minecraft/recipe/acacia_fence_gate.json index af366bf332..e685099595 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/acacia_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:acacia_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/acacia_sign.json b/src/main/generated/data/minecraft/recipe/acacia_sign.json index 3232b1b89a..8a03c68de4 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_sign.json +++ b/src/main/generated/data/minecraft/recipe/acacia_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:acacia_planks", diff --git a/src/main/generated/data/minecraft/recipe/activator_rail.json b/src/main/generated/data/minecraft/recipe/activator_rail.json index 555bb300db..4fa1b01904 100644 --- a/src/main/generated/data/minecraft/recipe/activator_rail.json +++ b/src/main/generated/data/minecraft/recipe/activator_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:redstone_torch", "S": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/andesite.json b/src/main/generated/data/minecraft/recipe/andesite.json index a73dac1c38..5dfdf07cd9 100644 --- a/src/main/generated/data/minecraft/recipe/andesite.json +++ b/src/main/generated/data/minecraft/recipe/andesite.json @@ -3,7 +3,7 @@ "category": "building", "ingredients": [ "minecraft:diorite", - "#forge:cobblestone/normal" + "#c:cobblestones/normal" ], "result": { "count": 2, diff --git a/src/main/generated/data/minecraft/recipe/anvil.json b/src/main/generated/data/minecraft/recipe/anvil.json index e50cd1febe..fc40541868 100644 --- a/src/main/generated/data/minecraft/recipe/anvil.json +++ b/src/main/generated/data/minecraft/recipe/anvil.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "minecraft:iron_block", "i": "#c:ingots/iron" @@ -11,7 +10,6 @@ "iii" ], "result": { - "count": 1, "id": "minecraft:anvil" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/armor_stand.json b/src/main/generated/data/minecraft/recipe/armor_stand.json index a3ad60d12c..09aaff0756 100644 --- a/src/main/generated/data/minecraft/recipe/armor_stand.json +++ b/src/main/generated/data/minecraft/recipe/armor_stand.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "/": "#c:rods/wooden", "_": "minecraft:smooth_stone_slab" @@ -11,7 +10,6 @@ "/_/" ], "result": { - "count": 1, "id": "minecraft:armor_stand" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json b/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json index 3715812774..bcaa8136ee 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:bamboo_raft" ], "result": { - "count": 1, "id": "minecraft:bamboo_chest_raft" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bamboo_fence.json b/src/main/generated/data/minecraft/recipe/bamboo_fence.json index d36413016a..9730b110af 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_fence.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/bamboo_fence_gate.json b/src/main/generated/data/minecraft/recipe/bamboo_fence_gate.json index 444acda7be..4156b7fec1 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:bamboo_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bamboo_sign.json b/src/main/generated/data/minecraft/recipe/bamboo_sign.json index 79d256d984..ae6b9c61e8 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_sign.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:bamboo_planks", diff --git a/src/main/generated/data/minecraft/recipe/birch_chest_boat.json b/src/main/generated/data/minecraft/recipe/birch_chest_boat.json index 8e41afa74c..f887571b42 100644 --- a/src/main/generated/data/minecraft/recipe/birch_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/birch_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:birch_boat" ], "result": { - "count": 1, "id": "minecraft:birch_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/birch_fence.json b/src/main/generated/data/minecraft/recipe/birch_fence.json index f340e905c3..ecf986d15e 100644 --- a/src/main/generated/data/minecraft/recipe/birch_fence.json +++ b/src/main/generated/data/minecraft/recipe/birch_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/birch_fence_gate.json b/src/main/generated/data/minecraft/recipe/birch_fence_gate.json index 55e6c5133a..df4e8880cd 100644 --- a/src/main/generated/data/minecraft/recipe/birch_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/birch_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:birch_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/birch_sign.json b/src/main/generated/data/minecraft/recipe/birch_sign.json index 94b286ed75..f74bb206c3 100644 --- a/src/main/generated/data/minecraft/recipe/birch_sign.json +++ b/src/main/generated/data/minecraft/recipe/birch_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:birch_planks", diff --git a/src/main/generated/data/minecraft/recipe/black_banner.json b/src/main/generated/data/minecraft/recipe/black_banner.json index 7f67600216..bbc855b37f 100644 --- a/src/main/generated/data/minecraft/recipe/black_banner.json +++ b/src/main/generated/data/minecraft/recipe/black_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:black_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:black_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/blast_furnace.json b/src/main/generated/data/minecraft/recipe/blast_furnace.json index eb2c292aac..6aca85ac79 100644 --- a/src/main/generated/data/minecraft/recipe/blast_furnace.json +++ b/src/main/generated/data/minecraft/recipe/blast_furnace.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:smooth_stone", "I": "#c:ingots/iron", @@ -12,7 +11,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:blast_furnace" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/blue_banner.json b/src/main/generated/data/minecraft/recipe/blue_banner.json index a98940c6b1..e529c7eb88 100644 --- a/src/main/generated/data/minecraft/recipe/blue_banner.json +++ b/src/main/generated/data/minecraft/recipe/blue_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:blue_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:blue_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json index e5db16797d..628de82168 100644 --- a/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": [ diff --git a/src/main/generated/data/minecraft/recipe/bow.json b/src/main/generated/data/minecraft/recipe/bow.json index 5831fc36f1..57e32ba264 100644 --- a/src/main/generated/data/minecraft/recipe/bow.json +++ b/src/main/generated/data/minecraft/recipe/bow.json @@ -11,7 +11,6 @@ " #X" ], "result": { - "count": 1, "id": "minecraft:bow" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/brown_banner.json b/src/main/generated/data/minecraft/recipe/brown_banner.json index 5394a3d33c..ff3b670602 100644 --- a/src/main/generated/data/minecraft/recipe/brown_banner.json +++ b/src/main/generated/data/minecraft/recipe/brown_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:brown_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:brown_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/brush.json b/src/main/generated/data/minecraft/recipe/brush.json index 4fc5863cee..c66d1df5b6 100644 --- a/src/main/generated/data/minecraft/recipe/brush.json +++ b/src/main/generated/data/minecraft/recipe/brush.json @@ -12,7 +12,6 @@ "I" ], "result": { - "count": 1, "id": "minecraft:brush" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bucket.json b/src/main/generated/data/minecraft/recipe/bucket.json index 692ea8b728..447b848ac1 100644 --- a/src/main/generated/data/minecraft/recipe/bucket.json +++ b/src/main/generated/data/minecraft/recipe/bucket.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, @@ -9,7 +8,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:bucket" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/bundle.json b/src/main/generated/data/minecraft/recipe/bundle.json index fb9cad8657..75cd477459 100644 --- a/src/main/generated/data/minecraft/recipe/bundle.json +++ b/src/main/generated/data/minecraft/recipe/bundle.json @@ -10,7 +10,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:bundle" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/calibrated_sculk_sensor.json b/src/main/generated/data/minecraft/recipe/calibrated_sculk_sensor.json index 7b748c17a2..b1ceef8b50 100644 --- a/src/main/generated/data/minecraft/recipe/calibrated_sculk_sensor.json +++ b/src/main/generated/data/minecraft/recipe/calibrated_sculk_sensor.json @@ -10,7 +10,6 @@ "#X#" ], "result": { - "count": 1, "id": "minecraft:calibrated_sculk_sensor" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/campfire.json b/src/main/generated/data/minecraft/recipe/campfire.json index fd2f337523..10da3b72d2 100644 --- a/src/main/generated/data/minecraft/recipe/campfire.json +++ b/src/main/generated/data/minecraft/recipe/campfire.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "C": "#minecraft:coals", "L": "#minecraft:logs", @@ -12,7 +11,6 @@ "LLL" ], "result": { - "count": 1, "id": "minecraft:campfire" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/candle.json b/src/main/generated/data/minecraft/recipe/candle.json index 6cb6864e6b..9e9b03ea16 100644 --- a/src/main/generated/data/minecraft/recipe/candle.json +++ b/src/main/generated/data/minecraft/recipe/candle.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "H": "minecraft:honeycomb", "S": "#c:strings" @@ -10,7 +9,6 @@ "H" ], "result": { - "count": 1, "id": "minecraft:candle" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/cauldron.json b/src/main/generated/data/minecraft/recipe/cauldron.json index 101a0b54d6..e4f76c54fb 100644 --- a/src/main/generated/data/minecraft/recipe/cauldron.json +++ b/src/main/generated/data/minecraft/recipe/cauldron.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, @@ -10,7 +9,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:cauldron" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json b/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json index df03568c18..ab5750cbd1 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:cherry_boat" ], "result": { - "count": 1, "id": "minecraft:cherry_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/cherry_fence.json b/src/main/generated/data/minecraft/recipe/cherry_fence.json index 9866480fe0..b1d0626d72 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_fence.json +++ b/src/main/generated/data/minecraft/recipe/cherry_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/cherry_fence_gate.json b/src/main/generated/data/minecraft/recipe/cherry_fence_gate.json index 7ad275d012..22f74cc665 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/cherry_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:cherry_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/cherry_sign.json b/src/main/generated/data/minecraft/recipe/cherry_sign.json index 000659bd4a..febe767664 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_sign.json +++ b/src/main/generated/data/minecraft/recipe/cherry_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:cherry_planks", diff --git a/src/main/generated/data/minecraft/recipe/chest_minecart.json b/src/main/generated/data/minecraft/recipe/chest_minecart.json index 9da9c5c21d..adbeb2d5cb 100644 --- a/src/main/generated/data/minecraft/recipe/chest_minecart.json +++ b/src/main/generated/data/minecraft/recipe/chest_minecart.json @@ -1,12 +1,10 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "#c:chests/wooden", "minecraft:minecart" ], "result": { - "count": 1, "id": "minecraft:chest_minecart" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/clock.json b/src/main/generated/data/minecraft/recipe/clock.json index 0ffa5dfe00..d7130bdfff 100644 --- a/src/main/generated/data/minecraft/recipe/clock.json +++ b/src/main/generated/data/minecraft/recipe/clock.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:clock" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json index 8064692610..680d59584f 100644 --- a/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", - "C": "#forge:cobblestone/normal", + "C": "#c:cobblestones/normal", "S": "minecraft:coast_armor_trim_smithing_template" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/compass.json b/src/main/generated/data/minecraft/recipe/compass.json index 89310bdf95..5dc4cc7981 100644 --- a/src/main/generated/data/minecraft/recipe/compass.json +++ b/src/main/generated/data/minecraft/recipe/compass.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:compass" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_axe.json b/src/main/generated/data/minecraft/recipe/copper_axe.json index 98bae5923d..e74f15829a 100644 --- a/src/main/generated/data/minecraft/recipe/copper_axe.json +++ b/src/main/generated/data/minecraft/recipe/copper_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:copper_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_bars.json b/src/main/generated/data/minecraft/recipe/copper_bars.json index 57c1a88ba8..20d2045949 100644 --- a/src/main/generated/data/minecraft/recipe/copper_bars.json +++ b/src/main/generated/data/minecraft/recipe/copper_bars.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/copper" }, diff --git a/src/main/generated/data/minecraft/recipe/copper_boots.json b/src/main/generated/data/minecraft/recipe/copper_boots.json index d6dede53ee..46363bf8da 100644 --- a/src/main/generated/data/minecraft/recipe/copper_boots.json +++ b/src/main/generated/data/minecraft/recipe/copper_boots.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:copper_boots" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_chain.json b/src/main/generated/data/minecraft/recipe/copper_chain.json index 7b30fb1115..4abf563b44 100644 --- a/src/main/generated/data/minecraft/recipe/copper_chain.json +++ b/src/main/generated/data/minecraft/recipe/copper_chain.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "#c:ingots/copper", "N": "minecraft:copper_nugget" @@ -11,7 +10,6 @@ "N" ], "result": { - "count": 1, "id": "minecraft:copper_chain" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_chest.json b/src/main/generated/data/minecraft/recipe/copper_chest.json index 543686cdd0..440f5201a8 100644 --- a/src/main/generated/data/minecraft/recipe/copper_chest.json +++ b/src/main/generated/data/minecraft/recipe/copper_chest.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/copper", "X": "#c:chests/wooden" @@ -11,7 +10,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:copper_chest" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_chestplate.json b/src/main/generated/data/minecraft/recipe/copper_chestplate.json index 996c150fcf..c0af241259 100644 --- a/src/main/generated/data/minecraft/recipe/copper_chestplate.json +++ b/src/main/generated/data/minecraft/recipe/copper_chestplate.json @@ -10,7 +10,6 @@ "XXX" ], "result": { - "count": 1, "id": "minecraft:copper_chestplate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_helmet.json b/src/main/generated/data/minecraft/recipe/copper_helmet.json index fe31d6caca..7db88051e7 100644 --- a/src/main/generated/data/minecraft/recipe/copper_helmet.json +++ b/src/main/generated/data/minecraft/recipe/copper_helmet.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:copper_helmet" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_hoe.json b/src/main/generated/data/minecraft/recipe/copper_hoe.json index 4eaf00f663..8a16409b03 100644 --- a/src/main/generated/data/minecraft/recipe/copper_hoe.json +++ b/src/main/generated/data/minecraft/recipe/copper_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:copper_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_leggings.json b/src/main/generated/data/minecraft/recipe/copper_leggings.json index aa4cb1e52f..fb2d240bd4 100644 --- a/src/main/generated/data/minecraft/recipe/copper_leggings.json +++ b/src/main/generated/data/minecraft/recipe/copper_leggings.json @@ -10,7 +10,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:copper_leggings" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_nugget.json b/src/main/generated/data/minecraft/recipe/copper_nugget.json index 6309a958a8..43f2d8b76e 100644 --- a/src/main/generated/data/minecraft/recipe/copper_nugget.json +++ b/src/main/generated/data/minecraft/recipe/copper_nugget.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "#c:ingots/copper" ], diff --git a/src/main/generated/data/minecraft/recipe/copper_pickaxe.json b/src/main/generated/data/minecraft/recipe/copper_pickaxe.json index 2238f2cf5e..ba3fa4e56a 100644 --- a/src/main/generated/data/minecraft/recipe/copper_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/copper_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:copper_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_shovel.json b/src/main/generated/data/minecraft/recipe/copper_shovel.json index 581a606f5d..fddf9c90e7 100644 --- a/src/main/generated/data/minecraft/recipe/copper_shovel.json +++ b/src/main/generated/data/minecraft/recipe/copper_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:copper_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_spear.json b/src/main/generated/data/minecraft/recipe/copper_spear.json index 6a3b1446a0..833fdc4e61 100644 --- a/src/main/generated/data/minecraft/recipe/copper_spear.json +++ b/src/main/generated/data/minecraft/recipe/copper_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:copper_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_sword.json b/src/main/generated/data/minecraft/recipe/copper_sword.json index 123e70b648..6d9608daaa 100644 --- a/src/main/generated/data/minecraft/recipe/copper_sword.json +++ b/src/main/generated/data/minecraft/recipe/copper_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:copper_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/copper_torch.json b/src/main/generated/data/minecraft/recipe/copper_torch.json index 4bde6043d5..a6d835a1c5 100644 --- a/src/main/generated/data/minecraft/recipe/copper_torch.json +++ b/src/main/generated/data/minecraft/recipe/copper_torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "C": "minecraft:copper_nugget", diff --git a/src/main/generated/data/minecraft/recipe/copper_trapdoor.json b/src/main/generated/data/minecraft/recipe/copper_trapdoor.json index 00b43cd5a3..2128a38437 100644 --- a/src/main/generated/data/minecraft/recipe/copper_trapdoor.json +++ b/src/main/generated/data/minecraft/recipe/copper_trapdoor.json @@ -9,7 +9,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:copper_trapdoor" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/crafter.json b/src/main/generated/data/minecraft/recipe/crafter.json index 8db88e0466..96f30df790 100644 --- a/src/main/generated/data/minecraft/recipe/crafter.json +++ b/src/main/generated/data/minecraft/recipe/crafter.json @@ -13,7 +13,6 @@ "RDR" ], "result": { - "count": 1, "id": "minecraft:crafter" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/crimson_fence.json b/src/main/generated/data/minecraft/recipe/crimson_fence.json index 20e9d8a6e3..1bef1ecd26 100644 --- a/src/main/generated/data/minecraft/recipe/crimson_fence.json +++ b/src/main/generated/data/minecraft/recipe/crimson_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/crimson_fence_gate.json b/src/main/generated/data/minecraft/recipe/crimson_fence_gate.json index fdbdfa0f4b..2411d23301 100644 --- a/src/main/generated/data/minecraft/recipe/crimson_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/crimson_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:crimson_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/crimson_sign.json b/src/main/generated/data/minecraft/recipe/crimson_sign.json index b175242019..d89fbe0ad2 100644 --- a/src/main/generated/data/minecraft/recipe/crimson_sign.json +++ b/src/main/generated/data/minecraft/recipe/crimson_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:crimson_planks", diff --git a/src/main/generated/data/minecraft/recipe/crossbow.json b/src/main/generated/data/minecraft/recipe/crossbow.json index 96364225e1..05ab180df4 100644 --- a/src/main/generated/data/minecraft/recipe/crossbow.json +++ b/src/main/generated/data/minecraft/recipe/crossbow.json @@ -13,7 +13,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:crossbow" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/cyan_banner.json b/src/main/generated/data/minecraft/recipe/cyan_banner.json index 2efc2367e5..b6c3fcb7b0 100644 --- a/src/main/generated/data/minecraft/recipe/cyan_banner.json +++ b/src/main/generated/data/minecraft/recipe/cyan_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:cyan_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:cyan_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json index dcdf6da42f..cda05e602b 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:dark_oak_boat" ], "result": { - "count": 1, "id": "minecraft:dark_oak_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_fence.json b/src/main/generated/data/minecraft/recipe/dark_oak_fence.json index d5c3933be8..0104840445 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_fence_gate.json b/src/main/generated/data/minecraft/recipe/dark_oak_fence_gate.json index d7db1861f2..d43a8b5076 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:dark_oak_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_sign.json b/src/main/generated/data/minecraft/recipe/dark_oak_sign.json index aeb6ace8bf..0905d76807 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:dark_oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/detector_rail.json b/src/main/generated/data/minecraft/recipe/detector_rail.json index aa0d8b1f83..b7fc13cdcd 100644 --- a/src/main/generated/data/minecraft/recipe/detector_rail.json +++ b/src/main/generated/data/minecraft/recipe/detector_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:stone_pressure_plate", "R": "minecraft:redstone", diff --git a/src/main/generated/data/minecraft/recipe/diamond_axe.json b/src/main/generated/data/minecraft/recipe/diamond_axe.json index 81cfd04879..bbf68047c1 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_axe.json +++ b/src/main/generated/data/minecraft/recipe/diamond_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:diamond_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_boots.json b/src/main/generated/data/minecraft/recipe/diamond_boots.json index 38ea7f8e5d..db05b15507 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_boots.json +++ b/src/main/generated/data/minecraft/recipe/diamond_boots.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:diamond_boots" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_chestplate.json b/src/main/generated/data/minecraft/recipe/diamond_chestplate.json index bace9a7d21..65ed426afc 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_chestplate.json +++ b/src/main/generated/data/minecraft/recipe/diamond_chestplate.json @@ -10,7 +10,6 @@ "XXX" ], "result": { - "count": 1, "id": "minecraft:diamond_chestplate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_helmet.json b/src/main/generated/data/minecraft/recipe/diamond_helmet.json index 59067194a0..ae369acd28 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_helmet.json +++ b/src/main/generated/data/minecraft/recipe/diamond_helmet.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:diamond_helmet" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_hoe.json b/src/main/generated/data/minecraft/recipe/diamond_hoe.json index 6a770c0452..baabf3d6ce 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_hoe.json +++ b/src/main/generated/data/minecraft/recipe/diamond_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:diamond_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_leggings.json b/src/main/generated/data/minecraft/recipe/diamond_leggings.json index 7992a0d478..8d6eba381e 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_leggings.json +++ b/src/main/generated/data/minecraft/recipe/diamond_leggings.json @@ -10,7 +10,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:diamond_leggings" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_pickaxe.json b/src/main/generated/data/minecraft/recipe/diamond_pickaxe.json index bc06ce4af1..fa25c31047 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/diamond_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:diamond_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_shovel.json b/src/main/generated/data/minecraft/recipe/diamond_shovel.json index ff947a6fd7..f4b7f3cf24 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_shovel.json +++ b/src/main/generated/data/minecraft/recipe/diamond_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:diamond_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_spear.json b/src/main/generated/data/minecraft/recipe/diamond_spear.json index 38d7aa9389..eb350b7965 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_spear.json +++ b/src/main/generated/data/minecraft/recipe/diamond_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:diamond_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diamond_sword.json b/src/main/generated/data/minecraft/recipe/diamond_sword.json index cb872879e7..f04f283eae 100644 --- a/src/main/generated/data/minecraft/recipe/diamond_sword.json +++ b/src/main/generated/data/minecraft/recipe/diamond_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:diamond_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/diorite.json b/src/main/generated/data/minecraft/recipe/diorite.json index f26df80c2f..35427a7339 100644 --- a/src/main/generated/data/minecraft/recipe/diorite.json +++ b/src/main/generated/data/minecraft/recipe/diorite.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "C": "#forge:cobblestone/normal", + "C": "#c:cobblestones/normal", "Q": "minecraft:quartz" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/dispenser.json b/src/main/generated/data/minecraft/recipe/dispenser.json index bcffee112c..4eedc72fce 100644 --- a/src/main/generated/data/minecraft/recipe/dispenser.json +++ b/src/main/generated/data/minecraft/recipe/dispenser.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": "#forge:cobblestone/normal", + "#": "#c:cobblestones/normal", "R": "minecraft:redstone", "X": "minecraft:bow" }, @@ -12,7 +12,6 @@ "#R#" ], "result": { - "count": 1, "id": "minecraft:dispenser" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/dropper.json b/src/main/generated/data/minecraft/recipe/dropper.json index 27ccdd1489..9af6ef7b51 100644 --- a/src/main/generated/data/minecraft/recipe/dropper.json +++ b/src/main/generated/data/minecraft/recipe/dropper.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": "#forge:cobblestone/normal", + "#": "#c:cobblestones/normal", "R": "minecraft:redstone" }, "pattern": [ @@ -11,7 +11,6 @@ "#R#" ], "result": { - "count": 1, "id": "minecraft:dropper" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json index a732119fe5..f1a0c7f59c 100644 --- a/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:sandstone", diff --git a/src/main/generated/data/minecraft/recipe/enchanting_table.json b/src/main/generated/data/minecraft/recipe/enchanting_table.json index a18e62aa60..55908f490a 100644 --- a/src/main/generated/data/minecraft/recipe/enchanting_table.json +++ b/src/main/generated/data/minecraft/recipe/enchanting_table.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:obsidian", "B": "minecraft:book", @@ -12,7 +11,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:enchanting_table" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json index 24c0e2e4ad..30e1a0feb8 100644 --- a/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:end_stone", diff --git a/src/main/generated/data/minecraft/recipe/fishing_rod.json b/src/main/generated/data/minecraft/recipe/fishing_rod.json index 8308c1ef46..c01dafa760 100644 --- a/src/main/generated/data/minecraft/recipe/fishing_rod.json +++ b/src/main/generated/data/minecraft/recipe/fishing_rod.json @@ -11,7 +11,6 @@ "# X" ], "result": { - "count": 1, "id": "minecraft:fishing_rod" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/flint_and_steel.json b/src/main/generated/data/minecraft/recipe/flint_and_steel.json index 291b18605e..00ba34c791 100644 --- a/src/main/generated/data/minecraft/recipe/flint_and_steel.json +++ b/src/main/generated/data/minecraft/recipe/flint_and_steel.json @@ -6,7 +6,6 @@ "minecraft:flint" ], "result": { - "count": 1, "id": "minecraft:flint_and_steel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json index 958fdf6b4c..c625dfd37c 100644 --- a/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:breeze_rod", diff --git a/src/main/generated/data/minecraft/recipe/golden_apple.json b/src/main/generated/data/minecraft/recipe/golden_apple.json index 0a029564aa..b7446f43e0 100644 --- a/src/main/generated/data/minecraft/recipe/golden_apple.json +++ b/src/main/generated/data/minecraft/recipe/golden_apple.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/gold", "X": "minecraft:apple" @@ -11,7 +10,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:golden_apple" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_axe.json b/src/main/generated/data/minecraft/recipe/golden_axe.json index aad3355e76..0818c3cb61 100644 --- a/src/main/generated/data/minecraft/recipe/golden_axe.json +++ b/src/main/generated/data/minecraft/recipe/golden_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:golden_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_boots.json b/src/main/generated/data/minecraft/recipe/golden_boots.json index baede9b2b0..5abe0af920 100644 --- a/src/main/generated/data/minecraft/recipe/golden_boots.json +++ b/src/main/generated/data/minecraft/recipe/golden_boots.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:golden_boots" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_chestplate.json b/src/main/generated/data/minecraft/recipe/golden_chestplate.json index 44610c5b75..7573b40a02 100644 --- a/src/main/generated/data/minecraft/recipe/golden_chestplate.json +++ b/src/main/generated/data/minecraft/recipe/golden_chestplate.json @@ -10,7 +10,6 @@ "XXX" ], "result": { - "count": 1, "id": "minecraft:golden_chestplate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_helmet.json b/src/main/generated/data/minecraft/recipe/golden_helmet.json index 77e0c12be8..a13d779537 100644 --- a/src/main/generated/data/minecraft/recipe/golden_helmet.json +++ b/src/main/generated/data/minecraft/recipe/golden_helmet.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:golden_helmet" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_hoe.json b/src/main/generated/data/minecraft/recipe/golden_hoe.json index 6a31db7ec1..6b390024a9 100644 --- a/src/main/generated/data/minecraft/recipe/golden_hoe.json +++ b/src/main/generated/data/minecraft/recipe/golden_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:golden_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_leggings.json b/src/main/generated/data/minecraft/recipe/golden_leggings.json index 6ffc3edd1c..76ff024ef5 100644 --- a/src/main/generated/data/minecraft/recipe/golden_leggings.json +++ b/src/main/generated/data/minecraft/recipe/golden_leggings.json @@ -10,7 +10,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:golden_leggings" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_pickaxe.json b/src/main/generated/data/minecraft/recipe/golden_pickaxe.json index 7e88522f3e..ef13a0f17a 100644 --- a/src/main/generated/data/minecraft/recipe/golden_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/golden_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:golden_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_shovel.json b/src/main/generated/data/minecraft/recipe/golden_shovel.json index ed7b535236..e4f71ef565 100644 --- a/src/main/generated/data/minecraft/recipe/golden_shovel.json +++ b/src/main/generated/data/minecraft/recipe/golden_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:golden_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_spear.json b/src/main/generated/data/minecraft/recipe/golden_spear.json index 477bbb3f6b..bb65788d46 100644 --- a/src/main/generated/data/minecraft/recipe/golden_spear.json +++ b/src/main/generated/data/minecraft/recipe/golden_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:golden_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/golden_sword.json b/src/main/generated/data/minecraft/recipe/golden_sword.json index a400bb8117..510d5fd8bd 100644 --- a/src/main/generated/data/minecraft/recipe/golden_sword.json +++ b/src/main/generated/data/minecraft/recipe/golden_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:golden_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/gray_banner.json b/src/main/generated/data/minecraft/recipe/gray_banner.json index 75e5ac3ebe..a257155230 100644 --- a/src/main/generated/data/minecraft/recipe/gray_banner.json +++ b/src/main/generated/data/minecraft/recipe/gray_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:gray_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:gray_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/green_banner.json b/src/main/generated/data/minecraft/recipe/green_banner.json index e18d67a1f3..05a5f5d812 100644 --- a/src/main/generated/data/minecraft/recipe/green_banner.json +++ b/src/main/generated/data/minecraft/recipe/green_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:green_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:green_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/grindstone.json b/src/main/generated/data/minecraft/recipe/grindstone.json index 5edf22f750..92c80c562b 100644 --- a/src/main/generated/data/minecraft/recipe/grindstone.json +++ b/src/main/generated/data/minecraft/recipe/grindstone.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "-": "minecraft:stone_slab", @@ -11,7 +10,6 @@ "# #" ], "result": { - "count": 1, "id": "minecraft:grindstone" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/heavy_weighted_pressure_plate.json b/src/main/generated/data/minecraft/recipe/heavy_weighted_pressure_plate.json index e4c401e38e..0400715a6b 100644 --- a/src/main/generated/data/minecraft/recipe/heavy_weighted_pressure_plate.json +++ b/src/main/generated/data/minecraft/recipe/heavy_weighted_pressure_plate.json @@ -8,7 +8,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:heavy_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/hopper.json b/src/main/generated/data/minecraft/recipe/hopper.json index 7cbd773bf6..bc8d837595 100644 --- a/src/main/generated/data/minecraft/recipe/hopper.json +++ b/src/main/generated/data/minecraft/recipe/hopper.json @@ -11,7 +11,6 @@ " I " ], "result": { - "count": 1, "id": "minecraft:hopper" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json index ae84d48cc6..f6c673ad85 100644 --- a/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/iron_axe.json b/src/main/generated/data/minecraft/recipe/iron_axe.json index 535479a2ba..bb95203181 100644 --- a/src/main/generated/data/minecraft/recipe/iron_axe.json +++ b/src/main/generated/data/minecraft/recipe/iron_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:iron_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_bars.json b/src/main/generated/data/minecraft/recipe/iron_bars.json index e33ecdcc4f..9ff84ac625 100644 --- a/src/main/generated/data/minecraft/recipe/iron_bars.json +++ b/src/main/generated/data/minecraft/recipe/iron_bars.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, diff --git a/src/main/generated/data/minecraft/recipe/iron_boots.json b/src/main/generated/data/minecraft/recipe/iron_boots.json index 459f753384..82ec93b74d 100644 --- a/src/main/generated/data/minecraft/recipe/iron_boots.json +++ b/src/main/generated/data/minecraft/recipe/iron_boots.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:iron_boots" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_chain.json b/src/main/generated/data/minecraft/recipe/iron_chain.json index 5aab56a86f..cc7b7e3449 100644 --- a/src/main/generated/data/minecraft/recipe/iron_chain.json +++ b/src/main/generated/data/minecraft/recipe/iron_chain.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "#c:ingots/iron", "N": "minecraft:iron_nugget" @@ -11,7 +10,6 @@ "N" ], "result": { - "count": 1, "id": "minecraft:iron_chain" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_chestplate.json b/src/main/generated/data/minecraft/recipe/iron_chestplate.json index 42ac070a95..c04281055a 100644 --- a/src/main/generated/data/minecraft/recipe/iron_chestplate.json +++ b/src/main/generated/data/minecraft/recipe/iron_chestplate.json @@ -10,7 +10,6 @@ "XXX" ], "result": { - "count": 1, "id": "minecraft:iron_chestplate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_helmet.json b/src/main/generated/data/minecraft/recipe/iron_helmet.json index 67b4fa7229..227d97983b 100644 --- a/src/main/generated/data/minecraft/recipe/iron_helmet.json +++ b/src/main/generated/data/minecraft/recipe/iron_helmet.json @@ -9,7 +9,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:iron_helmet" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_hoe.json b/src/main/generated/data/minecraft/recipe/iron_hoe.json index 65fb6202de..be5921217f 100644 --- a/src/main/generated/data/minecraft/recipe/iron_hoe.json +++ b/src/main/generated/data/minecraft/recipe/iron_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:iron_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_leggings.json b/src/main/generated/data/minecraft/recipe/iron_leggings.json index ca4c45bc62..232ad3cade 100644 --- a/src/main/generated/data/minecraft/recipe/iron_leggings.json +++ b/src/main/generated/data/minecraft/recipe/iron_leggings.json @@ -10,7 +10,6 @@ "X X" ], "result": { - "count": 1, "id": "minecraft:iron_leggings" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_pickaxe.json b/src/main/generated/data/minecraft/recipe/iron_pickaxe.json index 169d8f7094..313311755f 100644 --- a/src/main/generated/data/minecraft/recipe/iron_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/iron_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:iron_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_shovel.json b/src/main/generated/data/minecraft/recipe/iron_shovel.json index b436766778..3074e560c3 100644 --- a/src/main/generated/data/minecraft/recipe/iron_shovel.json +++ b/src/main/generated/data/minecraft/recipe/iron_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:iron_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_spear.json b/src/main/generated/data/minecraft/recipe/iron_spear.json index eca0174318..4d4d17ea8f 100644 --- a/src/main/generated/data/minecraft/recipe/iron_spear.json +++ b/src/main/generated/data/minecraft/recipe/iron_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:iron_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_sword.json b/src/main/generated/data/minecraft/recipe/iron_sword.json index 8c909bfa56..a676cd048c 100644 --- a/src/main/generated/data/minecraft/recipe/iron_sword.json +++ b/src/main/generated/data/minecraft/recipe/iron_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:iron_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/iron_trapdoor.json b/src/main/generated/data/minecraft/recipe/iron_trapdoor.json index a64774b455..ef32cfaa39 100644 --- a/src/main/generated/data/minecraft/recipe/iron_trapdoor.json +++ b/src/main/generated/data/minecraft/recipe/iron_trapdoor.json @@ -9,7 +9,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:iron_trapdoor" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/item_frame.json b/src/main/generated/data/minecraft/recipe/item_frame.json index 9daf39f512..e553296ccd 100644 --- a/src/main/generated/data/minecraft/recipe/item_frame.json +++ b/src/main/generated/data/minecraft/recipe/item_frame.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "minecraft:leather" @@ -11,7 +10,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:item_frame" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/jukebox.json b/src/main/generated/data/minecraft/recipe/jukebox.json index c7c109d95f..eb3d291fdd 100644 --- a/src/main/generated/data/minecraft/recipe/jukebox.json +++ b/src/main/generated/data/minecraft/recipe/jukebox.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "X": "#c:gems/diamond" @@ -11,7 +10,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:jukebox" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json b/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json index cab5728082..5478d47d17 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:jungle_boat" ], "result": { - "count": 1, "id": "minecraft:jungle_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/jungle_fence.json b/src/main/generated/data/minecraft/recipe/jungle_fence.json index dc919dea44..b8b91627bd 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_fence.json +++ b/src/main/generated/data/minecraft/recipe/jungle_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/jungle_fence_gate.json b/src/main/generated/data/minecraft/recipe/jungle_fence_gate.json index 3f3ee533ed..b94a81ea03 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/jungle_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:jungle_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/jungle_sign.json b/src/main/generated/data/minecraft/recipe/jungle_sign.json index 9c22e2bcd1..9033e56d3b 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_sign.json +++ b/src/main/generated/data/minecraft/recipe/jungle_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:jungle_planks", diff --git a/src/main/generated/data/minecraft/recipe/ladder.json b/src/main/generated/data/minecraft/recipe/ladder.json index 0aefdd0268..ffd1098465 100644 --- a/src/main/generated/data/minecraft/recipe/ladder.json +++ b/src/main/generated/data/minecraft/recipe/ladder.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden" }, diff --git a/src/main/generated/data/minecraft/recipe/lever.json b/src/main/generated/data/minecraft/recipe/lever.json index f0cc6c54d5..69f1f2f36d 100644 --- a/src/main/generated/data/minecraft/recipe/lever.json +++ b/src/main/generated/data/minecraft/recipe/lever.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": "#forge:cobblestone/normal", + "#": "#c:cobblestones/normal", "X": "#c:rods/wooden" }, "pattern": [ @@ -10,7 +10,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:lever" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/light_blue_banner.json b/src/main/generated/data/minecraft/recipe/light_blue_banner.json index b0fa080366..166356a244 100644 --- a/src/main/generated/data/minecraft/recipe/light_blue_banner.json +++ b/src/main/generated/data/minecraft/recipe/light_blue_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:light_blue_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:light_blue_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/light_gray_banner.json b/src/main/generated/data/minecraft/recipe/light_gray_banner.json index 7a16563cc0..711327e1a9 100644 --- a/src/main/generated/data/minecraft/recipe/light_gray_banner.json +++ b/src/main/generated/data/minecraft/recipe/light_gray_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:light_gray_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:light_gray_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/light_weighted_pressure_plate.json b/src/main/generated/data/minecraft/recipe/light_weighted_pressure_plate.json index ef08a13e3f..ebff2fb7aa 100644 --- a/src/main/generated/data/minecraft/recipe/light_weighted_pressure_plate.json +++ b/src/main/generated/data/minecraft/recipe/light_weighted_pressure_plate.json @@ -8,7 +8,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:light_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/lightning_rod.json b/src/main/generated/data/minecraft/recipe/lightning_rod.json index 614ed2737e..92b7699ca0 100644 --- a/src/main/generated/data/minecraft/recipe/lightning_rod.json +++ b/src/main/generated/data/minecraft/recipe/lightning_rod.json @@ -10,7 +10,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:lightning_rod" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/lime_banner.json b/src/main/generated/data/minecraft/recipe/lime_banner.json index 49b26aba09..19685f6245 100644 --- a/src/main/generated/data/minecraft/recipe/lime_banner.json +++ b/src/main/generated/data/minecraft/recipe/lime_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:lime_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:lime_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/lodestone.json b/src/main/generated/data/minecraft/recipe/lodestone.json index 56532f2eed..d2a7d4a61c 100644 --- a/src/main/generated/data/minecraft/recipe/lodestone.json +++ b/src/main/generated/data/minecraft/recipe/lodestone.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron", "S": "minecraft:chiseled_stone_bricks" @@ -11,7 +10,6 @@ "SSS" ], "result": { - "count": 1, "id": "minecraft:lodestone" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/loom.json b/src/main/generated/data/minecraft/recipe/loom.json index 9b25eeb36f..f4e54b62d5 100644 --- a/src/main/generated/data/minecraft/recipe/loom.json +++ b/src/main/generated/data/minecraft/recipe/loom.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "@": "#c:strings" @@ -10,7 +9,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:loom" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/magenta_banner.json b/src/main/generated/data/minecraft/recipe/magenta_banner.json index f09624c2ac..5eb547b59a 100644 --- a/src/main/generated/data/minecraft/recipe/magenta_banner.json +++ b/src/main/generated/data/minecraft/recipe/magenta_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:magenta_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:magenta_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json b/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json index e8bec29182..219b9e30e5 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:mangrove_boat" ], "result": { - "count": 1, "id": "minecraft:mangrove_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/mangrove_fence.json b/src/main/generated/data/minecraft/recipe/mangrove_fence.json index f939810940..efda31e05f 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_fence.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/mangrove_fence_gate.json b/src/main/generated/data/minecraft/recipe/mangrove_fence_gate.json index 8510a15d3f..a2814dee24 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:mangrove_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/mangrove_sign.json b/src/main/generated/data/minecraft/recipe/mangrove_sign.json index 2c1eeab8a2..d232b6519e 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_sign.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:mangrove_planks", diff --git a/src/main/generated/data/minecraft/recipe/minecart.json b/src/main/generated/data/minecraft/recipe/minecart.json index 3a407b046e..5bd1dcdeac 100644 --- a/src/main/generated/data/minecraft/recipe/minecart.json +++ b/src/main/generated/data/minecraft/recipe/minecart.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, @@ -9,7 +8,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:minecart" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json b/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json index 4ee8e0a4c2..b2d83bde40 100644 --- a/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json +++ b/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_moss_block.json @@ -3,11 +3,10 @@ "category": "building", "group": "mossy_cobblestone", "ingredients": [ - "#forge:cobblestone/normal", + "#c:cobblestones/normal", "minecraft:moss_block" ], "result": { - "count": 1, "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_vine.json b/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_vine.json index 03cf0e01c5..4ee78421da 100644 --- a/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_vine.json +++ b/src/main/generated/data/minecraft/recipe/mossy_cobblestone_from_vine.json @@ -3,11 +3,10 @@ "category": "building", "group": "mossy_cobblestone", "ingredients": [ - "#forge:cobblestone/normal", + "#c:cobblestones/normal", "minecraft:vine" ], "result": { - "count": 1, "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/netherite_ingot.json b/src/main/generated/data/minecraft/recipe/netherite_ingot.json index 839b4ad4f5..1d8fba0d64 100644 --- a/src/main/generated/data/minecraft/recipe/netherite_ingot.json +++ b/src/main/generated/data/minecraft/recipe/netherite_ingot.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "netherite_ingot", "ingredients": [ "minecraft:netherite_scrap", @@ -13,7 +12,6 @@ "#c:ingots/gold" ], "result": { - "count": 1, "id": "minecraft:netherite_ingot" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json b/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json index aa03072c28..1527cf530b 100644 --- a/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:netherrack", diff --git a/src/main/generated/data/minecraft/recipe/oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/oak_chest_boat.json index 753ef643c4..35eaedd589 100644 --- a/src/main/generated/data/minecraft/recipe/oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/oak_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:oak_boat" ], "result": { - "count": 1, "id": "minecraft:oak_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/oak_fence.json b/src/main/generated/data/minecraft/recipe/oak_fence.json index b3684fd871..841737af50 100644 --- a/src/main/generated/data/minecraft/recipe/oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/oak_fence_gate.json b/src/main/generated/data/minecraft/recipe/oak_fence_gate.json index 36941138d7..8d1ab67ec0 100644 --- a/src/main/generated/data/minecraft/recipe/oak_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/oak_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:oak_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/oak_sign.json b/src/main/generated/data/minecraft/recipe/oak_sign.json index 1692e49e39..37d025c615 100644 --- a/src/main/generated/data/minecraft/recipe/oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/observer.json b/src/main/generated/data/minecraft/recipe/observer.json index 435f76840d..2287dea5fd 100644 --- a/src/main/generated/data/minecraft/recipe/observer.json +++ b/src/main/generated/data/minecraft/recipe/observer.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": "#forge:cobblestone/normal", + "#": "#c:cobblestones/normal", "Q": "minecraft:quartz", "R": "minecraft:redstone" }, @@ -12,7 +12,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:observer" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/orange_banner.json b/src/main/generated/data/minecraft/recipe/orange_banner.json index 8bbc0dbf42..46a0917e02 100644 --- a/src/main/generated/data/minecraft/recipe/orange_banner.json +++ b/src/main/generated/data/minecraft/recipe/orange_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:orange_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:orange_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/painting.json b/src/main/generated/data/minecraft/recipe/painting.json index 64b32014dc..6f64524c95 100644 --- a/src/main/generated/data/minecraft/recipe/painting.json +++ b/src/main/generated/data/minecraft/recipe/painting.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "#minecraft:wool" @@ -11,7 +10,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:painting" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json index 2b223559ee..ab238d2548 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:pale_oak_boat" ], "result": { - "count": 1, "id": "minecraft:pale_oak_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_fence.json b/src/main/generated/data/minecraft/recipe/pale_oak_fence.json index c4a34ad537..a45cc02b9d 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_fence_gate.json b/src/main/generated/data/minecraft/recipe/pale_oak_fence_gate.json index b09f87fa2b..ae5182f114 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:pale_oak_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_sign.json b/src/main/generated/data/minecraft/recipe/pale_oak_sign.json index ac471218f3..dfa9f8e208 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:pale_oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/pink_banner.json b/src/main/generated/data/minecraft/recipe/pink_banner.json index 4fd7901e5d..1ec35a93c2 100644 --- a/src/main/generated/data/minecraft/recipe/pink_banner.json +++ b/src/main/generated/data/minecraft/recipe/pink_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:pink_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:pink_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/piston.json b/src/main/generated/data/minecraft/recipe/piston.json index 5b7ddd117c..432146eef5 100644 --- a/src/main/generated/data/minecraft/recipe/piston.json +++ b/src/main/generated/data/minecraft/recipe/piston.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "redstone", "key": { - "#": "#forge:cobblestone/normal", + "#": "#c:cobblestones/normal", "R": "minecraft:redstone", "T": "#minecraft:planks", "X": "#c:ingots/iron" @@ -13,7 +13,6 @@ "#R#" ], "result": { - "count": 1, "id": "minecraft:piston" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/polished_deepslate.json b/src/main/generated/data/minecraft/recipe/polished_deepslate.json index 3fb3c80730..10b6ccbff7 100644 --- a/src/main/generated/data/minecraft/recipe/polished_deepslate.json +++ b/src/main/generated/data/minecraft/recipe/polished_deepslate.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "category": "building", "key": { - "S": "#forge:cobblestone/deepslate" + "S": "#c:cobblestones/deepslate" }, "pattern": [ "SS", diff --git a/src/main/generated/data/minecraft/recipe/powered_rail.json b/src/main/generated/data/minecraft/recipe/powered_rail.json index 40d834f692..98d2889b68 100644 --- a/src/main/generated/data/minecraft/recipe/powered_rail.json +++ b/src/main/generated/data/minecraft/recipe/powered_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "R": "minecraft:redstone", diff --git a/src/main/generated/data/minecraft/recipe/purple_banner.json b/src/main/generated/data/minecraft/recipe/purple_banner.json index ed4b36c136..21aae0f5ea 100644 --- a/src/main/generated/data/minecraft/recipe/purple_banner.json +++ b/src/main/generated/data/minecraft/recipe/purple_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:purple_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:purple_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/rail.json b/src/main/generated/data/minecraft/recipe/rail.json index b9ed74f2f2..0a3e60e760 100644 --- a/src/main/generated/data/minecraft/recipe/rail.json +++ b/src/main/generated/data/minecraft/recipe/rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "#c:ingots/iron" diff --git a/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json index f49dd8b54a..4fb9ee682a 100644 --- a/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/red_banner.json b/src/main/generated/data/minecraft/recipe/red_banner.json index 9b0643110e..d1a839d900 100644 --- a/src/main/generated/data/minecraft/recipe/red_banner.json +++ b/src/main/generated/data/minecraft/recipe/red_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:red_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:red_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/redstone_torch.json b/src/main/generated/data/minecraft/recipe/redstone_torch.json index ea402cb6e4..ed035e7db2 100644 --- a/src/main/generated/data/minecraft/recipe/redstone_torch.json +++ b/src/main/generated/data/minecraft/recipe/redstone_torch.json @@ -10,7 +10,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:redstone_torch" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json index f99a49c84f..98a267e64d 100644 --- a/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:netherrack", diff --git a/src/main/generated/data/minecraft/recipe/saddle.json b/src/main/generated/data/minecraft/recipe/saddle.json index 38171a6054..7aa4f31671 100644 --- a/src/main/generated/data/minecraft/recipe/saddle.json +++ b/src/main/generated/data/minecraft/recipe/saddle.json @@ -10,7 +10,6 @@ "X#X" ], "result": { - "count": 1, "id": "minecraft:saddle" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/scaffolding.json b/src/main/generated/data/minecraft/recipe/scaffolding.json index 1393f3b416..6ca014d1bc 100644 --- a/src/main/generated/data/minecraft/recipe/scaffolding.json +++ b/src/main/generated/data/minecraft/recipe/scaffolding.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "minecraft:bamboo", "~": "#c:strings" diff --git a/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json index 9619e872ce..a0307a6d17 100644 --- a/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", - "C": "#forge:cobblestone/normal", + "C": "#c:cobblestones/normal", "S": "minecraft:sentry_armor_trim_smithing_template" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json index e1f08a5ca1..db0aa56270 100644 --- a/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/shears.json b/src/main/generated/data/minecraft/recipe/shears.json index ca02dfb8aa..08fc67bbe1 100644 --- a/src/main/generated/data/minecraft/recipe/shears.json +++ b/src/main/generated/data/minecraft/recipe/shears.json @@ -9,7 +9,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:shears" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/shield.json b/src/main/generated/data/minecraft/recipe/shield.json index e0cc4be9a4..6dc818bc94 100644 --- a/src/main/generated/data/minecraft/recipe/shield.json +++ b/src/main/generated/data/minecraft/recipe/shield.json @@ -11,7 +11,6 @@ " W " ], "result": { - "count": 1, "id": "minecraft:shield" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/shulker_box.json b/src/main/generated/data/minecraft/recipe/shulker_box.json index d95b64e916..fa88e88e2c 100644 --- a/src/main/generated/data/minecraft/recipe/shulker_box.json +++ b/src/main/generated/data/minecraft/recipe/shulker_box.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:chests/wooden", "-": "minecraft:shulker_shell" @@ -11,7 +10,6 @@ "-" ], "result": { - "count": 1, "id": "minecraft:shulker_box" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json index 26ec6d761c..20a9278cf3 100644 --- a/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", - "C": "#forge:cobblestone/deepslate", + "C": "#c:cobblestones/deepslate", "S": "minecraft:silence_armor_trim_smithing_template" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/smithing_table.json b/src/main/generated/data/minecraft/recipe/smithing_table.json index cdf474dfc5..d745c68519 100644 --- a/src/main/generated/data/minecraft/recipe/smithing_table.json +++ b/src/main/generated/data/minecraft/recipe/smithing_table.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "@": "#c:ingots/iron" @@ -11,7 +10,6 @@ "##" ], "result": { - "count": 1, "id": "minecraft:smithing_table" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json index 8f24674fdd..f99ecffc0f 100644 --- a/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:blackstone", diff --git a/src/main/generated/data/minecraft/recipe/soul_campfire.json b/src/main/generated/data/minecraft/recipe/soul_campfire.json index 8daec84a10..d683caea06 100644 --- a/src/main/generated/data/minecraft/recipe/soul_campfire.json +++ b/src/main/generated/data/minecraft/recipe/soul_campfire.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:soul_fire_base_blocks", "L": "#minecraft:logs", @@ -12,7 +11,6 @@ "LLL" ], "result": { - "count": 1, "id": "minecraft:soul_campfire" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/soul_torch.json b/src/main/generated/data/minecraft/recipe/soul_torch.json index 89fba8cfe0..9c373bb794 100644 --- a/src/main/generated/data/minecraft/recipe/soul_torch.json +++ b/src/main/generated/data/minecraft/recipe/soul_torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "S": "#minecraft:soul_fire_base_blocks", diff --git a/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json index a4f55cc155..76ac8903bd 100644 --- a/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:purpur_block", diff --git a/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json b/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json index ce964f8696..49c8cf18c8 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json @@ -1,13 +1,11 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", "minecraft:spruce_boat" ], "result": { - "count": 1, "id": "minecraft:spruce_chest_boat" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/spruce_fence.json b/src/main/generated/data/minecraft/recipe/spruce_fence.json index f84b63a72b..804b3b538a 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_fence.json +++ b/src/main/generated/data/minecraft/recipe/spruce_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/spruce_fence_gate.json b/src/main/generated/data/minecraft/recipe/spruce_fence_gate.json index ea1f612c1f..3a7d27c4ec 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/spruce_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:spruce_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/spruce_sign.json b/src/main/generated/data/minecraft/recipe/spruce_sign.json index 58046b4828..9a020a7592 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_sign.json +++ b/src/main/generated/data/minecraft/recipe/spruce_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:spruce_planks", diff --git a/src/main/generated/data/minecraft/recipe/spyglass.json b/src/main/generated/data/minecraft/recipe/spyglass.json index d2caaad362..b7e83ec960 100644 --- a/src/main/generated/data/minecraft/recipe/spyglass.json +++ b/src/main/generated/data/minecraft/recipe/spyglass.json @@ -11,7 +11,6 @@ " X " ], "result": { - "count": 1, "id": "minecraft:spyglass" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_axe.json b/src/main/generated/data/minecraft/recipe/stone_axe.json index 8d557557d6..e3113ba751 100644 --- a/src/main/generated/data/minecraft/recipe/stone_axe.json +++ b/src/main/generated/data/minecraft/recipe/stone_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:stone_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_hoe.json b/src/main/generated/data/minecraft/recipe/stone_hoe.json index 8ed74421de..c8cf52f38d 100644 --- a/src/main/generated/data/minecraft/recipe/stone_hoe.json +++ b/src/main/generated/data/minecraft/recipe/stone_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:stone_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_pickaxe.json b/src/main/generated/data/minecraft/recipe/stone_pickaxe.json index cd245c22c4..0be8cd1618 100644 --- a/src/main/generated/data/minecraft/recipe/stone_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/stone_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:stone_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_shovel.json b/src/main/generated/data/minecraft/recipe/stone_shovel.json index bde9b0a8be..98f9b03920 100644 --- a/src/main/generated/data/minecraft/recipe/stone_shovel.json +++ b/src/main/generated/data/minecraft/recipe/stone_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:stone_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_spear.json b/src/main/generated/data/minecraft/recipe/stone_spear.json index c0f703f53d..f2fa601208 100644 --- a/src/main/generated/data/minecraft/recipe/stone_spear.json +++ b/src/main/generated/data/minecraft/recipe/stone_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:stone_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stone_sword.json b/src/main/generated/data/minecraft/recipe/stone_sword.json index cdff3bf44e..9e5d697896 100644 --- a/src/main/generated/data/minecraft/recipe/stone_sword.json +++ b/src/main/generated/data/minecraft/recipe/stone_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:stone_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/stonecutter.json b/src/main/generated/data/minecraft/recipe/stonecutter.json index e2f95eecf4..596ee798c0 100644 --- a/src/main/generated/data/minecraft/recipe/stonecutter.json +++ b/src/main/generated/data/minecraft/recipe/stonecutter.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:stone", "I": "#c:ingots/iron" @@ -10,7 +9,6 @@ "###" ], "result": { - "count": 1, "id": "minecraft:stonecutter" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json index 4f4f0feec4..802def7aad 100644 --- a/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:prismarine", diff --git a/src/main/generated/data/minecraft/recipe/torch.json b/src/main/generated/data/minecraft/recipe/torch.json index 442a61780e..9ed89552aa 100644 --- a/src/main/generated/data/minecraft/recipe/torch.json +++ b/src/main/generated/data/minecraft/recipe/torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": [ diff --git a/src/main/generated/data/minecraft/recipe/trapped_chest.json b/src/main/generated/data/minecraft/recipe/trapped_chest.json index 82cb55b53a..069ea4a9ae 100644 --- a/src/main/generated/data/minecraft/recipe/trapped_chest.json +++ b/src/main/generated/data/minecraft/recipe/trapped_chest.json @@ -6,7 +6,6 @@ "minecraft:tripwire_hook" ], "result": { - "count": 1, "id": "minecraft:trapped_chest" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json index a150f73101..0717a4ef69 100644 --- a/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", - "C": "#forge:cobblestone/normal", + "C": "#c:cobblestones/normal", "S": "minecraft:vex_armor_trim_smithing_template" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json index e3a8c9db9d..78cbdb841a 100644 --- a/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", - "C": "#forge:cobblestone/deepslate", + "C": "#c:cobblestones/deepslate", "S": "minecraft:ward_armor_trim_smithing_template" }, "pattern": [ diff --git a/src/main/generated/data/minecraft/recipe/warped_fence.json b/src/main/generated/data/minecraft/recipe/warped_fence.json index 54684ffb50..cbc3eb97e5 100644 --- a/src/main/generated/data/minecraft/recipe/warped_fence.json +++ b/src/main/generated/data/minecraft/recipe/warped_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/warped_fence_gate.json b/src/main/generated/data/minecraft/recipe/warped_fence_gate.json index bd500ac089..aae3e2aeb4 100644 --- a/src/main/generated/data/minecraft/recipe/warped_fence_gate.json +++ b/src/main/generated/data/minecraft/recipe/warped_fence_gate.json @@ -11,7 +11,6 @@ "#W#" ], "result": { - "count": 1, "id": "minecraft:warped_fence_gate" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/warped_sign.json b/src/main/generated/data/minecraft/recipe/warped_sign.json index fd63852c3b..b9cc43590e 100644 --- a/src/main/generated/data/minecraft/recipe/warped_sign.json +++ b/src/main/generated/data/minecraft/recipe/warped_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:warped_planks", diff --git a/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json index 3c93a650a0..b21c78e691 100644 --- a/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/white_banner.json b/src/main/generated/data/minecraft/recipe/white_banner.json index 0f87a1e878..d4061a1300 100644 --- a/src/main/generated/data/minecraft/recipe/white_banner.json +++ b/src/main/generated/data/minecraft/recipe/white_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:white_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:white_banner" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json index 0048eb4531..7a7d4dd58f 100644 --- a/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:mossy_cobblestone", diff --git a/src/main/generated/data/minecraft/recipe/wooden_axe.json b/src/main/generated/data/minecraft/recipe/wooden_axe.json index 05fdaaad7e..dc06831065 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_axe.json +++ b/src/main/generated/data/minecraft/recipe/wooden_axe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:wooden_axe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wooden_hoe.json b/src/main/generated/data/minecraft/recipe/wooden_hoe.json index 6fd2085dda..bff2385c5a 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_hoe.json +++ b/src/main/generated/data/minecraft/recipe/wooden_hoe.json @@ -11,7 +11,6 @@ " #" ], "result": { - "count": 1, "id": "minecraft:wooden_hoe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wooden_pickaxe.json b/src/main/generated/data/minecraft/recipe/wooden_pickaxe.json index ff84e265b6..1981ea719a 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_pickaxe.json +++ b/src/main/generated/data/minecraft/recipe/wooden_pickaxe.json @@ -11,7 +11,6 @@ " # " ], "result": { - "count": 1, "id": "minecraft:wooden_pickaxe" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wooden_shovel.json b/src/main/generated/data/minecraft/recipe/wooden_shovel.json index 3aac8226a5..43c48e78c1 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_shovel.json +++ b/src/main/generated/data/minecraft/recipe/wooden_shovel.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:wooden_shovel" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wooden_spear.json b/src/main/generated/data/minecraft/recipe/wooden_spear.json index 6c9f4220e0..cc7dbe09af 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_spear.json +++ b/src/main/generated/data/minecraft/recipe/wooden_spear.json @@ -11,7 +11,6 @@ "# " ], "result": { - "count": 1, "id": "minecraft:wooden_spear" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/wooden_sword.json b/src/main/generated/data/minecraft/recipe/wooden_sword.json index 35a7a42140..ca80932c0a 100644 --- a/src/main/generated/data/minecraft/recipe/wooden_sword.json +++ b/src/main/generated/data/minecraft/recipe/wooden_sword.json @@ -11,7 +11,6 @@ "#" ], "result": { - "count": 1, "id": "minecraft:wooden_sword" } } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/recipe/yellow_banner.json b/src/main/generated/data/minecraft/recipe/yellow_banner.json index 6228650872..f33512542b 100644 --- a/src/main/generated/data/minecraft/recipe/yellow_banner.json +++ b/src/main/generated/data/minecraft/recipe/yellow_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:yellow_wool", @@ -12,7 +11,6 @@ " | " ], "result": { - "count": 1, "id": "minecraft:yellow_banner" } } \ No newline at end of file diff --git a/src/main/generated/pack.mcmeta b/src/main/generated/pack.mcmeta index bd6dcb1db5..ed943be2fb 100644 --- a/src/main/generated/pack.mcmeta +++ b/src/main/generated/pack.mcmeta @@ -3,9 +3,9 @@ "description": { "translate": "pack.forge.description" }, - "max_format": 94, + "max_format": 107, "min_format": [ - 94, + 107, 1 ] } diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index b08f53de82..0c606ea277 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -16,7 +16,6 @@ import com.mojang.brigadier.tree.RootCommandNode; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.multiplayer.ClientSuggestionProvider; import net.minecraft.client.player.LocalPlayer; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSource; @@ -26,7 +25,6 @@ import net.minecraft.commands.synchronization.SuggestionProviders; import net.minecraft.network.chat.*; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.RegisterClientCommandsEvent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.server.command.CommandHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -71,12 +69,12 @@ public class ClientCommandHandler { copy(serverCommandsRoot, newServerCommands.getRoot()); // Copies the client side commands into the server side commands to be used for suggestions - CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (context) -> 0, (suggestions) -> { + CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (_) -> 0, (suggestions) -> { @SuppressWarnings("unchecked") var shared = (SuggestionProvider)(SuggestionProvider)suggestions; var suggestionProvider = shared; //SuggestionProviders.safelySwap(shared); if (suggestionProvider == SuggestionProviders.ASK_SERVER) { - suggestionProvider = (context, builder) -> { + suggestionProvider = (context, _) -> { ClientCommandSourceStack source = getSource(); StringReader reader = new StringReader(context.getInput()); if (reader.canRead() && reader.peek() == '/') @@ -109,7 +107,7 @@ public class ClientCommandHandler { new CommandSource() { @Override public void sendSystemMessage(Component message) { - mc.gui.getChat().addMessage(message); + mc.gui.hud.getChat().addClientSystemMessage(message); } @Override @@ -188,7 +186,7 @@ public class ClientCommandHandler { // in case of unknown command, let the server try and handle it return false; } - mc.gui.getChat().addMessage( + mc.gui.hud.getChat().addClientSystemMessage( Component.literal("").append(ComponentUtils.fromMessage(syntax.getRawMessage())).withStyle(ChatFormatting.RED) ); if (syntax.getInput() != null && syntax.getCursor() >= 0) { @@ -205,11 +203,11 @@ public class ClientCommandHandler { details.append(Component.literal(syntax.getInput().substring(position)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE)); details.append(Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); - mc.gui.getChat().addMessage(Component.literal("").append(details).withStyle(ChatFormatting.RED)); + mc.gui.hud.getChat().addClientSystemMessage(Component.literal("").append(details).withStyle(ChatFormatting.RED)); } } catch (Exception generic) { // Probably thrown by the command{ MutableComponent message = Component.literal(generic.getMessage() == null ? generic.getClass().getName() : generic.getMessage()); - mc.gui.getChat().addMessage( + mc.gui.hud.getChat().addClientSystemMessage( Component.translatable("command.failed") .withStyle(ChatFormatting.RED) .withStyle(style -> style.withHoverEvent(new HoverEvent.ShowText(message))) diff --git a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java index 12961b964a..3affac5f77 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java @@ -41,7 +41,7 @@ public class ClientCommandSourceStack extends CommandSourceStack { @SuppressWarnings("resource") @Override public void sendSuccess(Supplier message, boolean sendToAdmins) { - Minecraft.getInstance().gui.getChat().addMessage(message.get()); + Minecraft.getInstance().gui.hud.getChat().addClientSystemMessage(message.get()); } /** diff --git a/src/main/java/net/minecraftforge/client/ClientForgeMod.java b/src/main/java/net/minecraftforge/client/ClientForgeMod.java index 8f5239dec8..265c4b9fa1 100644 --- a/src/main/java/net/minecraftforge/client/ClientForgeMod.java +++ b/src/main/java/net/minecraftforge/client/ClientForgeMod.java @@ -6,14 +6,13 @@ package net.minecraftforge.client; import net.minecraft.client.renderer.chunk.ChunkSectionLayer; -import net.minecraft.client.resources.model.UnbakedGeometry; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; import net.minecraft.resources.Identifier; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; import net.minecraftforge.client.event.RegisterNamedRenderTypesEvent; import net.minecraftforge.client.model.DynamicFluidContainerModel; -import net.minecraftforge.client.model.ItemLayerGeometry; import net.minecraftforge.client.model.obj.ObjLoader; import net.minecraftforge.eventbus.api.listener.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -22,10 +21,9 @@ import net.minecraftforge.fml.common.Mod; public class ClientForgeMod { @SubscribeEvent public static void onRegisterGeometryLoaders(ModelEvent.RegisterGeometryLoaders event) { - event.register(forgeRL("empty"), (json, ctx) -> UnbakedGeometry.EMPTY); + event.register(forgeRL("empty"), (_, _) -> UnbakedGeometry.EMPTY); event.register(forgeRL("obj"), ObjLoader.INSTANCE); event.register(forgeRL("fluid_container"), DynamicFluidContainerModel.Loader.INSTANCE); - event.register(forgeRL("item_layers"), ItemLayerGeometry.Loader.INSTANCE); } @SubscribeEvent diff --git a/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java b/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java index 2d23601bd4..16f12a6b74 100644 --- a/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java +++ b/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java @@ -33,13 +33,13 @@ public class ConfigScreenHandler * instance.

*/ public ConfigScreenFactory(Function screenFunction) { - this((mcClient, modsScreen) -> screenFunction.apply(modsScreen)); + this((_, modsScreen) -> screenFunction.apply(modsScreen)); } } public static Optional> getScreenFactoryFor(IModInfo selectedMod) { - return ModList.get().getModContainerById(selectedMod.getModId()). + return ModList.getModContainerById(selectedMod.getModId()). flatMap(mc -> mc.getCustomExtension(ConfigScreenFactory.class).map(ConfigScreenFactory::screenFunction)); } } diff --git a/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java b/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java index e244336b89..da7b16605a 100644 --- a/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java +++ b/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java @@ -53,7 +53,7 @@ public class CreativeModeTabSearchRegistry { if (!tab.hasSearchBar()) return null; - return NAME_SEARCH_KEYS.computeIfAbsent(tab, k -> new SessionSearchTrees.Key()); + return NAME_SEARCH_KEYS.computeIfAbsent(tab, _ -> new SessionSearchTrees.Key()); } @Nullable @@ -64,6 +64,6 @@ public class CreativeModeTabSearchRegistry { if (!tab.hasSearchBar()) return null; - return TAG_SEARCH_KEYS.computeIfAbsent(tab, k -> new SessionSearchTrees.Key()); + return TAG_SEARCH_KEYS.computeIfAbsent(tab, _ -> new SessionSearchTrees.Key()); } } diff --git a/src/main/java/net/minecraftforge/client/ForgeAtlasProvider.java b/src/main/java/net/minecraftforge/client/ForgeAtlasProvider.java new file mode 100644 index 0000000000..0824241177 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/ForgeAtlasProvider.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.client; + +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +import net.minecraft.client.data.AtlasProvider; +import net.minecraft.client.renderer.texture.atlas.SpriteSource; +import net.minecraft.client.renderer.texture.atlas.sources.SingleFile; +import net.minecraft.data.AtlasIds; +import net.minecraft.data.CachedOutput; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.Identifier; + +public class ForgeAtlasProvider extends AtlasProvider { + public ForgeAtlasProvider(PackOutput output) { + super(output); + } + + @Override + public CompletableFuture run(final CachedOutput cache) { + return CompletableFuture.allOf( + this.storeAtlas(cache, AtlasIds.BLOCKS, List.of( + single("white") + )), + this.storeAtlas(cache, AtlasIds.ITEMS, List.of( + fromBlock("block/lava_still"), + fromBlock("block/water_still") + )) + ); + } + + private static SpriteSource single(String path) { + return new SingleFile(Identifier.fromNamespaceAndPath("forge", path)); + } + + private static SpriteSource fromBlock(String name) { + var resource = Identifier.withDefaultNamespace(name); + var id = resource; + if (resource.getPath().startsWith("block/")) + id = resource.withPath(path -> "item/" + path.substring(6)); + return new SingleFile(resource, Optional.of(id)); + } +} diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 93f6bd7fb6..ac6ecec55c 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -23,12 +23,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.Options; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.ChatComponent; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState; -import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; @@ -43,33 +41,27 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.particle.ParticleEngine; -import net.minecraft.client.particle.ParticleRenderType; import net.minecraft.client.particle.ParticleResources; import net.minecraft.client.player.ClientInput; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.renderer.SubmitNodeCollector; -import net.minecraft.client.renderer.block.model.BlockModelPart; -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; +import net.minecraft.client.renderer.block.FluidModel; import net.minecraft.client.renderer.entity.state.HumanoidRenderState; +import net.minecraft.client.renderer.extract.LevelExtractor; import net.minecraft.client.renderer.fog.FogData; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.client.renderer.texture.SpriteContents; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.metadata.animation.FrameSize; -import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.ResolvedModel; -import net.minecraft.client.resources.model.SpriteGetter; -import net.minecraft.client.resources.model.UnbakedGeometry; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; +import net.minecraft.client.resources.model.sprite.MaterialBaker; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; import net.minecraft.core.BlockPos; -import net.minecraft.data.AtlasIds; import net.minecraft.locale.Language; import net.minecraft.network.Connection; import net.minecraft.network.chat.ChatType; @@ -82,10 +74,8 @@ import net.minecraft.resources.Identifier; import net.minecraft.server.packs.metadata.MetadataSectionType; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceMetadata; import net.minecraft.util.GsonHelper; import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -94,10 +84,10 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.GameType; import net.minecraft.world.level.block.Blocks; 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.FogType; import net.minecraft.world.phys.BlockHitResult; @@ -124,7 +114,6 @@ import net.minecraftforge.client.event.RenderBlockScreenEffectEvent; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderHighlightEvent; import net.minecraftforge.client.event.RenderTooltipEvent; -import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.ViewportEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; @@ -134,7 +123,6 @@ import net.minecraftforge.client.extensions.common.IClientMobEffectExtensions; import net.minecraftforge.client.gui.ClientTooltipComponentManager; import net.minecraftforge.client.gui.ModMismatchDisconnectedScreen; import net.minecraftforge.client.model.ForgeBlockModelData; -import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.client.model.geometry.GeometryLoaderManager; import net.minecraftforge.client.textures.ForgeTextureMetadata; import net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager; @@ -142,7 +130,6 @@ import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.IExtensionPoint; import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.ModLoader; import net.minecraftforge.network.NetworkContext; import net.minecraftforge.network.NetworkInitialization; import net.minecraftforge.network.NetworkRegistry; @@ -159,19 +146,15 @@ import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; import org.joml.Vector4f; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.Stack; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; @@ -186,53 +169,6 @@ public class ForgeHooksClient { //private static final Identifier ITEM_GLINT = new Identifier("textures/misc/enchanted_item_glint.png"); - /** - * Contains the *extra* GUI layers. - * The current top layer stays in Minecraft#currentScreen, and the rest serve as a background for it. - */ - private static final Stack guiLayers = new Stack<>(); - - public static void resizeGuiLayers(Minecraft minecraft, int width, int height) { - guiLayers.forEach(screen -> screen.resize(width, height)); - } - - public static void clearGuiLayers(Minecraft minecraft) { - while (!guiLayers.isEmpty()) - popGuiLayerInternal(minecraft); - } - - private static void popGuiLayerInternal(Minecraft minecraft) { - if (minecraft.screen != null) - minecraft.screen.removed(); - minecraft.screen = guiLayers.pop(); - } - - public static void pushGuiLayer(Minecraft minecraft, Screen screen) { - if (minecraft.screen != null) - guiLayers.push(minecraft.screen); - minecraft.screen = Objects.requireNonNull(screen); - screen.init(minecraft.getWindow().getGuiScaledWidth(), minecraft.getWindow().getGuiScaledHeight()); - minecraft.getNarrator().saySystemNow(screen.getNarrationMessage()); - } - - public static void popGuiLayer(Minecraft minecraft) { - if (guiLayers.isEmpty()) { - minecraft.setScreen(null); - return; - } - - popGuiLayerInternal(minecraft); - if (minecraft.screen != null) - minecraft.getNarrator().saySystemNow(minecraft.screen.getNarrationMessage()); - } - - public static float getGuiFarPlane() { - // 11000 units for the overlay background, - // and 10000 units for each layered Screen, - - return 11000.0F + 10000.0F * (1 + guiLayers.size()); - } - public static boolean onClientPauseChangePre(boolean pause) { return ClientPauseChangeEvent.Pre.BUS.post(new ClientPauseChangeEvent.Pre(pause)); } @@ -248,9 +184,9 @@ public class ForgeHooksClient { } */ - private static final RenderHighlightEvent.Callback NOOP_HIGHLIGHTER = (source, stack, translucent, state) -> { }; + private static final RenderHighlightEvent.Callback NOOP_HIGHLIGHTER = (_, _, _) -> { }; - public static RenderHighlightEvent.Callback onExtractBlockOutline(LevelRenderer context, Camera camera, LevelRenderState state, HitResult target) { + public static RenderHighlightEvent.Callback onExtractBlockOutline(LevelExtractor context, Camera camera, LevelRenderState state, HitResult target) { if (target instanceof BlockHitResult blockTarget) { var event = new RenderHighlightEvent.Block(context, camera, state, blockTarget); if (RenderHighlightEvent.Block.BUS.post(event)) @@ -277,6 +213,7 @@ public class ForgeHooksClient { RegisterColorHandlersEvent.Block.BUS.post(new RegisterColorHandlersEvent.Block(blockColors)); } + @SuppressWarnings("rawtypes") public static Model getArmorModel(HumanoidRenderState state, ItemStack itemStack, EquipmentSlot slot, HumanoidModel _default) { return IClientItemExtensions.of(itemStack).getGenericArmorModel(state, itemStack, slot, _default); } @@ -319,23 +256,6 @@ public class ForgeHooksClient { return PlaySoundEvent.BUS.fire(new PlaySoundEvent(manager, sound)).getSound(); } - public static void drawScreen(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - guiGraphics.pose().pushMatrix(); - for (Screen layer : guiLayers) { - // Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted. - drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); - //guiGraphics.pose().translate(0, 0, 10000); - } - drawScreenInternal(screen, guiGraphics, mouseX, mouseY, partialTick); - guiGraphics.pose().popMatrix(); - } - - private static void drawScreenInternal(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (!ScreenEvent.Render.Pre.BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick))) - screen.renderWithTooltipAndSubtitles(guiGraphics, mouseX, mouseY, partialTick); - ScreenEvent.Render.Post.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) { // Modify fog color depending on the fluid FluidState state = level.getFluidState(camera.blockPosition()); @@ -367,15 +287,13 @@ public class ForgeHooksClient { ModelEvent.BakingCompleted.BUS.post(new ModelEvent.BakingCompleted(modelManager, modelBakery)); } - public static TextureAtlasSprite[] getFluidSprites(BlockAndTintGetter level, BlockPos pos, FluidState fluidStateIn) { - IClientFluidTypeExtensions props = IClientFluidTypeExtensions.of(fluidStateIn); - Identifier overlayTexture = props.getOverlayTexture(fluidStateIn, level, pos); - var atlas = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(AtlasIds.BLOCKS); - return new TextureAtlasSprite[] { - atlas.getSprite(props.getStillTexture(fluidStateIn, level, pos)), - atlas.getSprite(props.getFlowingTexture(fluidStateIn, level, pos)), - overlayTexture == null ? null : atlas.getSprite(overlayTexture), - }; + public static Map onFluidModelBake(ModelBakery bakery, MaterialBaker materials, Map vanilla) { + var ret = new HashMap(); + ModelEvent.BakeFluidModels.BUS.post(new ModelEvent.BakeFluidModels(bakery, materials, ret)); + if (ret.isEmpty()) + return vanilla; + ret.putAll(vanilla); + return Map.copyOf(ret); } private static int slotMainHand = 0; @@ -395,24 +313,24 @@ public class ForgeHooksClient { return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static @Nullable CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) { + public static @Nullable CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphicsExtractor guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) { var evt = new CustomizeGuiOverlayEvent.BossEventProgress(window, guiGraphics, Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(false), bossInfo, x, y, increment); return CustomizeGuiOverlayEvent.BossEventProgress.BUS.post(evt) ? null : evt; } - public static void onCustomizeChatEvent(GuiGraphics guiGraphics, ChatComponent chat, Window window, int mouseX, int mouseY, int tickCount, Font font) { + public static void onCustomizeChatEvent(GuiGraphicsExtractor guiGraphics, ChatComponent chat, Window window, int mouseX, int mouseY, int tickCount, Font font) { var minecraft = Minecraft.getInstance(); var evt = new CustomizeGuiOverlayEvent.Chat(window, guiGraphics, minecraft.getDeltaTracker().getRealtimeDeltaTicks(), 0, chat.getHeight() - 40); CustomizeGuiOverlayEvent.Chat.BUS.post(evt); guiGraphics.pose().pushMatrix(); // We give the absolute Y position of the chat component in the event and account for the chat component's own offsetting here. guiGraphics.pose().translate(evt.getPosX(), (float) ((evt.getPosY() - chat.getHeight() + 40) / chat.getScale())); - chat.render(guiGraphics, font, tickCount, mouseX, mouseY, false, false); + chat.extractRenderState(guiGraphics, font, tickCount, mouseX, mouseY, ChatComponent.DisplayMode.BACKGROUND, false); guiGraphics.pose().popMatrix(); } - public static void onCustomizeDebugEvent(GuiGraphics guiGraphics, Window window, float partialTick, List text, boolean isLeft) { + public static void onCustomizeDebugEvent(GuiGraphicsExtractor guiGraphics, Window window, float partialTick, List text, boolean isLeft) { var evt = new CustomizeGuiOverlayEvent.DebugText(window, guiGraphics, partialTick, text, isLeft ? CustomizeGuiOverlayEvent.DebugText.Side.Left : CustomizeGuiOverlayEvent.DebugText.Side.Right); CustomizeGuiOverlayEvent.DebugText.BUS.post(evt); @@ -450,14 +368,14 @@ public class ForgeHooksClient { InputEvent.Key.BUS.post(new InputEvent.Key(info, action)); } - public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance) { + public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance, double nameTagDistance) { if (entity instanceof LivingEntity living) { var attribute = living.getAttribute(ForgeMod.NAMETAG_DISTANCE.getHolder().get()); if (attribute != null) { return !(squareDistance > (attribute.getValue() * attribute.getValue())); } } - return !(squareDistance > 4096.0f); + return !(squareDistance > Mth.square(nameTagDistance)); } public static boolean shouldRenderEffect(MobEffectInstance effectInstance) { @@ -483,13 +401,12 @@ public class ForgeHooksClient { return null; } - @Nullable - public static TextureAtlasSprite loadTextureAtlasSprite(Identifier atlasName, SpriteContents contents, int atlasWidth, int atlasHeight, int spriteX, int spriteY, int padding, int mipmapLevel) { + public static TextureAtlasSprite loadTextureAtlasSprite(Identifier atlasName, SpriteContents contents, int atlasWidth, int atlasHeight, int x, int y, int padding) { + TextureAtlasSprite ret = null; var forgeMeta = contents.getAdditionalMetadata(ForgeTextureMetadata.TYPE).orElse(null); - if (forgeMeta == null || forgeMeta.loader() == null) - return null; - - return forgeMeta.loader().makeSprite(atlasName, contents, atlasWidth, atlasHeight, spriteX, spriteY, padding, mipmapLevel); + if (forgeMeta != null && forgeMeta.loader() != null) + ret = forgeMeta.loader().makeSprite(atlasName, contents, atlasWidth, atlasHeight, x, y, padding, contents.getMipLevel()); + return ret != null ? ret : new TextureAtlasSprite(atlasName, contents, atlasWidth, atlasHeight, x, y, padding); } private static final Map> layerDefinitions = new HashMap<>(); @@ -515,7 +432,7 @@ public class ForgeHooksClient { boolean channelsMatch = NetworkRegistry.checkListPingCompatibilityForClient(remoteChannels); AtomicBoolean result = new AtomicBoolean(true); final List extraClientMods = new ArrayList<>(); - ModList.get().forEachModContainer((modid, mc) -> + ModList.forEachModContainer((modid, mc) -> mc.getCustomExtension(IExtensionPoint.DisplayTest.class).ifPresent(ext-> { boolean foundModOnServer = ext.remoteVersionTest().test(mods.get(modid), true); result.compareAndSet(true, foundModOnServer); @@ -526,8 +443,8 @@ public class ForgeHooksClient { boolean modsMatch = result.get(); final Map extraServerMods = mods.entrySet().stream(). - filter(e -> !Objects.equals(IExtensionPoint.DisplayTest.IGNORESERVERONLY, e.getValue())). - filter(e -> !ModList.get().isLoaded(e.getKey())). + filter(e -> !IExtensionPoint.DisplayTest.IGNORESERVERONLY.equals(e.getValue())). + filter(e -> !ModList.isLoaded(e.getKey())). collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); LOGGER.debug(CLIENTHOOKS, "Received FML ping data from server at {}: FMLNETVER={}, mod list is compatible : {}, channel list is compatible: {}, extra server mods: {}", target.ip, fmlver, modsMatch, channelsMatch, extraServerMods); @@ -558,7 +475,7 @@ public class ForgeHooksClient { } private static final Identifier ICON_SHEET = Identifier.fromNamespaceAndPath(ForgeVersion.MOD_ID, "textures/gui/icons.png"); - public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, GuiGraphics guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY) { + public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, GuiGraphicsExtractor guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY) { int idx; String tooltip; if (target.forgeData == null) @@ -624,9 +541,8 @@ public class ForgeHooksClient { } public static void onRegisterPictureInPictureRenderers(List> renderers, - MultiBufferSource.BufferSource bufferSource, ImmutableMap.Builder, PictureInPictureRenderer> builder) { - RegisterPictureInPictureRendererEvent.BUS.post(new RegisterPictureInPictureRendererEvent(renderers, bufferSource, builder)); + RegisterPictureInPictureRendererEvent.BUS.post(new RegisterPictureInPictureRendererEvent(renderers, builder)); } @Nullable @@ -659,7 +575,7 @@ public class ForgeHooksClient { return stackFont == null ? fallbackFont : stackFont; } - public static @Nullable 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, @Nullable Identifier background) { + public static @Nullable RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, GuiGraphicsExtractor graphics, int x, int y, int screenWidth, int screenHeight, @NotNull List components, @NotNull Font fallbackFont, @NotNull ClientTooltipPositioner positioner, @Nullable Identifier background) { var preEvent = new RenderTooltipEvent.Pre(stack, graphics, x, y, screenWidth, screenHeight, getTooltipFont(stack, fallbackFont), components, positioner, background); return RenderTooltipEvent.Pre.BUS.post(preEvent) ? null : preEvent; } @@ -684,7 +600,7 @@ public class ForgeHooksClient { // text wrapping int tooltipTextWidth = event.getTooltipElements().stream() - .mapToInt(either -> either.map(font::width, component -> 0)) + .mapToInt(either -> either.map(font::width, _ -> 0)) .max() .orElse(0); @@ -730,27 +646,6 @@ public class ForgeHooksClient { return font.split(text, maxWidth).stream().map(ClientTooltipComponent::create); } - public static boolean isBlockInSolidLayer(BlockState state) { - var model = Minecraft.getInstance().getBlockRenderer().getBlockModel(state); - return model.getRenderTypes(state, RandomSource.create(), ModelData.EMPTY).contains(ChunkSectionLayer.SOLID); - } - - public static void createWorldConfirmationScreen(Runnable doConfirmedWorldLoad) { - Component title = Component.translatable("selectWorld.backupQuestion.experimental"); - Component msg = Component.translatable("selectWorld.backupWarning.experimental") - .append("\n\n") - .append(Component.translatable("forge.selectWorld.backupWarning.experimental.additional")); - - Screen screen = new ConfirmScreen(confirmed -> { - if (confirmed) - doConfirmedWorldLoad.run(); - else - Minecraft.getInstance().setScreen(null); - }, title, msg, CommonComponents.GUI_PROCEED, CommonComponents.GUI_CANCEL); - - Minecraft.getInstance().setScreen(screen); - } - public static boolean renderFireOverlay(Player player, PoseStack mat) { return renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition()); } @@ -805,7 +700,7 @@ public class ForgeHooksClient { var mismatch = NetworkContext.get(connection).getMismatchs(); if (mismatch == null) return false; - mc.setScreen(new ModMismatchDisconnectedScreen(parent, CommonComponents.CONNECT_FAILED, message, mismatch)); + mc.gui.setScreen(new ModMismatchDisconnectedScreen(parent, CommonComponents.CONNECT_FAILED, message, mismatch)); return true; } @@ -855,55 +750,6 @@ public class ForgeHooksClient { return new ForgeBlockModelData(transform, renderType, renderTypeFast, visibility); } - /** This is a dirty fucking hack, but it needs to send in the top most render type. */ - public static ModelBaker wrapRenderType(ModelBaker parent, RenderTypeGroup group) { - if (group == null || group == RenderTypeGroup.EMPTY || parent.renderType() != null) - return parent; - return new WrapedModelBaker(parent, group); - } - - public static ModelBaker wrapRenderType(ModelBaker parent, RenderTypeGroup group, RenderTypeGroup groupFast) { - if (group == null || group == RenderTypeGroup.EMPTY || parent.renderType() != null) - return parent; - return new WrapedModelBaker(parent, group, groupFast); - } - - // a record for performance reasons - private record WrapedModelBaker(ModelBaker parent, RenderTypeGroup group, RenderTypeGroup renderTypeFast) implements ModelBaker { - private WrapedModelBaker(ModelBaker parent, RenderTypeGroup group) { - this(parent, group, RenderTypeGroup.EMPTY); - } - - @Override - public RenderTypeGroup renderType() { - return group; - } - - @Override public ResolvedModel getModel(Identifier p_397309_) { - return parent.getModel(p_397309_); - } - - @Override - public SpriteGetter sprites() { - return parent.sprites(); - } - - @Override - public T compute(SharedOperationKey p_395456_) { - return parent.compute(p_395456_); - } - - @Override - public BlockModelPart missingBlockModelPart() { - return parent.missingBlockModelPart(); - } - - @Override - public PartCache parts() { - return parent.parts(); - } - } - public static void addFramePass(Identifier rl, FramePassManager.PassDefinition definition) { FramePassManager.addPass(rl, definition); } diff --git a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java index 71da1042df..159035b79d 100644 --- a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java +++ b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java @@ -5,16 +5,15 @@ package net.minecraftforge.client; +import com.mojang.blaze3d.GpuFormat; import com.mojang.blaze3d.pipeline.BlendFunction; +import com.mojang.blaze3d.pipeline.ColorTargetState; import com.mojang.blaze3d.pipeline.RenderPipeline; -import com.mojang.blaze3d.platform.DepthTestFunction; -import com.mojang.blaze3d.platform.DestFactor; -import com.mojang.blaze3d.platform.SourceFactor; +import com.mojang.blaze3d.platform.BlendFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.textures.AddressMode; import com.mojang.blaze3d.textures.FilterMode; import com.mojang.blaze3d.textures.GpuSampler; -import com.mojang.blaze3d.textures.TextureFormat; import net.minecraft.util.Util; import net.minecraft.client.renderer.RenderPipelines; @@ -32,8 +31,6 @@ import org.jetbrains.annotations.ApiStatus; public enum ForgeRenderTypes { ITEM_LAYERED_SOLID(()-> getItemLayeredSolid(blockAtlas())), ITEM_LAYERED_CUTOUT(()-> getItemLayeredCutout(blockAtlas())), - ITEM_LAYERED_CUTOUT_MIPPED(()-> getItemLayeredCutoutMipped(blockAtlas())), - ITEM_LAYERED_TRANSLUCENT(()-> getItemLayeredTranslucent(blockAtlas())), ITEM_UNSORTED_TRANSLUCENT(()-> getUnsortedTranslucent(blockAtlas())), ITEM_UNLIT_TRANSLUCENT(()-> getUnlitTranslucent(blockAtlas())), ITEM_UNSORTED_UNLIT_TRANSLUCENT(()-> getUnlitTranslucent(blockAtlas(), false)); @@ -69,20 +66,6 @@ public enum ForgeRenderTypes { return Internal.LAYERED_ITEM_CUTOUT.apply(textureLocation); } - /** - * @return A RenderType fit for multi-layer cutout-mipped item rendering. - */ - public static RenderType getItemLayeredCutoutMipped(Identifier textureLocation) { - return Internal.LAYERED_ITEM_CUTOUT_MIPPED.apply(textureLocation); - } - - /** - * @return A RenderType fit for multi-layer translucent item rendering. - */ - public static RenderType getItemLayeredTranslucent(Identifier textureLocation) { - return Internal.LAYERED_ITEM_TRANSLUCENT.apply(textureLocation); - } - /** * @return A RenderType fit for translucent item/entity rendering, but with depth sorting disabled. */ @@ -107,13 +90,6 @@ public enum ForgeRenderTypes { return (sortingEnabled ? Internal.UNLIT_TRANSLUCENT_SORTED : Internal.UNLIT_TRANSLUCENT_UNSORTED).apply(textureLocation); } - /** - * @return Same as {@link RenderType#entityCutout(Identifier)}, but with mipmapping enabled. - */ - public static RenderType getEntityCutoutMipped(Identifier textureLocation) { - return Internal.LAYERED_ITEM_CUTOUT_MIPPED.apply(textureLocation); - } - /** * @see #enableTextTextureLinearFiltering * @@ -128,8 +104,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensity(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensity(Identifier locationIn) { - return Internal.TEXT_INTENSITY.apply(locationIn); + public static RenderType getTextGrayscale(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE.apply(locationIn); } /** @@ -146,8 +122,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensityPolygonOffset(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensityPolygonOffset(Identifier locationIn) { - return Internal.TEXT_INTENSITY_POLYGON_OFFSET.apply(locationIn); + public static RenderType getTextGrayscalePolygonOffset(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE_POLYGON_OFFSET.apply(locationIn); } /** @@ -164,8 +140,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensitySeeThrough(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensitySeeThrough(Identifier locationIn) { - return Internal.TEXT_INTENSITY_SEE_THROUGH.apply(locationIn); + public static RenderType getTextGrayscaleSeeThrough(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE_SEE_THROUGH.apply(locationIn); } /** @@ -202,9 +178,7 @@ public enum ForgeRenderTypes { private static RenderType unsortedTranslucent(Identifier texture) { return RenderType.create("forge_unsorted_translucent", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .withTexture("Sampler0", texture) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .useLightmap() .useOverlay() @@ -217,7 +191,6 @@ public enum ForgeRenderTypes { private static RenderType unlitTranslucentSorted(Identifier texture) { return RenderType.create("forge_unlit_translucent_sorted", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .sortOnUpload() .withTexture("Sampler0", texture) @@ -231,7 +204,6 @@ public enum ForgeRenderTypes { private static RenderType unlitTranslucentUnsorted(Identifier texture) { return RenderType.create("forge_unlit_translucent_sorted", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useOverlay() @@ -244,7 +216,6 @@ public enum ForgeRenderTypes { private static RenderType layeredItemSolid(Identifier texture) { return RenderType.create("forge_layered_item_soild", RenderSetup.builder(RenderPipelines.ENTITY_SOLID) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useLightmap() @@ -258,7 +229,6 @@ public enum ForgeRenderTypes { private static RenderType layeredItemCutout(Identifier texture) { return RenderType.create("forge_layered_item_cutout", RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useLightmap() @@ -268,35 +238,6 @@ public enum ForgeRenderTypes { ); } - public static Function LAYERED_ITEM_CUTOUT_MIPPED = Util.memoize(Internal::layeredItemCutoutMipped); - private static RenderType layeredItemCutoutMipped(Identifier texture) { - return RenderType.create("forge_layered_item_cutout_mipped", - RenderSetup.builder(RenderPipelines.ENTITY_SMOOTH_CUTOUT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) - .affectsCrumbling() - .withTexture("Sampler0", texture) // Used to have mipmap = true - .useLightmap() - .useOverlay() - .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE) - .createRenderSetup() - ); - } - - public static Function LAYERED_ITEM_TRANSLUCENT = Util.memoize(Internal::layeredItemTranslucent); - private static RenderType layeredItemTranslucent(Identifier texture) { - return RenderType.create("forge_layered_item_translucent", - RenderSetup.builder(RenderPipelines.ITEM_ENTITY_TRANSLUCENT_CULL) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) - .affectsCrumbling() - .sortOnUpload() - .withTexture("Sampler0", texture) - .useLightmap() - .useOverlay() - .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE) - .createRenderSetup() - ); - } - public static Function TEXT = Util.memoize(Internal::getText); private static RenderType getText(Identifier texture) { return RenderType.create( @@ -304,17 +245,15 @@ public enum ForgeRenderTypes { RenderSetup.builder(RenderPipelines.TEXT) .withTexture("Sampler0", texture) .useLightmap() - .bufferSize(RenderType.SMALL_BUFFER_SIZE) .sortOnUpload() // This is what is different from RenderTypes.TEXT .createRenderSetup() ); } - public static Function TEXT_INTENSITY = Util.memoize(Internal::getTextIntensity); - private static RenderType getTextIntensity(Identifier texture) { - return RenderType.create("forge_text_intensity", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY) - .bufferSize(RenderType.SMALL_BUFFER_SIZE) + public static Function TEXT_GRAYSCALE = Util.memoize(Internal::getTextGrayscale); + private static RenderType getTextGrayscale(Identifier texture) { + return RenderType.create("forge_text_grayscale", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE) .withTexture("Sampler0", texture) .useLightmap() .useOverlay() @@ -326,7 +265,6 @@ public enum ForgeRenderTypes { private static RenderType getTextPolygonOffset(Identifier texture) { return RenderType.create("forge_text_polygon_offset", RenderSetup.builder(RenderPipelines.TEXT_POLYGON_OFFSET) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -334,11 +272,10 @@ public enum ForgeRenderTypes { ); } - public static Function TEXT_INTENSITY_POLYGON_OFFSET = Util.memoize(Internal::getTextIntensityPolygonOffset); - private static RenderType getTextIntensityPolygonOffset(Identifier texture) { - return RenderType.create("forge_text_intensity_polygon_offset", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) + public static Function TEXT_GRAYSCALE_POLYGON_OFFSET = Util.memoize(Internal::getTextGrayscalePolygonOffset); + private static RenderType getTextGrayscalePolygonOffset(Identifier texture) { + return RenderType.create("forge_text_grayscale_polygon_offset", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -350,18 +287,16 @@ public enum ForgeRenderTypes { private static RenderType getTextSeeThrough(Identifier texture) { return RenderType.create("forge_text_see_through", RenderSetup.builder(RenderPipelines.TEXT_SEE_THROUGH) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .withTexture("Sampler0", texture) .useLightmap() .createRenderSetup() ); } - public static Function TEXT_INTENSITY_SEE_THROUGH = Util.memoize(Internal::getTextIntensitySeeThrough); + public static Function TEXT_GRAYSCALE_SEE_THROUGH = Util.memoize(Internal::getTextIntensitySeeThrough); private static RenderType getTextIntensitySeeThrough(Identifier texture) { - return RenderType.create("forge_text_intensity_see_through", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY_SEE_THROUGH) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) + return RenderType.create("forge_text_grayscale_see_through", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE_SEE_THROUGH) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -371,9 +306,7 @@ public enum ForgeRenderTypes { private static final RenderPipeline LOADING_PIPELINE = RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET) .withLocation("pipeline/forge/loading_overlay") - .withBlend(new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE)) - .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST) - .withDepthWrite(false) + .withColorTargetState(new ColorTargetState(new BlendFunction(BlendFactor.SRC_ALPHA, BlendFactor.ONE))) .build(); private static final GpuSampler LOADING_SAMPLER = RenderSystem.getSamplerCache().getSampler(AddressMode.REPEAT, AddressMode.REPEAT, FilterMode.NEAREST, FilterMode.NEAREST, false); @@ -381,15 +314,14 @@ public enum ForgeRenderTypes { public static RenderType getLoadingOverlay(DisplayWindow window) { var gpu = RenderSystem.getDevice(); - var texture = gpu.createTexture(LOADING_TEXTURE.toString(), 5, TextureFormat.RGBA8, + var texture = gpu.createTexture(LOADING_TEXTURE.toString(), 5, GpuFormat.RGBA8_UNORM, window.context().width(), window.context().height(), 1, window.getFramebufferTextureId()); var textureView = gpu.createTextureView(texture); return RenderType.create("forge_loading_overlay", RenderSetup.builder(LOADING_PIPELINE) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) - .withTexture("Sampler0", textureView, LOADING_SAMPLER) + .withTexture("Sampler0", LOADING_TEXTURE, () -> LOADING_SAMPLER) .createRenderSetup() ); } diff --git a/src/main/java/net/minecraftforge/client/FramePassManager.java b/src/main/java/net/minecraftforge/client/FramePassManager.java index 37b28c2f80..2029d2cc16 100644 --- a/src/main/java/net/minecraftforge/client/FramePassManager.java +++ b/src/main/java/net/minecraftforge/client/FramePassManager.java @@ -7,11 +7,12 @@ package net.minecraftforge.client; import com.mojang.blaze3d.framegraph.FrameGraphBuilder; import com.mojang.blaze3d.framegraph.FramePass; -import com.mojang.blaze3d.resource.ResourceHandle; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.renderer.LevelTargetBundle; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.resources.Identifier; import org.jetbrains.annotations.ApiStatus; +import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; import java.util.ArrayList; @@ -30,43 +31,77 @@ public class FramePassManager { // Note: Pass order is determined automatically within FrameGraphBuilder. It's unclear what must be done to guarantee ordering. @ApiStatus.Internal - public static void insertForgePasses(FrameGraphBuilder graphBuilder, LevelTargetBundle bundle, LevelRenderState state) { + public static void insertForgePasses(FrameGraphBuilder graphBuilder, LevelTargetBundle bundle, LevelRenderState state, DeltaTracker deltaTracker) { for (PassInfo info : addedPasses) { FramePass pass = graphBuilder.addPass(info.name); PassDefinition forgePass = info.pass; - forgePass.extracts(bundle, pass); + forgePass.extracts(bundle, pass, deltaTracker); pass.executes(() -> forgePass.executes(state)); } } + + + /// ### A PassDefinition must satisfy 3 things. + /// + /// 1. The rendering order for the purpose of translucency sorting. Read further for specific details. + /// 2. A render state definition supplier; "what" will be rendered. + /// 3. A render state definition consumer; "how" it will be rendered. + /// + /// + /// To satisfy #1, all FramePasses (and thus PassDefinitions) must bind against at least one target. + /// The list of targets can be found in {@linkplain LevelTargetBundle}. + /// HOWEVER!!! Only {@linkplain LevelTargetBundle#main} is used if the graphics mode is not set to Fabulous! + /// So at minimum, all passes must guarantee a fallback binding to the main target, like the below. + /// ``` + /// @Override + /// void extracts(LevelTargetBundle bundle, FramePass pass, DeltaTracker deltaTracker) { + /// if (bundle.clouds != null) { // Perhaps we want to bind to clouds if Fabulous! is on. + /// bundle.clouds = pass.readsAndWrites(bundle.clouds); + /// } + /// // An else clause could be used, but is not mandatory. It is fine to bind to more than one target. + /// bundle.main = pass.readsAndWrites(bundle.main); + /// } + /// ``` + /// + /// + /// It is up to the user to decide how their pass should bind to targets, but it must always bind to at least one. + /// Failure to satisfy this requirement will result in {@linkplain FrameGraphBuilder#resolvePassOrder} exploding. + /// Custom render targets are possible but not documented, see the implementation of {@linkplain LevelTargetBundle} + /// if you want to take a crack at it. + /// + /// Satisfying #2 is simple. Any state information you need to extract + /// should be done during {@linkplain PassDefinition#extracts(LevelTargetBundle, FramePass, DeltaTracker)}. + /// No actual rendering should be done at this time. This can happen before or after binding to a target. + /// The specific implementation of your render state is up to you, it can even be done with some instance variables. + /// + /// Satisfying #3 is also simple, this is the actual rendering that will consume the state created + /// during the extracts phase. + @NullMarked public interface PassDefinition { - /** - * Use to define which targets your pass will bind against, see {@link FramePass#reads} and {@link FramePass#readsAndWrites} - * A FramePass must bind to at least ONE target. Otherwise, you get freaky issues with >1 modded passes. - * Additionally, this method should be used for extracting render states into instance variables if desired. - */ - default void extracts(LevelTargetBundle bundle, FramePass pass) { - targets(bundle, pass); - } /** - * Prefer {@link PassDefinition#extracts} + * @deprecated Prefer {@linkplain PassDefinition#extracts(LevelTargetBundle, FramePass, DeltaTracker)} */ - @Deprecated(forRemoval = true, since = "1.21.10") - default void targets(LevelTargetBundle bundle, FramePass pass) {} + @Deprecated(forRemoval = true, since="26.2") + default void extracts(LevelTargetBundle bundle, FramePass pass) {}; /** - * Use to define what your pass does during the render stage. + * This method exists to do render state extraction. Your instance of a PassDefinition should have + * locals or some filled record instance that represents the render state created. + * The resulting render state should be consumed by {@linkplain PassDefinition#executes(LevelRenderState)} + * You must also use this to define which targets your pass will bind against. See PassDefinition javadocs for details. */ - default void executes(LevelRenderState state) { - executes(); + + default void extracts(LevelTargetBundle bundle, FramePass pass, DeltaTracker deltaTracker) { + extracts(bundle, pass); }; /** - * Use to define what your pass does during the render stage, prefer {@link PassDefinition#executes(LevelRenderState)}. + * Use to define what your pass does during the render stage. This should consume the render state created + * during the extracts phase. */ - @Deprecated(forRemoval = true, since = "1.21.10") - default void executes(){}; + void executes(LevelRenderState state); } private record PassInfo(String name, PassDefinition pass){} diff --git a/src/main/java/net/minecraftforge/client/IItemDecorator.java b/src/main/java/net/minecraftforge/client/IItemDecorator.java index 761fe87c79..7178734347 100644 --- a/src/main/java/net/minecraftforge/client/IItemDecorator.java +++ b/src/main/java/net/minecraftforge/client/IItemDecorator.java @@ -6,7 +6,7 @@ package net.minecraftforge.client; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraftforge.client.event.RegisterItemDecorationsEvent; @@ -15,14 +15,13 @@ import net.minecraftforge.client.event.RegisterItemDecorationsEvent; * An ItemDecorator that is used to render something on specific items, when the DurabilityBar and StackCount is rendered. * Add it to an item using {@linkplain RegisterItemDecorationsEvent#register(ItemLike, IItemDecorator)}. */ -public interface IItemDecorator -{ +public interface IItemDecorator { /** - * Is called after {@linkplain GuiGraphics#renderItemDecorations(Font, ItemStack, int, int, String)} is done rendering. + * Is called after {@linkplain GuiGraphicsExtractor#itemDecorations(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 */ - boolean render(GuiGraphics guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset); + boolean render(GuiGraphicsExtractor guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset); } diff --git a/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java b/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java index f07e6e8f8a..0024a5d485 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 net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraftforge.client.event.RegisterItemDecorationsEvent; @@ -49,7 +49,7 @@ public final class ItemDecoratorHandler { return DECORATOR_LOOKUP.getOrDefault(stack.getItem(), EMPTY); } - public void render(GuiGraphics guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset) { + public void render(GuiGraphicsExtractor guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset) { resetRenderState(); for (IItemDecorator itemDecorator : itemDecorators) { if (itemDecorator.render(guiGraphics, font, stack, xOffset, yOffset)) diff --git a/src/main/java/net/minecraftforge/client/NamedRenderTypeManager.java b/src/main/java/net/minecraftforge/client/NamedRenderTypeManager.java index 56868bf6c9..a62835ba70 100644 --- a/src/main/java/net/minecraftforge/client/NamedRenderTypeManager.java +++ b/src/main/java/net/minecraftforge/client/NamedRenderTypeManager.java @@ -42,8 +42,6 @@ public final class NamedRenderTypeManager { private static void preRegisterVanillaRenderTypes(Map blockRenderTypes) { blockRenderTypes.put(rl("solid"), new RenderTypeGroup(ChunkSectionLayer.SOLID, ForgeRenderTypes.ITEM_LAYERED_SOLID.get())); blockRenderTypes.put(rl("cutout"), new RenderTypeGroup(ChunkSectionLayer.CUTOUT, ForgeRenderTypes.ITEM_LAYERED_CUTOUT.get())); - blockRenderTypes.put(rl("translucent_moving_block"), new RenderTypeGroup(ChunkSectionLayer.TRANSLUCENT, ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get())); - blockRenderTypes.put(rl("tripwire"), new RenderTypeGroup(ChunkSectionLayer.TRIPWIRE, ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get())); } private static Identifier rl(String path) { diff --git a/src/main/java/net/minecraftforge/client/RenderTypeHelper.java b/src/main/java/net/minecraftforge/client/RenderTypeHelper.java deleted file mode 100644 index 6a334a44ee..0000000000 --- a/src/main/java/net/minecraftforge/client/RenderTypeHelper.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client; - -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import net.minecraft.client.renderer.ItemBlockRenderTypes; -import net.minecraft.client.renderer.Sheets; -import net.minecraft.client.renderer.block.model.BlockStateModel; -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; -import net.minecraft.client.renderer.rendertype.RenderType; -import net.minecraft.client.renderer.rendertype.RenderTypes; -import net.minecraft.util.RandomSource; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; -import org.jetbrains.annotations.NotNull; - -/** - * Provides helper functions replacing those in {@link ItemBlockRenderTypes}. - */ -public final class RenderTypeHelper { - /** - * Provides a {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY} for the given {@link DefaultVertexFormat#BLOCK} format. - * This should be called for each {@link RenderType} returned by {@link BakedModel#getRenderTypes(BlockState, RandomSource, ModelData)}. - *

- * Mimics the behavior of vanilla's {@link ItemBlockRenderTypes#getRenderType(BlockState)}. - */ - @NotNull - public static RenderType getEntityRenderType(ChunkSectionLayer layer) { - return layer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet(); - } - - /** - * Provides a {@link RenderType} fit for rendering moving blocks given the specified chunk render type. - * This should be called for each {@link RenderType} returned by {@link BakedModel#getRenderTypes(BlockState, RandomSource, ModelData)}. - *

- * Mimics the behavior of vanilla's {@link ItemBlockRenderTypes#getMovingBlockRenderType(BlockState)}. - */ - @NotNull - public static RenderType getMovingBlockRenderType(ChunkSectionLayer layer) { - if (layer == null) - return RenderTypes.solidMovingBlock(); - - return switch (layer) { - case SOLID -> RenderTypes.solidMovingBlock(); - case CUTOUT -> RenderTypes.cutoutMovingBlock(); - case TRANSLUCENT -> RenderTypes.translucentMovingBlock(); - case TRIPWIRE -> RenderTypes.tripwireMovingBlock(); - }; - } - - /** - * Provides a fallback {@link RenderType} for the given {@link ItemStack} in the case that none is explicitly specified. - *

- * Mimics the behavior of vanilla's {@link ItemBlockRenderTypes#getRenderType(ItemStack, boolean)} - * but removes the need to query the model again if the item is a {@link BlockItem}. - */ - @NotNull - public static RenderType getFallbackItemRenderType(ItemStack stack, BlockStateModel model) { - if (stack.getItem() instanceof BlockItem blockItem) { - var renderTypes = model.getRenderTypes(blockItem.getBlock().defaultBlockState(), RandomSource.create(42), ModelData.EMPTY); - if (renderTypes.contains(ChunkSectionLayer.TRANSLUCENT)) - return getEntityRenderType(ChunkSectionLayer.TRANSLUCENT); - return Sheets.cutoutBlockSheet(); - } - return Sheets.translucentItemSheet(); - } - - private RenderTypeHelper() {} -} diff --git a/src/main/java/net/minecraftforge/client/event/AddFramePassEvent.java b/src/main/java/net/minecraftforge/client/event/AddFramePassEvent.java index 3031c9e835..c8e9ad9a94 100644 --- a/src/main/java/net/minecraftforge/client/event/AddFramePassEvent.java +++ b/src/main/java/net/minecraftforge/client/event/AddFramePassEvent.java @@ -13,7 +13,7 @@ import net.minecraftforge.eventbus.api.event.RecordEvent; import org.jspecify.annotations.NullMarked; /** - * Fired after all vanilla frame passes are added into the pass list. + * Fired during the construction of {@linkplain net.minecraft.client.renderer.LevelRenderer}. * *

This event is fired on the {@linkplain net.minecraftforge.common.MinecraftForge#EVENT_BUS main Forge event bus}, * only on the {@linkplain net.minecraftforge.fml.LogicalSide#CLIENT logical client}. @@ -24,8 +24,9 @@ public record AddFramePassEvent() implements RecordEvent { /** * Adds a frame pass to pass list. * Create a new {@linkplain FramePassManager.PassDefinition} to handle render targets and render code. + * See javadocs for details on what creating a PassDefinition entails. * - * @param rl Resource location for frame pass name. Use RLs to avoid duplicate names. + * @param rl Identifier for frame pass name. Use RLs to avoid duplicate names. * @param definition see usages of {@linkplain com.mojang.blaze3d.framegraph.FramePass} in {@linkplain net.minecraft.client.renderer.LevelRenderer} * @throws IllegalArgumentException If the name is a duplicate. */ diff --git a/src/main/java/net/minecraftforge/client/event/AddGuiOverlayLayersEvent.java b/src/main/java/net/minecraftforge/client/event/AddGuiOverlayLayersEvent.java index 63620b878c..beb065f2b7 100644 --- a/src/main/java/net/minecraftforge/client/event/AddGuiOverlayLayersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/AddGuiOverlayLayersEvent.java @@ -6,11 +6,9 @@ package net.minecraftforge.client.event; import net.minecraftforge.client.gui.overlay.ForgeLayeredDraw; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -28,10 +26,4 @@ public record AddGuiOverlayLayersEvent(ForgeLayeredDraw getLayeredDraw) implemen @ApiStatus.Internal public AddGuiOverlayLayersEvent {} - - /** @deprecated {@link AddGuiOverlayLayersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } } diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index 50390e12ac..10a94d5bd5 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -5,7 +5,6 @@ package net.minecraftforge.client.event; -import net.minecraft.util.Util; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.PlayerChatMessage; @@ -75,17 +74,6 @@ public sealed class ClientChatReceivedEvent extends MutableEvent implements Canc return this.sender; } - /** - * {@return {@code true} if the message was sent by the system, {@code false} otherwise} - * - * @deprecated Mojang made ChatType a registry, which isn't always accessible when the System messages are sent. - * So moved to it's own event. {@link SystemMessageReceivedEvent} - */ - @Deprecated(forRemoval = true, since = "1.21.1") - public boolean isSystem() { - return this.sender.equals(Util.NIL_UUID); - } - /** * Fired when a player chat message is received on the client. * @@ -116,30 +104,4 @@ public sealed class ClientChatReceivedEvent extends MutableEvent implements Canc return this.playerChatMessage; } } - - /** - * Fired when a system message is received on the client. - * - * @deprecated Mojang made ChatType a registry, which isn't always accessible when the System messages are sent. - * So moved to its own event. {@link SystemMessageReceivedEvent} - */ - @Deprecated(forRemoval = true, since = "1.21.1") - public static final class System extends ClientChatReceivedEvent { - public static final CancellableEventBus BUS = CancellableEventBus.create(System.class); - - private final boolean overlay; - - @ApiStatus.Internal - public System(ChatType.Bound boundChatType, Component message, boolean overlay) { - super(boundChatType, message, Util.NIL_UUID); - this.overlay = overlay; - } - - /** - * {@return whether the message goes to the overlay} - */ - public boolean isOverlay() { - return this.overlay; - } - } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java index 7f0c06fd2f..6db26deaa7 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 net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.EventBus; @@ -43,7 +43,7 @@ public sealed interface ContainerScreenEvent { /** * {@return the gui graphics used for rendering} */ - GuiGraphics getGuiGraphics(); + GuiGraphicsExtractor getGuiGraphics(); /** * {@return the X coordinate of the mouse pointer} @@ -67,7 +67,7 @@ public sealed interface ContainerScreenEvent { */ record Foreground( AbstractContainerScreen getContainerScreen, - GuiGraphics getGuiGraphics, + GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY ) implements RecordEvent, Render { @@ -86,7 +86,7 @@ public sealed interface ContainerScreenEvent { */ record Background( AbstractContainerScreen getContainerScreen, - GuiGraphics getGuiGraphics, + GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY ) implements RecordEvent, Render { diff --git a/src/main/java/net/minecraftforge/client/event/CreateSpecialBlockRendererEvent.java b/src/main/java/net/minecraftforge/client/event/CreateSpecialBlockRendererEvent.java deleted file mode 100644 index 1a7d32df25..0000000000 --- a/src/main/java/net/minecraftforge/client/event/CreateSpecialBlockRendererEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.event; - -import java.util.Map; - -import net.minecraft.client.renderer.special.SpecialModelRenderer; -import net.minecraft.world.level.block.Block; -import net.minecraftforge.eventbus.api.bus.EventBus; -import net.minecraftforge.eventbus.api.event.MutableEvent; - -public final class CreateSpecialBlockRendererEvent extends MutableEvent { - public static final EventBus BUS = EventBus.create(CreateSpecialBlockRendererEvent.class); - - private final Map map; - - public CreateSpecialBlockRendererEvent(Map map) { - this.map = map; - } - - public void register(Block block, SpecialModelRenderer.Unbaked renderer) { - this.map.put(block, renderer); - } -} diff --git a/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java index bf674111c7..fad2e3f6c0 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 net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; @@ -29,7 +29,7 @@ import java.util.List; public sealed interface CustomizeGuiOverlayEvent { Window getWindow(); - GuiGraphics getGuiGraphics(); + GuiGraphicsExtractor getGuiGraphics(); float getPartialTick(); @@ -46,7 +46,7 @@ public sealed interface CustomizeGuiOverlayEvent { public static final CancellableEventBus BUS = CancellableEventBus.create(BossEventProgress.class); private final Window window; - private final GuiGraphics guiGraphics; + private final GuiGraphicsExtractor guiGraphics; private final float partialTick; private final LerpingBossEvent bossEvent; private final int x; @@ -54,7 +54,7 @@ public sealed interface CustomizeGuiOverlayEvent { private int increment; @ApiStatus.Internal - public BossEventProgress(Window window, GuiGraphics guiGraphics, float partialTick, LerpingBossEvent bossEvent, int x, int y, int increment) { + public BossEventProgress(Window window, GuiGraphicsExtractor guiGraphics, float partialTick, LerpingBossEvent bossEvent, int x, int y, int increment) { this.window = window; this.guiGraphics = guiGraphics; this.partialTick = partialTick; @@ -70,7 +70,7 @@ public sealed interface CustomizeGuiOverlayEvent { } @Override - public GuiGraphics getGuiGraphics() { + public GuiGraphicsExtractor getGuiGraphics() { return guiGraphics; } @@ -129,7 +129,7 @@ public sealed interface CustomizeGuiOverlayEvent { */ record DebugText( Window getWindow, - GuiGraphics getGuiGraphics, + GuiGraphicsExtractor getGuiGraphics, float getPartialTick, List getText, Side getSide @@ -155,13 +155,13 @@ public sealed interface CustomizeGuiOverlayEvent { public static final EventBus BUS = EventBus.create(Chat.class); private final Window window; - private final GuiGraphics guiGraphics; + private final GuiGraphicsExtractor guiGraphics; private final float partialTick; private int posX; private int posY; @ApiStatus.Internal - public Chat(Window window, GuiGraphics guiGraphics, float partialTick, int posX, int posY) { + public Chat(Window window, GuiGraphicsExtractor guiGraphics, float partialTick, int posX, int posY) { this.window = window; this.guiGraphics = guiGraphics; this.partialTick = partialTick; @@ -175,7 +175,7 @@ public sealed interface CustomizeGuiOverlayEvent { } @Override - public GuiGraphics getGuiGraphics() { + public GuiGraphicsExtractor getGuiGraphics() { return guiGraphics; } diff --git a/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java b/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java index be52b81094..473d755357 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java @@ -32,13 +32,11 @@ import net.minecraft.world.level.block.SkullBlock.Type; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import org.jspecify.annotations.NullMarked; @@ -69,12 +67,6 @@ public sealed interface EntityRenderersEvent { record RegisterLayerDefinitions() implements SelfDestructing, RecordEvent, EntityRenderersEvent { public static final EventBus BUS = EventBus.create(RegisterLayerDefinitions.class); - /** @deprecated {@link EntityRenderersEvent.RegisterLayerDefinitions} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public RegisterLayerDefinitions {} @@ -103,12 +95,6 @@ public sealed interface EntityRenderersEvent { record RegisterRenderers() implements SelfDestructing, RecordEvent, EntityRenderersEvent { public static final EventBus BUS = EventBus.create(RegisterRenderers.class); - /** @deprecated {@link RegisterRenderers} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public RegisterRenderers {} @@ -142,12 +128,6 @@ public sealed interface EntityRenderersEvent { final class AddLayers extends MutableEvent implements EntityRenderersEvent { public static final EventBus BUS = EventBus.create(AddLayers.class); - /** @deprecated {@link EntityRenderersEvent.AddLayers} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, EntityRenderer> renderers; private final Map> playerRenderers; private final Map> mannequinRenderers; @@ -234,12 +214,6 @@ public sealed interface EntityRenderersEvent { final class CreateSkullModels extends MutableEvent implements EntityRenderersEvent { public static final EventBus BUS = EventBus.create(CreateSkullModels.class); - /** @deprecated {@link EntityRenderersEvent.CreateSkullModels} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final ImmutableMap.Builder> builder; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java b/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java index 4f8356a60b..5283c7c8ec 100644 --- a/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java +++ b/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java @@ -24,7 +24,7 @@ import net.minecraft.client.KeyMapping; import net.minecraft.client.MouseHandler; import net.minecraft.client.entity.ClientAvatarEntity; import net.minecraft.client.entity.ClientMannequin; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.toasts.Toast; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -49,12 +49,10 @@ import net.minecraft.client.renderer.entity.state.AvatarRenderState; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.entity.state.ItemFrameRenderState; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; -import net.minecraft.client.renderer.special.SpecialModelRenderer; -import net.minecraft.client.renderer.state.CameraRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; import net.minecraft.network.Connection; -import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Avatar; import net.minecraft.world.entity.EntityType; @@ -62,7 +60,6 @@ import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.PlayerModelType; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SkullBlock.Type; import net.minecraftforge.client.event.sound.PlaySoundSourceEvent; import net.minecraftforge.client.event.sound.PlayStreamingSourceEvent; @@ -169,11 +166,11 @@ public final class ForgeEventFactoryClient { return InputEvent.InteractionKeyMappingTriggered.BUS.post(event); } - public static void onContainerRenderBackground(AbstractContainerScreen screen, GuiGraphics graphics, int mouseX, int mouseY) { + public static void onContainerRenderBackground(AbstractContainerScreen screen, GuiGraphicsExtractor graphics, int mouseX, int mouseY) { ContainerScreenEvent.Render.Background.BUS.post(new ContainerScreenEvent.Render.Background(screen, graphics, mouseX, mouseY)); } - public static void onContainerRenderForeground(AbstractContainerScreen screen, GuiGraphics graphics, int mouseX, int mouseY) { + public static void onContainerRenderForeground(AbstractContainerScreen screen, GuiGraphicsExtractor graphics, int mouseX, int mouseY) { ContainerScreenEvent.Render.Foreground.BUS.post(new ContainerScreenEvent.Render.Foreground(screen, graphics, mouseX, mouseY)); } @@ -221,11 +218,11 @@ public final class ForgeEventFactoryClient { return RenderItemInFrameEvent.BUS.post(new RenderItemInFrameEvent(state, renderItemFrame, poseStack, nodeCollector, packedLight)); } - public static RenderNameTagEvent fireRenderNameTagEvent(EntityRenderState state, Component content, EntityRenderer entityRenderer, PoseStack poseStack, SubmitNodeCollector nodeCollector, CameraRenderState cameraState) { - return RenderNameTagEvent.BUS.fire(new RenderNameTagEvent(state, content, entityRenderer, poseStack, nodeCollector, cameraState)); + public static RenderNameTagEvent fireRenderNameTagEvent(EntityRenderState state, EntityRenderer entityRenderer, PoseStack poseStack, SubmitNodeCollector nodeCollector, CameraRenderState cameraState) { + return RenderNameTagEvent.BUS.fire(new RenderNameTagEvent(state, entityRenderer, poseStack, nodeCollector, cameraState)); } - public static void onRenderScreenBackground(Screen screen, GuiGraphics guiGraphics) { + public static void onRenderScreenBackground(Screen screen, GuiGraphicsExtractor guiGraphics) { ScreenEvent.BackgroundRendered.BUS.post(new ScreenEvent.BackgroundRendered(screen, guiGraphics)); } @@ -254,10 +251,6 @@ public final class ForgeEventFactoryClient { return ComputeFovModifierEvent.BUS.fire(new ComputeFovModifierEvent(entity, modifier, scale)); } - public static void onCreateSpecialBlockRenderers(Map map) { - CreateSpecialBlockRendererEvent.BUS.post(new CreateSpecialBlockRendererEvent(map)); - } - public static Map> onCreateSkullModels() { var builder = ImmutableMap.>builder(); EntityRenderersEvent.CreateSkullModels.BUS.post(new EntityRenderersEvent.CreateSkullModels(builder)); diff --git a/src/main/java/net/minecraftforge/client/event/ModelEvent.java b/src/main/java/net/minecraftforge/client/event/ModelEvent.java index bef1a40bc6..af9742717c 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelEvent.java @@ -6,19 +6,21 @@ package net.minecraftforge.client.event; import com.google.common.base.Preconditions; + +import net.minecraft.client.renderer.block.FluidModel; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.sprite.MaterialBaker; import net.minecraft.resources.Identifier; 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.material.Fluid; import net.minecraftforge.client.model.geometry.IGeometryLoader; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -50,12 +52,6 @@ public sealed interface ModelEvent { implements RecordEvent, ModelEvent { public static final EventBus BUS = EventBus.create(ModifyBakingResult.class); - /** @deprecated {@link ModelEvent.ModifyBakingResult} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public ModifyBakingResult {} } @@ -75,12 +71,6 @@ public sealed interface ModelEvent { implements RecordEvent, ModelEvent { public static final EventBus BUS = EventBus.create(BakingCompleted.class); - /** @deprecated {@link ModelEvent.BakingCompleted} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public BakingCompleted {} } @@ -96,12 +86,6 @@ public sealed interface ModelEvent { final class RegisterModelStateDefinitions extends MutableEvent implements ModelEvent { public static final EventBus BUS = EventBus.create(RegisterModelStateDefinitions.class); - /** @deprecated {@link ModelEvent.RegisterModelStateDefinitions} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map> states = new HashMap<>(); private final Map> view = Collections.unmodifiableMap(states); @@ -132,12 +116,6 @@ public sealed interface ModelEvent { final class RegisterGeometryLoaders extends MutableEvent implements ModelEvent { public static final EventBus BUS = EventBus.create(RegisterGeometryLoaders.class); - /** @deprecated {@link ModelEvent.RegisterGeometryLoaders} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map loaders; @ApiStatus.Internal @@ -154,4 +132,37 @@ public sealed interface ModelEvent { loaders.put(Identifier, loader); } } + + /** + * Allows users to register their own {@link FluidModel fluid models}. + * + *

This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ + @NullMarked + final class BakeFluidModels extends MutableEvent implements ModelEvent { + public static final EventBus BUS = EventBus.create(BakeFluidModels.class); + + private final ModelBakery bakery; + private final MaterialBaker materials; + private final Map models; + + @ApiStatus.Internal + public BakeFluidModels(ModelBakery bakery, MaterialBaker materials, Map models) { + this.bakery = bakery; + this.materials = materials; + this.models = models; + } + + public ModelBakery bakery() { + return this.bakery; + } + + public MaterialBaker materials() { + return this.materials; + } + + public void register(Fluid fluid, FluidModel model) { + models.put(fluid, model); + } + } } diff --git a/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java index 8e9fdb51bb..5a8997d0e3 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java @@ -9,12 +9,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraftforge.event.AddReloadListenerEvent; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -30,12 +28,6 @@ import org.jspecify.annotations.NullMarked; public final class RegisterClientReloadListenersEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterClientReloadListenersEvent.class); - /** @deprecated {@link RegisterClientReloadListenersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final ReloadableResourceManager resourceManager; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RegisterClientTooltipComponentFactoriesEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterClientTooltipComponentFactoriesEvent.java index 79d590d97c..00682ee201 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterClientTooltipComponentFactoriesEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterClientTooltipComponentFactoriesEvent.java @@ -7,12 +7,10 @@ package net.minecraftforge.client.event; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.world.inventory.tooltip.TooltipComponent; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -29,12 +27,6 @@ import java.util.function.Function; public final class RegisterClientTooltipComponentFactoriesEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterClientTooltipComponentFactoriesEvent.class); - /** @deprecated {@link RegisterClientTooltipComponentFactoriesEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, Function> factories; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RegisterColorHandlersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterColorHandlersEvent.java index 0aaee87643..9ef42e2666 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterColorHandlersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterColorHandlersEvent.java @@ -5,21 +5,20 @@ package net.minecraftforge.client.event; -import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.block.BlockTintSource; import net.minecraft.core.BlockPos; import net.minecraft.world.level.ColorResolver; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; import java.util.ArrayList; +import java.util.List; /** * Fired for registering block and item color handlers at the appropriate time. @@ -39,12 +38,6 @@ public sealed interface RegisterColorHandlersEvent { record Block(BlockColors getBlockColors) implements RecordEvent, RegisterColorHandlersEvent { public static final EventBus BUS = EventBus.create(Block.class); - /** @deprecated {@link RegisterColorHandlersEvent.Block} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public Block {} @@ -58,14 +51,14 @@ public sealed interface RegisterColorHandlersEvent { } /** - * Registers a {@link BlockColor} instance for a set of blocks. + * Registers {@link BlockTintSource} instances for a set of blocks. * - * @param blockColor The color provider - * @param blocks The blocks + * @param sources The tint sources + * @param blocks The blocks */ @SuppressWarnings("deprecation") - public void register(BlockColor blockColor, net.minecraft.world.level.block.Block... blocks) { - getBlockColors.register(blockColor, blocks); + public void register(List sources, net.minecraft.world.level.block.Block... blocks) { + getBlockColors.register(sources, blocks); } } @@ -77,12 +70,6 @@ public sealed interface RegisterColorHandlersEvent { final class ColorResolvers extends MutableEvent implements SelfDestructing, RegisterColorHandlersEvent { public static final EventBus BUS = EventBus.create(ColorResolvers.class); - /** @deprecated {@link RegisterColorHandlersEvent.ColorResolvers} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final ArrayList builder; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RegisterEntitySpectatorShadersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterEntitySpectatorShadersEvent.java index 0b512a9600..603b367d52 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterEntitySpectatorShadersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterEntitySpectatorShadersEvent.java @@ -7,12 +7,10 @@ package net.minecraftforge.client.event; import net.minecraft.resources.Identifier; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -28,12 +26,6 @@ import java.util.Map; public final class RegisterEntitySpectatorShadersEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterEntitySpectatorShadersEvent.class); - /** @deprecated {@link RegisterEntitySpectatorShadersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, Identifier> shaders; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java index 3ce3087478..2c26b95749 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java @@ -9,12 +9,10 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.ItemLike; import net.minecraftforge.client.IItemDecorator; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -31,12 +29,6 @@ import java.util.Map; public final class RegisterItemDecorationsEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterItemDecorationsEvent.class); - /** @deprecated {@link RegisterItemDecorationsEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map> decorators; @ApiStatus.Internal @@ -48,7 +40,7 @@ public final class RegisterItemDecorationsEvent extends MutableEvent implements * Register an ItemDecorator to an Item */ public void register(ItemLike itemLike, IItemDecorator decorator) { - List itemDecoratorList = decorators.computeIfAbsent(itemLike.asItem(), item -> new ArrayList<>()); + List itemDecoratorList = decorators.computeIfAbsent(itemLike.asItem(), _ -> new ArrayList<>()); itemDecoratorList.add(decorator); } } diff --git a/src/main/java/net/minecraftforge/client/event/RegisterKeyMappingsEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterKeyMappingsEvent.java index 528aec2184..2045795ba6 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterKeyMappingsEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterKeyMappingsEvent.java @@ -7,12 +7,10 @@ package net.minecraftforge.client.event; import net.minecraft.client.KeyMapping; import net.minecraft.client.Options; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -26,12 +24,6 @@ import org.jspecify.annotations.NullMarked; public final class RegisterKeyMappingsEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterKeyMappingsEvent.class); - /** @deprecated {@link RegisterKeyMappingsEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Options options; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RegisterNamedRenderTypesEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterNamedRenderTypesEvent.java index 610f4ca672..7547b7ec42 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterNamedRenderTypesEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterNamedRenderTypesEvent.java @@ -50,14 +50,14 @@ public final class RegisterNamedRenderTypesEvent extends MutableEvent implements * * @param key The namespace should match your mod's namespace, such as your mod ID * @param blockRenderType What ChunkSectionLayer to render in - * @param entityRenderType A {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY} - * @param fabulousEntityRenderType A {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY} for use when + * @param entityRenderType A {@link RenderType} using {@link DefaultVertexFormat#ENTITY} + * @param fabulousEntityRenderType A {@link RenderType} using {@link DefaultVertexFormat#ENTITY} for use when * "fabulous" rendering is enabled */ public void register(Identifier key, ChunkSectionLayer blockRenderType, RenderType entityRenderType, RenderType fabulousEntityRenderType) { Preconditions.checkArgument(!renderTypes.containsKey(key), "Render type already registered: " + key); - Preconditions.checkArgument(entityRenderType.format() == DefaultVertexFormat.NEW_ENTITY, "The entity render type must use the NEW_ENTITY vertex format."); - Preconditions.checkArgument(fabulousEntityRenderType.format() == DefaultVertexFormat.NEW_ENTITY, "The fabulous entity render type must use the NEW_ENTITY vertex format."); + Preconditions.checkArgument(entityRenderType.format() == DefaultVertexFormat.ENTITY, "The entity render type must use the ENTITY vertex format."); + Preconditions.checkArgument(fabulousEntityRenderType.format() == DefaultVertexFormat.ENTITY, "The fabulous entity render type must use the ENTITY vertex format."); renderTypes.put(key, new RenderTypeGroup(blockRenderType, entityRenderType, fabulousEntityRenderType)); } } diff --git a/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java index 24f4c7d768..a72a322d1d 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java @@ -9,11 +9,9 @@ import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleResources; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleType; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import net.minecraftforge.registries.RegisterEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -28,13 +26,7 @@ import org.jspecify.annotations.NullMarked; */ @NullMarked public final class RegisterParticleProvidersEvent extends MutableEvent { - public static EventBus BUS = EventBus.create(RegisterParticleProvidersEvent.class); - - /** @deprecated {@link RegisterParticleProvidersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } + public static final EventBus BUS = EventBus.create(RegisterParticleProvidersEvent.class); private final ParticleResources particles; diff --git a/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java index ad1df59263..57f9f752fa 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java @@ -7,8 +7,7 @@ package net.minecraftforge.client.event; import com.google.common.collect.ImmutableMap; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState; -import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; @@ -29,20 +28,14 @@ public final class RegisterPictureInPictureRendererEvent extends MutableEvent im public static final EventBus BUS = EventBus.create(RegisterPictureInPictureRendererEvent.class); private final List> renderers; - private final MultiBufferSource.BufferSource bufferSource; private final ImmutableMap.Builder, PictureInPictureRenderer> builder; @ApiStatus.Internal - public RegisterPictureInPictureRendererEvent(List> renderers, MultiBufferSource.BufferSource bufferSource, ImmutableMap.Builder, PictureInPictureRenderer> builder) { + public RegisterPictureInPictureRendererEvent(List> renderers, ImmutableMap.Builder, PictureInPictureRenderer> builder) { this.renderers = renderers; - this.bufferSource = bufferSource; this.builder = builder; } - public MultiBufferSource.BufferSource getBufferSource() { - return bufferSource; - } - public void register(PictureInPictureRenderer renderer) { var seen = HashSet.newHashSet(renderers.size()); for (var r : renderers) diff --git a/src/main/java/net/minecraftforge/client/event/RegisterTextureAtlasSpriteLoadersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterTextureAtlasSpriteLoadersEvent.java index e2beaae1d1..0338d4885a 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterTextureAtlasSpriteLoadersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterTextureAtlasSpriteLoadersEvent.java @@ -10,12 +10,10 @@ import com.google.common.collect.BiMap; import net.minecraft.resources.Identifier; import net.minecraftforge.client.textures.ITextureAtlasSpriteLoader; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.SelfDestructing; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; /** @@ -26,12 +24,6 @@ import org.jetbrains.annotations.ApiStatus; public final class RegisterTextureAtlasSpriteLoadersEvent extends MutableEvent implements SelfDestructing { public static final EventBus BUS = EventBus.create(RegisterTextureAtlasSpriteLoadersEvent.class); - /** {@link RegisterTextureAtlasSpriteLoadersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final BiMap loaders; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java b/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java index 96e6db3750..c515c083ca 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.world.entity.HumanoidArm; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; diff --git a/src/main/java/net/minecraftforge/client/event/RenderAvatarEvent.java b/src/main/java/net/minecraftforge/client/event/RenderAvatarEvent.java index 99b08612fa..430c948dc7 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderAvatarEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderAvatarEvent.java @@ -11,7 +11,7 @@ import net.minecraft.client.entity.ClientAvatarEntity; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.entity.player.AvatarRenderer; import net.minecraft.client.renderer.entity.state.AvatarRenderState; -import net.minecraft.client.renderer.state.CameraRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.world.entity.Avatar; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.bus.EventBus; diff --git a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java index b755dce91c..2cb4cfe893 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java index b378a8ff52..2c925c98a1 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java @@ -7,9 +7,9 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Camera; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.MultiBufferSource.BufferSource; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.extract.LevelExtractor; +import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; @@ -33,13 +33,13 @@ import org.jetbrains.annotations.Nullable; public sealed abstract class RenderHighlightEvent extends MutableEvent implements Cancellable, InheritableEvent permits RenderHighlightEvent.Block, RenderHighlightEvent.Entity { CancellableEventBus BUS = CancellableEventBus.create(RenderHighlightEvent.class); - private final LevelRenderer levelRenderer; + private final LevelExtractor levelExtractor; private final Camera camera; private final LevelRenderState levelRenderState; private Callback customRenderer; - private RenderHighlightEvent(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState) { - this.levelRenderer = levelRenderer; + private RenderHighlightEvent(LevelExtractor levelExtractor, Camera camera, LevelRenderState levelRenderState) { + this.levelExtractor = levelExtractor; this.camera = camera; this.levelRenderState = levelRenderState; } @@ -47,8 +47,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement /** * {@return the level renderer} */ - public LevelRenderer getLevelRenderer() { - return this.levelRenderer; + public LevelExtractor getLevelExtractor() { + return this.levelExtractor; } /** @@ -101,8 +101,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement private final BlockHitResult target; @ApiStatus.Internal - public Block(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState, BlockHitResult target) { - super(levelRenderer, camera, levelRenderState); + public Block(LevelExtractor levelExtrctor, Camera camera, LevelRenderState levelRenderState, BlockHitResult target) { + super(levelExtrctor, camera, levelRenderState); this.target = target; } @@ -127,8 +127,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement private final EntityHitResult target; @ApiStatus.Internal - public Entity(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState, EntityHitResult target) { - super(levelRenderer, camera, levelRenderState); + public Entity(LevelExtractor levelExtractor, Camera camera, LevelRenderState levelRenderState, EntityHitResult target) { + super(levelExtractor, camera, levelRenderState); this.target = target; } @@ -142,6 +142,6 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement } public interface Callback { - void render(BufferSource source, PoseStack stack, boolean translucent, LevelRenderState state); + void render(SubmitNodeCollector submitNodeCollector, PoseStack stack, LevelRenderState state); } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java index 531ac38432..55cace59e1 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.entity.ItemFrameRenderer; import net.minecraft.client.renderer.entity.state.ItemFrameRenderState; diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index a3122a1fa2..fd33050787 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -7,11 +7,10 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.EntityModel; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; -import net.minecraft.client.renderer.state.CameraRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.world.entity.LivingEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; diff --git a/src/main/java/net/minecraftforge/client/event/RenderNameTagEvent.java b/src/main/java/net/minecraftforge/client/event/RenderNameTagEvent.java index 0b332d3024..4cd782a551 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderNameTagEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderNameTagEvent.java @@ -9,45 +9,45 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.state.EntityRenderState; -import net.minecraft.client.renderer.state.CameraRenderState; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.network.chat.Component; -import net.minecraftforge.common.util.HasResult; import net.minecraftforge.common.util.Result; +import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; +import net.minecraftforge.eventbus.api.event.characteristic.Cancellable; import net.minecraftforge.fml.LogicalSide; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; /** * Fired before an entity renderer renders the nameplate of an entity. * - *

This event {@linkplain HasResult has a result}:

- *
    - *
  • {@link Result#ALLOW} - the nameplate will be forcibly rendered.
  • - *
  • {@link Result#DEFAULT} - the vanilla logic will be used.
  • - *
  • {@link Result#DENY} - the nameplate will not be rendered.
  • - *
- * *

This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.

* + * Setting any of the content to null will prevent that content from being rendered. + * If you wish to cancel both score and name tag, you can cancel the entire event. + * * @see EntityRenderer */ -public final class RenderNameTagEvent extends MutableEvent implements HasResult { - public static final EventBus BUS = EventBus.create(RenderNameTagEvent.class); +public final class RenderNameTagEvent extends MutableEvent implements Cancellable { + public static final EventBus BUS = CancellableEventBus.create(RenderNameTagEvent.class); private Component nameplateContent; + private Component scoreContent; private final EntityRenderState state; private final Component originalContent; + private final Component originalScoreContent; private final EntityRenderer entityRenderer; private final PoseStack poseStack; private final SubmitNodeCollector nodeCollector; private final CameraRenderState cameraState; - private Result result = Result.DEFAULT; @ApiStatus.Internal - public RenderNameTagEvent(EntityRenderState state, Component content, EntityRenderer entityRenderer, PoseStack poseStack, SubmitNodeCollector nodeCollector, CameraRenderState cameraState) { + public RenderNameTagEvent(EntityRenderState state, EntityRenderer entityRenderer, PoseStack poseStack, SubmitNodeCollector nodeCollector, CameraRenderState cameraState) { this.state = state; - this.originalContent = content; + this.originalContent = this.nameplateContent = state.nameTag; + this.originalScoreContent = this.scoreContent = state.scoreText; this.setContent(this.originalContent); this.entityRenderer = entityRenderer; this.poseStack = poseStack; @@ -65,24 +65,48 @@ public final class RenderNameTagEvent extends MutableEvent implements HasResult * * @param contents the new text */ - public void setContent(Component contents) { + public void setContent(@Nullable Component contents) { this.nameplateContent = contents; } /** * {@return the text on the nameplate that will be rendered, if the event is not {@link Result#DENY DENIED}} */ - public Component getContent() { + public @Nullable Component getContent() { return this.nameplateContent; } + /** + * Sets the new text for the score part of the nameplate. + * + * @param contents the new text + */ + public void setScoreContent(@Nullable Component contents) { + this.scoreContent = contents; + } + + /** + * {@return the text on the score part of the nameplate that will be rendered, if the event is not {@link Result#DENY DENIED}} + */ + public @Nullable Component getScoreContent() { + return this.scoreContent; + } + /** * {@return the original text on the nameplate} */ - public Component getOriginalContent() { + public @Nullable Component getOriginalContent() { return this.originalContent; } + /** + * {@return the original text of the score part of this nameplate} + */ + public @Nullable Component getOriginalScore() { + return this.originalScoreContent; + } + + /** * {@return the entity renderer rendering the nameplate} */ @@ -110,14 +134,4 @@ public final class RenderNameTagEvent extends MutableEvent implements HasResult public CameraRenderState getCameraState() { return this.cameraState; } - - @Override - public Result getResult() { - return this.result; - } - - @Override - public void setResult(Result result) { - this.result = result; - } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java index 82fb1e26ea..5cd02c8aa8 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java @@ -7,7 +7,7 @@ package net.minecraftforge.client.event; import com.mojang.datafixers.util.Either; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; import net.minecraft.network.chat.FormattedText; @@ -41,14 +41,14 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements public static final EventBus BUS = EventBus.create(RenderTooltipEvent.class); protected final ItemStack itemStack; - protected final GuiGraphics graphics; + protected final GuiGraphicsExtractor graphics; protected int x; protected int y; protected Font font; protected final List components; @ApiStatus.Internal - protected RenderTooltipEvent(ItemStack itemStack, GuiGraphics graphics, int x, int y, Font font, List components) { + protected RenderTooltipEvent(ItemStack itemStack, GuiGraphicsExtractor graphics, int x, int y, Font font, List components) { this.itemStack = itemStack; this.graphics = graphics; this.components = Collections.unmodifiableList(components); @@ -61,22 +61,15 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements * {@return the item stack which the tooltip is being rendered for, or an {@linkplain ItemStack#isEmpty() empty * item stack} if there is no associated item stack} */ - + public ItemStack getItemStack() { return itemStack; } - /** - * {@return the gui graphics helper for the gui} - */ - public GuiGraphics getGuiGraphics() { - return graphics; - } - /** * {@return the graphics helper for the gui} */ - public GuiGraphics getGraphics() { + public GuiGraphicsExtractor getGraphics() { return graphics; } @@ -214,7 +207,7 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements private Identifier originalBackground; @ApiStatus.Internal - public Pre(ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, Font font, List components, ClientTooltipPositioner positioner, @Nullable Identifier background) { + public Pre(ItemStack stack, GuiGraphicsExtractor graphics, int x, int y, int screenWidth, int screenHeight, Font font, List components, ClientTooltipPositioner positioner, @Nullable Identifier background) { super(stack, graphics, x, y, font, components); this.screenWidth = screenWidth; this.screenHeight = screenHeight; diff --git a/src/main/java/net/minecraftforge/client/event/ScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenEvent.java index 4a08eac6f0..96e9ce6d62 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 net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.input.CharacterEvent; @@ -154,7 +154,7 @@ public sealed interface ScreenEvent { /** * {@return the gui graphics used for rendering} */ - GuiGraphics getGuiGraphics(); + GuiGraphicsExtractor getGuiGraphics(); /** * {@return the X coordinate of the mouse pointer} @@ -180,7 +180,7 @@ public sealed interface ScreenEvent { *

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

*/ - record Pre(Screen getScreen, GuiGraphics getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick) + record Pre(Screen getScreen, GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick) implements Cancellable, Render, RecordEvent { public static final CancellableEventBus
 BUS = CancellableEventBus.create(Pre.class);
 
@@ -194,7 +194,7 @@ public sealed interface ScreenEvent {
          * 

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

*/ - record Post(Screen getScreen, GuiGraphics getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick) + record Post(Screen getScreen, GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick) implements Render, RecordEvent { public static final EventBus BUS = EventBus.create(Post.class); @@ -212,7 +212,7 @@ public sealed interface ScreenEvent { * * @param getGuiGraphics the gui graphics used for rendering */ - record BackgroundRendered(Screen getScreen, GuiGraphics getGuiGraphics) implements RecordEvent, ScreenEvent { + record BackgroundRendered(Screen getScreen, GuiGraphicsExtractor getGuiGraphics) implements RecordEvent, ScreenEvent { public static final EventBus BUS = EventBus.create(BackgroundRendered.class); @ApiStatus.Internal @@ -762,21 +762,6 @@ public sealed interface ScreenEvent { return (char)getInfo().codepoint(); } - /** - * {@return a bit field representing the active modifier keys} - * - * @see InputConstants#MOD_CONTROL CTRL modifier key bit - * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit - * @see GLFW#GLFW_MOD_ALT ALT modifier key bit - * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit - * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit - * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit - * @see
the online GLFW documentation - */ - default int getModifiers() { - return getInfo().modifiers(); - } - /** * Fired before the character input is handled by the screen. * diff --git a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java index 6a304ab686..75c979456e 100644 --- a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java +++ b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java @@ -6,11 +6,9 @@ package net.minecraftforge.client.event; import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -64,12 +62,6 @@ public sealed interface TextureStitchEvent { record Post(TextureAtlas getAtlas) implements RecordEvent, TextureStitchEvent { public static final EventBus BUS = EventBus.create(Post.class); - /** @deprecated {@link TextureStitchEvent.Post} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public Post {} } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java index e5c96e0799..b68d4c9298 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java @@ -6,11 +6,9 @@ package net.minecraftforge.client.event.sound; import net.minecraft.client.sounds.SoundEngine; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -24,12 +22,6 @@ import org.jspecify.annotations.NullMarked; public record SoundEngineLoadEvent(SoundEngine getEngine) implements RecordEvent, SoundEvent { public static final EventBus BUS = EventBus.create(SoundEngineLoadEvent.class); - /** @deprecated {@link SoundEngineLoadEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public SoundEngineLoadEvent {} } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index 16ab583530..62bd1479aa 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -11,9 +11,7 @@ import com.mojang.blaze3d.audio.Channel; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; -import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.fml.LogicalSide; -import org.jetbrains.annotations.ApiStatus; /** * Superclass for sound related events. diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeBlockModelPart.java b/src/main/java/net/minecraftforge/client/extensions/IForgeBlockModelPart.java deleted file mode 100644 index 9752010def..0000000000 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeBlockModelPart.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.extensions; - -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; - -public interface IForgeBlockModelPart { - /* - private BlockModelPart self() { - return (BlockModelPart)this; - } - */ - - default ChunkSectionLayer layer() { - return null; - } - - default ChunkSectionLayer layerFast() { - return null; - } -} diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeBlockStateModel.java b/src/main/java/net/minecraftforge/client/extensions/IForgeBlockStateModel.java index bf9af02b42..7937fb478f 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeBlockStateModel.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeBlockStateModel.java @@ -5,23 +5,15 @@ package net.minecraftforge.client.extensions; -import net.minecraft.client.renderer.ItemBlockRenderTypes; -import net.minecraft.client.renderer.rendertype.RenderType; -import net.minecraft.client.renderer.block.model.BlockModelPart; -import net.minecraft.client.renderer.block.model.BlockStateModel; -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.block.BlockAndTintGetter; +import net.minecraft.client.renderer.block.dispatch.BlockStateModel; +import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart; +import net.minecraft.client.resources.model.sprite.Material; import net.minecraft.core.BlockPos; import net.minecraft.util.RandomSource; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import it.unimi.dsi.fastutil.objects.ObjectArrayList; - -import java.util.Collection; import java.util.List; @SuppressWarnings("deprecation") @@ -34,37 +26,16 @@ public interface IForgeBlockStateModel { return modelData; } - default TextureAtlasSprite particleIcon(@NotNull ModelData data) { - return self().particleIcon(); + default Material.Baked particleMaterial(@NotNull ModelData data) { + return self().particleMaterial(); } /** - * Gets the set of {@link RenderType render types} to use when drawing this block in the level. - * Supported types are those returned by {@link RenderType#chunkBufferLayers()}. - *

- * By default, defers query to {@link ItemBlockRenderTypes}. - */ - default Collection getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) { - return ItemBlockRenderTypes.getRenderLayers(state); - } - - /** - * Collects the parts of this model to render for the specified render type. - * Not all paths call this, or use a valid render type. So it is recommended to also implement a sane default in + * Collects the parts of this model with the specified ModelData. + * Not all paths call this, or pass in empty data. So it is recommended to also implement a sane default in * the normal {@link BlockStateModel#collectParts(RandomSource, List)} method. */ - default List collectParts(RandomSource random, ModelData data, @Nullable ChunkSectionLayer renderType) { - List list = new ObjectArrayList<>(); - this.collectParts(random, list, data, renderType); - return list; - } - - /** - * Collects the parts of this model to render for the specified render type. - * Not all paths call this, or use a valid render type. So it is recommended to also implement a sane default in - * the normal {@link BlockStateModel#collectParts(RandomSource, List)} method. - */ - default void collectParts(RandomSource random, List dest, ModelData data, @Nullable ChunkSectionLayer renderType) { - self().collectParts(random, dest); + default void collectParts(RandomSource random, List output, ModelData data) { + self().collectParts(random, output); } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java b/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphicsExtractor.java similarity index 97% rename from src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java rename to src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphicsExtractor.java index b1b051b9b8..c1118b02bb 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphicsExtractor.java @@ -5,16 +5,16 @@ package net.minecraftforge.client.extensions; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.resources.Identifier; /** * Extension interface for {@link GuiGraphics}. */ -public interface IForgeGuiGraphics { - private GuiGraphics self() { - return (GuiGraphics)this; +public interface IForgeGuiGraphicsExtractor { + private GuiGraphicsExtractor self() { + return (GuiGraphicsExtractor)this; } int DEFAULT_BACKGROUND_COLOR = 0xF0100010; diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java index a0d4b4f665..ea8bf45f33 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java @@ -6,45 +6,21 @@ package net.minecraftforge.client.extensions; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.minecraftforge.client.ForgeHooksClient; - import java.util.Locale; /** - * Extension interface for {@link IForgeMinecraft}. + * Extension interface for {@link Minecraft}. */ -public interface IForgeMinecraft -{ - private Minecraft self() - { - return (Minecraft) this; - } - - /** - * Pushes a screen as a new GUI layer. - * - * @param screen the new GUI layer - */ - default void pushGuiLayer(Screen screen) - { - ForgeHooksClient.pushGuiLayer(self(), screen); - } - - /** - * Pops a GUI layer from the screen. - */ - default void popGuiLayer() - { - ForgeHooksClient.popGuiLayer(self()); +public interface IForgeMinecraft { + private Minecraft self() { + return (Minecraft)this; } /** * Retrieves the {@link Locale} set by the player. * Useful for creating string and number formatters. */ - default Locale getLocale() - { + default Locale getLocale() { return self().getLanguageManager().getJavaLocale(); } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgePoseStack.java b/src/main/java/net/minecraftforge/client/extensions/IForgePoseStack.java index 8a1e83f0a3..855eb0c05c 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgePoseStack.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgePoseStack.java @@ -26,14 +26,14 @@ public interface IForgePoseStack { final PoseStack self = self(); self.pushPose(); - var trans = transformation.getTranslation(); + var trans = transformation.translation(); self.translate(trans.x(), trans.y(), trans.z()); - self.mulPose(transformation.getLeftRotation()); + self.mulPose(transformation.leftRotation()); - var scale = transformation.getScale(); + var scale = transformation.scale(); self.scale(scale.x(), scale.y(), scale.z()); - self.mulPose(transformation.getRightRotation()); + self.mulPose(transformation.rightRotation()); } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java deleted file mode 100644 index 2611e192c4..0000000000 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.extensions; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.minecraft.client.renderer.block.model.BakedQuad; - -/** - * Extension interface for {@link VertexConsumer}. - */ -public interface IForgeVertexConsumer { - private VertexConsumer self() { - return (VertexConsumer)this; - } - - /** - * Variant with no per-vertex shading. - */ - default void putBulkData(PoseStack.Pose pose, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int packedLight, int packedOverlay) { - self().putBulkData(pose, bakedQuad, new float[] { 1.0F, 1.0F, 1.0F, 1.0F }, red, green, blue, alpha, new int[] { packedLight, packedLight, packedLight, packedLight }, packedOverlay); - } -} diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexFormat.java b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexFormat.java deleted file mode 100644 index 26e79177ee..0000000000 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexFormat.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.extensions; - -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexFormatElement; - -import java.util.List; - -/** - * Extension interface for {@link VertexFormat}. - */ -public interface IForgeVertexFormat { - List getElements(); - - default boolean hasPosition() { - return getElements().stream().anyMatch(e -> e.usage() == VertexFormatElement.Usage.POSITION); - } - - default boolean hasNormal() { - return getElements().stream().anyMatch(e -> e.usage() == VertexFormatElement.Usage.NORMAL); - } - - default boolean hasColor() { - return getElements().stream().anyMatch(e -> e.usage() == VertexFormatElement.Usage.COLOR); - } - - default boolean hasUV(int which) { - for (var e : getElements()) { - if (e.usage() == VertexFormatElement.Usage.UV && e.index() == which) { - return true; - } - } - return false; - } -} diff --git a/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java b/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java index 21494c0e3e..b49d6286db 100644 --- a/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java +++ b/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java @@ -10,12 +10,14 @@ import java.util.function.Consumer; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.ScreenEffectRenderer; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.block.BlockAndTintGetter; +import net.minecraft.client.renderer.block.FluidModel; +import net.minecraft.client.renderer.block.FluidRenderer; import net.minecraft.client.renderer.fog.FogData; import net.minecraft.core.BlockPos; import net.minecraft.resources.Identifier; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; @@ -136,7 +138,7 @@ public interface IClientFluidTypeExtensions { * @param mc the client instance * @param poseStack the transformations representing the current rendering position */ - default void renderOverlay(Minecraft mc, PoseStack poseStack, MultiBufferSource buffer) { + default void renderOverlay(Minecraft mc, PoseStack poseStack, SubmitNodeCollector buffer) { Identifier texture = this.getRenderOverlayTexture(mc); if (texture != null) ScreenEffectRenderer.renderFluid(mc, poseStack, buffer, texture); @@ -171,76 +173,18 @@ public interface IClientFluidTypeExtensions { /* Level-Based Accessors */ /** - * Returns the reference of the texture to apply to a source fluid. + * Returns the location dependent FluidModel. * - *

This should return a reference to the texture and not the actual - * texture itself (e.g. {@code minecraft:block/water_still} will point to - * {@code assets/minecraft/textures/block/water_still.png}). - * - *

Important: This method should only return {@code null} for {@link Fluids#EMPTY}. - * All other implementations must define this property. - * - * @param state the state of the fluid - * @param getter the getter the fluid can be obtained from - * @param pos the position of the fluid - * @return the reference of the texture to apply to a source fluid - */ - default Identifier getStillTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) { - return this.getStillTexture(); - } - - /** - * Returns the reference of the texture to apply to a flowing fluid. - * - *

This should return a reference to the texture and not the actual - * texture itself (e.g. {@code minecraft:block/water_flow} will point to - * {@code assets/minecraft/textures/block/water_flow.png}). - * - *

Important: This method should only return {@code null} for {@link Fluids#EMPTY}. - * All other implementations must define this property. - * - * @param state the state of the fluid - * @param getter the getter the fluid can be obtained from - * @param pos the position of the fluid - * @return the reference of the texture to apply to a flowing fluid - */ - default Identifier getFlowingTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) { - return this.getFlowingTexture(); - } - - /** - * Returns the reference of the texture to apply to a fluid directly touching - * a non-opaque block other than air. If no reference is specified, either - * {@code #getStillTexture} or {@code #getFlowingTexture} will be applied - * instead. - * - *

This should return a reference to the texture and not the actual - * texture itself (e.g. {@code minecraft:block/water_overlay} will point to - * {@code assets/minecraft/textures/block/water_overlay.png}). - * - * @param state the state of the fluid - * @param getter the getter the fluid can be obtained from - * @param pos the position of the fluid - * @return the reference of the texture to apply to a fluid directly touching - * a non-opaque block - */ - default Identifier getOverlayTexture(FluidState state, BlockAndTintGetter getter, BlockPos pos) { - return this.getOverlayTexture(); - } - - /** - * Returns the tint applied to the fluid's textures. - * - *

The result represents a 32-bit integer where each 8-bits represent - * the alpha, red, green, and blue channel respectively. + *

The result will be queried for its textures and tinting. + * See {@link FluidRenderer#tesselate(BlockAndTintGetter,BlockPos,net.minecraft.client.renderer.block.FluidRenderer.Output,net.minecraft.world.level.block.state.BlockState,FluidState) FluidRenderer.tesselate} * * @param state the state of the fluid * @param getter the getter the fluid can be obtained from * @param pos the position of the fluid * @return the tint applied to the fluid's textures in ARGB format */ - default int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos pos) { - return this.getTintColor(); + default FluidModel getModel(FluidState state, BlockAndTintGetter getter, BlockPos pos, FluidModel vanilla) { + return vanilla; } /* Stack-Based Accessors */ 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 79feb1250a..856e72ff45 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 net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.Hud; import net.minecraft.client.gui.screens.inventory.EffectsInInventory; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; @@ -51,15 +51,9 @@ public interface IClientMobEffectExtensions { /** * Renders the text and icon of the specified effect in the player's inventory. * - * @param instance The effect instance - * @param effects 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 renderInventory(MobEffectInstance instance, EffectsInInventory effects, GuiGraphics guiGraphics, int x, int y, int blitOffset) { + default boolean extractInventory(MobEffectInstance instance, EffectsInInventory effects, GuiGraphicsExtractor graphics, int x, int y, int blitOffset) { return false; } @@ -67,16 +61,10 @@ 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 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, GuiGraphics guiGraphics, int x, int y, float z, float alpha) { + default boolean extractGuiIcon(MobEffectInstance instance, Hud hud, GuiGraphicsExtractor graphics, int x, int y, float z, float alpha) { return false; } } diff --git a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java index 89a1550f45..fd0f42538a 100644 --- a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java @@ -8,7 +8,7 @@ package net.minecraftforge.client.gui; import com.google.common.base.Strings; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.ErrorScreen; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.util.FormattedCharSequence; @@ -53,15 +53,15 @@ public class LoadingErrorScreen extends ErrorScreen { this.clearWidgets(); this.errorHeader = Component.literal(ChatFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + ChatFormatting.RESET); - this.warningHeader = Component.literal(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + ChatFormatting.RESET); + this.warningHeader = Component.literal(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadWarnings.size()) + ChatFormatting.RESET); int yOffset = 46; - this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getPlatform().openFile(modsDir.toFile()))); - this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getPlatform().openFile(logFile.toFile()))); + this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile()))); if (this.modLoadErrors.isEmpty()) - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> this.minecraft.setScreen(null))); + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), _ -> this.minecraft.gui.setScreen(null))); else - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getPlatform().openFile(dumpedLocation.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), _ -> Util.getPlatform().openFile(dumpedLocation.toFile()))); this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings); this.addWidget(this.entryList); @@ -69,16 +69,15 @@ public class LoadingErrorScreen extends ErrorScreen { } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - this.renderBackground(guiGraphics, mouseX, mouseY, partialTick); - this.entryList.render(guiGraphics, mouseX, mouseY, partialTick); + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { + this.entryList.extractRenderState(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)); + this.renderables.forEach(button -> button.extractRenderState(guiGraphics, mouseX, mouseY, partialTick)); } - private void drawMultiLineCenteredString(GuiGraphics guiGraphics, Font fr, Component str, int x, int y) { + private void drawMultiLineCenteredString(GuiGraphicsExtractor guiGraphics, Font fr, Component str, int x, int y) { for (FormattedCharSequence s : fr.split(str, this.width)) { - guiGraphics.drawString(fr, s, x - fr.width(s) / 2, y, 0xFFFFFFFF); + guiGraphics.text(fr, s, x - fr.width(s) / 2, y, 0xFFFFFFFF); y += fr.lineHeight; } } @@ -127,7 +126,7 @@ public class LoadingErrorScreen extends ErrorScreen { } @Override - public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { + public void extractContent(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { int top = this.getContentY(); int left = this.getContentX(); var mc = Minecraft.getInstance(); @@ -136,9 +135,9 @@ public class LoadingErrorScreen extends ErrorScreen { int y = top + 2; for (var string : strings) { if (center) - guiGraphics.drawString(font, string, left + (width / 2) - (font.width(string) / 2), y, 0xFFFFFFFF, false); + guiGraphics.text(font, string, left + (width / 2) - (font.width(string) / 2), y, 0xFFFFFFFF, false); else - guiGraphics.drawString(font, string, left + 5, y, 0xFFFFFFFF, false); + guiGraphics.text(font, string, left + 5, y, 0xFFFFFFFF, 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 3194e93452..5c8f9f3ca4 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModListScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModListScreen.java @@ -23,11 +23,12 @@ import net.minecraftforge.client.gui.widget.ModListWidget; import net.minecraftforge.client.gui.widget.ScrollPanel; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import org.apache.maven.artifact.versioning.ComparableVersion; +import org.jspecify.annotations.Nullable; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ActiveTextCollector; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Button; @@ -103,7 +104,7 @@ public class ModListScreen extends Screen { public ModListScreen(Screen parentScreen) { super(Component.translatable("fml.menu.mods.title")); this.parentScreen = parentScreen; - this.mods = ModList.get().getMods(); + this.mods = ModList.getMods(); this.unsortedMods = List.copyOf(this.mods); } @@ -159,7 +160,7 @@ public class ModListScreen extends Screen { } @Override - protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY) { + protected void drawPanel(GuiGraphicsExtractor guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY) { if (logoPath != null) { //RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); // Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50 @@ -168,7 +169,7 @@ public class ModListScreen extends Screen { relativeY += headerHeight + PADDING; } - visitText(guiGraphics.textRenderer(GuiGraphics.HoveredTextEffects.TOOLTIP_AND_CURSOR), relativeY); + visitText(guiGraphics.textRenderer(GuiGraphicsExtractor.HoveredTextEffects.TOOLTIP_AND_CURSOR), relativeY); } private void visitText(ActiveTextCollector collector, int header) { @@ -227,16 +228,16 @@ public class ModListScreen extends Screen { final int doneButtonWidth = Math.min(modInfoWidth, 200); int y = this.height - BUTTON_HEIGHT - PADDING; - doneButton = Button.builder(Component.translatable("gui.done"), b -> ModListScreen.this.onClose()) + doneButton = Button.builder(Component.translatable("gui.done"), _ -> ModListScreen.this.onClose()) .bounds(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, BUTTON_HEIGHT) .build(); - openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), b -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())) + openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), _ -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())) .bounds(6, y, this.listWidth, BUTTON_HEIGHT) .build(); y -= BUTTON_HEIGHT + PADDING; - configButton = Button.builder(Component.translatable("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig()) + configButton = Button.builder(Component.translatable("fml.menu.mods.config"), _ -> ModListScreen.this.displayModConfig()) .bounds(6, y, this.listWidth, BUTTON_HEIGHT) .build(); @@ -266,17 +267,17 @@ public class ModListScreen extends Screen { width = listWidth / NUM_BUTTONS; int x = PADDING; - addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)) + addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), _ -> resortMods(SortType.NORMAL)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); x += width + BUTTON_MARGIN; - addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)) + addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), _ -> resortMods(SortType.A_TO_Z)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); x += width + BUTTON_MARGIN; - addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)) + addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), _ -> resortMods(SortType.Z_TO_A)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); @@ -291,7 +292,7 @@ public class ModListScreen extends Screen { try { ConfigScreenHandler.getScreenFactoryFor(selected.getInfo()) .map(f -> f.apply(this.minecraft, this)) - .ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); + .ifPresent(newScreen -> this.minecraft.gui.setScreen(newScreen)); } catch (final Exception e) { LOGGER.error("There was a critical issue trying to build the config GUI for {}", selected.getInfo().getModId(), e); } @@ -299,8 +300,6 @@ public class ModListScreen extends Screen { @Override public void tick() { - modList.setSelected(selected); - if (!search.getValue().equals(lastFilterText)) { reloadMods(); sorted = false; @@ -311,11 +310,11 @@ public class ModListScreen extends Screen { mods.sort(sortType); modList.refreshList(); if (selected != null) { - selected = modList.children().stream() + final var newSelected = modList.children().stream() .filter(e -> e.getInfo() == selected.getInfo()) .findFirst() .orElse(null); - updateCache(); + this.modList.setSelected(newSelected); } sorted = true; } @@ -349,11 +348,11 @@ public class ModListScreen extends Screen { } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.modInfo != null) - this.modInfo.render(guiGraphics, mouseX, mouseY, partialTick); + this.modInfo.extractRenderState(guiGraphics, mouseX, mouseY, partialTick); - super.render(guiGraphics, mouseX, mouseY, partialTick); + super.extractRenderState(guiGraphics, mouseX, mouseY, partialTick); } public Minecraft getMinecraftInstance() { @@ -365,8 +364,14 @@ public class ModListScreen extends Screen { } public void setSelected(ModListWidget.ModEntry entry) { - this.selected = entry == this.selected ? null : entry; - updateCache(); + if (this.selected != entry) { + this.selected = entry; + updateCache(); + } + } + + public ModListWidget.@Nullable ModEntry getSelected() { + return this.selected; } record Logo(Identifier texture, Size2i size) {} @@ -391,7 +396,7 @@ public class ModListScreen extends Screen { try { NativeImage logo = null; - var modfile = ModList.get().getModFileById(selectedMod.getModId()); + var modfile = ModList.getModFileById(selectedMod.getModId()); if (modfile != null) { var path = modfile.getFile().findResource(logoFile); if (Files.exists(path)) @@ -423,7 +428,7 @@ public class ModListScreen extends Screen { lines.add(selectedMod.getDisplayName()); lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.version", MavenVersionStringHelper.artifactVersionToString(selectedMod.getVersion()))); - lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()). + lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), ModList.getModContainerById(selectedMod.getModId()). map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE"))); selectedMod.getConfig().getConfigElement("credits").ifPresent(credits-> @@ -473,7 +478,6 @@ public class ModListScreen extends Screen { ModListWidget.ModEntry selected = this.selected; this.init(width, height); this.search.setValue(s); - this.selected = selected; if (!this.search.getValue().isEmpty()) reloadMods(); @@ -481,11 +485,11 @@ public class ModListScreen extends Screen { if (sort != SortType.NORMAL) resortMods(sort); - updateCache(); + this.modList.setSelected(selected); } @Override public void onClose() { - this.minecraft.setScreen(this.parentScreen); + this.minecraft.gui.setScreen(this.parentScreen); } } diff --git a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java index 4f5ecf4366..5f4215ec3b 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java @@ -20,7 +20,7 @@ import org.apache.commons.lang3.tuple.Pair; import net.minecraft.ChatFormatting; import net.minecraft.util.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.TextAlignment; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; @@ -67,7 +67,7 @@ public class ModMismatchDisconnectedScreen extends Screen { this.listHeight = hasMismatches ? 140 : 0; this.allModIds = data.mods().keySet().stream().distinct().collect(Collectors.toList()); - this.presentModUrls = ModList.get().getMods().stream() + this.presentModUrls = ModList.getMods().stream() .filter(info -> allModIds.contains(info.getModId())) .map(info -> Pair.of(info.getModId(), (String)info.getConfig().getConfigElement("displayURL").orElse(""))) .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); @@ -86,25 +86,24 @@ public class ModMismatchDisconnectedScreen extends Screen { this.addRenderableWidget(new MismatchInfoPanel(minecraft, listWidth, listHeight, (this.height - this.listHeight) / 2, listLeft)); int buttonWidth = Math.min(210, this.width / 2 - 20); - this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), button -> Util.getPlatform().openFile(logFile.toFile())) + this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile())) .bounds(Math.max(this.width / 4 - buttonWidth / 2, listLeft), upperButtonHeight, buttonWidth, 20) .build()); - this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), button -> Util.getPlatform().openFile(modsDir.toFile())) + this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile())) .bounds(Math.min(this.width * 3 / 4 - buttonWidth / 2, listLeft + listWidth - buttonWidth), upperButtonHeight, buttonWidth, 20) .build()); - this.addRenderableWidget(Button.builder(Component.translatable("gui.toMenu"), button -> this.minecraft.setScreen(this.parent)) + this.addRenderableWidget(Button.builder(Component.translatable("gui.toMenu"), _ -> this.minecraft.gui.setScreen(this.parent)) .bounds((this.width - buttonWidth) / 2, lowerButtonHeight, buttonWidth, 20) .build()); } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks); + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTicks) { int textYOffset = hasMismatches ? 18 : 0; - guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset - 9 * 2, 0xAAAAAA); - var lineCollector = guiGraphics.textRenderer(GuiGraphics.HoveredTextEffects.notClickable(false)); + guiGraphics.centeredText(this.font, this.title, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset - 9 * 2, 0xAAAAAA); + var lineCollector = guiGraphics.textRenderer(GuiGraphicsExtractor.HoveredTextEffects.notClickable(false), null); this.message.visitLines(TextAlignment.CENTER, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset, 9, lineCollector); - super.render(guiGraphics, mouseX, mouseY, partialTicks); + super.extractRenderState(guiGraphics, mouseX, mouseY, partialTicks); } class MismatchInfoPanel extends ScrollPanel { @@ -251,7 +250,7 @@ public class ModMismatchDisconnectedScreen extends Screen { } @Override - protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY) { + protected void drawPanel(GuiGraphicsExtractor guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY) { int i = 0; for (Pair> line : lineTable) { @@ -261,10 +260,10 @@ public class ModMismatchDisconnectedScreen extends Screen { int color = 0xFFFFFF; //Optional.ofNullable(font.substrByWidth(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); - guiGraphics.drawString(font, name, nameLeft, relativeY + i * 12, color, false); + guiGraphics.text(font, name, nameLeft, relativeY + i * 12, color, false); if (versions != null) { - 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); + guiGraphics.text(font, versions.getLeft(), left + border + nameIndent + nameWidth, relativeY + i * 12, color, false); + guiGraphics.text(font, versions.getRight(), left + border + nameIndent + nameWidth + versionWidth, relativeY + i * 12, color, false); } i++; @@ -272,11 +271,11 @@ public class ModMismatchDisconnectedScreen extends Screen { } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - super.render(guiGraphics, mouseX, mouseY, partialTicks); + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTicks) { + super.extractRenderState(guiGraphics, mouseX, mouseY, partialTicks); Style style = getComponentStyleAt(mouseX, mouseY); if (style != null && style.getHoverEvent() != null) - guiGraphics.renderComponentHoverEffect(font, style, mouseX, mouseY); + guiGraphics.componentHoverEffect(font, style, mouseX, mouseY); } public Style getComponentStyleAt(double x, double y) { @@ -285,7 +284,7 @@ public class ModMismatchDisconnectedScreen extends Screen { int slotIndex = (int)(relativeY + (border / 2)) / 12; if (slotIndex < contentSize) { //The relative x needs to take the potentially missing indent of the row into account. It does that by checking if the line has a version associated to it - double relativeX = x - left - border - (lineTable.get(slotIndex).getRight() == null ? 0 : nameIndent); + //double relativeX = x - left - border - (lineTable.get(slotIndex).getRight() == null ? 0 : nameIndent); //if (relativeX >= 0) // return font.getSplitter().componentStyleAtWidth(lineTable.get(slotIndex).getLeft(), (int)relativeX); } diff --git a/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java b/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java index 263c81a60d..21769fc6d6 100644 --- a/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java +++ b/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java @@ -5,7 +5,7 @@ package net.minecraftforge.client.gui; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.renderer.RenderPipelines; @@ -40,7 +40,7 @@ public class TitleScreenModUpdateIndicator extends Screen { } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK)) return; diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayer.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayer.java index a33c799ee0..d862b03798 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayer.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayer.java @@ -6,8 +6,8 @@ package net.minecraftforge.client.gui.overlay; import net.minecraft.client.DeltaTracker; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; public interface ForgeLayer { - void render(GuiGraphics gg, DeltaTracker dt); + void extract(GuiGraphicsExtractor gg, DeltaTracker dt); } diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java new file mode 100644 index 0000000000..35b3a11255 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.client.gui.overlay; + +import java.util.Objects; +import java.util.Stack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.Screen; +import net.minecraftforge.client.event.ScreenEvent; + +import org.jetbrains.annotations.ApiStatus; + +// This should be accessed via Gui +public abstract class ForgeLayerInstance { + public void pushLayer(Screen screen) { + if (screen() != null) + guiLayers.push(screen()); + setScreenInternal(Objects.requireNonNull(screen)); + screen.init(minecraft.getWindow().getGuiScaledWidth(), minecraft.getWindow().getGuiScaledHeight()); + minecraft.getNarrator().saySystemNow(screen.getNarrationMessage()); + } + + public void popLayer() { + if (guiLayers.isEmpty()) { + minecraft.gui.setScreen(null); + return; + } + + popLayerInternal(); + if (screen() != null) + minecraft.getNarrator().saySystemNow(screen().getNarrationMessage()); + } + + // Below here is private implementation details + + /** + * Contains the *extra* GUI layers. + * The current top layer stays in Minecraft#currentScreen, and the rest serve as a background for it. + */ + private final Stack guiLayers = new Stack<>(); + private final Minecraft minecraft; + + @ApiStatus.Internal + protected ForgeLayerInstance(Minecraft minecraft) { + this.minecraft = minecraft; + } + + @ApiStatus.Internal + protected abstract Screen screen(); + @ApiStatus.Internal + protected abstract void setScreenInternal(Screen value); + + @ApiStatus.Internal + public void resizeLayers(int width, int height) { + guiLayers.forEach(screen -> screen.resize(width, height)); + } + + @ApiStatus.Internal + protected void clearLayers() { + while (!guiLayers.isEmpty()) + popLayerInternal(); + } + + @ApiStatus.Internal + private void popLayerInternal() { + if (screen() != null) + screen().removed(); + setScreenInternal(guiLayers.pop()); + } + + @ApiStatus.Internal + protected void drawScreen(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { + guiGraphics.pose().pushMatrix(); + for (Screen layer : guiLayers) { + // Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted. + drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); + //guiGraphics.pose().translate(0, 0, 10000); + } + drawScreenInternal(screen(), guiGraphics, mouseX, mouseY, partialTick); + guiGraphics.pose().popMatrix(); + } + + @ApiStatus.Internal + private static void drawScreenInternal(Screen screen, GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { + if (!ScreenEvent.Render.Pre.BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick))) + screen.extractRenderStateWithTooltipAndSubtitles(guiGraphics, mouseX, mouseY, partialTick); + ScreenEvent.Render.Post.BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick)); + } +} diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java index fa1eac0902..f25c9804c1 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java @@ -8,8 +8,9 @@ package net.minecraftforge.client.gui.overlay; import com.mojang.logging.LogUtils; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.Hud; +import net.minecraft.client.gui.contextualbar.ContextualBar; import net.minecraft.resources.Identifier; import net.minecraftforge.client.event.ForgeEventFactoryClient; import net.minecraftforge.client.event.AddGuiOverlayLayersEvent; @@ -38,14 +39,27 @@ public final class ForgeLayeredDraw implements ForgeLayer { private final List bakedLayers = new ArrayList<>(); private final Identifier name; + // Begin pre-sleep overlay public static final Identifier PRE_SLEEP_STACK = Identifier.withDefaultNamespace("pre_sleep_phase"); public static final Identifier CAMERA_OVERLAY = Identifier.withDefaultNamespace("camera_overlay"); public static final Identifier CROSSHAIR = Identifier.withDefaultNamespace("crosshair"); public static final Identifier CHANGE_STRATUM = Identifier.withDefaultNamespace("stratum_change"); + // Begin hotbar public static final Identifier HOTBAR_AND_DECOS = Identifier.withDefaultNamespace("hotbar"); + public static final Identifier ITEM_HOTBAR = Identifier.withDefaultNamespace("item_hotbar"); + public static final Identifier SPECTATOR_HOTBAR = Identifier.withDefaultNamespace("spectator_hotbar"); + public static final Identifier HEALTH_BAR = Identifier.withDefaultNamespace("health_bar"); + public static final Identifier VEHICLE_HEALTH = Identifier.withDefaultNamespace("vehicle_health"); + public static final Identifier BACKGROUND = Identifier.withDefaultNamespace("background"); // Any layer needing contextual info should order at some point after this layer. + public static final Identifier EXPERIENCE_LEVEL = Identifier.withDefaultNamespace("experience_level"); + public static final Identifier CONTEXTUAL_INFO = Identifier.withDefaultNamespace("contextual_info"); + public static final Identifier SELECTED_ITEM_NAME = Identifier.withDefaultNamespace("selected_item_name"); + public static final Identifier SPECTATOR_ACTION = Identifier.withDefaultNamespace("spectator_action"); + // End hotbar public static final Identifier POTION_EFFECTS = Identifier.withDefaultNamespace("potion_effects"); public static final Identifier BOSS_OVERLAY = Identifier.withDefaultNamespace("boss_overlay"); - + // End pre-sleep overlay + // Begin post-sleep overlay public static final Identifier POST_SLEEP_STACK = Identifier.withDefaultNamespace("post_sleep_phase"); public static final Identifier DEMO_OVERLAY = Identifier.withDefaultNamespace("demo"); public static final Identifier DEBUG_OVERLAY = Identifier.withDefaultNamespace("debug"); @@ -55,6 +69,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { public static final Identifier CHAT_OVERLAY = Identifier.withDefaultNamespace("chat_overlay"); public static final Identifier TAB_LIST = Identifier.withDefaultNamespace("tab_list"); public static final Identifier SUBTITLE_OVERLAY = Identifier.withDefaultNamespace("subtitle"); + // End post-sleep overlay public static final Identifier VANILLA_ROOT = Identifier.withDefaultNamespace("vanilla_root"); public static final Identifier SLEEP_OVERLAY = Identifier.withDefaultNamespace("sleep_overlay"); @@ -87,11 +102,22 @@ public final class ForgeLayeredDraw implements ForgeLayer { return this; } + /** + * Adds a full draw stack and assumes condition is always true. + * Use {@linkplain ForgeLayeredDraw#putAbove} and {@linkplain ForgeLayeredDraw#putBelow} for fine location adjustment. + * @param name RL of the name to identify this stack with. + * @param layeredDraw the draw stack + * @return this + */ + public ForgeLayeredDraw add(Identifier name, ForgeLayeredDraw layeredDraw) { + return add(name, layeredDraw, () -> true); + } + /** * Add a layer to the layer list. This layer will be at the end of the list, which means * it will be rendered last (on top) of already added layers. * @param name RL for other mods to order against. - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw add(Identifier targetStack, Identifier name, ForgeLayer layer) { @@ -104,7 +130,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * Use any of the non-deprecated add methods if you want a specific instance, * or call {@linkplain ForgeLayeredDraw#locateStack(Identifier)} to get a reference to an instance. * @param name RL of layer to add - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw add(Identifier name, ForgeLayer layer) { @@ -172,7 +198,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * If the current stack does not contain otherLayer, no changes will be made. * @param newLayer name of the layer to be added * @param otherLayer name of the layer being ordered against - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw addAbove(Identifier expectedStack, Identifier newLayer, Identifier otherLayer, ForgeLayer layer) { @@ -199,7 +225,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * If the current stack does not contain otherLayer, no changes will be made. * @param newLayer name of the layer to be added * @param otherLayer name of the layer being ordered against - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw addBelow(Identifier expectedStack, Identifier newLayer, Identifier otherLayer, ForgeLayer layer) { @@ -268,9 +294,9 @@ public final class ForgeLayeredDraw implements ForgeLayer { */ public ForgeLayeredDraw addConditionTo(Identifier targetLayer, BooleanSupplier condition) { var result = namedLayers.computeIfPresent(targetLayer, - (name, layer) -> (guiGraphics, deltaTracker) -> { + (_, layer) -> (guiGraphics, deltaTracker) -> { if (condition.getAsBoolean()) { - layer.render(guiGraphics, deltaTracker); + layer.extract(guiGraphics, deltaTracker); } }); if (result == null) { @@ -279,6 +305,28 @@ public final class ForgeLayeredDraw implements ForgeLayer { return this; } + /** + * Replaces the renderer of a single layer and logs whodunnit, this is not recommended for obvious reasons. + * Will not work if target is a ForgeLayeredDraw + * Prefer {@linkplain ForgeLayeredDraw#addConditionTo} + * @param expectedLocation Layer stack where the target should be. + * @param targetLayer Target whose renderer should be replaced. + * @param replacementRenderer Renderer to use instead. + * @return this + */ + public ForgeLayeredDraw replace(Identifier expectedLocation, Identifier targetLayer, ForgeLayer replacementRenderer) { + locateStack(expectedLocation).ifPresentOrElse((stack) -> { + if (stack.namedLayers.get(targetLayer) != null) { + stack.namedLayers.put(targetLayer, replacementRenderer); + LogUtils.getLogger().debug("ForgeLayer {} in {} was replaced by {}.", targetLayer, expectedLocation, replacementRenderer); + } else { + LogUtils.getLogger().debug("ForgeLayer {} in {} was attempted to be replaced by {}, but it did not exist.", targetLayer, expectedLocation, replacementRenderer); + } + }, () -> stackNotPresentWarning(expectedLocation)); + + return this; + } + /** * Propagate the layer order down to the inner render list after providing modders an opportunity to alter the list as they wish. * @apiNote Modders should NEVER be calling this method. @@ -304,7 +352,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { var entry = subLayerStacks.get(layerName); entry.getKey().resolveNested(); bakedLayers.add((gg, tr) -> { - if (entry.getValue().getAsBoolean()) entry.getKey().render(gg,tr); + if (entry.getValue().getAsBoolean()) entry.getKey().extract(gg,tr); }); } else { bakedLayers.add(namedLayers.get(layerName)); @@ -368,41 +416,52 @@ public final class ForgeLayeredDraw implements ForgeLayer { } @ApiStatus.Internal - public static void beginRender(GuiGraphics gg, DeltaTracker dt) { - instance.render(gg,dt); + public static void extractRenderState(GuiGraphicsExtractor gg, DeltaTracker dt) { + instance.extract(gg, dt); } @ApiStatus.Internal - public void render(GuiGraphics gg, DeltaTracker dt) { + public void extract(GuiGraphicsExtractor gg, DeltaTracker dt) { for (ForgeLayer bakedLayer : bakedLayers) { - bakedLayer.render(gg, dt); + bakedLayer.extract(gg, dt); } } @ApiStatus.Internal - public static void init(Gui gui, Minecraft minecraft) { + public static void init(Hud gui, Minecraft minecraft) { + BooleanSupplier spectator = () -> minecraft.gameMode.isSpectator(); + var hotbarCluster = new ForgeLayeredDraw(HOTBAR_AND_DECOS) + .addWithCondition(SPECTATOR_HOTBAR, (gg, _) -> gui.getSpectatorGui().extractHotbar(gg), spectator) + .addWithCondition(ITEM_HOTBAR, gui::extractItemHotbar, () -> !spectator.getAsBoolean()) + .addWithCondition(HEALTH_BAR, (gg, _) -> gui.extractPlayerHealth(gg), () -> minecraft.gameMode.canHurtPlayer()) + .add(VEHICLE_HEALTH, (gg, _) -> gui.extractVehicleHealth(gg)) + .add(BACKGROUND, gui::updateContextualInfo) + .addWithCondition(EXPERIENCE_LEVEL, (gg, _) -> ContextualBar.extractExperienceLevel(gg, minecraft.font, minecraft.player.experienceLevel), () -> minecraft.gameMode.hasExperience() && minecraft.player.experienceLevel > 0) + .add(CONTEXTUAL_INFO, gui::extractContextualInfoState) + .addWithCondition(SELECTED_ITEM_NAME, (gg, _) -> gui.extractSelectedItemName(gg), () -> !spectator.getAsBoolean()) + .addWithCondition(SPECTATOR_ACTION, (gg, _) -> gui.getSpectatorGui().extractAction(gg), spectator); var preSleepDraw = new ForgeLayeredDraw(PRE_SLEEP_STACK) - .add(CAMERA_OVERLAY, gui::renderCameraOverlays) - .add(CROSSHAIR, gui::renderCrosshair) - .add(CHANGE_STRATUM, (gg, dt) -> gg.nextStratum()) - .add(HOTBAR_AND_DECOS, gui::renderHotbarAndDecorations) - .add(POTION_EFFECTS, gui::renderEffects) - .add(BOSS_OVERLAY, gui::renderBossOverlay); + .add(CAMERA_OVERLAY, gui::extractCameraOverlays) + .add(CROSSHAIR, gui::extractCrosshair) + .add(CHANGE_STRATUM, (gg, _) -> gg.nextStratum()) + .add(HOTBAR_AND_DECOS, hotbarCluster) + .add(POTION_EFFECTS, gui::extractEffects) + .add(BOSS_OVERLAY, gui::extractBossOverlay); var postSleepDraw = new ForgeLayeredDraw(POST_SLEEP_STACK) - .add(DEMO_OVERLAY, gui::renderDemoOverlay) - .add(SCOREBOARD, gui::renderScoreboardSidebar) - .add(HOTBAR_MESSAGE, gui::renderOverlayMessage) - .add(TITLE_OVERLAY, gui::renderTitle) - .add(CHAT_OVERLAY, gui::renderChat) - .add(TAB_LIST, gui::renderTabList) - .add(SUBTITLE_OVERLAY, (gfx, delta) -> gui.renderSubtitleOverlay(gfx, minecraft.screen != null && minecraft.screen.isInGameUi())); + .add(DEMO_OVERLAY, gui::extractDemoOverlay) + .add(SCOREBOARD, gui::extractScoreboardSidebar) + .add(HOTBAR_MESSAGE, gui::extractOverlayMessage) + .add(TITLE_OVERLAY, gui::extractTitle) + .add(CHAT_OVERLAY, gui::extractChat) + .add(TAB_LIST, gui::extractTabList) + .add(SUBTITLE_OVERLAY, (gfx, _) -> gui.extractSubtitleOverlay(gfx, minecraft.gui.screen() != null && minecraft.gui.screen().isInGameUi())); instance - .add(PRE_SLEEP_STACK, preSleepDraw, () -> !minecraft.options.hideGui) - .add(SLEEP_OVERLAY, gui::renderSleepOverlay) - .add(POST_SLEEP_STACK, postSleepDraw, () -> !minecraft.options.hideGui) - .add(SUBTITLE_OVERLAY, (gfx, delta) -> { - if (minecraft.options.hideGui && minecraft.screen != null && minecraft.screen.isInGameUi()) - gui.renderSubtitleOverlay(gfx, true); + .add(PRE_SLEEP_STACK, preSleepDraw, () -> !gui.isHidden()) + .add(SLEEP_OVERLAY, gui::extractSleepOverlay) + .add(POST_SLEEP_STACK, postSleepDraw, () -> !gui.isHidden()) + .add(SUBTITLE_OVERLAY, (gfx, _) -> { + if (!gui.isHidden() && minecraft.gui.screen() != null && minecraft.gui.screen().isInGameUi()) + gui.extractSubtitleOverlay(gfx, true); }); instance.resolveLayers(); } 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 47646512d4..2b1c5755b0 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.gui.widget; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.locale.Language; @@ -38,11 +38,11 @@ public class ExtendedButton extends Button { * Draws this button to the screen. */ @Override - public void renderContents(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + public void extractContents(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { Minecraft mc = Minecraft.getInstance(); guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); 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 - guiGraphics.drawCenteredString(mc.font, Language.getInstance().getVisualOrder(buttonText), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, getFGColor()); + guiGraphics.centeredText(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 77c33edf9c..74ea2653ab 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java @@ -5,8 +5,7 @@ package net.minecraftforge.client.gui.widget; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.client.input.KeyEvent; import net.minecraft.client.input.MouseButtonEvent; @@ -197,10 +196,10 @@ public class ForgeSlider extends AbstractSliderButton { protected void applyValue() {} @Override - public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + public void extractWidgetRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.getSprite(), this.getX(), this.getY(), this.getWidth(), this.getHeight()); guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.getHandleSprite(), this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 8, this.getHeight()); - renderScrollingStringOverContents(guiGraphics.textRendererForWidget(this, GuiGraphics.HoveredTextEffects.NONE), this.getMessage(), 2); + extractScrollingStringOverContents(guiGraphics.textRendererForWidget(this, GuiGraphicsExtractor.HoveredTextEffects.NONE), this.getMessage(), 2); } } 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 930b42579d..a55edd14cf 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java @@ -5,8 +5,10 @@ package net.minecraftforge.client.gui.widget; +import org.jspecify.annotations.Nullable; + import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.input.MouseButtonEvent; import net.minecraft.client.renderer.RenderPipelines; @@ -45,8 +47,8 @@ public class ModListWidget extends ObjectSelectionList { } @Override - protected void renderSelection(GuiGraphics gui, ModListWidget.ModEntry entry, int color) { - int widthOffset = this.scrollbarVisible() ? 11 : 4; + protected void extractSelection(GuiGraphicsExtractor gui, ModListWidget.ModEntry entry, int color) { + int widthOffset = this.scrollable() ? 11 : 4; int top = entry.getContentY(); int left = entry.getContentX(); int right = left + entry.getWidth() - widthOffset; @@ -60,6 +62,12 @@ public class ModListWidget extends ObjectSelectionList { parent.buildModList(this::addEntry, mod->new ModEntry(mod, this.parent)); } + @Override + public void setSelected(final @Nullable ModEntry selected) { + parent.setSelected(selected); + super.setSelected(selected); + } + public class ModEntry extends ObjectSelectionList.Entry { private final IModInfo modInfo; private final ModListScreen parent; @@ -75,7 +83,7 @@ public class ModListWidget extends ObjectSelectionList { } @Override - public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { + public void extractContent(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { int top = this.getContentY(); int left = this.getContentX(); int entryHeight = this.getContentBottom(); @@ -84,22 +92,23 @@ public class ModListWidget extends ObjectSelectionList { Component version = Component.literal(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo); Font font = this.parent.getFontRenderer(); - var barOffset = ModListWidget.this.scrollbarVisible() ? 6 : 0; - guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth - 6 - barOffset))), left + 3, top + 2, 0xFFFFFFFF, false); - guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth - 6 - barOffset))), left + 3, top + 2 + font.lineHeight, 0xFFCCCCCC, false); + var barOffset = ModListWidget.this.scrollable() ? 6 : 0; + guiGraphics.text(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth - 6 - barOffset))), left + 3, top + 2, 0xFFFFFFFF, false); + guiGraphics.text(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth - 6 - barOffset))), left + 3, top + 2 + font.lineHeight, 0xFFCCCCCC, false); if (vercheck.status().shouldDraw()) { //TODO: [Forge][ModList] Consider adding more icons for visualization guiGraphics.pose().pushMatrix(); guiGraphics.blit(RenderPipelines.GUI_TEXTURED, VERSION_CHECK_ICONS, getX() + width - 12 - barOffset, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); guiGraphics.pose().popMatrix(); - } } @Override public boolean mouseClicked(MouseButtonEvent info, boolean recent) { - parent.setSelected(this); - ModListWidget.this.setSelected(this); + if (this.parent.getSelected() == this) + ModListWidget.this.setSelected(null); + else + ModListWidget.this.setSelected(this); return false; } 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 14603ece18..c60908d838 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.gui.widget; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.AbstractContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -143,7 +143,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen /** * Draws the background of the scroll panel. This runs AFTER Scissors are enabled. */ - protected void drawBackground(GuiGraphics guiGraphics, float partialTick) { + protected void drawBackground(GuiGraphicsExtractor guiGraphics, float partialTick) { if (this.client.level != null) this.drawGradientRect(guiGraphics, this.left, this.top, this.right, this.bottom, bgColorFrom, bgColorTo); } @@ -152,7 +152,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(GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY); + protected abstract void drawPanel(GuiGraphicsExtractor guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY); protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; @@ -245,7 +245,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { guiGraphics.enableScissor(left, top, left + width, top + height); this.drawBackground(guiGraphics, partialTick); @@ -289,7 +289,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen } } - protected void drawGradientRect(GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2) { + protected void drawGradientRect(GuiGraphicsExtractor guiGraphics, int left, int top, int right, int bottom, int color1, int color2) { guiGraphics.fillGradient(left, top, right, bottom, color1, color2); } diff --git a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java index 8b8ddd4b5e..88a633898e 100644 --- a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java @@ -30,7 +30,7 @@ import net.minecraftforge.client.gui.LoadingErrorScreen; import net.minecraftforge.resource.ResourcePackLoader; import net.minecraftforge.server.LanguageHook; -public class ClientModLoader { +public final class ClientModLoader { private static final Logger LOGGER = LogManager.getLogger(); private static boolean loading; private static Minecraft mc; @@ -45,7 +45,7 @@ public class ClientModLoader { ClientModLoader.mc = minecraft; LogicalSidedProvider.setClient(()->minecraft); LanguageHook.loadForgeAndMCLangs(); - createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ImmediateWindowHandler::renderTick)).run(); + createRunnableWithCatch(() -> ModLoader.gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ImmediateWindowHandler::renderTick)).run(); if (error == null) { ResourcePackLoader.loadResourcePacks(defaultResourcePacks, true); net.minecraftforge.event.AddPackFindersEvent.BUS.post(new AddPackFindersEvent(PackType.CLIENT_RESOURCES, defaultResourcePacks::addPackFinder)); @@ -73,11 +73,11 @@ public class ClientModLoader { } private static void startModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) { - createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); + createRunnableWithCatch(() -> ModLoader.loadMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); } private static void finishModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) { - createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); + createRunnableWithCatch(() -> ModLoader.finishMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); loading = false; loadingComplete = true; // reload game settings on main thread @@ -85,7 +85,7 @@ public class ClientModLoader { } public static VersionChecker.Status checkForUpdates() { - boolean anyOutdated = ModList.get().getMods().stream() + boolean anyOutdated = ModList.getMods().stream() .map(VersionChecker::getResult) .map(VersionChecker.CheckResult::status) .anyMatch(VersionChecker.Status::isOutdated); @@ -93,7 +93,7 @@ public class ClientModLoader { } public static boolean completeModLoading() { - var warnings = ModLoader.get().getWarnings(); + var warnings = ModLoader.getWarnings(); boolean showWarnings = ForgeConfig.CLIENT.showLoadWarnings(); if (!showWarnings) { @@ -114,7 +114,7 @@ public class ClientModLoader { if (error != null || !warnings.isEmpty()) { BusGroup.DEFAULT.shutdown(); - mc.setScreen(new LoadingErrorScreen(error, warnings, dumpedLocation)); + mc.gui.setScreen(new LoadingErrorScreen(error, warnings, dumpedLocation)); return true; } diff --git a/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java b/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java index 530d75bf69..7d9e391434 100644 --- a/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java +++ b/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java @@ -8,7 +8,7 @@ package net.minecraftforge.client.loading; import com.mojang.blaze3d.opengl.GlTexture; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.LoadingOverlay; import net.minecraft.client.renderer.rendertype.RenderType; import net.minecraft.server.packs.resources.ReloadInstance; @@ -59,7 +59,7 @@ public class ForgeLoadingOverlay extends LoadingOverlay { } @Override - protected boolean renderContents(GuiGraphics gui, float fade) { + protected boolean extractContentRenderState(final GuiGraphicsExtractor graphics, float fade) { if (!ENABLE) return true; /* This should render the framebuffer but it doesnt work in 1.21.6's rendering changes. diff --git a/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java b/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java index 887121e295..3d4a8c0947 100644 --- a/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java +++ b/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java @@ -6,6 +6,9 @@ package net.minecraftforge.client.loading; import com.mojang.blaze3d.platform.Monitor; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.systems.GpuBackend; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.LoadingOverlay; import net.minecraft.server.packs.resources.ReloadInstance; @@ -13,7 +16,6 @@ import net.minecraft.server.packs.resources.ReloadInstance; import java.util.Optional; import java.util.function.Consumer; import java.util.function.IntConsumer; -import java.util.function.IntSupplier; import java.util.function.LongSupplier; import java.util.function.Supplier; @@ -21,8 +23,20 @@ import org.lwjgl.glfw.GLFW; public final class NoVizFallback { private static long WINDOW; - public static LongSupplier windowHandoff(IntSupplier width, IntSupplier height, Supplier title, LongSupplier monitor) { - return () -> WINDOW = GLFW.glfwCreateWindow(width.getAsInt(), height.getAsInt(), title.get(), monitor.getAsLong(), 0L); + public static LongSupplier windowHandoff(int width, int height, String title, long monitor, Supplier backend) { + return () -> { + try { + return WINDOW = Window.createGlfwWindow(width, height, title, monitor, (GpuBackend)backend.get()); + } catch (Throwable e) { + return sneak(e); + } + }; + } + + + @SuppressWarnings("unchecked") + private static R sneak(Throwable t) throws E { + throw (E)t; } public static Supplier loadingOverlay(Supplier mc, Supplier ri, Consumer> ex, boolean fadein) { diff --git a/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java b/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java index dbaeff1e4e..263c3b71d8 100644 --- a/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java +++ b/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java @@ -8,16 +8,16 @@ package net.minecraftforge.client.model; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.mojang.math.Transformation; -import net.minecraft.client.renderer.block.model.TextureSlots; +import net.minecraft.client.renderer.block.dispatch.ModelState; import net.minecraft.client.renderer.chunk.ChunkSectionLayer; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelDebugName; -import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.QuadCollection; -import net.minecraft.client.resources.model.UnbakedGeometry; +import net.minecraft.client.resources.model.cuboid.ItemModelGenerator; +import net.minecraft.client.resources.model.geometry.BakedQuad.MaterialInfo; +import net.minecraft.client.resources.model.geometry.QuadCollection; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.client.resources.model.sprite.TextureSlots; import net.minecraft.resources.Identifier; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.material.Fluid; @@ -30,6 +30,7 @@ import net.minecraftforge.client.model.geometry.IGeometryLoader; import net.minecraftforge.client.model.geometry.StandaloneGeometryBakingContext; import net.minecraftforge.client.model.geometry.UnbakedGeometryHelper; import net.minecraftforge.registries.ForgeRegistries; + import org.joml.Quaternionf; import org.joml.Vector3f; @@ -64,11 +65,6 @@ public class DynamicFluidContainerModel implements UnbakedGeometry { return new RenderTypeGroup(ChunkSectionLayer.TRANSLUCENT, unlit ? ForgeRenderTypes.ITEM_UNSORTED_UNLIT_TRANSLUCENT.get() : ForgeRenderTypes.ITEM_UNSORTED_TRANSLUCENT.get()); } - @SuppressWarnings("deprecation") - private static Material getMaterial(Identifier texture) { - return new Material(TextureAtlas.LOCATION_BLOCKS, texture); - } - /** * Returns a new ModelDynBucket representing the given fluid, but with the same * other properties (flipGas, tint, coverIsMask). @@ -85,17 +81,26 @@ public class DynamicFluidContainerModel implements UnbakedGeometry { @Override public QuadCollection bake(TextureSlots textures, ModelBaker baker, ModelState state, ModelDebugName name, IGeometryBakingContext context) { Material fluidMaskLocation = textures.getMaterial("fluid"); + Material coverLocation = textures.getMaterial("cover"); Material stillMaterial = null; if (fluid != Fluids.EMPTY) { var stillTexture = IClientFluidTypeExtensions.of(fluid).getStillTexture(); - stillMaterial = getMaterial(stillTexture); + if (stillTexture != null) { + // Models can no longer have textures across atlases, so redirect to the item model of the same name. + // Modders may need to make clones of their textures in the item atlas, or provide a custom atlas alias + if (stillTexture.getPath().startsWith("block/")) + stillTexture = stillTexture.withPath(path -> "item/" + path.substring(6)); + stillMaterial = new Material(stillTexture); + } } - var sprites = baker.sprites(); - var baseSprite = sprites.resolveSlot(textures, "base", name); - var fluidSprite = stillMaterial == null ? null : sprites.get(stillMaterial, name); - var coverSprite = sprites.resolveSlot(textures, "cover", name); + + var materials = baker.materials(); + var baseMaterial = materials.resolveSlot(textures, "base", name); + var fluidMaterial = stillMaterial == null ? null : materials.get(stillMaterial, name); + var coverMaterial = coverLocation == null ? null : materials.get(coverLocation, name); + /* var particleSprite = sprites.resolveSlot(textures, "particle", name); @@ -108,39 +113,31 @@ public class DynamicFluidContainerModel implements UnbakedGeometry { // TODO: [Forge][Rendering] See if we can get rid of SimpleModelState and wrap transforms completely // If the fluid is lighter than air, rotate 180deg to turn it upside down - if (flipGas && fluid != Fluids.EMPTY && fluid.getFluidType().isLighterThanAir()) + if (flipGas && fluid != Fluids.EMPTY && fluid.getFluidType().isLighterThanAir()) { transformation = transformation.compose(new Transformation(null, new Quaternionf(0, 0, 1, 0), null, null)); + state = new SimpleModelState(transformation); + } var buf = new QuadCollection.Builder(); - if (baseSprite != null) { - // Base texture - var unbaked = UnbakedGeometryHelper.createUnbakedItemElements(0, baseSprite.contents()); - UnbakedGeometryHelper.bakeElements(baker.parts(), unbaked, $ -> baseSprite, state, buf); - } + if (baseMaterial != null) + ItemModelGenerator.bakeExtrudedSprite(buf, baker.interner(), state, info(baker, baseMaterial, 0)); - if (fluidMaskLocation != null && fluidSprite != null) { - TextureAtlasSprite templateSprite = sprites.get(fluidMaskLocation, name); - if (templateSprite != null) { - // Fluid layer + // Fluid layer + if (fluidMaskLocation != null && fluidMaterial != null) { + var templateMaterial = materials.get(fluidMaskLocation, name); + if (templateMaterial != null) { var transformedState = new SimpleModelState(transformation.compose(FLUID_TRANSFORM)); - var unbaked = UnbakedGeometryHelper.createUnbakedItemMaskElements(1, templateSprite.contents()); // Use template as mask - - //var emissive = applyFluidLuminosity && fluid.getFluidType().getLightLevel() > 0; - //var transformer = emissive ? QuadTransformers.settingMaxEmissivity() : QuadTransformers.empty(); - // TODO: [Forge][Rendering] Emissive fluid models - - UnbakedGeometryHelper.bakeElements(baker.parts(), unbaked, $ -> fluidSprite, transformedState, buf); // Bake with fluid texture + UnbakedGeometryHelper.bakeMaskedSprite(buf, baker.interner(), transformedState, info(baker, fluidMaterial, 1), info(baker, templateMaterial, 1)); } } - if (coverSprite != null) { - var sprite = coverIsMask ? baseSprite : coverSprite; + // Cover/overlay + if (coverMaterial != null) { + var sprite = coverIsMask ? baseMaterial : coverMaterial; if (sprite != null) { - // Cover/overlay var transformedState = new SimpleModelState(transformation.compose(COVER_TRANSFORM)); - var unbaked = UnbakedGeometryHelper.createUnbakedItemMaskElements(2, coverSprite.contents()); // Use cover as mask - UnbakedGeometryHelper.bakeElements(baker.parts(), unbaked, $ -> sprite, transformedState, buf); // Bake with selected texture + UnbakedGeometryHelper.bakeMaskedSprite(buf, baker.interner(), transformedState, info(baker, coverMaterial, 2), info(baker, sprite, 2)); } } @@ -148,6 +145,12 @@ public class DynamicFluidContainerModel implements UnbakedGeometry { return buf.build(); } + private static MaterialInfo info(final ModelBaker baker, final Material.Baked material, final int tintIndex) { + return baker.interner().materialInfo( + MaterialInfo.of(material, material.sprite().transparency(), tintIndex, true, 0) + ); + } + public static final class Loader implements IGeometryLoader { public static final Loader INSTANCE = new Loader(); diff --git a/src/main/java/net/minecraftforge/client/model/ForgeFaceData.java b/src/main/java/net/minecraftforge/client/model/ForgeFaceData.java index 75762294f9..8bfa185de4 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeFaceData.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeFaceData.java @@ -13,12 +13,9 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.client.renderer.block.model.BlockElement; -import net.minecraft.client.renderer.block.model.BlockElementFace; - /** * Holds extra data that may be injected into a face.

- * Used by {@link ItemLayerGeometry}, {@link BlockElement} and {@link BlockElementFace} + * Used by {@link BlockElement} and {@link BlockElementFace} * * @param ambientOcclusion If this face has AO * @param calculateNormals If we should manually calculate the normals for this block or inherit facing normals like vanilla diff --git a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java index 57e8797951..f3819d46a1 100644 --- a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java @@ -5,9 +5,10 @@ package net.minecraftforge.client.model; -import net.minecraft.client.renderer.block.model.BakedQuad; import java.util.List; +import net.minecraft.client.resources.model.geometry.BakedQuad; + /** * Transformer for {@link BakedQuad baked quads}. * diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerGeometry.java b/src/main/java/net/minecraftforge/client/model/ItemLayerGeometry.java deleted file mode 100644 index 7911ec3164..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerGeometry.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.model; - -import com.google.common.collect.ImmutableList; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.client.renderer.rendertype.RenderType; -import net.minecraft.client.renderer.block.model.ItemModelGenerator; -import net.minecraft.client.renderer.block.model.SimpleUnbakedGeometry; -import net.minecraft.client.renderer.block.model.TextureSlots; -import net.minecraft.client.renderer.block.model.BlockElement; -import net.minecraft.client.renderer.block.model.BlockModelPart; -import net.minecraft.client.resources.model.Material; -import net.minecraft.client.resources.model.ModelBaker; -import net.minecraft.client.resources.model.ModelDebugName; -import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.QuadCollection; -import net.minecraft.client.resources.model.UnbakedGeometry; -import net.minecraft.resources.Identifier; -import net.minecraftforge.client.ForgeRenderTypes; -import net.minecraftforge.client.RenderTypeGroup; -import net.minecraftforge.client.model.geometry.IGeometryBakingContext; -import net.minecraftforge.client.model.geometry.IGeometryLoader; -import net.minecraftforge.client.model.geometry.IUnbakedGeometry; -import net.minecraftforge.client.model.geometry.UnbakedGeometryHelper; - -import java.util.ArrayList; -import java.util.List; - -import org.jetbrains.annotations.Nullable; - -/** - * Forge version of vanilla's {@link ItemModelGenerator}, i.e. builtin/generated models with some tweaks: - * - Represented as {@link UnbakedGeometry} so it can be used in multiple root models - * - Not limited to an arbitrary number of layers (5) - //* - Support for per-layer render types - Currently Doesn't work. TODO: [Forge][Model] Make a Model loader for this - */ -@SuppressWarnings("unused") -public class ItemLayerGeometry implements UnbakedGeometry { - private static final ItemLayerGeometry INSTANCE = new ItemLayerGeometry(Int2ObjectMaps.emptyMap(), Int2ObjectMaps.emptyMap()); - - private final Int2ObjectMap renderTypeNames; - private final Int2ObjectMap renderTypeFastNames; - - private ItemLayerGeometry(Int2ObjectMap renderTypeNames, Int2ObjectMap renderTypeFastNames) { - this.renderTypeNames = renderTypeNames; - this.renderTypeFastNames = renderTypeFastNames; - } - - @Override - public QuadCollection bake(TextureSlots textures, ModelBaker baker, ModelState state, ModelDebugName name) { - List elements = new ArrayList<>(); - - int i = 0; - while (true) { - var layer = "layer" + i++; - var material = textures.getMaterial(layer); - if (material == null) - break; - var contents = baker.sprites().get(material, name).contents(); - elements.addAll(ItemModelGenerator.processFrames(i, layer, contents)); - } - - return SimpleUnbakedGeometry.bake(elements, textures, baker, state, name); - /* - Material particleMaterial = spriteGetter.getMaterial("particle"); - var particle = baker.sprites().get(particleMaterial == null ? textures.get(0) : particleMaterial, name); - var rootTransform = context.getRootTransform(); - if (!rootTransform.isIdentity()) - modelState = UnbakedGeometryHelper.composeRootTransformIntoModelState(modelState, rootTransform); - - var normalRenderTypes = new RenderTypeGroup(RenderType.translucent(), ForgeRenderTypes.ITEM_UNSORTED_TRANSLUCENT.get()); - var builder = CompositeModel.Baked.builder(context, particle, context.getTransforms()); - for (int i = 0; i < textures.size(); i++) { - var sprite = baker.sprites().get(textures.get(i), name); - var unbaked = UnbakedGeometryHelper.createUnbakedItemElements(i, sprite.contents()); - var quads = UnbakedGeometryHelper.bakeElements(unbaked, $ -> sprite, modelState); - var renderTypeName = renderTypeNames.get(i); - var renderTypes = renderTypeName != null ? context.getRenderType(renderTypeName) : null; - var renderTypeFastName = renderTypeFastNames.get(i); - var renderTypesFast = renderTypeFastName != null ? context.getRenderType(renderTypeFastName) : null; - builder.addQuads(renderTypes != null ? renderTypes : normalRenderTypes, renderTypesFast != null ? renderTypesFast : RenderTypeGroup.EMPTY, quads); - } - - return builder.build(); - */ - } - - public static final class Loader implements IGeometryLoader { - public static final Loader INSTANCE = new Loader(); - - @Override - public UnbakedGeometry read(JsonObject jsonObject, JsonDeserializationContext deserializationContext) { - return ItemLayerGeometry.INSTANCE; - /* - var renderTypeNames = readRenderTypeNames(jsonObject, "render_types"); - var renderTypeFastNames = readRenderTypeNames(jsonObject, "render_types_fast"); - return new ItemLayerModel(renderTypeNames, renderTypeFastNames); - */ - } - - private static Int2ObjectMap readRenderTypeNames(JsonObject jsonObject, String key) { - var renderTypeNames = new Int2ObjectOpenHashMap(); - if (jsonObject.has(key)) { - var renderTypes = jsonObject.getAsJsonObject(key); - for (var entry : renderTypes.entrySet()) { - var renderType = Identifier.parse(entry.getKey()); - for (var layer : entry.getValue().getAsJsonArray()) - if (renderTypeNames.put(layer.getAsInt(), renderType) != null) - throw new JsonParseException("Registered duplicate " + key + " for layer " + layer); - } - } - - return renderTypeNames; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/QuadTransformers.java b/src/main/java/net/minecraftforge/client/model/QuadTransformers.java index e222ede4aa..2e2e966835 100644 --- a/src/main/java/net/minecraftforge/client/model/QuadTransformers.java +++ b/src/main/java/net/minecraftforge/client/model/QuadTransformers.java @@ -6,7 +6,9 @@ package net.minecraftforge.client.model; import com.mojang.math.Transformation; -import net.minecraft.client.renderer.block.model.BakedQuad; + +import net.minecraft.client.resources.model.geometry.BakedQuad; + import org.joml.Vector3f; import org.joml.Vector3fc; import org.joml.Vector4f; @@ -44,7 +46,7 @@ public final class QuadTransformers { return new BakedQuad(positions[0], positions[1], positions[2], positions[3], quad.packedUV0(), quad.packedUV1(), quad.packedUV2(), quad.packedUV3(), - quad.tintIndex(), quad.direction(), quad.sprite(), quad.shade(), quad.lightEmission(), quad.ambientOcclusion()); + quad.direction(), quad.materialInfo()); }; } /** diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java index cf61c4fcf3..741ea46e22 100644 --- a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java @@ -6,7 +6,8 @@ package net.minecraftforge.client.model; import com.mojang.math.Transformation; -import net.minecraft.client.resources.model.ModelState; + +import net.minecraft.client.renderer.block.dispatch.ModelState; /** * Simple implementation of {@link ModelState}. diff --git a/src/main/java/net/minecraftforge/client/model/data/ModelData.java b/src/main/java/net/minecraftforge/client/model/data/ModelData.java index add17e3107..5ae0debc7d 100644 --- a/src/main/java/net/minecraftforge/client/model/data/ModelData.java +++ b/src/main/java/net/minecraftforge/client/model/data/ModelData.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.model.data; import com.google.common.base.Preconditions; -import net.minecraft.client.renderer.block.model.BlockModelPart; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; import org.jetbrains.annotations.Contract; diff --git a/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java b/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java index 91d8719158..7feac00250 100644 --- a/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java +++ b/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java @@ -44,7 +44,7 @@ public class ModelDataManager { public void requestRefresh(@NotNull BlockEntity blockEntity) { Preconditions.checkNotNull(blockEntity, "Block entity must not be null"); - needModelDataRefresh.computeIfAbsent(new ChunkPos(blockEntity.getBlockPos()), $ -> Collections.synchronizedSet(new HashSet<>())) + needModelDataRefresh.computeIfAbsent(ChunkPos.containing(blockEntity.getBlockPos()), _ -> Collections.synchronizedSet(new HashSet<>())) .add(blockEntity.getBlockPos()); } @@ -52,7 +52,7 @@ public class ModelDataManager { Set needUpdate = needModelDataRefresh.remove(chunk); if (needUpdate != null) { - Map data = modelDataCache.computeIfAbsent(chunk, $ -> new ConcurrentHashMap<>()); + Map data = modelDataCache.computeIfAbsent(chunk, _ -> new ConcurrentHashMap<>()); for (BlockPos pos : needUpdate) { BlockEntity toUpdate = level.getBlockEntity(pos); if (toUpdate != null && !toUpdate.isRemoved()) @@ -64,7 +64,12 @@ public class ModelDataManager { } public @Nullable ModelData getAt(BlockPos pos) { - return getAt(new ChunkPos(pos)).get(pos); + return getAt(ChunkPos.containing(pos)).get(pos); + } + + public ModelData getAtOrEmpty(double x, double y, double z) { + var ret = getAt(BlockPos.containing(x, y, z)); + return ret == null ? ModelData.EMPTY : ret; } public ModelData getAtOrEmpty(BlockPos pos) { diff --git a/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java b/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java index e237020272..fc11b4c04f 100644 --- a/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java +++ b/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java @@ -5,26 +5,24 @@ package net.minecraftforge.client.model.data; -import net.minecraft.client.renderer.block.model.BlockModelPart; import org.jetbrains.annotations.Nullable; +import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart; + import java.util.IdentityHashMap; import java.util.Map; -public class MultipartModelData -{ +public class MultipartModelData { public static final ModelProperty PROPERTY = new ModelProperty<>(); - private final Map partData; + private final Map partData; - private MultipartModelData(Map partData) - { + private MultipartModelData(Map partData) { this.partData = partData; } @Nullable - public ModelData get(BlockModelPart model) - { + public ModelData get(BlockStateModelPart model) { return partData.get(model); } @@ -35,8 +33,7 @@ public class MultipartModelData * @param model The model to get data for * @return The data for the part, or the one passed in if not found */ - public static ModelData resolve(ModelData modelData, BlockModelPart model) - { + public static ModelData resolve(ModelData modelData, BlockStateModelPart model) { var multipartData = modelData.get(PROPERTY); if (multipartData == null) return modelData; @@ -44,23 +41,19 @@ public class MultipartModelData return partData != null ? partData : modelData; } - public static Builder builder() - { + public static Builder builder() { return new Builder(); } - public static final class Builder - { - private final Map partData = new IdentityHashMap<>(); + public static final class Builder { + private final Map partData = new IdentityHashMap<>(); - public Builder with(BlockModelPart model, ModelData data) - { + public Builder with(BlockStateModelPart model, ModelData data) { partData.put(model, data); return this; } - public MultipartModelData build() - { + public MultipartModelData build() { return new MultipartModelData(partData); } } diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IGeometryBakingContext.java b/src/main/java/net/minecraftforge/client/model/geometry/IGeometryBakingContext.java index 942e9b530d..3f9ee48087 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/IGeometryBakingContext.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/IGeometryBakingContext.java @@ -6,8 +6,8 @@ package net.minecraftforge.client.model.geometry; import com.mojang.math.Transformation; -import net.minecraft.client.renderer.block.model.ItemTransforms; -import net.minecraft.client.resources.model.Material; + +import net.minecraft.client.resources.model.cuboid.ItemTransforms; import net.minecraft.resources.Identifier; import net.minecraftforge.client.NamedRenderTypeManager; import net.minecraftforge.client.RenderTypeGroup; diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IGeometryLoader.java b/src/main/java/net/minecraftforge/client/model/geometry/IGeometryLoader.java index bd86730144..edcd2b7075 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/IGeometryLoader.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/IGeometryLoader.java @@ -9,7 +9,7 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import net.minecraft.client.resources.model.UnbakedGeometry; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraftforge.client.event.ModelEvent.RegisterGeometryLoaders; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; diff --git a/src/main/java/net/minecraftforge/client/model/geometry/IUnbakedGeometry.java b/src/main/java/net/minecraftforge/client/model/geometry/IUnbakedGeometry.java deleted file mode 100644 index f849d41281..0000000000 --- a/src/main/java/net/minecraftforge/client/model/geometry/IUnbakedGeometry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.model.geometry; - -import java.util.Set; - -import net.minecraft.client.renderer.block.model.BlockModel; -import net.minecraft.client.renderer.block.model.TextureSlots; -import net.minecraft.client.renderer.block.model.BlockModelPart; -import net.minecraft.client.resources.model.ModelBaker; -import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.ResolvableModel; -import net.minecraft.client.resources.model.UnbakedModel; - -/** - * General interface for any model that can be baked, superset of vanilla {@link UnbakedModel}. - *

- * Instances of this class are usually created via {@link IGeometryLoader}. - * - * @see IGeometryLoader - * @see IGeometryBakingContext - */ -public interface IUnbakedGeometry> { - BlockModelPart bake(IGeometryBakingContext context, ModelBaker baker, TextureSlots spriteGetter, ModelState modelState); - - /** - * Resolve parents of nested {@link BlockModel}s which are later used in - * {@link IUnbakedGeometry#bake(IGeometryBakingContext, ModelBaker, TextureSlots, ModelState)} - * via {@link BlockModel#resolveParents(Function)} - */ - default void resolveDependencies(ResolvableModel.Resolver resolver, IGeometryBakingContext context) { } - - /** - * {@return a set of all the components whose visibility may be configured via {@link IGeometryBakingContext}} - */ - default Set getConfigurableComponentNames() { - return Set.of(); - } -} diff --git a/src/main/java/net/minecraftforge/client/model/geometry/ModelContext.java b/src/main/java/net/minecraftforge/client/model/geometry/ModelContext.java index e11b5c8040..6b590baeeb 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/ModelContext.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/ModelContext.java @@ -10,10 +10,10 @@ import org.jetbrains.annotations.Nullable; import com.mojang.math.Transformation; -import net.minecraft.client.renderer.block.model.BlockModel; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.ModelDiscovery.ModelWrapper; import net.minecraft.client.resources.model.ResolvedModel; +import net.minecraft.client.resources.model.cuboid.CuboidModel; +import net.minecraft.client.resources.model.cuboid.ItemTransforms; import net.minecraft.resources.Identifier; import net.minecraftforge.client.model.ForgeBlockModelData; @@ -29,11 +29,11 @@ public record ModelContext( } private static ForgeBlockModelData makeData(ResolvedModel self, ResolvedModel parent) { - var data = self.wrapped() instanceof BlockModel block ? block.forgeData() : null; + var data = self.wrapped() instanceof CuboidModel block ? block.forgeData() : null; var p = parent; while (p != null && (data == null || !data.full())) { - if (p.wrapped() instanceof BlockModel block) { + if (p.wrapped() instanceof CuboidModel block) { if (data == null) data = block.forgeData(); else @@ -72,7 +72,7 @@ public record ModelContext( @Override public Transformation getRootTransform() { - return data == null ? Transformation.identity() : data.transform().orElse(Transformation.identity()); + return data == null ? Transformation.IDENTITY : data.transform().orElse(Transformation.IDENTITY); } @Override diff --git a/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java b/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java index d72cbb8acf..9dd4bcedf8 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java @@ -7,7 +7,7 @@ package net.minecraftforge.client.model.geometry; import com.mojang.math.Transformation; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.resources.model.cuboid.ItemTransforms; import net.minecraft.resources.Identifier; import org.jetbrains.annotations.Nullable; @@ -115,12 +115,12 @@ public class StandaloneGeometryBakingContext implements IGeometryBakingContext { private boolean useBlockLight = true; private boolean useAmbientOcclusion = true; private ItemTransforms transforms = ItemTransforms.NO_TRANSFORMS; - private Transformation rootTransform = Transformation.identity(); + private Transformation rootTransform = Transformation.IDENTITY; @Nullable private Identifier renderTypeHint; @Nullable private Identifier renderTypeFastHint; - private BiPredicate visibilityTest = (c, def) -> def; + private BiPredicate visibilityTest = (_, def) -> def; private Builder() { } 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 e8c3327210..4cb1468bb8 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java @@ -7,21 +7,17 @@ package net.minecraftforge.client.model.geometry; import com.mojang.math.Quadrant; import com.mojang.math.Transformation; -import net.minecraft.util.Util; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.BlockElement; -import net.minecraft.client.renderer.block.model.BlockElementFace; -import net.minecraft.client.renderer.block.model.FaceBakery; -import net.minecraft.client.renderer.block.model.ItemModelGenerator; -import net.minecraft.client.renderer.block.model.TextureSlots; +import net.minecraft.client.renderer.block.dispatch.ModelState; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; -import net.minecraft.client.renderer.texture.SpriteContents; import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -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.QuadCollection; +import net.minecraft.client.resources.model.cuboid.CuboidFace; +import net.minecraft.client.resources.model.cuboid.FaceBakery; +import net.minecraft.client.resources.model.cuboid.ItemModelGenerator; +import net.minecraft.client.resources.model.geometry.BakedQuad; +import net.minecraft.client.resources.model.geometry.QuadCollection; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.client.resources.model.sprite.TextureSlots; import net.minecraft.core.Direction; import net.minecraft.resources.Identifier; import net.minecraftforge.client.model.SimpleModelState; @@ -31,8 +27,6 @@ import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; import java.util.BitSet; -import java.util.List; -import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -85,33 +79,29 @@ public class UnbakedGeometryHelper { } /** - * Creates a list of {@linkplain BlockElement block elements} in the shape of the specified sprite contents. - * These can later be baked using the same, or another texture. - *

- * The {@link Direction#NORTH} and {@link Direction#SOUTH} faces take up the whole surface. + * Builds the model who's {@link Direction#NORTH} and {@link Direction#SOUTH} faces take up only the pixels the texture uses. + * + * This is basically ItemModelGenrator#bakeExtrudedSprite except for the front faces are not spread across the entire side + * + * Takes in a template MaterialInfo for the geometry, and a separate one to actually apply the texture from */ - public static List createUnbakedItemElements(int layerIndex, SpriteContents spriteContents) { - return ItemModelGenerator.processFrames(layerIndex, "layer" + layerIndex, spriteContents); - } - - /** - * Creates a list of {@linkplain BlockElement block elements} in the shape of the specified sprite contents. - * These can later be baked using the same, or another texture. - *

- * The {@link Direction#NORTH} and {@link Direction#SOUTH} faces take up only the pixels the texture uses. - */ - public static List createUnbakedItemMaskElements(int layerIndex, SpriteContents spriteContents) { - var elements = createUnbakedItemElements(layerIndex, spriteContents); - elements.remove(0); // Remove north and south faces - - int width = spriteContents.width(), height = spriteContents.height(); + public static void bakeMaskedSprite( + final QuadCollection.Builder builder, + final ModelBaker.Interner interner, + final ModelState state, + final BakedQuad.MaterialInfo texture, + final BakedQuad.MaterialInfo template + ) { + var sprite = template.sprite().contents(); + int width = sprite.width(); + int height = sprite.height(); var bits = new BitSet(width * height); // For every frame in the texture, mark all the opaque pixels (this is what vanilla does too) - spriteContents.getUniqueFrames().forEach(frame -> { + sprite.getUniqueFrames().forEach(frame -> { for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) - if (!spriteContents.isTransparent(frame, x, y)) + if (!sprite.isTransparent(frame, x, y)) bits.set(x + y * width); }); @@ -140,56 +130,28 @@ public class UnbakedGeometryHelper { for (int j = y; j < yEnd; j++) bits.clear(i + j * width); + var from = new Vector3f(16 * xStart / (float) width, 16 - 16 * yEnd / (float) height, 7.5F); + var to = new Vector3f(16 * x / (float) width, 16 - 16 * y / (float) height, 8.5F); + // Create element - elements.add(new BlockElement( - new Vector3f(16 * xStart / (float) width, 16 - 16 * yEnd / (float) height, 7.5F), - new Vector3f(16 * x / (float) width, 16 - 16 * y / (float) height, 8.5F), - Util.makeEnumMap(Direction.class, dir -> new BlockElementFace(dir, layerIndex, "layer" + layerIndex, new BlockElementFace.UVs(0F, 0F, 16F, 16F), Quadrant.R0)) - )); + var southUvs = new CuboidFace.UVs(from.x, from.y, to.x, to.y); + var northUvs = new CuboidFace.UVs(to.x, from.y, from.x, to.y); + builder.addUnculledFace(FaceBakery.bakeQuad(interner, from, to, southUvs, Quadrant.R0, texture, Direction.SOUTH, state, null)); + builder.addUnculledFace(FaceBakery.bakeQuad(interner, from, to, northUvs, Quadrant.R0, texture, Direction.NORTH, state, null)); // Reset xStart xStart = -1; } } } - return elements; - } - /** - * Bakes a list of {@linkplain BlockElement block elements} and returns a {@link QuadCollection}. - */ - public static QuadCollection bakeElements(ModelBaker.PartCache cache, List elements, Function spriteGetter, ModelState modelState) { - var builder = new QuadCollection.Builder(); - bakeElements(cache, elements, spriteGetter, modelState, builder); - return builder.build(); - } - - /** - * Adds a list of {@linkplain BlockElement block elements} int a {@link QuadCollection.Builder}. - */ - public static void bakeElements(ModelBaker.PartCache cache, List elements, Function spriteGetter, ModelState modelState, QuadCollection.Builder builder) { - for (var element : elements) { - element.faces().forEach((side, face) -> { - var sprite = spriteGetter.apply(getMaterial(face.texture())); - var quad = bakeElementFace(cache, element, face, sprite, side, modelState, element.lightEmission()); - if (face.cullForDirection() == null) - builder.addUnculledFace(quad); - else - builder.addCulledFace(Direction.rotate(modelState.transformation().getMatrix(), face.cullForDirection()), quad); - }); - } + // Re-use vanilla code to create the side geometry + ItemModelGenerator.bakeSideFaces(builder, interner, state, texture, template); } @SuppressWarnings("deprecation") private static Material getMaterial(String texture) { - return new Material(TextureAtlas.LOCATION_BLOCKS, Identifier.parse(texture)); - } - - /** - * Turns a single {@link BlockElementFace} into a {@link BakedQuad}. - */ - public static BakedQuad bakeElementFace(ModelBaker.PartCache cache, BlockElement element, BlockElementFace face, TextureAtlasSprite sprite, Direction direction, ModelState state, int lightEmission) { - return FaceBakery.bakeQuad(cache, element.from(), element.to(), face, sprite, direction, state, element.rotation(), element.shade(), lightEmission); + return new Material(Identifier.parse(texture)); } /** 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 cda8c627a7..6e53e5f904 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java @@ -9,12 +9,12 @@ import com.google.common.collect.Maps; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.TextureSlots; +import net.minecraft.client.renderer.block.dispatch.ModelState; import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelDebugName; -import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.QuadCollection; -import net.minecraft.client.resources.model.UnbakedGeometry; +import net.minecraft.client.resources.model.geometry.QuadCollection; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; +import net.minecraft.client.resources.model.sprite.TextureSlots; import net.minecraft.resources.Identifier; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; @@ -64,7 +64,7 @@ public class ObjLoader implements IGeometryLoader, ResourceManagerReloadListener } public ObjModel loadModel(ObjModel.ModelSettings settings) { - return modelCache.computeIfAbsent(settings, (data) -> { + return modelCache.computeIfAbsent(settings, (_) -> { Resource resource = manager.getResource(settings.modelLocation()).orElseThrow(); try (ObjTokenizer tokenizer = new ObjTokenizer(resource.open())) { return ObjModel.parse(tokenizer, settings); diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java b/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java index 16a68f25c3..6625068cdb 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.model.obj; import com.google.common.collect.Maps; -import net.minecraft.client.resources.model.ModelDebugName; import org.joml.Vector4f; import java.io.IOException; 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 3ca61f1d06..8f0bbfb95d 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java @@ -9,17 +9,18 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.mojang.math.Transformation; -import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.TextureSlots; + +import net.minecraft.client.renderer.block.dispatch.ModelState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelDebugName; -import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.QuadCollection; +import net.minecraft.client.resources.model.geometry.BakedQuad; +import net.minecraft.client.resources.model.geometry.QuadCollection; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.client.resources.model.sprite.TextureSlots; import net.minecraft.core.Direction; import net.minecraft.resources.Identifier; +import net.minecraft.util.LightCoordsUtil; import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec2; import net.minecraftforge.client.model.geometry.IGeometryBakingContext; @@ -314,7 +315,7 @@ public class ObjModel { int uv2 = 0; if (emissiveAmbient) { int fakeLight = (int) ((ambientColor.x() + ambientColor.y() + ambientColor.z()) * 15 / 3.0f); - uv2 = LightTexture.pack(fakeLight, fakeLight); + uv2 = LightCoordsUtil.pack(fakeLight, fakeLight); quadBaker.setShade(fakeLight == 0 && shadeQuads); } else quadBaker.setShade(shadeQuads); @@ -523,16 +524,16 @@ public class ObjModel { return; var material = UnbakedGeometryHelper.resolveDirtyMaterial(mat.diffuseColorMap, slots); - var texture = baker.sprites().get(material, name); + var texture = baker.materials().get(material, name); int tintIndex = mat.diffuseTintIndex; Vector4f colorTint = mat.diffuseColor; - // TODO: [Forge][Rendering] Models contains the transforms so we shouldnt care about them here. + // TODO: [Forge][Rendering] Models contains the transforms so we shouldn't care about them here. //var rootTransform = context.getRootTransform(); //var transform = rootTransform.isIdentity() ? modelTransform.transformation() : modelTransform.transformation().compose(rootTransform); - var transform = Transformation.identity(); + var transform = Transformation.IDENTITY; for (int[][] face : faces) { - Pair quad = makeQuad(face, tintIndex, colorTint, mat.ambientColor, texture, transform); + Pair quad = makeQuad(face, tintIndex, colorTint, mat.ambientColor, texture.sprite(), transform); if (quad.getRight() == null) builder.addUnculledFace(quad.getLeft()); else @@ -550,11 +551,11 @@ public class ObjModel { final List quads = new ArrayList<>(); for (var face : this.faces) { - var pair = makeQuad(face, tintIndex, colorTint, mat.ambientColor, UnitTextureAtlasSprite.INSTANCE, Transformation.identity()); + var pair = makeQuad(face, tintIndex, colorTint, mat.ambientColor, UnitTextureAtlasSprite.INSTANCE, Transformation.IDENTITY); quads.add(pair.getLeft()); } - Identifier textureLocation = UnbakedGeometryHelper.resolveDirtyMaterial(mat.diffuseColorMap, textures).texture(); + Identifier textureLocation = UnbakedGeometryHelper.resolveDirtyMaterial(mat.diffuseColorMap, textures).sprite(); Identifier texturePath = textureLocation.withPath(p -> "textures/" + p + ".png"); builder.addMesh(texturePath, quads); diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java b/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java index 747ca6a389..c3d675da33 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java @@ -5,38 +5,34 @@ package net.minecraftforge.client.model.obj; -import com.google.common.base.Charsets; -import joptsimple.internal.Strings; import org.jetbrains.annotations.Nullable; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; /** * A tokenizer for OBJ and MTL files. *

* Joins split lines and ignores comments. */ -public class ObjTokenizer implements AutoCloseable -{ +public class ObjTokenizer implements AutoCloseable { + private static final Pattern TABS = Pattern.compile("[\t ]+"); private final BufferedReader lineReader; - public ObjTokenizer(InputStream inputStream) - { - this.lineReader = new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8)); + public ObjTokenizer(InputStream inputStream) { + this.lineReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); } @Nullable - public String[] readAndSplitLine(boolean ignoreEmptyLines) throws IOException - { + public String[] readAndSplitLine(boolean ignoreEmptyLines) throws IOException { //noinspection LoopConditionNotUpdatedInsideLoop - do - { + do { String currentLine = lineReader.readLine(); if (currentLine == null) return null; @@ -46,19 +42,19 @@ public class ObjTokenizer implements AutoCloseable if (currentLine.startsWith("#")) currentLine = ""; - if (!currentLine.isEmpty()) - { + if (!currentLine.isEmpty()) { boolean hasContinuation; - do - { + do { hasContinuation = currentLine.endsWith("\\"); String tmp = hasContinuation ? currentLine.substring(0, currentLine.length() - 1) : currentLine; - Arrays.stream(tmp.split("[\t ]+")).filter(s -> !Strings.isNullOrEmpty(s)).forEach(lineParts::add); + for (var part : TABS.split(tmp)) { + if (part != null && !part.isEmpty()) + lineParts.add(part); + } - if (hasContinuation) - { + if (hasContinuation) { currentLine = lineReader.readLine(); if (currentLine == null) break; @@ -78,8 +74,7 @@ public class ObjTokenizer implements AutoCloseable } @Override - public void close() throws IOException - { + public void close() throws IOException { lineReader.close(); } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BakedQuadBuilder.java b/src/main/java/net/minecraftforge/client/model/pipeline/BakedQuadBuilder.java index a3cbb69015..1c28878184 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BakedQuadBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BakedQuadBuilder.java @@ -8,8 +8,10 @@ package net.minecraftforge.client.model.pipeline; import com.google.common.base.Preconditions; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.geom.builders.UVPair; -import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.geometry.BakedQuad; +import net.minecraft.client.resources.model.geometry.BakedQuad.MaterialInfo; +import net.minecraft.client.resources.model.sprite.Material; import net.minecraft.core.Direction; import net.minecraftforge.client.textures.UnitTextureAtlasSprite; @@ -35,7 +37,6 @@ public class BakedQuadBuilder implements VertexConsumer { private Direction direction = Direction.DOWN; private TextureAtlasSprite sprite = UnitTextureAtlasSprite.INSTANCE; private boolean shade; - private boolean hasAmbientOcclusion; private int lightEmission; public BakedQuadBuilder(Consumer quadConsumer) { @@ -113,7 +114,12 @@ public class BakedQuadBuilder implements VertexConsumer { BakedQuad quad = new BakedQuad( this.positions[0], this.positions[1], this.positions[2], this.positions[3], this.uvs[0], this.uvs[1], this.uvs[2], this.uvs[3], - tintIndex, direction, sprite, shade, lightEmission, hasAmbientOcclusion + direction, + MaterialInfo.of( + new Material.Baked(sprite, false), + sprite.transparency(), + tintIndex, shade, lightEmission + ) ); setup(); // We have a full quad, pass it to the consumer and reset @@ -137,10 +143,6 @@ public class BakedQuadBuilder implements VertexConsumer { this.shade = shade; } - public void setHasAmbientOcclusion(boolean hasAmbientOcclusion) { - this.hasAmbientOcclusion = hasAmbientOcclusion; - } - public void setLightEmission(int value) { this.lightEmission = value; } diff --git a/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java b/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java index a20e4473f5..321b508f1c 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java @@ -3,13 +3,15 @@ * SPDX-License-Identifier: LGPL-2.1-only */ +/* package net.minecraftforge.client.model.renderable; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.QuadInstance; + import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.BlockModelPart; -import net.minecraft.client.renderer.block.model.BlockStateModel; +import net.minecraft.client.renderer.block.dispatch.BlockStateModel; +import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; @@ -29,21 +31,21 @@ import java.util.Arrays; * a {@link ModelData} instance, and a {@link Vector4f tint}. * * @see Context - */ + * / public class BakedModelRenderable implements IRenderable { /** * Constructs a {@link BakedModelRenderable} from the given model location. * The model is expected to have been baked ahead of time. * * @see net.minecraftforge.client.event.ModelEvent.RegisterModelStateDefinitions - */ + * / public static BakedModelRenderable of(BlockState state) { - return of(Minecraft.getInstance().getModelManager().getBlockModelShaper().getBlockModel(state)); + return of(Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(state)); } /** * Constructs a {@link BakedModelRenderable} from the given baked model. - */ + * / public static BakedModelRenderable of(BlockStateModel model) { return new BakedModelRenderable(model); } @@ -55,19 +57,26 @@ public class BakedModelRenderable implements IRenderable(); - model.collectParts(randomSource, parts, context.data(), null); + var parts = new ArrayList(); + model.collectParts(randomSource, parts, context.data()); + + // Not sure how we're suppoed to put the tint index, that comes from the Material + var quadInstance = new QuadInstance(); + quadInstance.setLightCoords(lightmap); + quadInstance.setOverlayCoords(overlay); + for (var part : parts) { for (var direction : Direction.valuesView()) { for (var quad : part.getQuads(direction)) { - buffer.putBulkData(poseStack.last(), quad, tint.x(), tint.y(), tint.z(), tint.w(), lightmap, overlay); + buffer.putBakedQuad(poseStack.last(), quad, quadInstance); + //buffer.putBulkData(poseStack.last(), quad, tint.x(), tint.y(), tint.z(), tint.w(), lightmap, overlay); } } } @@ -78,8 +87,8 @@ public class BakedModelRenderable implements IRenderable withModelDataContext() { - return (poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, context) -> - render(poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, new Context(context)); + return (poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, context) -> + render(poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, new Context(context)); } public record Context(@Nullable BlockState state, Direction[] faces, RandomSource randomSource, long seed, ModelData data, Vector4f tint) { @@ -91,3 +100,4 @@ public class BakedModelRenderable implements IRenderable quads = new ArrayList<>(); + private final QuadInstance quadInstance = new QuadInstance(); public Mesh(Identifier texture) { this.texture = texture; } - public void render(PoseStack poseStack, MultiBufferSource bufferSource, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay) { - var consumer = bufferSource.getBuffer(textureRenderTypeLookup.get(texture)); - for (var quad : quads) - consumer.putBulkData(poseStack.last(), quad, 1, 1, 1, 1, lightmap, overlay); + public void render(PoseStack poseStack, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay) { + //var consumer = bufferSource.getBuffer(textureRenderTypeLookup.get(texture)); + quadInstance.setLightCoords(lightmap); + quadInstance.setOverlayCoords(overlay); + + //for (var quad : quads) + // consumer.putBakedQuad(poseStack.last(), quad, quadInstance); } } diff --git a/src/main/java/net/minecraftforge/client/model/renderable/IRenderable.java b/src/main/java/net/minecraftforge/client/model/renderable/IRenderable.java index 1321d4f4b1..91c06ecc17 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/IRenderable.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/IRenderable.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.model.renderable; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.util.Unit; /** @@ -27,7 +26,7 @@ public interface IRenderable { * @param partialTick The current time expressed in the fraction of a tick elapsed since the last client tick * @param context The context used for rendering */ - void render(PoseStack poseStack, MultiBufferSource bufferSource, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay, float partialTick, T context); + void render(PoseStack poseStack, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay, float partialTick, T context); /** * Wraps the current renderable along with a context. @@ -37,7 +36,7 @@ public interface IRenderable { * @return A renderable that accepts {@link Unit#INSTANCE} as context, but uses the provided {@code context} instead */ default IRenderable withContext(T context) { - return (poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, unused) -> - this.render(poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, context); + return (poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, _) -> + this.render(poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, context); } } diff --git a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java index 53d492a367..67cc790aa8 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java @@ -29,10 +29,9 @@ public enum KeyConflictContext implements IKeyConflictContext { * Gui key bindings are only used when a {@link Screen} is open. */ GUI { - @SuppressWarnings("resource") @Override public boolean isActive() { - return Minecraft.getInstance().screen != null; + return Minecraft.getInstance().gui.screen() != null; } @Override diff --git a/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java b/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java index b17144259e..0400caa236 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java @@ -7,8 +7,6 @@ package net.minecraftforge.client.settings; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.client.KeyMapping; -import org.jetbrains.annotations.Nullable; - import java.util.ArrayList; import java.util.Collections; import java.util.EnumMap; @@ -60,7 +58,7 @@ public class KeyMappingLookup { public void put(InputConstants.Key keyCode, KeyMapping keyBinding) { var bindingsMap = map.get(keyBinding.getKeyModifier()); - var bindingsForKey = bindingsMap.computeIfAbsent(keyCode, k -> new ArrayList()); + var bindingsForKey = bindingsMap.computeIfAbsent(keyCode, _ -> new ArrayList()); bindingsForKey.add(keyBinding); } diff --git a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java index bc9af0186e..6ab9124cd7 100644 --- a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java +++ b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java @@ -160,7 +160,7 @@ public final class CreativeModeTabRegistry { } private static void setCreativeModeTabOrder(List tierList) { - runInServerThreadIfPossible(hasServer -> { + runInServerThreadIfPossible(_ -> { SORTED_TABS.clear(); SORTED_TABS.addAll(tierList); }); diff --git a/src/main/java/net/minecraftforge/common/DungeonHooks.java b/src/main/java/net/minecraftforge/common/DungeonHooks.java index 9696286e3e..38680af611 100644 --- a/src/main/java/net/minecraftforge/common/DungeonHooks.java +++ b/src/main/java/net/minecraftforge/common/DungeonHooks.java @@ -10,12 +10,13 @@ import java.util.ArrayList; import net.minecraft.util.RandomSource; import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; public class DungeonHooks { private static WeightedList> dungeonMobs = WeightedList.>builder() - .add(EntityType.SKELETON, 100) - .add(EntityType.ZOMBIE, 200) - .add(EntityType.SPIDER, 100) + .add(EntityTypes.SKELETON, 100) + .add(EntityTypes.ZOMBIE, 200) + .add(EntityTypes.SPIDER, 100) .build(); /** diff --git a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java index fa4e7d65fc..1348e75a95 100644 --- a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java +++ b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java @@ -25,8 +25,7 @@ import java.util.Map; import java.util.Set; import java.util.WeakHashMap; -public class FarmlandWaterManager -{ +public class FarmlandWaterManager { private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugFarmlandWaterManager", "false")); private static final Map>> customWaterHandler = new WeakHashMap<>(); private static final Logger LOGGER = LogManager.getLogger(); @@ -44,10 +43,9 @@ public class FarmlandWaterManager * @return The ticket for your requested region. */ @SuppressWarnings("unchecked") - public static> T addCustomTicket(Level level, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks) - { + public static> T addCustomTicket(Level level, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks) { Preconditions.checkArgument(!level.isClientSide(), "Water region is only determined server-side"); - Map> ticketMap = customWaterHandler.computeIfAbsent(level, id -> new MapMaker().weakValues().makeMap()); + Map> ticketMap = customWaterHandler.computeIfAbsent(level, _ -> new MapMaker().weakValues().makeMap()); ChunkTicketManager[] additionalTickets = new ChunkTicketManager[additionalChunks.length]; for (int i = 0; i < additionalChunks.length; i++) additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new); @@ -67,28 +65,23 @@ public class FarmlandWaterManager * @param aabb The region where blocks should be watered * @return The ticket for your requested region. */ - public static AABBTicket addAABBTicket(Level level, AABB aabb) - { + public static AABBTicket addAABBTicket(Level level, AABB aabb) { if (DEBUG) LOGGER.info("FarmlandWaterManager: New AABBTicket, aabb={}", aabb); //First calculate all chunks the aabb is in ChunkPos leftUp = new ChunkPos(((int) aabb.minX) >> 4, ((int) aabb.minZ) >> 4); ChunkPos rightDown = new ChunkPos(((int) aabb.maxX) >> 4, ((int) aabb.maxZ) >> 4); Set posSet = new HashSet<>(); - for (int x = leftUp.x; x <= rightDown.x; x++) - { - for (int z = leftUp.z; z <= rightDown.z; z++) - { + for (int x = leftUp.x(); x <= rightDown.x(); x++) { + for (int z = leftUp.z(); z <= rightDown.z(); z++) { posSet.add(new ChunkPos(x, z)); } } ChunkPos masterPos = null; double masterDistance = Double.MAX_VALUE; - for (ChunkPos pos : posSet) //Find the chunkPos with the lowest distance to the center and choose it as the master pos - { + for (var pos : posSet) { //Find the chunkPos with the lowest distance to the center and choose it as the master pos double distToCenter = getDistanceSq(pos, aabb.getCenter()); - if (distToCenter < masterDistance) - { + if (distToCenter < masterDistance) { if (DEBUG) LOGGER.info("FarmlandWaterManager: New better pos then {}: {}, prev dist {}, new dist {}", masterPos, pos, masterDistance, distToCenter); masterPos = pos; @@ -101,11 +94,10 @@ public class FarmlandWaterManager return addCustomTicket(level, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0])); } - private static double getDistanceSq(ChunkPos pos, Vec3 vec3d) - { + private static double getDistanceSq(ChunkPos pos, Vec3 vec3d) { //See ChunkPos#getDistanceSq - double d0 = (double)(pos.x * 16 + 8); - double d1 = (double)(pos.z * 16 + 8); + double d0 = (double)(pos.x() * 16 + 8); + double d1 = (double)(pos.z() * 16 + 8); double d2 = d0 - vec3d.x; double d3 = d1 - vec3d.z; return d2 * d2 + d3 * d3; @@ -115,11 +107,9 @@ public class FarmlandWaterManager * Tests if a block is in a region that is watered by blocks. This does not check vanilla water, see {@code net.minecraft.level.level.block.FarmBlock#isNearWater(LevelReader, BlockPos)} * @return true if there is a ticket with an AABB that includes your block */ - public static boolean hasBlockWaterTicket(LevelReader level, BlockPos pos) - { + public static boolean hasBlockWaterTicket(LevelReader level, BlockPos pos) { ChunkTicketManager ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), level); - if (ticketManager != null) - { + if (ticketManager != null) { Vec3 posAsVec3d = new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); for (SimpleTicket ticket : ticketManager.getTickets()) { if (ticket.matches(posAsVec3d)) @@ -129,11 +119,9 @@ public class FarmlandWaterManager return false; } - static void removeTickets(ChunkAccess chunk) - { + static void removeTickets(ChunkAccess chunk) { ChunkTicketManager ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge()); - if (ticketManager != null) - { + if (ticketManager != null) { if (DEBUG) LOGGER.info("FarmlandWaterManager: got tickets {} at {} before", ticketManager.getTickets().size(), ticketManager.pos); ticketManager.getTickets().removeIf(next -> next.unload(ticketManager)); //remove if this is the master manager of the ticket @@ -146,9 +134,7 @@ public class FarmlandWaterManager Preconditions.checkArgument(!level.isClientSide(), "Water region is only determined server-side"); Map> ticketMap = customWaterHandler.get(level); if (ticketMap == null) - { return null; - } return ticketMap.get(pos); } } diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index c109a9bed1..5ab0f771e6 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -82,9 +82,9 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper + (_, path, incorrectValue, correctedValue) -> LOGGER.warn(Logging.CORE, "Incorrect key {} was corrected from {} to its default, {}. {}", DOT_JOINER.join( path ), incorrectValue, correctedValue, incorrectValue == correctedValue ? "This seems to be an error." : ""), - (action, path, incorrectValue, correctedValue) -> + (_, path, _, _) -> LOGGER.debug(Logging.CORE, "The comment on key {} does not match the spec. This may create a backup.", DOT_JOINER.join( path ))); if (config instanceof FileConfig fileConfig) { @@ -140,12 +140,12 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper parentPath = new LinkedList<>(); - return correct(this.config, config, parentPath, Collections.unmodifiableList( parentPath ), (a, b, c, d) -> {}, null, true) == 0; + return correct(this.config, config, parentPath, Collections.unmodifiableList( parentPath ), (_, _, _, _) -> {}, null, true) == 0; } @Override public int correct(CommentedConfig config) { - return correct(config, (action, path, incorrectValue, correctedValue) -> {}, null); + return correct(config, (_, _, _, _) -> {}, null); } public synchronized int correct(CommentedConfig config, CorrectionListener listener) { diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index e44f8c4a8c..b6bb7bee81 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.regex.Matcher; @@ -31,7 +32,6 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.Decoder; -import com.mojang.serialization.Dynamic; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; import com.mojang.serialization.Lifecycle; @@ -40,7 +40,6 @@ import io.netty.handler.codec.DecoderException; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; -import net.minecraft.commands.arguments.selector.EntitySelectorParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder.Reference; @@ -50,10 +49,11 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.HolderSet.Named; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponents; -import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.Connection; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.PacketListener; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.VarInt; import net.minecraft.network.chat.ClickEvent; @@ -107,6 +107,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.protocol.PacketType; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.DiscardedPayload; import net.minecraft.network.syncher.EntityDataSerializer; @@ -157,11 +158,9 @@ import net.minecraftforge.event.level.NoteBlockEvent; import net.minecraftforge.event.level.ChunkEvent; import net.minecraftforge.event.network.CustomPayloadEvent; import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.config.ConfigTracker; -import net.minecraftforge.fml.util.thread.EffectiveSide; import net.minecraftforge.network.ConnectionType; import net.minecraftforge.network.ForgePayload; import net.minecraftforge.network.NetworkContext; @@ -191,6 +190,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import net.minecraft.world.level.levelgen.structure.templatesystem.loader.TemplateSource; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; @@ -226,13 +226,14 @@ public final class ForgeHooks { return player.hasCorrectToolForDrops(state); } - public static Brain onLivingMakeBrain(LivingEntity entity, Brain originalBrain, Dynamic dynamic) { + public static Brain onLivingMakeBrain(final LivingEntity entity, final Brain originalBrain, final Brain.Packed packedBrain) { if (!LivingMakeBrainEvent.BUS.hasListeners()) return originalBrain; - BrainBuilder brainBuilder = originalBrain.createBuilder(); + @SuppressWarnings("unchecked") + var brainBuilder = (BrainBuilder)originalBrain.createBuilder(); LivingMakeBrainEvent.BUS.post(new LivingMakeBrainEvent(entity, brainBuilder)); - return brainBuilder.makeBrain(dynamic); + return brainBuilder.makeBrain(entity, packedBrain); } public static boolean onLivingAttack(LivingEntity entity, DamageSource src, float amount) { @@ -257,13 +258,6 @@ public final class ForgeHooks { return LivingDamageEvent.BUS.post(event) ? 0 : event.getAmount(); } - public static InteractionResult onInteractEntityAt(Entity entity, Player player, Vec3 vec3d, InteractionHand hand) { - var ret = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d); - if (PlayerInteractEvent.EntityInteractSpecific.BUS.post(ret)) - return ret.getCancellationResult(); - return entity.interactAt(player, vec3d, hand); - } - public static int getLootingLevel(Entity target, @Nullable Entity killer, @Nullable DamageSource cause) { int looting = 0; if (killer instanceof LivingEntity living) @@ -412,7 +406,7 @@ public final class ForgeHooks { var lookup = level.holderLookup(Registries.ENCHANTMENT); int fortuneLevel = EnchantmentHelper.getItemEnchantmentLevel(lookup.getOrThrow(Enchantments.FORTUNE), stack); int silkTouchLevel = EnchantmentHelper.getItemEnchantmentLevel(lookup.getOrThrow(Enchantments.SILK_TOUCH), stack); - int exp = state.getExpDrop(level, level.random, pos, fortuneLevel, silkTouchLevel); + int exp = state.getExpDrop(level, level.getRandom(), pos, fortuneLevel, silkTouchLevel); if (exp > 0) state.getBlock().popExperience(level, pos, exp); } @@ -563,8 +557,8 @@ public final class ForgeHooks { @NotNull public static ItemStack getCraftingRemainingItem(@NotNull ItemStack stack) { var remainder = stack.getCraftingRemainder(); - if (!remainder.isEmpty()) { - stack = remainder; + if (remainder != null) { + stack = remainder.create(); if (!stack.isEmpty() && stack.isDamageableItem() && stack.getDamageValue() > stack.getMaxDamage()) { ForgeEventFactory.onPlayerDestroyItem(CRAFTING_PLAYER.get(), stack, (EquipmentSlot)null); return ItemStack.EMPTY; @@ -809,7 +803,7 @@ public final class ForgeHooks { public static void writeAdditionalLevelSaveData(WorldData worldData, CompoundTag levelTag) { CompoundTag fmlData = new CompoundTag(); ListTag modList = new ListTag(); - ModList.get().getMods().forEach(mi -> { + ModList.getMods().forEach(mi -> { final CompoundTag mod = new CompoundTag(); mod.putString("ModId", mi.getModId()); mod.putString("ModVersion", MavenVersionStringHelper.artifactVersionToString(mi.getVersion())); @@ -854,7 +848,7 @@ public final class ForgeHooks { String modVersion = mod.getStringOr("ModVersion", null); final var previousVersion = new DefaultArtifactVersion(modVersion); - ModList.get().getModContainerById(modId).ifPresentOrElse(container -> { + ModList.getModContainerById(modId).ifPresentOrElse(container -> { final var loadingVersion = container.getModInfo().getVersion(); if (!loadingVersion.equals(previousVersion)) { // Enqueue mismatched versions for bulk event @@ -1019,10 +1013,13 @@ public final class ForgeHooks { @SuppressWarnings("deprecation") public static void onLivingBreathe(LivingEntity entity, int consumeAirAmount, int refillAirAmount) { // Check things that vanilla considers to be air - these will cause the air supply to be increased. - boolean isAir = entity.getEyeInFluidType().isAir() || entity.level().getBlockState(BlockPos.containing(entity.getX(), entity.getEyeY(), entity.getZ())).is(Blocks.BUBBLE_COLUMN); + // This is only called when the server level is already checked + var level = (ServerLevel)entity.level(); + var eyeFluid = entity.getEyeInFluidType(); + boolean isAir = eyeFluid.isAir() || level.getBlockState(BlockPos.containing(entity.getX(), entity.getEyeY(), entity.getZ())).is(Blocks.BUBBLE_COLUMN); // The following effects cause the entity to not drown, but do not cause the air supply to be increased. - boolean canBreathe = !entity.canDrownInFluidType(entity.getEyeInFluidType()) || MobEffectUtil.hasWaterBreathing(entity) || (entity instanceof Player player && player.getAbilities().invulnerable); - var breatheEvent = ForgeEventFactory.onLivingBreathe(entity, isAir || canBreathe, consumeAirAmount, refillAirAmount, isAir); + boolean canBreathe = !entity.canDrownInFluidType(eyeFluid) || MobEffectUtil.hasWaterBreathing(entity) || (entity instanceof Player player && player.getAbilities().invulnerable); + var breatheEvent = ForgeEventFactory.onLivingBreathe(entity, isAir || canBreathe, consumeAirAmount, refillAirAmount, isAir || MobEffectUtil.shouldEffectsRefillAirsupply(entity)); if (breatheEvent.canBreathe()) { if (breatheEvent.canRefillAir()) { entity.setAirSupply(Math.min(entity.getAirSupply() + breatheEvent.getRefillAirAmount(), entity.getMaxAirSupply())); @@ -1031,32 +1028,29 @@ public final class ForgeHooks { entity.setAirSupply(entity.getAirSupply() - breatheEvent.getConsumeAirAmount()); if (entity.getAirSupply() <= -20) { - var drownEvent = new LivingDrownEvent(entity, entity.getAirSupply() <= -20, 2.0F, 8); + var drownEvent = new LivingDrownEvent(entity, true, 2.0F, 8); if (!LivingDrownEvent.BUS.post(drownEvent) && drownEvent.isDrowning()) { entity.setAirSupply(0); - Vec3 vec3 = entity.getDeltaMovement(); - - for (int i = 0; i < drownEvent.getBubbleCount(); ++i) { - double d2 = entity.getRandom().nextDouble() - entity.getRandom().nextDouble(); - double d3 = entity.getRandom().nextDouble() - entity.getRandom().nextDouble(); - double d4 = entity.getRandom().nextDouble() - entity.getRandom().nextDouble(); - entity.level().addParticle(ParticleTypes.BUBBLE, entity.getX() + d2, entity.getY() + d3, entity.getZ() + d4, vec3.x, vec3.y, vec3.z); - } - + level.broadcastEntityEvent(entity, (byte)67); if (drownEvent.getDamageAmount() > 0) { - entity.hurt(entity.damageSources().drown(), drownEvent.getDamageAmount()); + entity.hurtServer(level, entity.damageSources().drown(), drownEvent.getDamageAmount()); } } } - if (!isAir && !entity.level().isClientSide() && entity.isPassenger() && entity.getVehicle() != null && !entity.getVehicle().canBeRiddenUnderFluidType(entity.getEyeInFluidType(), entity)) { + if (!isAir && entity.isPassenger() && entity.getVehicle() != null && !entity.getVehicle().canBeRiddenUnderFluidType(entity.getEyeInFluidType(), entity)) { entity.stopRiding(); } } - public static void onCreativeModeTabBuildContents(CreativeModeTab tab, ResourceKey tabKey, CreativeModeTab.DisplayItemsGenerator originalGenerator, CreativeModeTab.ItemDisplayParameters params, CreativeModeTab.Output output) { + public static void onCreativeModeTabBuildContents(CreativeModeTab tab, CreativeModeTab.DisplayItemsGenerator originalGenerator, CreativeModeTab.ItemDisplayParameters params, CreativeModeTab.Output output) { + if (!BuildCreativeModeTabContentsEvent.BUS.hasListeners()) { + originalGenerator.accept(params, output); + return; + } + final var entries = new MutableHashedLinkedMap(ItemStackLinkedSet.TYPE_AND_TAG, - (key, left, right) -> { + (_, _, _) -> { //throw new IllegalStateException("Accidentally adding the same item stack twice " + key.getDisplayName().getString() + " to a Creative Mode Tab: " + tab.getDisplayName().getString()); // Vanilla adds enchanting books twice in both visibilities. // This is just code cleanliness for them. For us lets just increase the visibility and merge the entries. @@ -1070,7 +1064,11 @@ public final class ForgeHooks { entries.put(stack, vis); }); - BuildCreativeModeTabContentsEvent.BUS.post(new BuildCreativeModeTabContentsEvent(tab, tabKey, params, entries)); + var key = BuiltInRegistries.CREATIVE_MODE_TAB + .getResourceKey(tab) + .orElseThrow(() -> new IllegalStateException("Unregistered creative tab: " + tab)); + + BuildCreativeModeTabContentsEvent.BUS.post(new BuildCreativeModeTabContentsEvent(tab, key, params, entries)); for (var entry : entries) output.accept(entry.getKey(), entry.getValue()); @@ -1132,7 +1130,7 @@ public final class ForgeHooks { public static void handleClientConfigurationComplete(Connection connection) { if (NetworkContext.get(connection).getType() == ConnectionType.VANILLA) { LOGGER.info("Connected to a vanilla server. Catching up missing behaviour."); - ConfigTracker.INSTANCE.loadDefaultServerConfigs(); + ConfigTracker.loadDefaultServerConfigs(); } else LOGGER.info("Connected to a modded server."); } @@ -1236,8 +1234,9 @@ public final class ForgeHooks { @Nullable public static DyeColor getDyeColorFromItemStack(ItemStack stack) { - if (stack.getItem() instanceof DyeItem dye) - return dye.getDyeColor(); + var comp = stack.getComponents().get(DataComponents.DYE); + if (comp != null) + return comp; for (int x = 0; x < DyeColor.BLACK.getId(); x++) { var color = DyeColor.byId(x); @@ -1271,8 +1270,22 @@ public final class ForgeHooks { * * This is useful for game tests that need a structure, but want to create the contents in code. */ - public static Optional createEmptyStructure(Identifier name) { - if (name== null || !"forge".equals(name.getNamespace())) + public static TemplateSource emptyStructureSource() { + return new TemplateSource(null, null) { + @Override + public Optional load(Identifier id) { + return createEmptyStructure(id); + } + + @Override + public Stream list() { + return Stream.empty(); + } + }; + } + + private static Optional createEmptyStructure(Identifier name) { + if (name == null || !"forge".equals(name.getNamespace())) return Optional.empty(); var match = EMPTY_SIZE_PATTERN.matcher(name.getPath()); @@ -1305,4 +1318,32 @@ public final class ForgeHooks { return Optional.of(ret); } + + // This is similar to PacketUtils.ensureRunningOnSameThread, we can't use the normal LogicalSidedProvider.WORKQUEUE because it is processed after packets. + // So any vanilla packets that are received after this packet, will be processed before our enqueued packet. + public static void enqueuePacket(BiConsumer handler, MSG packet, CustomPayloadEvent.Context context) { + var processor = LogicalSidedProvider.PACKETS.get(context.isClientSide()); + if (!processor.isSameThread()) + processor.scheduleIfPossible(context.getConnection().getPacketListener(), new DummyPacket<>(handler, packet, context)); + else + handler.accept(packet, context); + } + + private static final record DummyPacket( + BiConsumer handler, + MSG packet, + CustomPayloadEvent.Context context + ) implements Packet { + private static final PacketType> TYPE = new PacketType<>(PacketFlow.CLIENTBOUND, Identifier.fromNamespaceAndPath("forge", "dummy_for_schedualing")); + + @Override + public PacketType> type() { + return TYPE; + } + + @Override + public void handle(PacketListener listener) { + handler.accept(packet, context); + } + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/ForgeI18n.java b/src/main/java/net/minecraftforge/common/ForgeI18n.java index 163a94a067..27ab8def28 100644 --- a/src/main/java/net/minecraftforge/common/ForgeI18n.java +++ b/src/main/java/net/minecraftforge/common/ForgeI18n.java @@ -40,21 +40,21 @@ public class ForgeI18n { static { customFactories = new HashMap<>(); // {0,modinfo,id} -> modid from ModInfo object; {0,modinfo,name} -> displayname from ModInfo object - customFactories.put("modinfo", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseModInfo(formatString, stringBuffer, objectToParse))); + customFactories.put("modinfo", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseModInfo(formatString, stringBuffer, objectToParse))); // {0,lower} -> lowercase supplied string - customFactories.put("lower", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toLowerCase(String.valueOf(objectToParse))))); + customFactories.put("lower", (_, _, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toLowerCase(String.valueOf(objectToParse))))); // {0,upper> -> uppercase supplied string - customFactories.put("upper", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toUpperCase(String.valueOf(objectToParse))))); + customFactories.put("upper", (_, _, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toUpperCase(String.valueOf(objectToParse))))); // {0,exc,cls} -> class of exception; {0,exc,msg} -> message from exception - customFactories.put("exc", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseException(formatString, stringBuffer, objectToParse))); + customFactories.put("exc", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseException(formatString, stringBuffer, objectToParse))); // {0,vr} -> transform VersionRange into cleartext string using fml.messages.version.restriction.* strings - customFactories.put("vr", (name, formatString, locale) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseVersionRange)); + customFactories.put("vr", (_, _, _) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseVersionRange)); // {0,featurebound} -> transform feature bound to cleartext string - customFactories.put("featurebound", (name, formatString, locale) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseFeatureBoundValue)); + customFactories.put("featurebound", (_, _, _) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseFeatureBoundValue)); // {0,i18n,fml.message} -> pass object to i18n string 'fml.message' - customFactories.put("i18n", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(ForgeI18n.parseMessage(formatString, o)))); + customFactories.put("i18n", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(ForgeI18n.parseMessage(formatString, o)))); // {0,ornull,fml.absent} -> append String value of o, or i18n string 'fml.absent' (message format transforms nulls into the string literal "null") - customFactories.put("ornull", ((name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(Objects.equals(String.valueOf(o),"null") ? ForgeI18n.parseMessage(formatString) : String.valueOf(o))))); + customFactories.put("ornull", ((_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(Objects.equals(String.valueOf(o),"null") ? ForgeI18n.parseMessage(formatString) : String.valueOf(o))))); } private static void parseException(final String formatString, final StringBuffer stringBuffer, final Object objectToParse) { diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 107a08503e..cf0b5a8dd0 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -7,7 +7,6 @@ package net.minecraftforge.common; import net.minecraft.DetectedVersion; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BiomeColors; import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.commands.synchronization.SingletonArgumentInfo; @@ -30,15 +29,16 @@ 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.RecipeSerializer; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.item.Items; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.pathfinder.PathType; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.ForgeAtlasProvider; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ForgeBiomeTagsProvider; @@ -49,7 +49,6 @@ import net.minecraftforge.common.data.ForgeFluidTagsProvider; import net.minecraftforge.common.data.ForgeItemTagsProvider; import net.minecraftforge.common.data.ForgeLootTableProvider; import net.minecraftforge.common.data.ForgeRecipeProvider; -import net.minecraftforge.common.data.ForgeSpriteSourceProvider; import net.minecraftforge.common.data.ForgeStructureTagsProvider; import net.minecraftforge.common.data.VanillaSoundDefinitionsProvider; import net.minecraftforge.common.loot.CanToolPerformAction; @@ -63,7 +62,6 @@ import net.minecraftforge.common.world.NoneBiomeModifier; import net.minecraftforge.common.world.NoneStructureModifier; import net.minecraftforge.common.world.StructureModifier; import net.minecraftforge.event.network.GatherLoginConfigurationTasksEvent; -import net.minecraftforge.event.server.ServerAboutToStartEvent; import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.ForgeFlowingFluid; @@ -72,6 +70,7 @@ import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.config.ModConfigEvent; import net.minecraftforge.fml.event.lifecycle.*; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.registries.*; import net.minecraftforge.registries.holdersets.AndHolderSet; import net.minecraftforge.registries.holdersets.AnyHolderSet; @@ -110,16 +109,12 @@ import net.minecraftforge.common.crafting.ingredients.CompoundIngredient; import net.minecraftforge.common.crafting.ingredients.DifferenceIngredient; import net.minecraftforge.common.crafting.ingredients.IIngredientSerializer; import net.minecraftforge.common.crafting.ingredients.IntersectionIngredient; -import net.minecraftforge.common.crafting.ingredients.PartialNBTIngredient; -import net.minecraftforge.common.crafting.ingredients.StrictNBTIngredient; +import net.minecraftforge.common.crafting.ingredients.NBTIngredient; import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; - import com.mojang.serialization.MapCodec; - import org.jetbrains.annotations.Nullable; - import java.lang.reflect.Method; import java.util.*; import java.util.concurrent.CompletableFuture; @@ -262,11 +257,6 @@ public class ForgeMod { public int getTintColor() { return 0xFF3F76E4; } - - @Override - public int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos pos) { - return BiomeColors.getAverageWaterColor(getter, pos) | 0xFF000000; - } }); } }); @@ -315,10 +305,10 @@ public class ForgeMod { } }); - private static final DeferredRegister LOOT_CONDITION_TYPES = deferred(Registries.LOOT_CONDITION_TYPE); + private static final DeferredRegister> LOOT_CONDITION_TYPES = deferred(Registries.LOOT_CONDITION_TYPE); static { - LOOT_CONDITION_TYPES.register("loot_table_id", () -> LootTableIdCondition.TYPE); - LOOT_CONDITION_TYPES.register("can_tool_perform_action", () -> CanToolPerformAction.TYPE); + LOOT_CONDITION_TYPES.register("loot_table_id", () -> LootTableIdCondition.CODEC); + LOOT_CONDITION_TYPES.register("can_tool_perform_action", () -> CanToolPerformAction.CODEC); } private static final DeferredRegister> CONDITION_SERIALIZERS = deferred(ForgeRegistries.Keys.CONDITION_SERIALIZERS); @@ -341,8 +331,7 @@ public class ForgeMod { private static final DeferredRegister> INGREDIENT_SERIALIZERS = deferred(ForgeRegistries.Keys.INGREDIENT_SERIALIZERS); static { INGREDIENT_SERIALIZERS.register("compound", () -> CompoundIngredient.SERIALIZER); - INGREDIENT_SERIALIZERS.register("nbt", () -> StrictNBTIngredient.SERIALIZER); - INGREDIENT_SERIALIZERS.register("partial_nbt", () -> PartialNBTIngredient.SERIALIZER); + INGREDIENT_SERIALIZERS.register("nbt", () -> NBTIngredient.SERIALIZER); INGREDIENT_SERIALIZERS.register("difference", () -> DifferenceIngredient.SERIALIZER); INGREDIENT_SERIALIZERS.register("intersection", () -> IntersectionIngredient.SERIALIZER); } @@ -412,7 +401,6 @@ public class ForgeMod { context.registerDisplayTest(IExtensionPoint.DisplayTest.IGNORE_ALL_VERSION); StartupMessageManager.addModMessage("Forge version "+ForgeVersion.getVersion()); - ServerAboutToStartEvent.BUS.addListener(VillagerTradingManager::loadTrades); ForgeInternalHandler.register(); GatherLoginConfigurationTasksEvent.BUS.addListener(ForgeNetworkConfigurationHandler::gatherInit); @@ -458,8 +446,11 @@ public class ForgeMod { gen.addProvider(event.includeServer(), new ForgeBiomeTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new ForgeStructureTagsProvider(packOutput, lookupProvider, existingFileHelper)); - gen.addProvider(event.includeClient(), new ForgeSpriteSourceProvider(packOutput, existingFileHelper)); gen.addProvider(event.includeClient(), new VanillaSoundDefinitionsProvider(packOutput, existingFileHelper)); + // The provider uses Client only classes, so put a side guard on it. + if (FMLLoader.getDist() == Dist.CLIENT) { + gen.addProvider(event.includeClient(), new ForgeAtlasProvider(packOutput)); + } } // done in an event instead of deferred to only enable if a mod requests it @@ -520,7 +511,7 @@ public class ForgeMod { } public static final PermissionNode USE_SELECTORS_PERMISSION = new PermissionNode<>("forge", "use_entity_selectors", - PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && Commands.LEVEL_GAMEMASTERS.check(player.permissions())); + PermissionTypes.BOOLEAN, (player, _, _) -> player != null && Commands.LEVEL_GAMEMASTERS.check(player.permissions())); /** * TODO: Remove when {@link ForgeRegistry#addAlias(Identifier, Identifier)} is elevated to {@link IForgeRegistry}. diff --git a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java index d4bc1f0468..97a2789e32 100644 --- a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java +++ b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java @@ -29,7 +29,7 @@ public class ForgeStatesProvider implements IModStateProvider { } private static ModLoadingState gather(String name, ModLoadingState after, Runnable inline) { - return gather(name, after).withInline(ml -> inline.run()); + return gather(name, after).withInline(inline); } private static ModLoadingState.Builder complete(String name, ModLoadingState after) { @@ -37,7 +37,7 @@ public class ForgeStatesProvider implements IModStateProvider { } private static ModLoadingState complete(String name, ModLoadingState after, Runnable inline) { - return complete(name, after).withInline(ml -> inline.run()); + return complete(name, after).withInline(inline); } @Override diff --git a/src/main/java/net/minecraftforge/common/IForgeShearable.java b/src/main/java/net/minecraftforge/common/IForgeShearable.java deleted file mode 100644 index 8e671d63db..0000000000 --- a/src/main/java/net/minecraftforge/common/IForgeShearable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common; - -import java.util.Collections; -import java.util.List; - -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * - * This allows for mods to create there own Shear-like items - * and have them interact with Blocks/Entities without extra work. - * Also, if your block/entity supports the Shears, this allows you - * to support mod-shears as well. - * - */ -public interface IForgeShearable { - /** - * Checks if the object is currently shearable - * Example: Sheep return false when they have no wool - * - * @param item The ItemStack that is being used, may be empty. - * @param level The current level. - * @param pos Block's position in level. - * @return If this is shearable, and onSheared should be called. - */ - default boolean isShearable(@NotNull ItemStack item, Level level, BlockPos pos) { - return true; - } - - /** - * Performs the shear function on this object. - * This is called for both client, and server. - * The object should perform all actions related to being sheared, - * except for dropping of the items, and removal of the block. - * As those are handled by ItemShears itself. - * - * Returns a list of items that resulted from the shearing process. - * - * For entities, they should trust there internal location information - * over the values passed into this function. - * - * @param item The ItemStack that is being used, may be empty. - * @param level The current level. - * @param pos If this is a block, the block's position in level. - * @param fortune The fortune level of the shears being used. - * @return A List containing all items from this shearing. May be empty. - */ - @NotNull - default List onSheared(@Nullable Player player, @NotNull ItemStack item, Level level, BlockPos pos, int fortune) { - return Collections.emptyList(); - } -} diff --git a/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java b/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java index e620898253..6139b6674d 100644 --- a/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java +++ b/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java @@ -52,17 +52,17 @@ public class LenientUnboundedMapCodec implements BaseMapCodec, Codec final DataResult v = elementCodec().parse(ops, pair.getSecond()); final DataResult> entry = k.apply2stable(Pair::of, v); - entry.error().ifPresent(e -> failed.add(pair)); + entry.error().ifPresent(_ -> failed.add(pair)); entry.result().ifPresent(e -> read.put(e.getFirst(), e.getSecond())); // FORGE: This line moved outside the below apply2stable condition - return r.apply2stable((u, p) -> u, entry); + return r.apply2stable((u, _) -> u, entry); }, - (r1, r2) -> r1.apply2stable((u1, u2) -> u1, r2) + (r1, r2) -> r1.apply2stable((u1, _) -> u1, r2) ); final Map elements = read.build(); final T errors = ops.createMap(failed.build().stream()); - return result.map(unit -> elements).setPartial(elements).mapError(e -> e + " missed input: " + errors); + return result.map(_ -> elements).setPartial(elements).mapError(e -> e + " missed input: " + errors); } @Override diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index efc38caa0e..2a6093a3ca 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -67,7 +67,7 @@ public class MinecraftForge { * @see ModLoadingContext#registerConfig(ModConfig.Type, IConfigSpec) */ public static void registerConfigScreen(Function screenFunction) { - registerConfigScreen((mcClient, modsScreen) -> screenFunction.apply(modsScreen)); + registerConfigScreen((_, modsScreen) -> screenFunction.apply(modsScreen)); } /** diff --git a/src/main/java/net/minecraftforge/common/TagConventionMappings.java b/src/main/java/net/minecraftforge/common/TagConventionMappings.java index 9266376fac..1e65dec2bf 100644 --- a/src/main/java/net/minecraftforge/common/TagConventionMappings.java +++ b/src/main/java/net/minecraftforge/common/TagConventionMappings.java @@ -238,7 +238,7 @@ public final class TagConventionMappings { legacyToCommon(Registries.ITEM, forgeRl("tools/bows"), Tags.Items.TOOLS_BOW), legacyToCommon(Registries.ITEM, forgeRl("tools/crossbows"), Tags.Items.TOOLS_CROSSBOW), legacyToCommon(Registries.ITEM, forgeRl("tools/fishing_rods"), Tags.Items.TOOLS_FISHING_ROD), - legacyToCommon(Registries.ITEM, forgeRl("tools/tridents"), Tags.Items.TOOLS_SPEAR), + legacyToCommon(Registries.ITEM, forgeRl("tools/tridents"), Tags.Items.TOOLS_TRIDENT), legacyToCommon(Registries.ITEM, forgeRl("tools/shears"), Tags.Items.TOOLS_SHEAR), legacyToCommon(Registries.ITEM, forgeRl("armors"), Tags.Items.ARMORS), diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index 6fc8d3e1cc..7977a14959 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -8,14 +8,18 @@ package net.minecraftforge.common; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.tags.BlockItemTagId; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; +import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemUseAnimation; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; @@ -28,6 +32,7 @@ import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper; public class Tags { public static void init() { + BlockItems.init(); Blocks.init(); EntityTypes.init(); Items.init(); @@ -37,6 +42,223 @@ public class Tags { Structures.init(); } + public static class BlockItems { + private static void init() {} + //region forge specific tags + public static final BlockItemTagId STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); + public static final BlockItemTagId STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); + //endregion + + + //region `c` tags for common conventions + // Note: Other loaders have additional `c` tags that are exclusive to their loader. + // Forge only adopts `c` tags that are common across all loaders. + public static final BlockItemTagId BARRELS = cTag("barrels"); + public static final BlockItemTagId BARRELS_WOODEN = cTag("barrels/wooden"); + /** + * Equivalent to the "minecraft:bars" block tag. + */ + public static final BlockItemTagId BARS = cTag("bars"); + public static final BlockItemTagId BARS_COPPER = cTag("bars/copper"); + public static final BlockItemTagId BARS_IRON = cTag("bars/iron"); + public static final BlockItemTagId BOOKSHELVES = cTag("bookshelves"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final BlockItemTagId BUDDING_BLOCKS = cTag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final BlockItemTagId BUDS = cTag("buds"); + public static final BlockItemTagId CHAINS = cTag("chains"); + public static final BlockItemTagId CHESTS = cTag("chests"); + public static final BlockItemTagId CHESTS_ENDER = cTag("chests/ender"); + public static final BlockItemTagId CHESTS_TRAPPED = cTag("chests/trapped"); + public static final BlockItemTagId CHESTS_WOODEN = cTag("chests/wooden"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final BlockItemTagId CLUSTERS = cTag("clusters"); + public static final BlockItemTagId COBBLESTONES = cTag("cobblestones"); + public static final BlockItemTagId COBBLESTONES_DEEPSLATE = cTag("cobblestones/deepslate"); + public static final BlockItemTagId COBBLESTONES_INFESTED = cTag("cobblestones/infested"); + public static final BlockItemTagId COBBLESTONES_MOSSY = cTag("cobblestones/mossy"); + public static final BlockItemTagId COBBLESTONES_NORMAL = cTag("cobblestones/normal"); + public static final BlockItemTagId CONCRETES = cTag("concretes"); + + public static final BlockItemTagId END_STONES = cTag("end_stones"); + + public static final BlockItemTagId FENCE_GATES = cTag("fence_gates"); + public static final BlockItemTagId FENCE_GATES_WOODEN = cTag("fence_gates/wooden"); + + public static final BlockItemTagId FENCES = cTag("fences"); + public static final BlockItemTagId FENCES_NETHER_BRICK = cTag("fences/nether_brick"); + public static final BlockItemTagId FENCES_WOODEN = cTag("fences/wooden"); + + /** + * Contains living ground-based flowers that are 1 block tall such as Dandelions or Poppy. + * Equivalent to the {@code minecraft:small_flowers} block tag. + * This is NOT aliased with {@link BlockTags#SMALL_FLOWERS} because the vanilla tag is used to make the block weak to swords. + */ + public static final BlockItemTagId FLOWERS_SMALL = cTag("flowers/small"); + /** + * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. + * Equivalent to the {@code minecraft:tall_flowers} block tag in past Minecraft versions. + */ + public static final BlockItemTagId FLOWERS_TALL = cTag("flowers/tall"); + /** + * Contains any living plant block that contains flowers or is a flower itself. + * Equivalent to the {@code minecraft:flowers} block tag. + * Aliased with {@link BlockTags#FLOWERS}. + */ + public static final BlockItemTagId FLOWERS = cTag("flowers"); + + public static final BlockItemTagId GRAVELS = cTag("gravels"); + + public static final BlockItemTagId GLASS_BLOCKS = cTag("glass_blocks"); + public static final BlockItemTagId GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final BlockItemTagId GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); + public static final BlockItemTagId GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + + public static final BlockItemTagId GLASS_PANES = cTag("glass_panes"); + public static final BlockItemTagId GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); + public static final BlockItemTagId GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + + public static final BlockItemTagId NATURAL_LOGS = cTag("natural_logs"); + public static final BlockItemTagId NATURAL_LOGS_NETHER = cTag("natural_logs/nether"); + public static final BlockItemTagId NATURAL_LOGS_OVERWORLD = cTag("natural_logs/overworld"); + + public static final BlockItemTagId NATURAL_WOODS = cTag("natural_woods"); + + public static final BlockItemTagId NETHERRACKS = cTag("netherracks"); + + public static final BlockItemTagId OBSIDIANS = cTag("obsidians"); + /** + * For common obsidian that has no special quirks or behaviours - ideal for recipe use. + * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. + */ + public static final BlockItemTagId OBSIDIANS_NORMAL = cTag("obsidians/normal"); + public static final BlockItemTagId OBSIDIANS_CRYING = cTag("obsidians/crying"); + /** + * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_DEEPSLATE = cTag("ore_bearing_ground/deepslate"); + /** + * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_NETHERRACK = cTag("ore_bearing_ground/netherrack"); + /** + * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_STONE = cTag("ore_bearing_ground/stone"); + /** + * Ores which on average result in more than one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_DENSE = cTag("ore_rates/dense"); + /** + * Ores which on average result in one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_SINGULAR = cTag("ore_rates/singular"); + /** + * Ores which on average result in less than one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_SPARSE = cTag("ore_rates/sparse"); + public static final BlockItemTagId ORES = cTag("ores"); + public static final BlockItemTagId ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); + public static final BlockItemTagId ORES_QUARTZ = cTag("ores/quartz"); + public static final BlockItemTagId ORES_COAL = cTag("ores/coal"); + public static final BlockItemTagId ORES_COPPER = cTag("ores/copper"); + public static final BlockItemTagId ORES_DIAMOND = cTag("ores/diamond"); + public static final BlockItemTagId ORES_EMERALD = cTag("ores/emerald"); + public static final BlockItemTagId ORES_GOLD = cTag("ores/gold"); + public static final BlockItemTagId ORES_IRON = cTag("ores/iron"); + public static final BlockItemTagId ORES_LAPIS = cTag("ores/lapis"); + public static final BlockItemTagId ORES_REDSTONE = cTag("ores/redstone"); + /** + * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_DEEPSLATE = cTag("ores_in_ground/deepslate"); + /** + * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_NETHERRACK = cTag("ores_in_ground/netherrack"); + /** + * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_STONE = cTag("ores_in_ground/stone"); + public static final BlockItemTagId PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); + public static final BlockItemTagId PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); + public static final BlockItemTagId PUMPKINS = cTag("pumpkins"); + /** For pumpkins that are not carved. */ + public static final BlockItemTagId PUMPKINS_NORMAL = cTag("pumpkins/normal"); + /** For pumpkins that are already carved but not a light source. */ + public static final BlockItemTagId PUMPKINS_CARVED = cTag("pumpkins/carved"); + /** For pumpkins that are already carved and a light source. */ + public static final BlockItemTagId PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final BlockItemTagId ROPES = cTag("ropes"); + + public static final BlockItemTagId SANDS = cTag("sands"); + public static final BlockItemTagId SANDS_COLORLESS = cTag("sands/colorless"); + public static final BlockItemTagId SANDS_RED = cTag("sands/red"); + + public static final BlockItemTagId SANDSTONE_BLOCKS = cTag("sandstone/blocks"); + public static final BlockItemTagId SANDSTONE_SLABS = cTag("sandstone/slabs"); + public static final BlockItemTagId SANDSTONE_STAIRS = cTag("sandstone/stairs"); + public static final BlockItemTagId SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); + public static final BlockItemTagId SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); + public static final BlockItemTagId SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final BlockItemTagId STONES = cTag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ + public static final BlockItemTagId STORAGE_BLOCKS = cTag("storage_blocks"); + public static final BlockItemTagId STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); + public static final BlockItemTagId STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); + public static final BlockItemTagId STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); + public static final BlockItemTagId STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); + public static final BlockItemTagId STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); + public static final BlockItemTagId STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); + public static final BlockItemTagId STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); + public static final BlockItemTagId STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); + public static final BlockItemTagId STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); + public static final BlockItemTagId STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); + public static final BlockItemTagId STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); + public static final BlockItemTagId STORAGE_BLOCKS_RESIN = cTag("storage_blocks/resin"); + public static final BlockItemTagId STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); + public static final BlockItemTagId STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); + public static final BlockItemTagId STRIPPED_LOGS = cTag("stripped_logs"); + public static final BlockItemTagId STRIPPED_WOODS = cTag("stripped_woods"); + //endregion + + private static BlockItemTagId cTag(String name) { + return create(Identifier.fromNamespaceAndPath("c", name)); + } + + private static BlockItemTagId forgeTag(String name) { + return create(Identifier.fromNamespaceAndPath("forge", name)); + } + + private static BlockItemTagId create(Identifier id) { + return BlockItemTagId.create(id, id); + } + } + public static class Blocks { private static void init() {} @@ -50,98 +272,45 @@ public class Tags { public static final TagKey NEEDS_WOOD_TOOL = forgeTag("needs_wood_tool"); public static final TagKey NEEDS_GOLD_TOOL = forgeTag("needs_gold_tool"); public static final TagKey NEEDS_NETHERITE_TOOL = forgeTag("needs_netherite_tool"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); - - public static final TagKey CHESTS_ENDER = forgeTag("chests/ender"); - public static final TagKey CHESTS_TRAPPED = forgeTag("chests/trapped"); - public static final TagKey CHORUS_ADDITIONALLY_GROWS_ON = forgeTag("chorus_additionally_grows_on"); - public static final TagKey COBBLESTONE_NORMAL = forgeTag("cobblestone/normal"); - public static final TagKey COBBLESTONE_INFESTED = forgeTag("cobblestone/infested"); - public static final TagKey COBBLESTONE_MOSSY = forgeTag("cobblestone/mossy"); - public static final TagKey COBBLESTONE_DEEPSLATE = forgeTag("cobblestone/deepslate"); - public static final TagKey END_STONES = forgeTag("end_stones"); - public static final TagKey FENCE_GATES = forgeTag("fence_gates"); - public static final TagKey FENCE_GATES_WOODEN = forgeTag("fence_gates/wooden"); - public static final TagKey FENCES = forgeTag("fences"); - public static final TagKey FENCES_NETHER_BRICK = forgeTag("fences/nether_brick"); - public static final TagKey FENCES_WOODEN = forgeTag("fences/wooden"); - - public static final TagKey GRAVEL = forgeTag("gravel"); - public static final TagKey NETHERRACK = forgeTag("netherrack"); - /** - * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = forgeTag("ore_bearing_ground/deepslate"); - /** - * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_NETHERRACK = forgeTag("ore_bearing_ground/netherrack"); - /** - * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_STONE = forgeTag("ore_bearing_ground/stone"); - /** - * Ores which on average result in more than one resource worth of materials - */ - public static final TagKey ORE_RATES_DENSE = forgeTag("ore_rates/dense"); - /** - * Ores which on average result in one resource worth of materials - */ - public static final TagKey ORE_RATES_SINGULAR = forgeTag("ore_rates/singular"); - /** - * Ores which on average result in less than one resource worth of materials - */ - public static final TagKey ORE_RATES_SPARSE = forgeTag("ore_rates/sparse"); - - public static final TagKey ORES_COAL = forgeTag("ores/coal"); - public static final TagKey ORES_COPPER = forgeTag("ores/copper"); - public static final TagKey ORES_DIAMOND = forgeTag("ores/diamond"); - public static final TagKey ORES_EMERALD = forgeTag("ores/emerald"); - public static final TagKey ORES_GOLD = forgeTag("ores/gold"); - public static final TagKey ORES_IRON = forgeTag("ores/iron"); - public static final TagKey ORES_LAPIS = forgeTag("ores/lapis"); - public static final TagKey ORES_REDSTONE = forgeTag("ores/redstone"); - /** - * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_DEEPSLATE = forgeTag("ores_in_ground/deepslate"); - /** - * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_NETHERRACK = forgeTag("ores_in_ground/netherrack"); - /** - * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_STONE = forgeTag("ores_in_ground/stone"); - public static final TagKey SAND = forgeTag("sand"); - public static final TagKey SAND_COLORLESS = forgeTag("sand/colorless"); - public static final TagKey SAND_RED = forgeTag("sand/red"); + public static final TagKey STORAGE_BLOCKS_AMETHYST = BlockItems.STORAGE_BLOCKS_AMETHYST.block(); + public static final TagKey STORAGE_BLOCKS_QUARTZ = BlockItems.STORAGE_BLOCKS_QUARTZ.block(); //endregion //region `c` tags for common conventions // Note: Other loaders have additional `c` tags that are exclusive to their loader. // Forge only adopts `c` tags that are common across all loaders. - public static final TagKey BARRELS = cTag("barrels"); - public static final TagKey BARRELS_WOODEN = cTag("barrels/wooden"); - public static final TagKey BOOKSHELVES = cTag("bookshelves"); + public static final TagKey BARRELS = BlockItems.BARRELS.block(); + public static final TagKey BARRELS_WOODEN = BlockItems.BARRELS_WOODEN.block(); + /** + * Equivalent to the "minecraft:bars" block tag. + */ + public static final TagKey BARS = BlockItems.BARS.block(); + public static final TagKey BARS_COPPER = BlockItems.BARS_COPPER.block(); + public static final TagKey BARS_IRON = BlockItems.BARS_IRON.block(); + public static final TagKey BOOKSHELVES = BlockItems.BOOKSHELVES.block(); /** * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks */ - public static final TagKey BUDDING_BLOCKS = cTag("budding_blocks"); + public static final TagKey BUDDING_BLOCKS = BlockItems.BUDDING_BLOCKS.block(); /** * For blocks that are similar to amethyst where they have buddings forming from budding blocks */ - public static final TagKey BUDS = cTag("buds"); - public static final TagKey CHAINS = cTag("chains"); - public static final TagKey CHESTS = cTag("chests"); - public static final TagKey CHESTS_WOODEN = cTag("chests/wooden"); + public static final TagKey BUDS = BlockItems.BUDS.block(); + public static final TagKey CHAINS = BlockItems.CHAINS.block(); + public static final TagKey CHESTS = BlockItems.CHESTS.block(); + public static final TagKey CHESTS_ENDER = BlockItems.CHESTS_ENDER.block(); + public static final TagKey CHESTS_TRAPPED = BlockItems.CHESTS_TRAPPED.block(); + public static final TagKey CHESTS_WOODEN = BlockItems.CHESTS_WOODEN.block(); /** * For blocks that are similar to amethyst where they have clusters forming from budding blocks */ - public static final TagKey CLUSTERS = cTag("clusters"); - public static final TagKey COBBLESTONES = cTag("cobblestones"); - public static final TagKey CONCRETES = cTag("concretes"); + public static final TagKey CLUSTERS = BlockItems.CLUSTERS.block(); + public static final TagKey COBBLESTONES = BlockItems.COBBLESTONES.block(); + public static final TagKey COBBLESTONES_DEEPSLATE = BlockItems.COBBLESTONES_DEEPSLATE.block(); + public static final TagKey COBBLESTONES_INFESTED = BlockItems.COBBLESTONES_INFESTED.block(); + public static final TagKey COBBLESTONES_MOSSY = BlockItems.COBBLESTONES_MOSSY.block(); + public static final TagKey COBBLESTONES_NORMAL = BlockItems.COBBLESTONES_NORMAL.block(); + public static final TagKey CONCRETES = BlockItems.CONCRETES.block(); /** * Tag that holds all blocks that can be dyed a specific color. @@ -165,58 +334,124 @@ public class Tags { public static final TagKey DYED_WHITE = cTag("dyed/white"); public static final TagKey DYED_YELLOW = cTag("dyed/yellow"); + public static final TagKey END_STONES = BlockItems.END_STONES.block(); + + public static final TagKey FENCE_GATES = BlockItems.FENCE_GATES.block(); + public static final TagKey FENCE_GATES_WOODEN = BlockItems.FENCE_GATES_WOODEN.block(); + + public static final TagKey FENCES = BlockItems.FENCES.block(); + public static final TagKey FENCES_NETHER_BRICK = BlockItems.FENCES_NETHER_BRICK.block(); + public static final TagKey FENCES_WOODEN = BlockItems.FENCES_WOODEN.block(); + /** * Contains living ground-based flowers that are 1 block tall such as Dandelions or Poppy. * Equivalent to the {@code minecraft:small_flowers} block tag. + * This is NOT aliased with {@link BlockTags#SMALL_FLOWERS} because the vanilla tag is used to make the block weak to swords. */ - public static final TagKey FLOWERS_SMALL = cTag("flowers/small"); + public static final TagKey FLOWERS_SMALL = BlockItems.FLOWERS_SMALL.block(); /** * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. * Equivalent to the {@code minecraft:tall_flowers} block tag in past Minecraft versions. */ - public static final TagKey FLOWERS_TALL = cTag("flowers/tall"); + public static final TagKey FLOWERS_TALL = BlockItems.FLOWERS_TALL.block(); /** * Contains any living plant block that contains flowers or is a flower itself. * Equivalent to the {@code minecraft:flowers} block tag. + * Aliased with {@link BlockTags#FLOWERS}. */ - public static final TagKey FLOWERS = cTag("flowers"); + public static final TagKey FLOWERS = BlockItems.FLOWERS.block(); - public static final TagKey GLASS_BLOCKS = cTag("glass_blocks"); - public static final TagKey GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + public static final TagKey GRAVELS = BlockItems.GRAVELS.block(); + + public static final TagKey GLASS_BLOCKS = BlockItems.GLASS_BLOCKS.block(); + public static final TagKey GLASS_BLOCKS_COLORLESS = BlockItems.GLASS_BLOCKS_COLORLESS.block(); /** * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes */ - public static final TagKey GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); - public static final TagKey GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + public static final TagKey GLASS_BLOCKS_CHEAP = BlockItems.GLASS_BLOCKS_CHEAP.block(); + public static final TagKey GLASS_BLOCKS_TINTED = BlockItems.GLASS_BLOCKS_TINTED.block(); - public static final TagKey GLASS_PANES = cTag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); - public static final TagKey GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + public static final TagKey GLASS_PANES = BlockItems.GLASS_PANES.block(); + public static final TagKey GLASS_PANES_COLORLESS = BlockItems.GLASS_PANES_COLORLESS.block(); + public static final TagKey GLAZED_TERRACOTTAS = BlockItems.GLAZED_TERRACOTTAS.block(); /** * Tag that holds all blocks that recipe viewers should not show to users. * Recipe viewers may use this to automatically find the corresponding BlockItem to hide. */ public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = cTag("hidden_from_recipe_viewers"); - public static final TagKey OBSIDIANS = cTag("obsidians"); + + public static final TagKey NATURAL_LOGS = BlockItems.NATURAL_LOGS.block(); + public static final TagKey NATURAL_LOGS_NETHER = BlockItems.NATURAL_LOGS_NETHER.block(); + public static final TagKey NATURAL_LOGS_OVERWORLD = BlockItems.NATURAL_LOGS_OVERWORLD.block(); + + public static final TagKey NATURAL_WOODS = BlockItems.NATURAL_WOODS.block(); + + public static final TagKey NETHERRACKS = BlockItems.NETHERRACKS.block(); + + public static final TagKey OBSIDIANS = BlockItems.OBSIDIANS.block(); /** * For common obsidian that has no special quirks or behaviours - ideal for recipe use. * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. */ - public static final TagKey OBSIDIANS_NORMAL = cTag("obsidians/normal"); - public static final TagKey OBSIDIANS_CRYING = cTag("obsidians/crying"); - public static final TagKey ORES = cTag("ores"); - public static final TagKey ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); - public static final TagKey ORES_QUARTZ = cTag("ores/quartz"); - public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); - public static final TagKey PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); - public static final TagKey PUMPKINS = cTag("pumpkins"); + public static final TagKey OBSIDIANS_NORMAL = BlockItems.OBSIDIANS_NORMAL.block(); + public static final TagKey OBSIDIANS_CRYING = BlockItems.OBSIDIANS_CRYING.block(); + /** + * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = BlockItems.ORE_BEARING_GROUND_DEEPSLATE.block(); + /** + * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = BlockItems.ORE_BEARING_GROUND_NETHERRACK.block(); + /** + * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_STONE = BlockItems.ORE_BEARING_GROUND_STONE.block(); + /** + * Ores which on average result in more than one resource worth of materials + */ + public static final TagKey ORE_RATES_DENSE = BlockItems.ORE_RATES_DENSE.block(); + /** + * Ores which on average result in one resource worth of materials + */ + public static final TagKey ORE_RATES_SINGULAR = BlockItems.ORE_RATES_SINGULAR.block(); + /** + * Ores which on average result in less than one resource worth of materials + */ + public static final TagKey ORE_RATES_SPARSE = BlockItems.ORE_RATES_SPARSE.block(); + public static final TagKey ORES = BlockItems.ORES.block(); + public static final TagKey ORES_NETHERITE_SCRAP = BlockItems.ORES_NETHERITE_SCRAP.block(); + public static final TagKey ORES_QUARTZ = BlockItems.ORES_QUARTZ.block(); + public static final TagKey ORES_COAL = BlockItems.ORES_COAL.block(); + public static final TagKey ORES_COPPER = BlockItems.ORES_COPPER.block(); + public static final TagKey ORES_DIAMOND = BlockItems.ORES_DIAMOND.block(); + public static final TagKey ORES_EMERALD = BlockItems.ORES_EMERALD.block(); + public static final TagKey ORES_GOLD = BlockItems.ORES_GOLD.block(); + public static final TagKey ORES_IRON = BlockItems.ORES_IRON.block(); + public static final TagKey ORES_LAPIS = BlockItems.ORES_LAPIS.block(); + public static final TagKey ORES_REDSTONE = BlockItems.ORES_REDSTONE.block(); + /** + * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_DEEPSLATE = BlockItems.ORES_IN_GROUND_DEEPSLATE.block(); + /** + * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_NETHERRACK = BlockItems.ORES_IN_GROUND_NETHERRACK.block(); + /** + * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_STONE = BlockItems.ORES_IN_GROUND_STONE.block(); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = BlockItems.PLAYER_WORKSTATIONS_CRAFTING_TABLES.block(); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = BlockItems.PLAYER_WORKSTATIONS_FURNACES.block(); + public static final TagKey PUMPKINS = BlockItems.PUMPKINS.block(); /** For pumpkins that are not carved. */ - public static final TagKey PUMPKINS_NORMAL = cTag("pumpkins/normal"); + public static final TagKey PUMPKINS_NORMAL = BlockItems.PUMPKINS_NORMAL.block(); /** For pumpkins that are already carved but not a light source. */ - public static final TagKey PUMPKINS_CARVED = cTag("pumpkins/carved"); + public static final TagKey PUMPKINS_CARVED = BlockItems.PUMPKINS_CARVED.block(); /** For pumpkins that are already carved and a light source. */ - public static final TagKey PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final TagKey PUMPKINS_JACK_O_LANTERNS = BlockItems.PUMPKINS_JACK_O_LANTERNS.block(); /** * Blocks should be included in this tag if their movement/relocation can cause serious issues such * as world corruption upon being moved or for balance reason where the block should not be able to be relocated. @@ -224,17 +459,21 @@ public class Tags { * {@link BlockBehaviour.BlockStateBase#getPistonPushReaction}. */ public static final TagKey RELOCATION_NOT_SUPPORTED = cTag("relocation_not_supported"); - public static final TagKey ROPES = cTag("ropes"); + public static final TagKey ROPES = BlockItems.ROPES.block(); - public static final TagKey SANDSTONE_BLOCKS = cTag("sandstone/blocks"); - public static final TagKey SANDSTONE_SLABS = cTag("sandstone/slabs"); - public static final TagKey SANDSTONE_STAIRS = cTag("sandstone/stairs"); - public static final TagKey SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); - public static final TagKey SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); - public static final TagKey SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); - public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); - public static final TagKey SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); - public static final TagKey SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + public static final TagKey SANDS = BlockItems.SANDS.block(); + public static final TagKey SANDS_COLORLESS = BlockItems.SANDS_COLORLESS.block(); + public static final TagKey SANDS_RED = BlockItems.SANDS_RED.block(); + + public static final TagKey SANDSTONE_BLOCKS = BlockItems.SANDSTONE_BLOCKS.block(); + public static final TagKey SANDSTONE_SLABS = BlockItems.SANDSTONE_SLABS.block(); + public static final TagKey SANDSTONE_STAIRS = BlockItems.SANDSTONE_STAIRS.block(); + public static final TagKey SANDSTONE_RED_BLOCKS = BlockItems.SANDSTONE_RED_BLOCKS.block(); + public static final TagKey SANDSTONE_RED_SLABS = BlockItems.SANDSTONE_RED_SLABS.block(); + public static final TagKey SANDSTONE_RED_STAIRS = BlockItems.SANDSTONE_RED_STAIRS.block(); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = BlockItems.SANDSTONE_UNCOLORED_BLOCKS.block(); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = BlockItems.SANDSTONE_UNCOLORED_SLABS.block(); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = BlockItems.SANDSTONE_UNCOLORED_STAIRS.block(); /** * Tag that holds all head based blocks such as Skeleton Skull or Player Head. (Named skulls to match minecraft:skulls item tag) */ @@ -242,7 +481,7 @@ public class Tags { /** * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. */ - public static final TagKey STONES = cTag("stones"); + public static final TagKey STONES = BlockItems.STONES.block(); /** * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block * and has a mirror recipe to reverse the crafting with no loss in resources. @@ -250,153 +489,29 @@ public class Tags { * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe * and so, it is considered a special case and not given a storage block tag. */ - public static final TagKey STORAGE_BLOCKS = cTag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); - public static final TagKey STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); - public static final TagKey STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); - public static final TagKey STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); - public static final TagKey STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); - public static final TagKey STRIPPED_LOGS = cTag("stripped_logs"); - public static final TagKey STRIPPED_WOODS = cTag("stripped_woods"); + public static final TagKey STORAGE_BLOCKS = BlockItems.STORAGE_BLOCKS.block(); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = BlockItems.STORAGE_BLOCKS_BONE_MEAL.block(); + public static final TagKey STORAGE_BLOCKS_COAL = BlockItems.STORAGE_BLOCKS_COAL.block(); + public static final TagKey STORAGE_BLOCKS_COPPER = BlockItems.STORAGE_BLOCKS_COPPER.block(); + public static final TagKey STORAGE_BLOCKS_DIAMOND = BlockItems.STORAGE_BLOCKS_DIAMOND.block(); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = BlockItems.STORAGE_BLOCKS_DRIED_KELP.block(); + public static final TagKey STORAGE_BLOCKS_EMERALD = BlockItems.STORAGE_BLOCKS_EMERALD.block(); + public static final TagKey STORAGE_BLOCKS_GOLD = BlockItems.STORAGE_BLOCKS_GOLD.block(); + public static final TagKey STORAGE_BLOCKS_IRON = BlockItems.STORAGE_BLOCKS_IRON.block(); + public static final TagKey STORAGE_BLOCKS_LAPIS = BlockItems.STORAGE_BLOCKS_LAPIS.block(); + public static final TagKey STORAGE_BLOCKS_NETHERITE = BlockItems.STORAGE_BLOCKS_NETHERITE.block(); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = BlockItems.STORAGE_BLOCKS_RAW_COPPER.block(); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = BlockItems.STORAGE_BLOCKS_RAW_GOLD.block(); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = BlockItems.STORAGE_BLOCKS_RAW_IRON.block(); + public static final TagKey STORAGE_BLOCKS_REDSTONE = BlockItems.STORAGE_BLOCKS_REDSTONE.block(); + public static final TagKey STORAGE_BLOCKS_RESIN = BlockItems.STORAGE_BLOCKS_RESIN.block(); + public static final TagKey STORAGE_BLOCKS_SLIME = BlockItems.STORAGE_BLOCKS_SLIME.block(); + public static final TagKey STORAGE_BLOCKS_WHEAT = BlockItems.STORAGE_BLOCKS_WHEAT.block(); + public static final TagKey STRIPPED_LOGS = BlockItems.STRIPPED_LOGS.block(); + public static final TagKey STRIPPED_WOODS = BlockItems.STRIPPED_WOODS.block(); public static final TagKey VILLAGER_JOB_SITES = cTag("villager_job_sites"); //endregion - //region Redirect fields for improved backward-compatibility - // TODO: Remove backwards compat redirect fields in 1.22 - /** @deprecated Use {@link #COBBLESTONES} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey COBBLESTONE = COBBLESTONES; - - /** @deprecated Use {@link #GLASS_BLOCKS_CHEAP} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_SILICA = GLASS_BLOCKS_CHEAP; - //endregion - - //region Forge tags that now map to combining multiple `c` tags - // Kept for binary compatibility - // TODO: Remove these in 1.22 - /** @deprecated Use {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS = forgeTag("glass"); - /** @deprecated Use {@link #DYED_BLACK} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BLACK = forgeTag("glass/black"); - /** @deprecated Use {@link #DYED_BLUE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BLUE = forgeTag("glass/blue"); - /** @deprecated Use {@link #DYED_BROWN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BROWN = forgeTag("glass/brown"); - /** @deprecated Use {@link #GLASS_BLOCKS_COLORLESS} and/or {@link #GLASS_PANES_COLORLESS} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_COLORLESS = forgeTag("glass/colorless"); - /** @deprecated Use {@link #DYED_CYAN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_CYAN = forgeTag("glass/cyan"); - /** @deprecated Use {@link #DYED_GRAY} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_GRAY = forgeTag("glass/gray"); - /** @deprecated Use {@link #DYED_GREEN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_GREEN = forgeTag("glass/green"); - /** @deprecated Use {@link #DYED_LIGHT_BLUE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIGHT_BLUE = forgeTag("glass/light_blue"); - /** @deprecated Use {@link #DYED_LIGHT_GRAY} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIGHT_GRAY = forgeTag("glass/light_gray"); - /** @deprecated Use {@link #DYED_LIME} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIME = forgeTag("glass/lime"); - /** @deprecated Use {@link #DYED_MAGENTA} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_MAGENTA = forgeTag("glass/magenta"); - /** @deprecated Use {@link #DYED_ORANGE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_ORANGE = forgeTag("glass/orange"); - /** @deprecated Use {@link #DYED_PINK} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PINK = forgeTag("glass/pink"); - /** @deprecated Use {@link #DYED_PURPLE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PURPLE = forgeTag("glass/purple"); - /** @deprecated Use {@link #DYED_RED} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_RED = forgeTag("glass/red"); - /** @deprecated Use {@link #DYED_WHITE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_WHITE = forgeTag("glass/white"); - /** @deprecated Use {@link #DYED_YELLOW} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_YELLOW = forgeTag("glass/yellow"); - /** @deprecated Use {@link #DYED} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STAINED_GLASS = forgeTag("stained_glass"); - - /** @deprecated Use {@link #DYED_BLACK} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BLACK = forgeTag("glass_panes/black"); - /** @deprecated Use {@link #DYED_BLUE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BLUE = forgeTag("glass_panes/blue"); - /** @deprecated Use {@link #DYED_BROWN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BROWN = forgeTag("glass_panes/brown"); - /** @deprecated Use {@link #DYED_CYAN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_CYAN = forgeTag("glass_panes/cyan"); - /** @deprecated Use {@link #DYED_GRAY} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_GRAY = forgeTag("glass_panes/gray"); - /** @deprecated Use {@link #DYED_GREEN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_GREEN = forgeTag("glass_panes/green"); - /** @deprecated Use {@link #DYED_LIGHT_BLUE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIGHT_BLUE = forgeTag("glass_panes/light_blue"); - /** @deprecated Use {@link #DYED_LIGHT_GRAY} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIGHT_GRAY = forgeTag("glass_panes/light_gray"); - /** @deprecated Use {@link #DYED_LIME} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIME = forgeTag("glass_panes/lime"); - /** @deprecated Use {@link #DYED_MAGENTA} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_MAGENTA = forgeTag("glass_panes/magenta"); - /** @deprecated Use {@link #DYED_ORANGE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_ORANGE = forgeTag("glass_panes/orange"); - /** @deprecated Use {@link #DYED_PINK} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_PINK = forgeTag("glass_panes/pink"); - /** @deprecated Use {@link #DYED_PURPLE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_PURPLE = forgeTag("glass_panes/purple"); - /** @deprecated Use {@link #DYED_RED} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_RED = forgeTag("glass_panes/red"); - /** @deprecated Use {@link #DYED_WHITE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_WHITE = forgeTag("glass_panes/white"); - /** @deprecated Use {@link #DYED_YELLOW} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_YELLOW = forgeTag("glass_panes/yellow"); - /** @deprecated Use {@link #DYED} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STAINED_GLASS_PANES = forgeTag("stained_glass_panes"); - //endregion - private static TagKey cTag(String name) { return BlockTags.create(Identifier.fromNamespaceAndPath("c", name)); } @@ -416,6 +531,10 @@ public class Tags { public static final TagKey> MINECARTS = cTag("minecarts"); public static final TagKey> BOATS = cTag("boats"); + /// Tag containing entity types, generally extending {@link ItemFrame}, + /// that can be placed on the surfaces of blocks to display an item. + public static final TagKey> ITEM_FRAMES = cTag("item_frames"); + /** * Entities should be included in this tag if they are not allowed to be picked up by items or grabbed in a way * that a player can easily move the entity to anywhere they want. Ideal for special entities that should not @@ -440,105 +559,33 @@ public class Tags { private static void init() {} //region `forge` tags for Forge-specific tags - public static final TagKey BONES = forgeTag("bones"); - public static final TagKey CHESTS_ENDER = forgeTag("chests/ender"); - public static final TagKey CHESTS_TRAPPED = forgeTag("chests/trapped"); - public static final TagKey COBBLESTONE_NORMAL = forgeTag("cobblestone/normal"); - public static final TagKey COBBLESTONE_INFESTED = forgeTag("cobblestone/infested"); - public static final TagKey COBBLESTONE_MOSSY = forgeTag("cobblestone/mossy"); - public static final TagKey COBBLESTONE_DEEPSLATE = forgeTag("cobblestone/deepslate"); - public static final TagKey EGGS = forgeTag("eggs"); - public static final TagKey END_STONES = forgeTag("end_stones"); - public static final TagKey FEATHERS = forgeTag("feathers"); - public static final TagKey FENCE_GATES = forgeTag("fence_gates"); - public static final TagKey FENCE_GATES_WOODEN = forgeTag("fence_gates/wooden"); - public static final TagKey FENCES = forgeTag("fences"); - public static final TagKey FENCES_NETHER_BRICK = forgeTag("fences/nether_brick"); - public static final TagKey FENCES_WOODEN = forgeTag("fences/wooden"); - public static final TagKey GRAVEL = forgeTag("gravel"); - public static final TagKey GUNPOWDER = forgeTag("gunpowder"); - public static final TagKey MUSHROOMS = forgeTag("mushrooms"); - public static final TagKey NETHER_STARS = forgeTag("nether_stars"); - public static final TagKey NETHERRACK = forgeTag("netherrack"); - /** - * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = forgeTag("ore_bearing_ground/deepslate"); - /** - * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_NETHERRACK = forgeTag("ore_bearing_ground/netherrack"); - /** - * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation - */ - public static final TagKey ORE_BEARING_GROUND_STONE = forgeTag("ore_bearing_ground/stone"); - /** - * Ores which on average result in more than one resource worth of materials - */ - public static final TagKey ORE_RATES_DENSE = forgeTag("ore_rates/dense"); - /** - * Ores which on average result in one resource worth of materials - */ - public static final TagKey ORE_RATES_SINGULAR = forgeTag("ore_rates/singular"); - /** - * Ores which on average result in less than one resource worth of materials - */ - public static final TagKey ORE_RATES_SPARSE = forgeTag("ore_rates/sparse"); - public static final TagKey ORES_COAL = forgeTag("ores/coal"); - public static final TagKey ORES_COPPER = forgeTag("ores/copper"); - public static final TagKey ORES_DIAMOND = forgeTag("ores/diamond"); - public static final TagKey ORES_EMERALD = forgeTag("ores/emerald"); - public static final TagKey ORES_GOLD = forgeTag("ores/gold"); - public static final TagKey ORES_IRON = forgeTag("ores/iron"); - public static final TagKey ORES_LAPIS = forgeTag("ores/lapis"); - public static final TagKey ORES_REDSTONE = forgeTag("ores/redstone"); - /** - * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_DEEPSLATE = forgeTag("ores_in_ground/deepslate"); - /** - * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_NETHERRACK = forgeTag("ores_in_ground/netherrack"); - /** - * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output - */ - public static final TagKey ORES_IN_GROUND_STONE = forgeTag("ores_in_ground/stone"); - - public static final TagKey SAND = forgeTag("sand"); - public static final TagKey SAND_COLORLESS = forgeTag("sand/colorless"); - public static final TagKey SAND_RED = forgeTag("sand/red"); - - public static final TagKey SEEDS = forgeTag("seeds"); - public static final TagKey SEEDS_BEETROOT = forgeTag("seeds/beetroot"); - public static final TagKey SEEDS_MELON = forgeTag("seeds/melon"); - public static final TagKey SEEDS_PUMPKIN = forgeTag("seeds/pumpkin"); - public static final TagKey SEEDS_WHEAT = forgeTag("seeds/wheat"); - /** * Controls what items can be consumed for enchanting such as Enchanting Tables. * This tag defaults to {@link net.minecraft.world.item.Items#LAPIS_LAZULI} when not present in any datapacks, including forge client on vanilla server */ public static final TagKey ENCHANTING_FUELS = forgeTag("enchanting_fuels"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); - - /** Deprecated for removal as misleading, because it also contained prismarine shards */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey DUSTS_PRISMARINE = forgeTag("dusts/prismarine"); - + public static final TagKey STORAGE_BLOCKS_AMETHYST = BlockItems.STORAGE_BLOCKS_AMETHYST.item(); + public static final TagKey STORAGE_BLOCKS_QUARTZ = BlockItems.STORAGE_BLOCKS_QUARTZ.item(); //endregion //region `c` tags for common conventions // Note: Other loaders have additional `c` tags that are exclusive to their loader. // Forge only adopts `c` tags that are common across all loaders. - public static final TagKey BARRELS = cTag("barrels"); - public static final TagKey BARRELS_WOODEN = cTag("barrels/wooden"); - public static final TagKey BOOKSHELVES = cTag("bookshelves"); + public static final TagKey BARRELS = BlockItems.BARRELS.item(); + public static final TagKey BARRELS_WOODEN = BlockItems.BARRELS_WOODEN.item(); + /** + * Equivalent to the "minecraft:bars" item tag. + */ + public static final TagKey BARS = BlockItems.BARS.item(); + public static final TagKey BARS_COPPER = BlockItems.BARS_COPPER.item(); + public static final TagKey BARS_IRON = BlockItems.BARS_IRON.item(); + public static final TagKey BONES = cTag("bones"); + public static final TagKey BOOKSHELVES = BlockItems.BOOKSHELVES.item(); public static final TagKey BRICKS = cTag("bricks"); public static final TagKey BRICKS_NORMAL = cTag("bricks/normal"); public static final TagKey BRICKS_NETHER = cTag("bricks/nether"); + public static final TagKey BRICKS_RESIN = cTag("bricks/resin"); public static final TagKey BUCKETS = cTag("buckets"); public static final TagKey BUCKETS_EMPTY = cTag("buckets/empty"); /** @@ -556,16 +603,22 @@ public class Tags { /** * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks */ - public static final TagKey BUDDING_BLOCKS = cTag("budding_blocks"); + public static final TagKey BUDDING_BLOCKS = BlockItems.BUDDING_BLOCKS.item(); /** * For blocks that are similar to amethyst where they have buddings forming from budding blocks */ - public static final TagKey BUDS = cTag("buds"); - public static final TagKey CHAINS = cTag("chains"); - public static final TagKey CHESTS = cTag("chests"); - public static final TagKey CHESTS_WOODEN = cTag("chests/wooden"); - public static final TagKey COBBLESTONES = cTag("cobblestones"); - public static final TagKey CONCRETES = cTag("concretes"); + public static final TagKey BUDS = BlockItems.BUDS.item(); + public static final TagKey CHAINS = BlockItems.CHAINS.item(); + public static final TagKey CHESTS = BlockItems.CHESTS.item(); + public static final TagKey CHESTS_WOODEN = BlockItems.CHESTS_WOODEN.item(); + public static final TagKey CHESTS_ENDER = BlockItems.CHESTS_ENDER.item(); + public static final TagKey CHESTS_TRAPPED = BlockItems.CHESTS_TRAPPED.item(); + public static final TagKey COBBLESTONES = BlockItems.COBBLESTONES.item(); + public static final TagKey COBBLESTONES_NORMAL = BlockItems.COBBLESTONES_NORMAL.item(); + public static final TagKey COBBLESTONES_INFESTED = BlockItems.COBBLESTONES_INFESTED.item(); + public static final TagKey COBBLESTONES_MOSSY = BlockItems.COBBLESTONES_MOSSY.item(); + public static final TagKey COBBLESTONES_DEEPSLATE = BlockItems.COBBLESTONES_DEEPSLATE.item(); + public static final TagKey CONCRETES = BlockItems.CONCRETES.item(); /** * Block tag equivalent is {@link BlockTags#CONCRETE_POWDER} */ @@ -573,7 +626,9 @@ public class Tags { /** * For blocks that are similar to amethyst where they have clusters forming from budding blocks */ - public static final TagKey CLUSTERS = cTag("clusters"); + public static final TagKey CLUSTERS = BlockItems.CLUSTERS.item(); + public static final TagKey CLUMPS = cTag("clumps"); + public static final TagKey CLUMPS_RESIN = cTag("clumps/resin"); /** * For raw materials harvested from growable plants. Crop items can be edible like carrots or * non-edible like wheat and cocoa beans. @@ -593,6 +648,49 @@ public class Tags { public static final TagKey DUSTS_REDSTONE = cTag("dusts/redstone"); public static final TagKey DUSTS_GLOWSTONE = cTag("dusts/glowstone"); + /** + * Drinks are defined as (1) consumable items that (2) use the + * {@linkplain ItemUseAnimation#DRINK drink item use animation}, (3) can be consumed regardless of the + * player's current hunger. + * + *

Drinks may provide nutrition and saturation, but are not required to do so. + * + *

More specific types of drinks, such as Water, Milk, or Juice should be placed in a sub-tag, such as + * {@code #c:drinks/water}, {@code #c:drinks/milk}, and {@code #c:drinks/juice}. + */ + public static final TagKey DRINKS = cTag("drinks"); + public static final TagKey DRINKS_HONEY = cTag("drinks/honey"); + /** + * Plant based fruit and vegetable juices belong in this tag, for example apple juice and carrot juice. + * + *

If tags for specific types of juices are desired, they may go in a sub-tag, using their regular name such as + * {@code #c:drinks/apple_juice}. + */ + public static final TagKey DRINKS_JUICE = cTag("drinks/juice"); + public static final TagKey DRINKS_MAGIC = cTag("drinks/magic"); + public static final TagKey DRINKS_MILK = cTag("drinks/milk"); + /** + * For drinks that always grant the {@linkplain MobEffects#BAD_OMEN Bad Omen} effect. + */ + public static final TagKey DRINKS_OMINOUS = cTag("drinks/ominous"); + /** + * For consumable drinks that contain only water. + */ + public static final TagKey DRINKS_WATER = cTag("drinks/water"); + /** + * For consumable drinks that are generally watery (such as potions). + */ + public static final TagKey DRINKS_WATERY = cTag("drinks/watery"); + + /** + * For non-empty bottles that are {@linkplain #DRINKS drinkable}. + */ + public static final TagKey DRINK_CONTAINING_BOTTLE = cTag("drink_containing/bottle"); + /** + * For non-empty buckets that are {@linkplain #DRINKS drinkable}. + */ + public static final TagKey DRINK_CONTAINING_BUCKET = cTag("drink_containing/bucket"); + /** * Tag that holds all blocks and items that can be dyed a specific color. * (Does not include color blending items like leather armor @@ -634,7 +732,16 @@ public class Tags { public static final TagKey DYES_ORANGE = DyeColor.ORANGE.getTag(); public static final TagKey DYES_WHITE = DyeColor.WHITE.getTag(); + public static final TagKey EGGS = cTag("eggs"); + public static final TagKey END_STONES = BlockItems.END_STONES.item(); public static final TagKey ENDER_PEARLS = cTag("ender_pearls"); + + public static final TagKey FEATHERS = cTag("feathers"); + public static final TagKey FENCE_GATES = BlockItems.FENCE_GATES.item(); + public static final TagKey FENCE_GATES_WOODEN = BlockItems.FENCE_GATES_WOODEN.item(); + public static final TagKey FENCES = BlockItems.FENCES.item(); + public static final TagKey FENCES_NETHER_BRICK = BlockItems.FENCES_NETHER_BRICK.item(); + public static final TagKey FENCES_WOODEN = BlockItems.FENCES_WOODEN.item(); /** * For bonemeal-like items that can grow plants. */ @@ -642,18 +749,19 @@ public class Tags { /** * Contains living ground-based flowers that are 1 block tall such as Dandelions or Poppy. * Equivalent to the {@code minecraft:small_flowers} item tag. + * Aliased with {@link ItemTags#SMALL_FLOWERS}. */ - public static final TagKey FLOWERS_SMALL = cTag("flowers/small"); + public static final TagKey FLOWERS_SMALL = BlockItems.FLOWERS_SMALL.item(); /** * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. * Equivalent to the {@code minecraft:tall_flowers} item tag in past Minecraft versions. */ - public static final TagKey FLOWERS_TALL = cTag("flowers/tall"); + public static final TagKey FLOWERS_TALL = BlockItems.FLOWERS_TALL.item(); /** * Contains any living plant block that contains flowers or is a flower itself. * Equivalent to the {@code minecraft:flowers} item tag in past Minecraft versions. */ - public static final TagKey FLOWERS = cTag("flowers"); + public static final TagKey FLOWERS = BlockItems.FLOWERS.item(); public static final TagKey FOODS = cTag("foods"); /** * Apples and other foods that are considered fruits in the culinary field belong in this tag. @@ -671,6 +779,20 @@ public class Tags { public static final TagKey FOODS_BERRY = cTag("foods/berry"); public static final TagKey FOODS_BREAD = cTag("foods/bread"); public static final TagKey FOODS_COOKIE = cTag("foods/cookie"); + /** + * For all doughs regardless of type, specific types of dough should fall under their respective sub-tag.
+ * For example:
+ * - Wheat dough (which generally results in bread) would go in "#c:foods/dough/wheat"
+ * - Rye dough (which has rye as it's main ingredient) would go in "#c:foods/dough/rye"
+ * - Sub-tags should also be added to this tag, for example: "#c:foods/dough/wheat" should be added to "#c:foods/dough"
+ *
+ * There are some important assumptions that should be kept in mind.
+ * - It is assumed that "1 dough = result", which in the case of wheat dough would be "1 dough = 1 bread"
+ * - It is assumed that this dough can be baked into another item
+ * - It is *not* assumed that all doughs result in bread, there can be doughs in this tag that result in things like pizza, etc. + * This means that this tag should *not* be used for furnace recipes, mods should add their own dough to result recipes for their respective items. + */ + public static final TagKey FOODS_DOUGH = cTag("foods/dough"); public static final TagKey FOODS_RAW_MEAT = cTag("foods/raw_meat"); public static final TagKey FOODS_COOKED_MEAT = cTag("foods/cooked_meat"); public static final TagKey FOODS_RAW_FISH = cTag("foods/raw_fish"); @@ -713,56 +835,112 @@ public class Tags { public static final TagKey GEMS_PRISMARINE = cTag("gems/prismarine"); public static final TagKey GEMS_QUARTZ = cTag("gems/quartz"); - public static final TagKey GLASS_BLOCKS = cTag("glass_blocks"); - public static final TagKey GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + public static final TagKey GLASS_BLOCKS = BlockItems.GLASS_BLOCKS.item(); + public static final TagKey GLASS_BLOCKS_COLORLESS = BlockItems.GLASS_BLOCKS_COLORLESS.item(); /** * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes */ - public static final TagKey GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); - public static final TagKey GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + public static final TagKey GLASS_BLOCKS_CHEAP = BlockItems.GLASS_BLOCKS_CHEAP.item(); + public static final TagKey GLASS_BLOCKS_TINTED = BlockItems.GLASS_BLOCKS_TINTED.item(); - public static final TagKey GLASS_PANES = cTag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); - public static final TagKey GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + public static final TagKey GLASS_PANES = BlockItems.GLASS_PANES.item(); + public static final TagKey GLASS_PANES_COLORLESS = BlockItems.GLASS_PANES_COLORLESS.item(); + public static final TagKey GLAZED_TERRACOTTAS = BlockItems.GLAZED_TERRACOTTAS.item(); + + public static final TagKey GRAVELS = BlockItems.GRAVELS.item(); + public static final TagKey GUNPOWDERS = cTag("gunpowders"); /** * Tag that holds all items that recipe viewers should not show to users. */ public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = cTag("hidden_from_recipe_viewers"); - public static final TagKey OBSIDIANS = cTag("obsidians"); + public static final TagKey OBSIDIANS = BlockItems.OBSIDIANS.item(); /** * For common obsidian that has no special quirks or behaviours - ideal for recipe use. * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. */ - public static final TagKey OBSIDIANS_NORMAL = cTag("obsidians/normal"); - public static final TagKey OBSIDIANS_CRYING = cTag("obsidians/crying"); + public static final TagKey OBSIDIANS_NORMAL = BlockItems.OBSIDIANS_NORMAL.item(); + public static final TagKey OBSIDIANS_CRYING = BlockItems.OBSIDIANS_CRYING.item(); + /** + * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = BlockItems.ORE_BEARING_GROUND_DEEPSLATE.item(); + /** + * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = BlockItems.ORE_BEARING_GROUND_NETHERRACK.item(); + /** + * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation + */ + public static final TagKey ORE_BEARING_GROUND_STONE = BlockItems.ORE_BEARING_GROUND_STONE.item(); + /** + * Ores which on average result in more than one resource worth of materials + */ + public static final TagKey ORE_RATES_DENSE = BlockItems.ORE_RATES_DENSE.item(); + /** + * Ores which on average result in one resource worth of materials + */ + public static final TagKey ORE_RATES_SINGULAR = BlockItems.ORE_RATES_SINGULAR.item(); + /** + * Ores which on average result in less than one resource worth of materials + */ + public static final TagKey ORE_RATES_SPARSE = BlockItems.ORE_RATES_SPARSE.item(); + public static final TagKey ORES = BlockItems.ORES.item(); + public static final TagKey ORES_COAL = BlockItems.ORES_COAL.item(); + public static final TagKey ORES_COPPER = BlockItems.ORES_COPPER.item(); + public static final TagKey ORES_DIAMOND = BlockItems.ORES_DIAMOND.item(); + public static final TagKey ORES_EMERALD = BlockItems.ORES_EMERALD.item(); + public static final TagKey ORES_GOLD = BlockItems.ORES_GOLD.item(); + public static final TagKey ORES_IRON = BlockItems.ORES_IRON.item(); + public static final TagKey ORES_LAPIS = BlockItems.ORES_LAPIS.item(); + public static final TagKey ORES_NETHERITE_SCRAP = BlockItems.ORES_NETHERITE_SCRAP.item(); + public static final TagKey ORES_QUARTZ = BlockItems.ORES_QUARTZ.item(); + public static final TagKey ORES_REDSTONE = BlockItems.ORES_REDSTONE.item(); + /** + * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_DEEPSLATE = BlockItems.ORES_IN_GROUND_DEEPSLATE.item(); + /** + * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_NETHERRACK = BlockItems.ORES_IN_GROUND_NETHERRACK.item(); + /** + * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output + */ + public static final TagKey ORES_IN_GROUND_STONE = BlockItems.ORES_IN_GROUND_STONE.item(); public static final TagKey INGOTS = cTag("ingots"); public static final TagKey INGOTS_COPPER = cTag("ingots/copper"); public static final TagKey INGOTS_GOLD = cTag("ingots/gold"); public static final TagKey INGOTS_IRON = cTag("ingots/iron"); public static final TagKey INGOTS_NETHERITE = cTag("ingots/netherite"); public static final TagKey LEATHERS = cTag("leathers"); + public static final TagKey MUSHROOMS = cTag("mushrooms"); /** * For music disc-like materials to be used in recipes. * A pancake with a JUKEBOX_PLAYABLE component attached to play in Jukeboxes as an Easter Egg is not a music disc and would not go in this tag. */ public static final TagKey MUSIC_DISCS = cTag("music_discs"); + public static final TagKey NATURAL_LOGS = BlockItems.NATURAL_LOGS.item(); + public static final TagKey NATURAL_LOGS_NETHER = BlockItems.NATURAL_LOGS_NETHER.item(); + public static final TagKey NATURAL_LOGS_OVERWORLD = BlockItems.NATURAL_LOGS_OVERWORLD.item(); + public static final TagKey NATURAL_WOODS = BlockItems.NATURAL_WOODS.item(); + public static final TagKey NETHER_STARS = cTag("nether_stars"); + public static final TagKey NETHERRACKS = BlockItems.NETHERRACKS.item(); public static final TagKey NUGGETS = cTag("nuggets"); public static final TagKey NUGGETS_COPPER = cTag("nuggets/copper"); public static final TagKey NUGGETS_GOLD = cTag("nuggets/gold"); public static final TagKey NUGGETS_IRON = cTag("nuggets/iron"); - public static final TagKey ORES = cTag("ores"); - public static final TagKey ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); - public static final TagKey ORES_QUARTZ = cTag("ores/quartz"); - public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); - public static final TagKey PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); - public static final TagKey PUMPKINS = cTag("pumpkins"); + public static final TagKey POTIONS = cTag("potions"); + public static final TagKey POTIONS_BOTTLE = cTag("potions/bottle"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = BlockItems.PLAYER_WORKSTATIONS_CRAFTING_TABLES.item(); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = BlockItems.PLAYER_WORKSTATIONS_FURNACES.item(); + public static final TagKey PUMPKINS = BlockItems.PUMPKINS.item(); /** For pumpkins that are not carved. */ - public static final TagKey PUMPKINS_NORMAL = cTag("pumpkins/normal"); + public static final TagKey PUMPKINS_NORMAL = BlockItems.PUMPKINS_NORMAL.item(); /** For pumpkins that are already carved but not a light source. */ - public static final TagKey PUMPKINS_CARVED = cTag("pumpkins/carved"); + public static final TagKey PUMPKINS_CARVED = BlockItems.PUMPKINS_CARVED.item(); /** For pumpkins that are already carved and a light source. */ - public static final TagKey PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final TagKey PUMPKINS_JACK_O_LANTERNS = BlockItems.PUMPKINS_JACK_O_LANTERNS.item(); public static final TagKey RAW_MATERIALS = cTag("raw_materials"); public static final TagKey RAW_MATERIALS_COPPER = cTag("raw_materials/copper"); public static final TagKey RAW_MATERIALS_GOLD = cTag("raw_materials/gold"); @@ -778,17 +956,29 @@ public class Tags { * One example is a mod adds stick variants such as Spruce Sticks but would like stick recipes to be able to use it. */ public static final TagKey RODS_WOODEN = cTag("rods/wooden"); - public static final TagKey ROPES = cTag("ropes"); + public static final TagKey ROPES = BlockItems.ROPES.item(); - public static final TagKey SANDSTONE_BLOCKS = cTag("sandstone/blocks"); - public static final TagKey SANDSTONE_SLABS = cTag("sandstone/slabs"); - public static final TagKey SANDSTONE_STAIRS = cTag("sandstone/stairs"); - public static final TagKey SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); - public static final TagKey SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); - public static final TagKey SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); - public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); - public static final TagKey SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); - public static final TagKey SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + public static final TagKey SANDS = BlockItems.SANDS.item(); + public static final TagKey SANDS_COLORLESS = BlockItems.SANDS_COLORLESS.item(); + public static final TagKey SANDS_RED = BlockItems.SANDS_RED.item(); + + public static final TagKey SEEDS = cTag("seeds"); + public static final TagKey SEEDS_BEETROOT = cTag("seeds/beetroot"); + public static final TagKey SEEDS_MELON = cTag("seeds/melon"); + public static final TagKey SEEDS_PITCHER_PLANT = cTag("seeds/pitcher_plant"); + public static final TagKey SEEDS_PUMPKIN = cTag("seeds/pumpkin"); + public static final TagKey SEEDS_TORCHFLOWER = cTag("seeds/torchflower"); + public static final TagKey SEEDS_WHEAT = cTag("seeds/wheat"); + + public static final TagKey SANDSTONE_BLOCKS = BlockItems.SANDSTONE_BLOCKS.item(); + public static final TagKey SANDSTONE_SLABS = BlockItems.SANDSTONE_SLABS.item(); + public static final TagKey SANDSTONE_STAIRS = BlockItems.SANDSTONE_STAIRS.item(); + public static final TagKey SANDSTONE_RED_BLOCKS = BlockItems.SANDSTONE_RED_BLOCKS.item(); + public static final TagKey SANDSTONE_RED_SLABS = BlockItems.SANDSTONE_RED_SLABS.item(); + public static final TagKey SANDSTONE_RED_STAIRS = BlockItems.SANDSTONE_RED_STAIRS.item(); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = BlockItems.SANDSTONE_UNCOLORED_BLOCKS.item(); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = BlockItems.SANDSTONE_UNCOLORED_SLABS.item(); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = BlockItems.SANDSTONE_UNCOLORED_STAIRS.item(); /** * Block tag equivalent is {@link BlockTags#SHULKER_BOXES} @@ -798,7 +988,7 @@ public class Tags { /** * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. */ - public static final TagKey STONES = cTag("stones"); + public static final TagKey STONES = BlockItems.STONES.item(); /** * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block * and has a mirror recipe to reverse the crafting with no loss in resources. @@ -806,26 +996,27 @@ public class Tags { * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe * and so, it is considered a special case and not given a storage block tag. */ - public static final TagKey STORAGE_BLOCKS = cTag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); - public static final TagKey STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); - public static final TagKey STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); - public static final TagKey STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); - public static final TagKey STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); + public static final TagKey STORAGE_BLOCKS = BlockItems.STORAGE_BLOCKS.item(); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = BlockItems.STORAGE_BLOCKS_BONE_MEAL.item(); + public static final TagKey STORAGE_BLOCKS_COAL = BlockItems.STORAGE_BLOCKS_COAL.item(); + public static final TagKey STORAGE_BLOCKS_COPPER = BlockItems.STORAGE_BLOCKS_COPPER.item(); + public static final TagKey STORAGE_BLOCKS_DIAMOND = BlockItems.STORAGE_BLOCKS_DIAMOND.item(); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = BlockItems.STORAGE_BLOCKS_DRIED_KELP.item(); + public static final TagKey STORAGE_BLOCKS_EMERALD = BlockItems.STORAGE_BLOCKS_EMERALD.item(); + public static final TagKey STORAGE_BLOCKS_GOLD = BlockItems.STORAGE_BLOCKS_GOLD.item(); + public static final TagKey STORAGE_BLOCKS_IRON = BlockItems.STORAGE_BLOCKS_IRON.item(); + public static final TagKey STORAGE_BLOCKS_LAPIS = BlockItems.STORAGE_BLOCKS_LAPIS.item(); + public static final TagKey STORAGE_BLOCKS_NETHERITE = BlockItems.STORAGE_BLOCKS_NETHERITE.item(); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = BlockItems.STORAGE_BLOCKS_RAW_COPPER.item(); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = BlockItems.STORAGE_BLOCKS_RAW_GOLD.item(); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = BlockItems.STORAGE_BLOCKS_RAW_IRON.item(); + public static final TagKey STORAGE_BLOCKS_REDSTONE = BlockItems.STORAGE_BLOCKS_REDSTONE.item(); + public static final TagKey STORAGE_BLOCKS_RESIN = BlockItems.STORAGE_BLOCKS_RESIN.item(); + public static final TagKey STORAGE_BLOCKS_SLIME = BlockItems.STORAGE_BLOCKS_SLIME.item(); + public static final TagKey STORAGE_BLOCKS_WHEAT = BlockItems.STORAGE_BLOCKS_WHEAT.item(); public static final TagKey STRINGS = cTag("strings"); - public static final TagKey STRIPPED_LOGS = cTag("stripped_logs"); - public static final TagKey STRIPPED_WOODS = cTag("stripped_woods"); + public static final TagKey STRIPPED_LOGS = BlockItems.STRIPPED_LOGS.item(); + public static final TagKey STRIPPED_WOODS = BlockItems.STRIPPED_WOODS.item(); public static final TagKey VILLAGER_JOB_SITES = cTag("villager_job_sites"); // Tools and Armors @@ -870,15 +1061,16 @@ public class Tags { */ public static final TagKey TOOLS_FISHING_ROD = cTag("tools/fishing_rod"); /** - * A tag containing all existing spears. Other tools such as throwing knives or boomerangs - * should not be put into this tag and should be put into their own tool tags. + * A tag containing all existing throwable stick-like weapons like tridents. + * Other tools such as throwing knives or boomerangs should not be put into + * this tag and should be put into their own tool tags. * Do not use this tag for determining a tool's behavior. * Please use {@link ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ - public static final TagKey TOOLS_SPEAR = cTag("tools/spear"); + public static final TagKey TOOLS_TRIDENT = cTag("tools/trident"); /** * A tag containing all existing shears. Do not use this tag for determining a tool's behavior. * Please use {@link ToolActions} instead for what action a tool can do. @@ -912,6 +1104,7 @@ public class Tags { * @see ToolActions */ public static final TagKey TOOLS_MACE = cTag("tools/mace"); + public static final TagKey TOOLS_WRENCH = cTag("tools/wrench"); /** * A tag containing melee-based weapons for recipes and loot tables. * Tools are considered melee if they are intentionally intended to be used for melee attack as a primary purpose. @@ -944,164 +1137,16 @@ public class Tags { * Collects the 4 vanilla armor tags into one parent collection for ease. */ public static final TagKey ARMORS = cTag("armors"); + public static final TagKey ARMORS_HORSE = cTag("armors/horse"); + public static final TagKey ARMORS_HUMANOID = cTag("armors/humanoid"); + public static final TagKey ARMORS_NAUTILUS = cTag("armors/nautilus"); + public static final TagKey ARMORS_WOLF = cTag("armors/wolf"); /** * Collects the many enchantable tags into one parent collection for ease. */ public static final TagKey ENCHANTABLES = cTag("enchantables"); //endregion - //region Redirect fields for improved backward-compatibility - // TODO: Remove backwards compat redirect fields in 1.22 - /** @deprecated Use {@link #COBBLESTONES} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey COBBLESTONE = COBBLESTONES; - /** @deprecated Use {@link #LEATHERS} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey LEATHER = LEATHERS; - /** @deprecated Use {@link #SANDSTONE_BLOCKS} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey SANDSTONE = SANDSTONE_BLOCKS; - /** @deprecated Use {@link #STONES} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STONE = STONES; - /** @deprecated Use {@link #TOOLS_SHEAR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey SHEARS = TOOLS_SHEAR; - /** @deprecated Use {@link #TOOLS_SPEAR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey TOOLS_TRIDENTS = TOOLS_SPEAR; - /** @deprecated Use {@link #STRINGS} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STRING = STRINGS; - //endregion - - //region Forge tags that now map to combining multiple `c` tags - // Kept for binary compatibility - // TODO: Remove these in 1.22 - /** @deprecated Use {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS = forgeTag("glass"); - /** @deprecated Use {@link #DYED_BLACK} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BLACK = forgeTag("glass/black"); - /** @deprecated Use {@link #DYED_BLUE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BLUE = forgeTag("glass/blue"); - /** @deprecated Use {@link #DYED_BROWN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_BROWN = forgeTag("glass/brown"); - /** @deprecated Use {@link #GLASS_BLOCKS_COLORLESS} and/or {@link #GLASS_PANES_COLORLESS} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_COLORLESS = forgeTag("glass/colorless"); - /** @deprecated Use {@link #DYED_CYAN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_CYAN = forgeTag("glass/cyan"); - /** @deprecated Use {@link #DYED_GRAY} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_GRAY = forgeTag("glass/gray"); - /** @deprecated Use {@link #DYED_GREEN} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_GREEN = forgeTag("glass/green"); - /** @deprecated Use {@link #DYED_LIGHT_BLUE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIGHT_BLUE = forgeTag("glass/light_blue"); - /** @deprecated Use {@link #DYED_LIGHT_GRAY} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIGHT_GRAY = forgeTag("glass/light_gray"); - /** @deprecated Use {@link #DYED_LIME} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_LIME = forgeTag("glass/lime"); - /** @deprecated Use {@link #DYED_MAGENTA} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_MAGENTA = forgeTag("glass/magenta"); - /** @deprecated Use {@link #DYED_ORANGE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_ORANGE = forgeTag("glass/orange"); - /** @deprecated Use {@link #DYED_PINK} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PINK = forgeTag("glass/pink"); - /** @deprecated Use {@link #DYED_PURPLE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PURPLE = forgeTag("glass/purple"); - /** @deprecated Use {@link #DYED_RED} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_RED = forgeTag("glass/red"); - /** @deprecated Use {@link #DYED_WHITE} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_WHITE = forgeTag("glass/white"); - /** @deprecated Use {@link #DYED_YELLOW} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_YELLOW = forgeTag("glass/yellow"); - /** @deprecated Use {@link #DYED} combined with {@link #GLASS_BLOCKS} and/or {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STAINED_GLASS = forgeTag("stained_glass"); - - /** @deprecated Use {@link #DYED_BLACK} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BLACK = forgeTag("glass_panes/black"); - /** @deprecated Use {@link #DYED_BLUE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BLUE = forgeTag("glass_panes/blue"); - /** @deprecated Use {@link #DYED_BROWN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_BROWN = forgeTag("glass_panes/brown"); - /** @deprecated Use {@link #DYED_CYAN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_CYAN = forgeTag("glass_panes/cyan"); - /** @deprecated Use {@link #DYED_GRAY} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_GRAY = forgeTag("glass_panes/gray"); - /** @deprecated Use {@link #DYED_GREEN} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_GREEN = forgeTag("glass_panes/green"); - /** @deprecated Use {@link #DYED_LIGHT_BLUE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIGHT_BLUE = forgeTag("glass_panes/light_blue"); - /** @deprecated Use {@link #DYED_LIGHT_GRAY} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIGHT_GRAY = forgeTag("glass_panes/light_gray"); - /** @deprecated Use {@link #DYED_LIME} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_LIME = forgeTag("glass_panes/lime"); - /** @deprecated Use {@link #DYED_MAGENTA} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_MAGENTA = forgeTag("glass_panes/magenta"); - /** @deprecated Use {@link #DYED_ORANGE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_ORANGE = forgeTag("glass_panes/orange"); - /** @deprecated Use {@link #DYED_PINK} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_PINK = forgeTag("glass_panes/pink"); - /** @deprecated Use {@link #DYED_PURPLE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_PURPLE = forgeTag("glass_panes/purple"); - /** @deprecated Use {@link #DYED_RED} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_RED = forgeTag("glass_panes/red"); - /** @deprecated Use {@link #DYED_WHITE} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_WHITE = forgeTag("glass_panes/white"); - /** @deprecated Use {@link #DYED_YELLOW} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey GLASS_PANES_YELLOW = forgeTag("glass_panes/yellow"); - /** @deprecated Use {@link #DYED} combined with {@link #GLASS_PANES} */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey STAINED_GLASS_PANES = forgeTag("stained_glass_panes"); - - /** @deprecated Use the Vanilla tag {@link ItemTags#HEAD_ARMOR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey ARMORS_HELMETS = forgeTag("armors/helmets"); - /** @deprecated Use the Vanilla tag {@link ItemTags#CHEST_ARMOR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey ARMORS_CHESTPLATES = forgeTag("armors/chestplates"); - /** @deprecated Use the Vanilla tag {@link ItemTags#LEG_ARMOR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey ARMORS_LEGGINGS = forgeTag("armors/leggings"); - /** @deprecated Use the Vanilla tag {@link ItemTags#FOOT_ARMOR} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey ARMORS_BOOTS = forgeTag("armors/boots"); - //endregion - private static TagKey cTag(String name) { return ItemTags.create(Identifier.fromNamespaceAndPath("c", name)); } @@ -1114,45 +1159,43 @@ public class Tags { public static class Fluids { private static void init() {} - //region `forge` tags for Forge-specific tags + //region `c` tags for common conventions + // Note: Other loaders have additional `c` tags that are exclusive to their loader. + // Forge only adopts `c` tags that are common across all loaders. + /** + * Holds all fluids related to Beetroot Soup.

+ * (Standard unit for beetroot soup is 250mb per bowl) + */ + public static final TagKey BEETROOT_SOUP = cTag("beetroot_soup"); + public static final TagKey EXPERIENCE = cTag("experience"); /** * Holds all fluids that are gaseous at room temperature. */ - public static final TagKey GASEOUS = forgeTag("gaseous"); + public static final TagKey GASEOUS = cTag("gaseous"); + /** + * Holds all fluids related to Mushroom Stew.

+ * (Standard unit for mushroom stew is 250mb per bowl) + */ + public static final TagKey MUSHROOM_STEW = cTag("mushroom_stew"); /** * Holds all fluids related to potions. The effects of the potion fluid should be read from NBT. * The effects and color of the potion fluid should be read from {@link net.minecraft.core.component.DataComponents#POTION_CONTENTS} * component that people should be attaching to the fluidstack of this fluid.

* (Standard unit for potions is 250mb per bottle) */ - public static final TagKey POTION = forgeTag("potion"); + public static final TagKey POTION = cTag("potion"); + /** + * Holds all fluids related to Rabbit Stew.

+ * (Standard unit for rabbit stew is 250mb per bowl) + */ + public static final TagKey RABBIT_STEW = cTag("rabbit_stew"); /** * Holds all fluids related to Suspicious Stew. * The effects of the suspicious stew fluid should be read from {@link net.minecraft.core.component.DataComponents#SUSPICIOUS_STEW_EFFECTS} * component that people should be attaching to the fluidstack of this fluid.

* (Standard unit for suspicious stew is 250mb per bowl) */ - public static final TagKey SUSPICIOUS_STEW = forgeTag("suspicious_stew"); - /** - * Holds all fluids related to Mushroom Stew.

- * (Standard unit for mushroom stew is 250mb per bowl) - */ - public static final TagKey MUSHROOM_STEW = forgeTag("mushroom_stew"); - /** - * Holds all fluids related to Rabbit Stew.

- * (Standard unit for rabbit stew is 250mb per bowl) - */ - public static final TagKey RABBIT_STEW = forgeTag("rabbit_stew"); - /** - * Holds all fluids related to Beetroot Soup.

- * (Standard unit for beetroot soup is 250mb per bowl) - */ - public static final TagKey BEETROOT_SOUP = forgeTag("beetroot_soup"); - //endregion - - //region `c` tags for common conventions - // Note: Other loaders have additional `c` tags that are exclusive to their loader. - // Forge only adopts `c` tags that are common across all loaders. + public static final TagKey SUSPICIOUS_STEW = cTag("suspicious_stew"); /** * Holds all fluids related to water. * This tag is done to help out multi-loader mods/datapacks where the vanilla water tag has attached behaviors outside Forge. @@ -1230,46 +1273,6 @@ public class Tags { public static class Biomes { private static void init() {} - //region `forge` tags for Forge-specific tags - public static final TagKey IS_COLD_NETHER = forgeTag("is_cold/nether"); - - /** - * Biomes in the Nether that have sparse vegetation. - */ - public static final TagKey IS_SPARSE_NETHER = forgeTag("is_sparse/nether"); - /** - * Biomes in the End that have sparse vegetation. - */ - public static final TagKey IS_SPARSE_END = forgeTag("is_sparse/end"); - /** - * Biomes in the Nether that have dense vegetation. - */ - public static final TagKey IS_DENSE_NETHER = forgeTag("is_dense/nether"); - /** - * Biomes in the End that have dense vegetation. - */ - public static final TagKey IS_DENSE_END = forgeTag("is_dense/end"); - - public static final TagKey IS_HOT_END = forgeTag("is_hot/end"); - - public static final TagKey IS_LUSH = forgeTag("is_lush"); - public static final TagKey IS_MAGICAL = forgeTag("is_magical"); - public static final TagKey IS_MODIFIED = forgeTag("is_modified"); - - public static final TagKey IS_RARE = forgeTag("is_rare"); - public static final TagKey IS_PLATEAU = forgeTag("is_plateau"); - - /** - * Biomes that are able to spawn sand-based blocks on the surface. - */ - public static final TagKey IS_SANDY = forgeTag("is_sandy"); - - public static final TagKey IS_WET_NETHER = forgeTag("is_wet/nether"); - public static final TagKey IS_WET_END = forgeTag("is_wet/end"); - - public static final TagKey IS_SPOOKY = forgeTag("is_spooky"); - //endregion - //region `c` tags for common conventions // Note: Other loaders have additional `c` tags that are exclusive to their loader. // Forge only adopts `c` tags that are common across all loaders. @@ -1289,18 +1292,26 @@ public class Tags { public static final TagKey IS_HOT = cTag("is_hot"); public static final TagKey IS_HOT_OVERWORLD = cTag("is_hot/overworld"); public static final TagKey IS_HOT_NETHER = cTag("is_hot/nether"); + public static final TagKey IS_HOT_END = cTag("is_hot/end"); public static final TagKey IS_COLD = cTag("is_cold"); + public static final TagKey IS_COLD_NETHER = cTag("is_cold/nether"); public static final TagKey IS_COLD_OVERWORLD = cTag("is_cold/overworld"); public static final TagKey IS_COLD_END = cTag("is_cold/end"); public static final TagKey IS_SPARSE_VEGETATION = cTag("is_sparse_vegetation"); public static final TagKey IS_SPARSE_VEGETATION_OVERWORLD = cTag("is_sparse_vegetation/overworld"); + public static final TagKey IS_SPARSE_VEGETATION_NETHER = cTag("is_sparse_vegetation/nether"); + public static final TagKey IS_SPARSE_VEGETATION_END = cTag("is_sparse_vegetation/end"); public static final TagKey IS_DENSE_VEGETATION = cTag("is_dense_vegetation"); public static final TagKey IS_DENSE_VEGETATION_OVERWORLD = cTag("is_dense_vegetation/overworld"); + public static final TagKey IS_DENSE_VEGETATION_NETHER = cTag("is_dense_vegetation/nether"); + public static final TagKey IS_DENSE_VEGETATION_END = cTag("is_dense_vegetation/end"); public static final TagKey IS_WET = cTag("is_wet"); public static final TagKey IS_WET_OVERWORLD = cTag("is_wet/overworld"); + public static final TagKey IS_WET_NETHER = cTag("is_wet/nether"); + public static final TagKey IS_WET_END = cTag("is_wet/end"); public static final TagKey IS_DRY = cTag("is_dry"); public static final TagKey IS_DRY_OVERWORLD = cTag("is_dry/overworld"); public static final TagKey IS_DRY_NETHER = cTag("is_dry/nether"); @@ -1321,6 +1332,8 @@ public class Tags { public static final TagKey IS_JUNGLE_TREE = cTag("is_tree/jungle"); public static final TagKey IS_DECIDUOUS_TREE = cTag("is_tree/deciduous"); + public static final TagKey IS_DARK_FOREST = cTag("is_dark_forest"); + /** * Biomes that spawn as part of giant mountains. * (This is for people who want to tag their biomes without getting @@ -1466,34 +1479,35 @@ public class Tags { * Biomes that spawn as part of the large islands outside the center island in The End dimension. */ public static final TagKey IS_OUTER_END_ISLAND = cTag("is_outer_end_island"); - //endregion - //region Redirect fields for improved backward-compatibility - // TODO: Remove backwards compat redirect fields in 1.22 - /** @deprecated Use {@link #IS_SPARSE_VEGETATION} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_SPARSE = IS_SPARSE_VEGETATION; - /** @deprecated Use {@link #IS_SPARSE_VEGETATION_OVERWORLD} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_SPARSE_OVERWORLD = IS_SPARSE_VEGETATION_OVERWORLD; + public static final TagKey IS_LUSH = cTag("is_lush"); + public static final TagKey IS_MAGICAL = cTag("is_magical"); + public static final TagKey IS_RARE = cTag("is_rare"); + public static final TagKey IS_PLATEAU = cTag("is_plateau"); + /** + * Biomes that are able to spawn sand-based blocks on the surface. + */ + public static final TagKey IS_SANDY = cTag("is_sandy"); + public static final TagKey IS_SPOOKY = cTag("is_spooky"); - /** @deprecated Use {@link #IS_DENSE_VEGETATION} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_DENSE = IS_DENSE_VEGETATION; - /** @deprecated Use {@link #IS_DENSE_VEGETATION_OVERWORLD} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_DENSE_OVERWORLD = IS_DENSE_VEGETATION_OVERWORLD; + public static final TagKey IS_TEMPERATE = cTag("is_temperate"); + public static final TagKey IS_TEMPERATE_END = cTag("is_temperate/end"); + public static final TagKey IS_TEMPERATE_NETHER = cTag("is_temperate/nether"); + public static final TagKey IS_TEMPERATE_OVERWORLD = cTag("is_temperate/overworld"); - /** @deprecated Use {@link #IS_AQUATIC} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_WATER = IS_AQUATIC; - - /** @deprecated Use {@link #IS_MOUNTAIN_SLOPE} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_SLOPE = IS_MOUNTAIN_SLOPE; - /** @deprecated Use {@link #IS_MOUNTAIN_PEAK} instead */ - @Deprecated(forRemoval = true, since = "1.21") - public static final TagKey IS_PEAK = IS_MOUNTAIN_PEAK; + public static final TagKey PRIMARY_WOOD_TYPE = cTag("primary_wood_type"); + public static final TagKey PRIMARY_WOOD_TYPE_ACACIA = cTag("primary_wood_type/acacia"); + public static final TagKey PRIMARY_WOOD_TYPE_BAMBOO = cTag("primary_wood_type/bamboo"); + public static final TagKey PRIMARY_WOOD_TYPE_BIRCH = cTag("primary_wood_type/birch"); + public static final TagKey PRIMARY_WOOD_TYPE_CHERRY = cTag("primary_wood_type/cherry"); + public static final TagKey PRIMARY_WOOD_TYPE_CRIMSON = cTag("primary_wood_type/crimson"); + public static final TagKey PRIMARY_WOOD_TYPE_DARK_OAK = cTag("primary_wood_type/dark_oak"); + public static final TagKey PRIMARY_WOOD_TYPE_JUNGLE = cTag("primary_wood_type/jungle"); + public static final TagKey PRIMARY_WOOD_TYPE_MANGROVE = cTag("primary_wood_type/mangrove"); + public static final TagKey PRIMARY_WOOD_TYPE_OAK = cTag("primary_wood_type/oak"); + public static final TagKey PRIMARY_WOOD_TYPE_PALE_OAK = cTag("primary_wood_type/pale_oak"); + public static final TagKey PRIMARY_WOOD_TYPE_SPRUCE = cTag("primary_wood_type/spruce"); + public static final TagKey PRIMARY_WOOD_TYPE_WARPED = cTag("primary_wood_type/warped"); //endregion private static TagKey cTag(String name) { diff --git a/src/main/java/net/minecraftforge/common/ToolActions.java b/src/main/java/net/minecraftforge/common/ToolActions.java index 2bcd9df290..bc2e420bcf 100644 --- a/src/main/java/net/minecraftforge/common/ToolActions.java +++ b/src/main/java/net/minecraftforge/common/ToolActions.java @@ -95,14 +95,6 @@ public class ToolActions */ public static final ToolAction HOE_TILL = ToolAction.get("till"); - /** - * A tool action corresponding to the 'block' action of shields. - * - * @deprecated Completely overshadowed by {@link net.minecraft.core.component.DataComponents#BLOCKS_ATTACKS} - */ - @Deprecated(forRemoval = true, since = "1.21.5") - public static final ToolAction SHIELD_BLOCK = ToolAction.get("shield_block"); - /** * This action corresponds to right-clicking the fishing rod. */ @@ -117,8 +109,6 @@ public class ToolActions @Deprecated(since = "1.21.5") public static final Set DEFAULT_SWORD_ACTIONS = of(SWORD_DIG, SWORD_SWEEP); public static final Set DEFAULT_SHEARS_ACTIONS = of(SHEARS_DIG, SHEARS_HARVEST, SHEARS_CARVE, SHEARS_DISARM); - @Deprecated(since = "1.21.5") - public static final Set DEFAULT_SHIELD_ACTIONS = of(SHIELD_BLOCK); public static final Set DEFAULT_FISHING_ROD_ACTIONS = of(FISHING_ROD_CAST); private static Set of(ToolAction... actions) { diff --git a/src/main/java/net/minecraftforge/common/UsernameCache.java b/src/main/java/net/minecraftforge/common/UsernameCache.java index 41a4219976..d328ed15ad 100644 --- a/src/main/java/net/minecraftforge/common/UsernameCache.java +++ b/src/main/java/net/minecraftforge/common/UsernameCache.java @@ -16,7 +16,6 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; -import com.google.common.base.Charsets; import net.minecraftforge.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,7 +38,6 @@ import org.jetbrains.annotations.Nullable; * the caches underlying map. */ public final class UsernameCache { - private static Map map = new HashMap<>(); private static final Path saveFile = FMLLoader.getGamePath().resolve("usernamecache.json"); @@ -58,8 +56,7 @@ public final class UsernameCache { * @param username * the player's username */ - protected static void setUsername(UUID uuid, String username) - { + protected static void setUsername(UUID uuid, String username) { Objects.requireNonNull(uuid); Objects.requireNonNull(username); @@ -76,12 +73,10 @@ public final class UsernameCache { * the player's {@link java.util.UUID UUID} * @return if the cache contained the user */ - protected static boolean removeUsername(UUID uuid) - { + protected static boolean removeUsername(UUID uuid) { Objects.requireNonNull(uuid); - if (map.remove(uuid) != null) - { + if (map.remove(uuid) != null) { save(); return true; } @@ -100,8 +95,7 @@ public final class UsernameCache { * cache doesn't have a record of the last username */ @Nullable - public static String getLastKnownUsername(UUID uuid) - { + public static String getLastKnownUsername(UUID uuid) { Objects.requireNonNull(uuid); return map.get(uuid); } @@ -113,8 +107,7 @@ public final class UsernameCache { * the player's {@link java.util.UUID UUID} * @return if the cache contains a username for the given player */ - public static boolean containsUUID(UUID uuid) - { + public static boolean containsUUID(UUID uuid) { Objects.requireNonNull(uuid); return map.containsKey(uuid); } @@ -124,51 +117,37 @@ public final class UsernameCache { * * @return the map */ - public static Map getMap() - { + public static Map getMap() { return ImmutableMap.copyOf(map); } /** * Save the cache to file */ - protected static void save() - { + protected static void save() { new SaveThread(gson.toJson(map)).start(); } /** * Load the cache from file */ - protected static void load() - { + protected static void load() { if (!Files.exists(saveFile)) return; - try (final BufferedReader reader = Files.newBufferedReader(saveFile, Charsets.UTF_8)) - { - @SuppressWarnings("serial") + try (final BufferedReader reader = Files.newBufferedReader(saveFile, StandardCharsets.UTF_8)) { Type type = new TypeToken>(){}.getType(); map = gson.fromJson(reader, type); - } - catch (JsonSyntaxException | IOException e) - { + } catch (JsonSyntaxException | IOException e) { LOGGER.error(USRCACHE,"Could not parse username cache file as valid json, deleting file {}", saveFile, e); - try - { + try { Files.delete(saveFile); - } - catch (IOException e1) - { + } catch (IOException e1) { LOGGER.error(USRCACHE,"Could not delete file {}", saveFile.toString()); } - } - finally - { + } finally { // Can sometimes occur when the json file is malformed if (map == null) - { map = new HashMap<>(); - } } } @@ -181,24 +160,18 @@ public final class UsernameCache { /** The data that will be saved to disk */ private final String data; - public SaveThread(String data) - { + public SaveThread(String data) { this.data = data; } @Override - public void run() - { - try - { + public void run() { + try { // Make sure we don't save when another thread is still saving - synchronized (saveFile) - { + synchronized (saveFile) { Files.write(saveFile, data.getBytes(StandardCharsets.UTF_8)); } - } - catch (IOException e) - { + } catch (IOException e) { LOGGER.error(USRCACHE, "Failed to save username cache to file!", e); } } diff --git a/src/main/java/net/minecraftforge/common/VillagerTradingManager.java b/src/main/java/net/minecraftforge/common/VillagerTradingManager.java deleted file mode 100644 index d792efff18..0000000000 --- a/src/main/java/net/minecraftforge/common/VillagerTradingManager.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.entity.npc.villager.VillagerProfession; -import net.minecraft.world.entity.npc.villager.VillagerTrades; -import net.minecraft.world.entity.npc.villager.VillagerTrades.ItemListing; -import net.minecraft.core.NonNullList; -import net.minecraftforge.event.village.VillagerTradesEvent; -import net.minecraftforge.event.village.WandererTradesEvent; -import net.minecraftforge.common.util.Lazy; -import net.minecraftforge.event.server.ServerAboutToStartEvent; -import net.minecraftforge.registries.ForgeRegistries; -import org.apache.commons.lang3.tuple.Pair; - -public class VillagerTradingManager { - private static final Lazy, Int2ObjectMap>> VANILLA_TRADES = Lazy.of(VillagerTradingManager::copyVanillaTrades); - private static final Lazy>> WANDERER_TRADES = Lazy.of(() -> new ArrayList>(VillagerTrades.WANDERING_TRADER_TRADES)); - - private static Map, Int2ObjectMap> copyVanillaTrades() { - var ret = new HashMap, Int2ObjectMap>(); - VillagerTrades.TRADES.forEach((key, value) -> { - Int2ObjectMap copy = new Int2ObjectOpenHashMap<>(); - for (var ent : value.int2ObjectEntrySet()) { - copy.put(ent.getIntKey(), Arrays.copyOf(ent.getValue(), ent.getValue().length)); - } - ret.put(key, copy); - }); - return ret; - } - - static void loadTrades(ServerAboutToStartEvent e) { - postWandererEvent(); - postVillagerEvents(); - } - - /** Posts the WandererTradesEvent. */ - private static void postWandererEvent() { - if (!WandererTradesEvent.BUS.hasListeners()) - return; - var event = WandererTradesEvent.BUS.fire(new WandererTradesEvent(WANDERER_TRADES.get())); - VillagerTrades.WANDERING_TRADER_TRADES.clear(); - for (var pool : event.getPools()) - VillagerTrades.WANDERING_TRADER_TRADES.add(Pair.of(pool.getEntries().toArray(ItemListing[]::new), pool.getRolls())); - } - - /** Posts a VillagerTradesEvent for each registered profession. */ - private static void postVillagerEvents() { - if (!VillagerTradesEvent.BUS.hasListeners()) - return; - // TODO [VillagerType][1.21.5] Villager Professions are stored as keys in vanilla now? Re-evaluate this. - var vanilla = VANILLA_TRADES.get(); - for (VillagerProfession value : ForgeRegistries.VILLAGER_PROFESSIONS) { - var prof = ForgeRegistries.VILLAGER_PROFESSIONS.getResourceKey(value).orElseThrow(); - Int2ObjectMap trades = vanilla.getOrDefault(prof, new Int2ObjectOpenHashMap<>()); - Int2ObjectMap> mutableTrades = new Int2ObjectOpenHashMap<>(); - for (int i = 1; i < 6; i++) - mutableTrades.put(i, NonNullList.create()); - - for (var entry : trades.int2ObjectEntrySet()) - Arrays.stream(entry.getValue()).forEach(mutableTrades.get(entry.getIntKey())::add); - - VillagerTradesEvent.BUS.post(new VillagerTradesEvent(mutableTrades, prof)); - Int2ObjectMap newTrades = new Int2ObjectOpenHashMap<>(); - for (var entry : mutableTrades.int2ObjectEntrySet()) - newTrades.put(entry.getIntKey(), entry.getValue().toArray(new ItemListing[0])); - - VillagerTrades.TRADES.put(prof, newTrades); - } - } - -} diff --git a/src/main/java/net/minecraftforge/common/WorldWorkerManager.java b/src/main/java/net/minecraftforge/common/WorldWorkerManager.java index 79e804280e..04663f27d7 100644 --- a/src/main/java/net/minecraftforge/common/WorldWorkerManager.java +++ b/src/main/java/net/minecraftforge/common/WorldWorkerManager.java @@ -10,7 +10,7 @@ import net.minecraftforge.eventbus.api.listener.EventListener; import java.util.ArrayList; -public class WorldWorkerManager { +public final class WorldWorkerManager { private static final ArrayList workers = new ArrayList<>(); private static long startTime = -1; private static int index = 0; @@ -46,17 +46,11 @@ public class WorldWorkerManager { } } - @Deprecated(forRemoval = true, since = "1.21.8") - public static void tick(boolean start) { - if (start) startTick(); - else endTick(); - } - public static synchronized void addWorker(IWorker worker) { workers.add(worker); if (tickStartListener == null) { - tickStartListener = TickEvent.ServerTickEvent.Pre.BUS.addListener(event -> startTick()); - tickEndListener = TickEvent.ServerTickEvent.Post.BUS.addListener(event -> endTick()); + tickStartListener = TickEvent.ServerTickEvent.Pre.BUS.addListener(_ -> startTick()); + tickEndListener = TickEvent.ServerTickEvent.Post.BUS.addListener(_ -> endTick()); } } diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java index 1337d9d6d5..89fbe670d0 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java @@ -8,7 +8,6 @@ package net.minecraftforge.common.capabilities; import net.minecraft.resources.Identifier; import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.ModLoader; import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -20,9 +19,6 @@ import java.util.HashMap; import java.util.Map; public final class CapabilityManager { - @Deprecated(forRemoval = true, since = "1.21") - public static final CapabilityManager INSTANCE = new CapabilityManager(); - private static final Logger LOGGER = LogManager.getLogger(); /** @@ -55,14 +51,14 @@ public final class CapabilityManager { Capability cap; synchronized (providers) { - final var parent = (Capability)providers.computeIfAbsent(new Key(type, null), k -> new Capability<>(type.intern())); + final var parent = (Capability)providers.computeIfAbsent(new Key(type, null), _ -> new Capability<>(type.intern())); if (name == null) { cap = parent; } else { // A Named child - cap = (Capability)providers.computeIfAbsent(new Key(type, name), k -> { + cap = (Capability)providers.computeIfAbsent(new Key(type, name), _ -> { var ret = new Capability<>((parent.getName() + '#' + name.toString()).intern()); - parent.addListener(p -> ret.onRegister()); + parent.addListener(_ -> ret.onRegister()); return ret; }); } @@ -88,8 +84,8 @@ public final class CapabilityManager { private static final Map> providers = new HashMap<>(); @ApiStatus.Internal - public static void injectCapabilities(ModList modlist) { - var autos = modlist.getAllScanData().stream() + public static void injectCapabilities() { + var autos = ModList.getAllScanData().stream() .flatMap(e -> e.getAnnotations().stream()) .filter(a -> AUTO_REGISTER.equals(a.annotationType())) .map(ModFileScanData.AnnotationData::clazz) @@ -101,9 +97,6 @@ public final class CapabilityManager { LOGGER.debug(Logging.CAPABILITIES, "Attempting to automatically register: " + auto); get(auto.getInternalName(), null, true); } - - @SuppressWarnings("removal") - var event = RegisterCapabilitiesEvent.BUS.fire(new RegisterCapabilitiesEvent()); } private static void error(String message) { diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java index 50a886bf2d..c6d6263720 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java @@ -13,6 +13,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.level.storage.ValueOutput; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.ForgeEventFactory; @@ -176,6 +178,16 @@ public abstract class CapabilityProvider> i return capabilities; } + + protected final @Nullable CompoundTag serializeCaps(ValueOutput output) { + if (isLazy && !initialized) + return lazyData; + var disp = getCapabilities(); + if (disp == null || !(output instanceof TagValueOutput tagOutput) || tagOutput.lookup == null) + return null; + return disp.serializeNBT(tagOutput.lookup); + } + protected final @Nullable CompoundTag serializeCaps(HolderLookup.Provider registryAccess) { if (isLazy && !initialized) return lazyData; diff --git a/src/main/java/net/minecraftforge/common/capabilities/RegisterCapabilitiesEvent.java b/src/main/java/net/minecraftforge/common/capabilities/RegisterCapabilitiesEvent.java deleted file mode 100644 index c7b6794717..0000000000 --- a/src/main/java/net/minecraftforge/common/capabilities/RegisterCapabilitiesEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.capabilities; - -import java.util.Objects; - -import net.minecraftforge.eventbus.api.bus.BusGroup; -import net.minecraftforge.eventbus.api.bus.EventBus; -import net.minecraftforge.eventbus.api.event.RecordEvent; -import net.minecraftforge.fml.event.IModBusEvent; -import org.jspecify.annotations.NullMarked; -import org.objectweb.asm.Type; - -/** - * This event fires when it is time to register your capabilities. - * @see Capability - * - * @deprecated Use {@link AutoRegisterCapability} annotation on your class. - */ -@Deprecated(forRemoval = true, since = "1.21") -@NullMarked -public record RegisterCapabilitiesEvent() implements RecordEvent { - public static final EventBus BUS = EventBus.create(RegisterCapabilitiesEvent.class); - - /** @deprecated {@link RegisterCapabilitiesEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - - /** - * Registers a capability to be consumed by others.
- * APIs who define the capability should call this.
- * This is meant to allow Capability consumers to have soft dependencies on the Capability type.
- * But be automatically notified when the Class actually exists. Meaning it's safe to create their implementations.
- *
- * To retrieve the Capability instance, use the {@link CapabilityManager} gets functions. - */ - public void register(Class type) { - Objects.requireNonNull(type, "Attempted to register a capability with invalid type"); - CapabilityManager.get(Type.getInternalName(type), null, true); - } -} diff --git a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java index 377126e601..20cedb7996 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java +++ b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java @@ -26,7 +26,6 @@ import com.mojang.serialization.RecordBuilder; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; -import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup.Provider; import net.minecraft.core.registries.Registries; import net.minecraft.data.recipes.RecipeBuilder; @@ -40,7 +39,6 @@ import net.minecraft.world.item.crafting.RecipeBookCategory; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; -import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; @@ -180,7 +178,9 @@ public class ConditionalRecipe { private static class Wrapper implements Recipe { @Override public boolean matches(CraftingInput inv, Level level) { return false; } - @Override public ItemStack assemble(CraftingInput inv, HolderLookup.Provider reg) { return null; } + @Override public ItemStack assemble(CraftingInput inv) { return null; } + @Override public boolean showNotification() { return false; } + @Override public String group() { return "ungrouped wrapper"; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @@ -284,17 +284,12 @@ public class ConditionalRecipe { } }); - public static final RecipeSerializer> SERIALZIER = new RecipeSerializer>() { - @Override - public MapCodec> codec() { - return CODEC; - } - - @Override - public StreamCodec> streamCodec() { - throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); - } - }; + public static final RecipeSerializer> SERIALZIER = new RecipeSerializer>(CODEC, + StreamCodec.of( + (_, _) -> new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"), + _ -> { throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); } + ) + ); private static final class Holder { private T value; diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java index b3829f7d7b..a32cc96c85 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java @@ -45,7 +45,7 @@ public class ConditionCodec { public DataResult> decode(DynamicOps ops, T input) { var ret = normal.decode(ops, input); if (!ret.result().isPresent() || !ret.result().get().getFirst().isPresent()) - return ret.map(p -> p.mapFirst(e -> _default.get())); + return ret.map(p -> p.mapFirst(_ -> _default.get())); return ret.map(p -> p.mapFirst(Optional::get)); } } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java index d82a3631e7..5a992d93a5 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java @@ -19,7 +19,7 @@ public record ModLoadedCondition(String modid) implements ICondition { @Override public boolean test(IContext context, DynamicOps ops) { - return ModList.get().isLoaded(modid); + return ModList.isLoaded(modid); } @Override diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java index 91cd54af38..6ce9566780 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java @@ -93,12 +93,12 @@ public class CompoundIngredient extends AbstractIngredient { @Override public void write(RegistryFriendlyByteBuf buffer, CompoundIngredient value) { - buffer.writeCollection(value.children, (buf, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); + buffer.writeCollection(value.children, (_, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); } @Override public CompoundIngredient read(RegistryFriendlyByteBuf buffer) { - var children = buffer.readCollection(ArrayList::new, buf -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); + var children = buffer.readCollection(ArrayList::new, _ -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); return new CompoundIngredient(children); } }; diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/IIngredientBuilder.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/IIngredientBuilder.java index 781d15c87d..a0c1f9a8df 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/IIngredientBuilder.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/IIngredientBuilder.java @@ -11,16 +11,11 @@ import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; public interface IIngredientBuilder { - default PartialNBTIngredient.Builder partialNbt() { - return PartialNBTIngredient.builder(); - } - - default Ingredient strictNbt(ItemStack value) { - return StrictNBTIngredient.of(value); + default NBTIngredient.Builder nbtIngredient() { + return NBTIngredient.builder(); } default Ingredient compound(Ingredient... values) { diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java index 1d40e180ae..98fec62695 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java @@ -108,13 +108,13 @@ public class IntersectionIngredient extends AbstractIngredient { @Override public IntersectionIngredient read(RegistryFriendlyByteBuf buffer) { - var children = buffer.readCollection(ArrayList::new, buf -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); + var children = buffer.readCollection(ArrayList::new, _ -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); return new IntersectionIngredient(children); } @Override public void write(RegistryFriendlyByteBuf buffer, IntersectionIngredient value) { - buffer.writeCollection(value.children, (b, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); + buffer.writeCollection(value.children, (_, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); } }; } diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/PartialNBTIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/NBTIngredient.java similarity index 63% rename from src/main/java/net/minecraftforge/common/crafting/ingredients/PartialNBTIngredient.java rename to src/main/java/net/minecraftforge/common/crafting/ingredients/NBTIngredient.java index 05d8de8fc4..e11d283a54 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/PartialNBTIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/NBTIngredient.java @@ -5,10 +5,10 @@ package net.minecraftforge.common.crafting.ingredients; +import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.advancements.criterion.NbtPredicate; import net.minecraft.core.HolderSet; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; @@ -28,28 +28,28 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; -/** Ingredient that matches the given items, performing a partial NBT match. Use {@link StrictNBTIngredient} if you want exact match on NBT */ -public class PartialNBTIngredient extends AbstractIngredient { +/** Ingredient that matches the given items, performing a partial NBT match unless strict is set. */ +public class NBTIngredient extends AbstractIngredient { public static Builder builder() { return new Builder(); } private final CompoundTag nbt; - private final NbtPredicate predicate; + private final boolean strict; - private PartialNBTIngredient(HolderSet items, CompoundTag nbt) { + private NBTIngredient(HolderSet items, CompoundTag nbt, boolean strict) { super(items); if (items.size() == 0) throw new IllegalArgumentException("Cannot create a PartialNBTIngredient with no items"); this.nbt = nbt; - this.predicate = new NbtPredicate(nbt); + this.strict = strict; } /** Creates a new ingredient matching any item from the list, containing the given NBT */ @SuppressWarnings("deprecation") - public static PartialNBTIngredient of(CompoundTag nbt, ItemLike... items) { + public static NBTIngredient of(CompoundTag nbt, ItemLike... items) { return of( HolderSet.direct( Arrays.stream(items) @@ -61,14 +61,20 @@ public class PartialNBTIngredient extends AbstractIngredient { } /** Creates a new ingredient matching the given item, containing the given NBT */ + public static NBTIngredient of(ItemLike item, CompoundTag nbt) { + return of(item, nbt, false); + } @SuppressWarnings("deprecation") - public static PartialNBTIngredient of(ItemLike item, CompoundTag nbt) { - return of(HolderSet.direct(item.asItem().builtInRegistryHolder()), nbt); + public static NBTIngredient of(ItemLike item, CompoundTag nbt, boolean strict) { + return of(HolderSet.direct(item.asItem().builtInRegistryHolder()), nbt, strict); } /** Creates a new ingredient matching the given item, containing the given NBT */ - public static PartialNBTIngredient of(HolderSet items, CompoundTag nbt) { - return new PartialNBTIngredient(items, nbt); + public static NBTIngredient of(HolderSet items, CompoundTag nbt) { + return of(items, nbt, false); + } + public static NBTIngredient of(HolderSet items, CompoundTag nbt, boolean strict) { + return new NBTIngredient(items, nbt, strict); } @Override @@ -76,7 +82,8 @@ public class PartialNBTIngredient extends AbstractIngredient { if (input == null) return false; var nbt = input.get(DataComponents.CUSTOM_DATA); - return nbt != null && input.is(this.values) && predicate.matches(nbt.copyTag()); + if (nbt == null || !input.is(this.values)) return false; + return strict ? nbt.strictMatchedBy(this.nbt) : nbt.matchedBy(this.nbt); } @Override @@ -89,38 +96,42 @@ public class PartialNBTIngredient extends AbstractIngredient { return SERIALIZER; } - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(builder -> + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(builder -> builder.group( Ingredient.NON_AIR_HOLDER_SET_CODEC.fieldOf("items").forGetter(i -> i.values), - TagParser.FLATTENED_CODEC.fieldOf("nbt").forGetter(i -> i.nbt) - ).apply(builder, PartialNBTIngredient::new) + TagParser.FLATTENED_CODEC.fieldOf("nbt").forGetter(i -> i.nbt), + Codec.BOOL.fieldOf("strict").forGetter(i -> i.strict) + ).apply(builder, NBTIngredient::new) ); - public static final IIngredientSerializer SERIALIZER = new IIngredientSerializer<>() { + public static final IIngredientSerializer SERIALIZER = new IIngredientSerializer<>() { private final StreamCodec> HOLDER_SET = ByteBufCodecs.holderSet(Registries.ITEM); @Override - public MapCodec codec() { + public MapCodec codec() { return CODEC; } @Override - public PartialNBTIngredient read(RegistryFriendlyByteBuf buffer) { + public NBTIngredient read(RegistryFriendlyByteBuf buffer) { var items = HOLDER_SET.decode(buffer); var nbt = buffer.readNbt(); - return new PartialNBTIngredient(items, Objects.requireNonNull(nbt)); + var strict = buffer.readBoolean(); + return new NBTIngredient(items, Objects.requireNonNull(nbt), strict); } @Override - public void write(RegistryFriendlyByteBuf buffer, PartialNBTIngredient value) { + public void write(RegistryFriendlyByteBuf buffer, NBTIngredient value) { HOLDER_SET.encode(buffer, value.values); buffer.writeNbt(value.nbt); + buffer.writeBoolean(value.strict); } }; public static class Builder { private final List items = new ArrayList<>(); private CompoundTag nbt; + private boolean strict = false; public Builder nbt(CompoundTag value) { if (this.nbt != null) @@ -129,6 +140,11 @@ public class PartialNBTIngredient extends AbstractIngredient { return this; } + public Builder strict() { + this.strict = true; + return this; + } + public Builder item(ItemLike item) { this.items.add(item); return this; @@ -140,13 +156,21 @@ public class PartialNBTIngredient extends AbstractIngredient { return this; } - public PartialNBTIngredient build() { + public NBTIngredient build() { if (nbt == null) throw new IllegalStateException("NBT Data not set"); if (items.isEmpty()) throw new IllegalStateException("No items added"); - return PartialNBTIngredient.of(nbt, items.stream().toArray(ItemLike[]::new)); + @SuppressWarnings("deprecation") + var holders = HolderSet.direct( + items.stream() + .map(ItemLike::asItem) + .map(Item::builtInRegistryHolder) + .toList() + ); + + return NBTIngredient.of(holders, nbt, strict); } } } diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/StrictNBTIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/StrictNBTIngredient.java deleted file mode 100644 index 8654a406db..0000000000 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/StrictNBTIngredient.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.crafting.ingredients; - -import net.minecraft.core.HolderSet; -import net.minecraft.core.component.DataComponents; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; - -/** Ingredient that matches the given stack, performing an exact NBT match. Use {@link PartialNBTIngredient} if you need partial match. */ -public class StrictNBTIngredient extends AbstractIngredient { - public static StrictNBTIngredient of(ItemStack stack) { - return new StrictNBTIngredient(stack); - } - - private final ItemStack stack; - private StrictNBTIngredient(ItemStack stack) { - super(HolderSet.direct(stack.getItemHolder())); - this.stack = stack; - } - - @Override - public boolean test(@Nullable ItemStack input) { - if (input == null) - return false; - - //Can't use areItemStacksEqualUsingNBTShareTag because it compares stack size as well - var inbt = input.get(DataComponents.CUSTOM_DATA); - var tnbt = this.stack.get(DataComponents.CUSTOM_DATA); - if(inbt == null || tnbt == null) - return false; - - return this.stack.getItem() == input.getItem() && tnbt.matchedBy(inbt.copyTag()); - } - - @Override - public boolean isSimple() { - return false; - } - - @Override - public IIngredientSerializer serializer() { - return SERIALIZER; - } - - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(b -> b.group( - ItemStack.CODEC.fieldOf("stack").forGetter(i -> i.stack) - ).apply(b, StrictNBTIngredient::new)); - - public static final IIngredientSerializer SERIALIZER = new IIngredientSerializer<>() { - @Override - public MapCodec codec() { - return CODEC; - } - - @Override - public void write(RegistryFriendlyByteBuf buffer, StrictNBTIngredient value) { - ItemStack.STREAM_CODEC.encode(buffer, value.stack); - } - - @Override - public StrictNBTIngredient read(RegistryFriendlyByteBuf buffer) { - var stack = ItemStack.STREAM_CODEC.decode(buffer); - return new StrictNBTIngredient(stack); - } - }; -} diff --git a/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java deleted file mode 100644 index e5800223ec..0000000000 --- a/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import java.util.concurrent.CompletableFuture; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.registries.Registries; -import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.IntrinsicHolderTagsProvider; -import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.Nullable; - -public abstract class BlockTagsProvider extends IntrinsicHolderTagsProvider { - @SuppressWarnings("deprecation") - public BlockTagsProvider(PackOutput output, CompletableFuture lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper) { - super(output, Registries.BLOCK, lookupProvider, block -> block.builtInRegistryHolder().key(), modId, existingFileHelper); - } -} diff --git a/src/main/java/net/minecraftforge/common/data/EnchantmentTagsProvider.java b/src/main/java/net/minecraftforge/common/data/EnchantmentTagsProvider.java deleted file mode 100644 index b08333159a..0000000000 --- a/src/main/java/net/minecraftforge/common/data/EnchantmentTagsProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import net.minecraft.core.HolderLookup; -import net.minecraft.data.PackOutput; -import org.jetbrains.annotations.Nullable; - -import java.util.concurrent.CompletableFuture; - -/** Use {@link net.minecraft.data.tags.EnchantmentTagsProvider Vanilla's EnchantmentTagsProvider} */ -@Deprecated(forRemoval = true, since = "1.21.6") -public abstract class EnchantmentTagsProvider extends net.minecraft.data.tags.EnchantmentTagsProvider { - public EnchantmentTagsProvider(PackOutput output, CompletableFuture lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, modId, existingFileHelper); - } -} diff --git a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index 0de6e1b90c..c82cf63278 100644 --- a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -81,7 +81,6 @@ public class ExistingFileHelper { } private final MultiPackResourceManager clientResources, serverData; - private final boolean enable; private final Multimap generated = HashMultimap.create(); /** @@ -93,11 +92,10 @@ public class ExistingFileHelper { * other generated files. * @param existingPacks a collection of paths to existing packs * @param existingMods a set of mod IDs for existing mods - * @param enable {@code true} if validation is enabled * @param assetIndex the identifier for the asset index, generally Minecraft's current major version * @param assetsDir the directory in which to find vanilla assets and indexes */ - public ExistingFileHelper(Collection existingPacks, final Set existingMods, boolean enable, @Nullable final String assetIndex, @Nullable final File assetsDir) { + public ExistingFileHelper(Collection existingPacks, final Set existingMods, @Nullable final String assetIndex, @Nullable final File assetsDir) { List candidateClientResources = new ArrayList<>(); List candidateServerResources = new ArrayList<>(); @@ -108,7 +106,7 @@ public class ExistingFileHelper { candidateServerResources.add(ServerPacksSource.createVanillaPackSource()); var symlinks = new ArrayList(); - var folder = new FolderRepositorySource.FolderPackDetector(new DirectoryValidator(p -> true)); + var folder = new FolderRepositorySource.FolderPackDetector(new DirectoryValidator(_ -> true)); for (Path existing : existingPacks) { try { @@ -123,7 +121,7 @@ public class ExistingFileHelper { } for (String existingMod : existingMods) { - IModFileInfo modFileInfo = ModList.get().getModFileById(existingMod); + IModFileInfo modFileInfo = ModList.getModFileById(existingMod); if (modFileInfo != null) { var root = modFileInfo.getFile().findResource("/"); var supplier = new PathResourcesSupplier(root); @@ -136,8 +134,6 @@ public class ExistingFileHelper { this.clientResources = new MultiPackResourceManager(PackType.CLIENT_RESOURCES, candidateClientResources); this.serverData = new MultiPackResourceManager(PackType.SERVER_DATA, candidateServerResources); - - this.enable = enable; } private ResourceManager getManager(PackType packType) { @@ -254,13 +250,4 @@ public class ExistingFileHelper { public List getResourceStack(Identifier loc, PackType packType) { return getManager(packType).getResourceStack(loc); } - - /** - * @return {@code true} if validation is enabled, {@code false} otherwise - * @deprecated Validation is always enabled, check things as you deem fit. - */ - @Deprecated(forRemoval = true, since = "1.21.5") - public boolean isEnabled() { - return enable; - } } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java index 84b23e29b4..868099b1ea 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java @@ -8,13 +8,8 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.BiomeTagsProvider; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.Identifier; import net.minecraft.tags.BiomeTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; -import net.minecraftforge.common.Tags; import org.jetbrains.annotations.ApiStatus; import java.util.concurrent.CompletableFuture; @@ -27,6 +22,7 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override protected void addTags(HolderLookup.Provider lookupProvider) { tag(NO_DEFAULT_MONSTERS).add(Biomes.MUSHROOM_FIELDS).add(Biomes.DEEP_DARK); @@ -39,8 +35,7 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { tag(IS_OVERWORLD).addTag(BiomeTags.IS_OVERWORLD); tag(IS_HOT_OVERWORLD) - .add(Biomes.SWAMP) - .add(Biomes.MANGROVE_SWAMP) + .add(Biomes.MUSHROOM_FIELDS) .add(Biomes.JUNGLE) .add(Biomes.BAMBOO_JUNGLE) .add(Biomes.SPARSE_JUNGLE) @@ -52,17 +47,15 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.SAVANNA_PLATEAU) .add(Biomes.WINDSWEPT_SAVANNA) .add(Biomes.STONY_PEAKS) - .add(Biomes.WARM_OCEAN) - .addOptionalTag(forgeTagKey("is_hot/overworld")); + .add(Biomes.WARM_OCEAN); tag(IS_HOT_NETHER) .add(Biomes.NETHER_WASTES) .add(Biomes.CRIMSON_FOREST) .add(Biomes.WARPED_FOREST) .add(Biomes.SOUL_SAND_VALLEY) - .add(Biomes.BASALT_DELTAS) - .addOptionalTag(forgeTagKey("is_hot/nether")); - tag(IS_HOT_END); // forge:is_hot/end - tag(IS_HOT).addTag(IS_HOT_OVERWORLD).addTag(IS_HOT_NETHER).addOptionalTag(IS_HOT_END); + .add(Biomes.BASALT_DELTAS); + tag(IS_HOT_END); + tag(IS_HOT).addTags(IS_HOT_OVERWORLD, IS_HOT_NETHER, IS_HOT_END); tag(IS_COLD_OVERWORLD) .add(Biomes.TAIGA) @@ -84,20 +77,20 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.COLD_OCEAN) .add(Biomes.FROZEN_OCEAN) .add(Biomes.DEEP_COLD_OCEAN) - .add(Biomes.DEEP_FROZEN_OCEAN) - .addOptionalTag(forgeTagKey("is_cold/overworld")); - tag(IS_COLD_NETHER); // forge:is_cold/nether + .add(Biomes.DEEP_FROZEN_OCEAN); + tag(IS_COLD_NETHER); tag(IS_COLD_END) .add(Biomes.THE_END) .add(Biomes.SMALL_END_ISLANDS) .add(Biomes.END_MIDLANDS) .add(Biomes.END_HIGHLANDS) - .add(Biomes.END_BARRENS) - .addOptionalTag(forgeTagKey("is_cold/end")); - tag(IS_COLD).addTag(IS_COLD_OVERWORLD).addOptionalTag(IS_COLD_NETHER).addTag(IS_COLD_END); + .add(Biomes.END_BARRENS); + tag(IS_COLD).addTags(IS_COLD_OVERWORLD, IS_COLD_NETHER, IS_COLD_END); - tag(IS_DEAD) - .addOptionalTag(forgeTagKey("is_dead")); + tag(IS_DARK_FOREST) + .add(Biomes.DARK_FOREST) + .add(Biomes.PALE_GARDEN); + tag(IS_DEAD); tag(IS_SPARSE_VEGETATION_OVERWORLD) .add(Biomes.WOODED_BADLANDS) @@ -111,10 +104,9 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.SNOWY_SLOPES) .add(Biomes.JAGGED_PEAKS) .add(Biomes.FROZEN_PEAKS); - //.addOptionalTag(forgeTagKey("is_sparse/overworld")); // can't because forge:is_sparse/overworld contains dripstone caves and eroded badlands, while c:is_sparse_vegetation/overworld does not - tag(IS_SPARSE_NETHER); // forge:is_sparse/nether - tag(IS_SPARSE_END); // forge:is_sparse/end - tag(IS_SPARSE_VEGETATION).addTag(IS_SPARSE_VEGETATION_OVERWORLD).addOptionalTag(IS_SPARSE_NETHER).addOptionalTag(IS_SPARSE_END); + tag(IS_SPARSE_VEGETATION_NETHER); + tag(IS_SPARSE_VEGETATION_END); + tag(IS_SPARSE_VEGETATION).addTags(IS_SPARSE_VEGETATION_OVERWORLD, IS_SPARSE_VEGETATION_NETHER, IS_SPARSE_VEGETATION_END); tag(IS_DENSE_VEGETATION_OVERWORLD) .add(Biomes.DARK_FOREST) @@ -122,11 +114,10 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.OLD_GROWTH_SPRUCE_TAIGA) .add(Biomes.JUNGLE) .add(Biomes.BAMBOO_JUNGLE) - .add(Biomes.MANGROVE_SWAMP) - .addOptionalTag(forgeTagKey("is_dense/overworld")); - tag(IS_DENSE_NETHER); - tag(IS_DENSE_END); - tag(IS_DENSE_VEGETATION).addTag(IS_DENSE_VEGETATION_OVERWORLD).addOptionalTag(IS_DENSE_NETHER).addOptionalTag(IS_DENSE_END); + .add(Biomes.MANGROVE_SWAMP); + tag(IS_DENSE_VEGETATION_NETHER); + tag(IS_DENSE_VEGETATION_END); + tag(IS_DENSE_VEGETATION).addTags(IS_DENSE_VEGETATION_OVERWORLD, IS_DENSE_VEGETATION_NETHER, IS_DENSE_VEGETATION_END); tag(IS_WET_OVERWORLD) .add(Biomes.SWAMP) @@ -136,11 +127,10 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.SPARSE_JUNGLE) .add(Biomes.BEACH) .add(Biomes.LUSH_CAVES) - .add(Biomes.DRIPSTONE_CAVES) - .addOptionalTag(forgeTagKey("is_wet/overworld")); + .add(Biomes.DRIPSTONE_CAVES); tag(IS_WET_NETHER); tag(IS_WET_END); - tag(IS_WET).addTag(IS_WET_OVERWORLD).addOptionalTag(IS_WET_NETHER).addOptionalTag(IS_WET_END); + tag(IS_WET).addTags(IS_WET_OVERWORLD, IS_WET_NETHER, IS_WET_END); tag(IS_DRY_OVERWORLD) .add(Biomes.DESERT) @@ -149,41 +139,84 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.ERODED_BADLANDS) .add(Biomes.SAVANNA) .add(Biomes.SAVANNA_PLATEAU) - .add(Biomes.WINDSWEPT_SAVANNA) - .addOptionalTag(forgeTagKey("is_dry/overworld")); + .add(Biomes.WINDSWEPT_SAVANNA); tag(IS_DRY_NETHER) .add(Biomes.NETHER_WASTES) .add(Biomes.CRIMSON_FOREST) .add(Biomes.WARPED_FOREST) .add(Biomes.SOUL_SAND_VALLEY) - .add(Biomes.BASALT_DELTAS) - .addOptionalTag(forgeTagKey("is_dry/nether")); + .add(Biomes.BASALT_DELTAS); tag(IS_DRY_END) .add(Biomes.THE_END) .add(Biomes.SMALL_END_ISLANDS) .add(Biomes.END_MIDLANDS) .add(Biomes.END_HIGHLANDS) - .add(Biomes.END_BARRENS) - .addOptionalTag(forgeTagKey("is_dry/end")); + .add(Biomes.END_BARRENS); tag(IS_DRY) - .addTag(IS_DRY_OVERWORLD).addTag(IS_DRY_NETHER).addTag(IS_DRY_END) - .addOptionalTag(forgeTagKey("is_dry")); + .addTags(IS_DRY_OVERWORLD, IS_DRY_NETHER, IS_DRY_END); + + tag(IS_TEMPERATE_OVERWORLD) + .add(Biomes.BEACH) + .add(Biomes.BIRCH_FOREST) + .add(Biomes.CHERRY_GROVE) + .add(Biomes.DARK_FOREST) + .add(Biomes.DEEP_OCEAN) + .add(Biomes.FLOWER_FOREST) + .add(Biomes.FOREST) + .add(Biomes.MANGROVE_SWAMP) + .add(Biomes.MEADOW) + .add(Biomes.OCEAN) + .add(Biomes.OLD_GROWTH_BIRCH_FOREST) + .add(Biomes.PLAINS) + .add(Biomes.SUNFLOWER_PLAINS) + .add(Biomes.SWAMP); + tag(IS_TEMPERATE_NETHER); + tag(IS_TEMPERATE_END); + tag(IS_TEMPERATE) + .addTag(IS_TEMPERATE_OVERWORLD) + .addTag(IS_TEMPERATE_NETHER) + .addTag(IS_TEMPERATE_END); + + tag(PRIMARY_WOOD_TYPE_ACACIA).add(Biomes.SAVANNA, Biomes.SAVANNA_PLATEAU, Biomes.WINDSWEPT_SAVANNA); + tag(PRIMARY_WOOD_TYPE_BAMBOO).add(Biomes.BAMBOO_JUNGLE); + tag(PRIMARY_WOOD_TYPE_BIRCH).add(Biomes.BIRCH_FOREST, Biomes.OLD_GROWTH_BIRCH_FOREST); + tag(PRIMARY_WOOD_TYPE_CHERRY).add(Biomes.CHERRY_GROVE); + tag(PRIMARY_WOOD_TYPE_CRIMSON).add(Biomes.CRIMSON_FOREST); + tag(PRIMARY_WOOD_TYPE_DARK_OAK).add(Biomes.DARK_FOREST); + tag(PRIMARY_WOOD_TYPE_JUNGLE).add(Biomes.JUNGLE, Biomes.SPARSE_JUNGLE); + tag(PRIMARY_WOOD_TYPE_MANGROVE).add(Biomes.MANGROVE_SWAMP); + tag(PRIMARY_WOOD_TYPE_OAK).add(Biomes.FLOWER_FOREST, Biomes.FOREST, Biomes.SWAMP, Biomes.WOODED_BADLANDS); + tag(PRIMARY_WOOD_TYPE_PALE_OAK).add(Biomes.PALE_GARDEN); + tag(PRIMARY_WOOD_TYPE_SPRUCE).add(Biomes.GROVE, Biomes.OLD_GROWTH_PINE_TAIGA, Biomes.OLD_GROWTH_SPRUCE_TAIGA, Biomes.SNOWY_TAIGA, Biomes.TAIGA); + tag(PRIMARY_WOOD_TYPE_WARPED).add(Biomes.WARPED_FOREST); + tag(PRIMARY_WOOD_TYPE) + .addTags( + PRIMARY_WOOD_TYPE_ACACIA, + PRIMARY_WOOD_TYPE_BAMBOO, + PRIMARY_WOOD_TYPE_BIRCH, + PRIMARY_WOOD_TYPE_CHERRY, + PRIMARY_WOOD_TYPE_CRIMSON, + PRIMARY_WOOD_TYPE_DARK_OAK, + PRIMARY_WOOD_TYPE_JUNGLE, + PRIMARY_WOOD_TYPE_MANGROVE, + PRIMARY_WOOD_TYPE_OAK, + PRIMARY_WOOD_TYPE_PALE_OAK, + PRIMARY_WOOD_TYPE_SPRUCE, + PRIMARY_WOOD_TYPE_WARPED + ); tag(IS_CONIFEROUS_TREE) .addTag(IS_TAIGA) - .add(Biomes.GROVE) - .addOptionalTag(forgeTagKey("is_coniferous")); + .add(Biomes.GROVE); tag(IS_SAVANNA_TREE).addTag(IS_SAVANNA); tag(IS_JUNGLE_TREE).addTag(IS_JUNGLE); - tag(IS_DECIDUOUS_TREE).add(Biomes.FOREST).add(Biomes.FLOWER_FOREST).add(Biomes.BIRCH_FOREST).add(Biomes.DARK_FOREST).add(Biomes.OLD_GROWTH_BIRCH_FOREST).add(Biomes.WINDSWEPT_FOREST); + tag(IS_DECIDUOUS_TREE).add(Biomes.FOREST, Biomes.FLOWER_FOREST, Biomes.BIRCH_FOREST, Biomes.DARK_FOREST, Biomes.OLD_GROWTH_BIRCH_FOREST, Biomes.PALE_GARDEN, Biomes.WINDSWEPT_FOREST); tag(IS_MOUNTAIN_SLOPE).add(Biomes.SNOWY_SLOPES).add(Biomes.MEADOW).add(Biomes.GROVE).add(Biomes.CHERRY_GROVE); tag(IS_MOUNTAIN_PEAK) - .add(Biomes.JAGGED_PEAKS).add(Biomes.FROZEN_PEAKS).add(Biomes.STONY_PEAKS) - .addOptionalTag(forgeTagKey("is_peak")); + .add(Biomes.JAGGED_PEAKS).add(Biomes.FROZEN_PEAKS).add(Biomes.STONY_PEAKS); tag(IS_MOUNTAIN) .addTag(BiomeTags.IS_MOUNTAIN).addTag(IS_MOUNTAIN_PEAK).addTag(IS_MOUNTAIN_SLOPE); - //.addOptionalTag(forgeTagKey("is_mountain")); // can't because forge:is_mountain contains savanna plateau, while c:is_mountain does not tag(IS_FOREST).addTag(BiomeTags.IS_FOREST); tag(IS_BIRCH_FOREST).add(Biomes.BIRCH_FOREST).add(Biomes.OLD_GROWTH_BIRCH_FOREST); @@ -209,19 +242,31 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { .add(Biomes.SNOWY_SLOPES) .add(Biomes.JAGGED_PEAKS) .add(Biomes.FROZEN_PEAKS); - //.addOptionalTag(forgeTagKey("is_snowy")); // can't add forge:is_snowy because it contains frozen ocean and frozen river, while c:is_snowy does not tag(IS_ICY).add(Biomes.ICE_SPIKES).add(Biomes.FROZEN_PEAKS); tag(IS_SWAMP).add(Biomes.SWAMP).add(Biomes.MANGROVE_SWAMP); tag(IS_OLD_GROWTH).add(Biomes.OLD_GROWTH_BIRCH_FOREST).add(Biomes.OLD_GROWTH_PINE_TAIGA).add(Biomes.OLD_GROWTH_SPRUCE_TAIGA); tag(IS_LUSH).add(Biomes.LUSH_CAVES); tag(IS_MAGICAL); - tag(IS_MODIFIED); tag(IS_SANDY).add(Biomes.DESERT).add(Biomes.BADLANDS).add(Biomes.WOODED_BADLANDS).add(Biomes.ERODED_BADLANDS).add(Biomes.BEACH); tag(IS_MUSHROOM).add(Biomes.MUSHROOM_FIELDS); tag(IS_PLATEAU).add(Biomes.WOODED_BADLANDS).add(Biomes.SAVANNA_PLATEAU).add(Biomes.CHERRY_GROVE).add(Biomes.MEADOW); - tag(IS_SPOOKY).add(Biomes.DARK_FOREST).add(Biomes.DEEP_DARK); + tag(IS_SPOOKY).add(Biomes.DARK_FOREST).add(Biomes.DEEP_DARK).add(Biomes.PALE_GARDEN); tag(IS_WASTELAND); - tag(IS_RARE).add(Biomes.SUNFLOWER_PLAINS).add(Biomes.FLOWER_FOREST).add(Biomes.OLD_GROWTH_BIRCH_FOREST).add(Biomes.OLD_GROWTH_SPRUCE_TAIGA).add(Biomes.BAMBOO_JUNGLE).add(Biomes.SPARSE_JUNGLE).add(Biomes.ERODED_BADLANDS).add(Biomes.SAVANNA_PLATEAU).add(Biomes.WINDSWEPT_SAVANNA).add(Biomes.ICE_SPIKES).add(Biomes.WINDSWEPT_GRAVELLY_HILLS).add(Biomes.MUSHROOM_FIELDS).add(Biomes.DEEP_DARK); + tag(IS_RARE) + .add(Biomes.SUNFLOWER_PLAINS) + .add(Biomes.FLOWER_FOREST) + .add(Biomes.OLD_GROWTH_BIRCH_FOREST) + .add(Biomes.OLD_GROWTH_SPRUCE_TAIGA) + .add(Biomes.BAMBOO_JUNGLE) + .add(Biomes.SPARSE_JUNGLE) + .add(Biomes.ERODED_BADLANDS) + .add(Biomes.SAVANNA_PLATEAU) + .add(Biomes.WINDSWEPT_SAVANNA) + .add(Biomes.ICE_SPIKES) + .add(Biomes.WINDSWEPT_GRAVELLY_HILLS) + .add(Biomes.MUSHROOM_FIELDS) + .add(Biomes.DEEP_DARK) + .add(Biomes.PALE_GARDEN); tag(IS_RIVER).addTag(BiomeTags.IS_RIVER); tag(IS_SHALLOW_OCEAN).add(Biomes.OCEAN).add(Biomes.LUKEWARM_OCEAN).add(Biomes.WARM_OCEAN).add(Biomes.COLD_OCEAN).add(Biomes.FROZEN_OCEAN); @@ -231,92 +276,11 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { tag(IS_AQUATIC).addTag(IS_OCEAN).addTag(IS_RIVER); tag(IS_CAVE) - .add(Biomes.LUSH_CAVES).add(Biomes.DRIPSTONE_CAVES).add(Biomes.DEEP_DARK) - .addOptionalTag(forgeTagKey("is_cave")); + .add(Biomes.LUSH_CAVES).add(Biomes.DRIPSTONE_CAVES).add(Biomes.DEEP_DARK); tag(IS_UNDERGROUND).addTag(IS_CAVE); tag(IS_NETHER_FOREST).add(Biomes.CRIMSON_FOREST).add(Biomes.WARPED_FOREST); tag(IS_OUTER_END_ISLAND).add(Biomes.END_HIGHLANDS).add(Biomes.END_MIDLANDS).add(Biomes.END_BARRENS); - - // Backwards compat definitions for pre-1.21 legacy `forge:` tags. - // TODO: Remove backwards compat tag entries in 1.22 - tag(Biomes.PLAINS, forgeTagKey("is_plains")); - tag(Biomes.DESERT, forgeTagKey("is_hot/overworld"), forgeTagKey("is_dry/overworld"), forgeTagKey("is_sandy"), forgeTagKey("is_desert")); - tag(Biomes.TAIGA, forgeTagKey("is_cold/overworld"), forgeTagKey("is_coniferous")); - tag(Biomes.SWAMP, forgeTagKey("is_wet/overworld"), forgeTagKey("is_swamp")); - tag(Biomes.NETHER_WASTES, forgeTagKey("is_hot/nether"), forgeTagKey("is_dry/nether")); - tag(Biomes.THE_END, forgeTagKey("is_cold/end"), forgeTagKey("is_dry/end")); - tag(Biomes.FROZEN_OCEAN, forgeTagKey("is_cold/overworld"), forgeTagKey("is_snowy")); - tag(Biomes.FROZEN_RIVER, forgeTagKey("is_cold/overworld"), forgeTagKey("is_snowy")); - tag(Biomes.SNOWY_PLAINS, forgeTagKey("is_cold/overworld"), forgeTagKey("is_snowy"), forgeTagKey("is_wasteland"), forgeTagKey("is_plains")); - tag(Biomes.MUSHROOM_FIELDS, forgeTagKey("is_mushroom"), forgeTagKey("is_rare")); - tag(Biomes.JUNGLE, forgeTagKey("is_hot/overworld"), forgeTagKey("is_wet/overworld"), forgeTagKey("is_dense/overworld")); - tag(Biomes.SPARSE_JUNGLE, forgeTagKey("is_hot/overworld"), forgeTagKey("is_wet/overworld"), forgeTagKey("is_rare")); - tag(Biomes.BEACH, forgeTagKey("is_wet/overworld"), forgeTagKey("is_sandy")); - tag(Biomes.SNOWY_BEACH, forgeTagKey("is_cold/overworld"), forgeTagKey("is_snowy")); - tag(Biomes.DARK_FOREST, forgeTagKey("is_spooky"), forgeTagKey("is_dense/overworld")); - tag(Biomes.SNOWY_TAIGA, forgeTagKey("is_cold/overworld"), forgeTagKey("is_coniferous"), forgeTagKey("is_snowy")); - tag(Biomes.OLD_GROWTH_PINE_TAIGA, forgeTagKey("is_cold/overworld"), forgeTagKey("is_coniferous")); - tag(Biomes.WINDSWEPT_FOREST, forgeTagKey("is_sparse/overworld")); - tag(Biomes.SAVANNA, forgeTagKey("is_hot/overworld"), forgeTagKey("is_sparse/overworld")); - tag(Biomes.SAVANNA_PLATEAU, forgeTagKey("is_hot/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_rare"), forgeTagKey("is_slope"), Tags.Biomes.IS_PLATEAU); - tag(Biomes.BADLANDS, forgeTagKey("is_sandy"), forgeTagKey("is_dry/overworld")); - tag(Biomes.WOODED_BADLANDS, forgeTagKey("is_sandy"), forgeTagKey("is_dry/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_slope"), Tags.Biomes.IS_PLATEAU); - tag(Biomes.MEADOW, forgeTagKey("is_plains"), Tags.Biomes.IS_PLATEAU, forgeTagKey("is_slope")); - tag(Biomes.GROVE, forgeTagKey("is_cold/overworld"), forgeTagKey("is_coniferous"), forgeTagKey("is_snowy"), forgeTagKey("is_slope")); - tag(Biomes.SNOWY_SLOPES, forgeTagKey("is_cold/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_snowy"), forgeTagKey("is_slope")); - tag(Biomes.JAGGED_PEAKS, forgeTagKey("is_cold/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_snowy"), forgeTagKey("is_peak")); - tag(Biomes.FROZEN_PEAKS, forgeTagKey("is_cold/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_snowy"), forgeTagKey("is_peak")); - tag(Biomes.STONY_PEAKS, forgeTagKey("is_hot/overworld"), forgeTagKey("is_peak")); - tag(Biomes.SMALL_END_ISLANDS, forgeTagKey("is_cold/end"), forgeTagKey("is_dry/end")); - tag(Biomes.END_MIDLANDS, forgeTagKey("is_cold/end"), forgeTagKey("is_dry/end")); - tag(Biomes.END_HIGHLANDS, forgeTagKey("is_cold/end"), forgeTagKey("is_dry/end")); - tag(Biomes.END_BARRENS, forgeTagKey("is_cold/end"), forgeTagKey("is_dry/end")); - tag(Biomes.WARM_OCEAN, forgeTagKey("is_hot/overworld")); - tag(Biomes.COLD_OCEAN, forgeTagKey("is_cold/overworld")); - tag(Biomes.DEEP_COLD_OCEAN, forgeTagKey("is_cold/overworld")); - tag(Biomes.DEEP_FROZEN_OCEAN, forgeTagKey("is_cold/overworld")); - tag(Biomes.THE_VOID, forgeTagKey("is_void")); - tag(Biomes.SUNFLOWER_PLAINS, forgeTagKey("is_plains"), forgeTagKey("is_rare")); - tag(Biomes.WINDSWEPT_GRAVELLY_HILLS, forgeTagKey("is_sparse/overworld"), forgeTagKey("is_rare")); - tag(Biomes.FLOWER_FOREST, forgeTagKey("is_rare")); - tag(Biomes.ICE_SPIKES, forgeTagKey("is_cold/overworld"), forgeTagKey("is_snowy"), forgeTagKey("is_rare")); - tag(Biomes.OLD_GROWTH_BIRCH_FOREST, forgeTagKey("is_dense/overworld"), forgeTagKey("is_rare")); - tag(Biomes.OLD_GROWTH_SPRUCE_TAIGA, forgeTagKey("is_dense/overworld"), forgeTagKey("is_rare")); - tag(Biomes.WINDSWEPT_SAVANNA, forgeTagKey("is_hot/overworld"), forgeTagKey("is_dry/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_rare")); - tag(Biomes.ERODED_BADLANDS, forgeTagKey("is_hot/overworld"), forgeTagKey("is_dry/overworld"), forgeTagKey("is_sparse/overworld"), forgeTagKey("is_rare")); - tag(Biomes.BAMBOO_JUNGLE, forgeTagKey("is_hot/overworld"), forgeTagKey("is_wet/overworld"), forgeTagKey("is_rare")); - tag(Biomes.LUSH_CAVES, forgeTagKey("is_cave"), forgeTagKey("is_lush"), forgeTagKey("is_wet/overworld")); - tag(Biomes.DRIPSTONE_CAVES, forgeTagKey("is_cave"), forgeTagKey("is_sparse/overworld")); - tag(Biomes.SOUL_SAND_VALLEY, forgeTagKey("is_hot/nether"), forgeTagKey("is_dry/nether")); - tag(Biomes.CRIMSON_FOREST, forgeTagKey("is_hot/nether"), forgeTagKey("is_dry/nether")); - tag(Biomes.WARPED_FOREST, forgeTagKey("is_hot/nether"), forgeTagKey("is_dry/nether")); - tag(Biomes.BASALT_DELTAS, forgeTagKey("is_hot/nether"), forgeTagKey("is_dry/nether")); - tag(Biomes.MANGROVE_SWAMP, forgeTagKey("is_wet/overworld"), forgeTagKey("is_hot/overworld"), forgeTagKey("is_swamp")); - tag(Biomes.DEEP_DARK, forgeTagKey("is_cave"), forgeTagKey("is_rare"), forgeTagKey("is_spooky")); - - tag(forgeTagKey("is_hot")).addTag(forgeTagKey("is_hot/overworld")).addTag(forgeTagKey("is_hot/nether")).addOptionalTag(Tags.Biomes.IS_HOT_END); - tag(forgeTagKey("is_cold")).addTag(forgeTagKey("is_cold/overworld")).addOptionalTag(Tags.Biomes.IS_COLD_NETHER).addTag(forgeTagKey("is_cold/end")); - tag(forgeTagKey("is_sparse")).addTag(forgeTagKey("is_sparse/overworld")).addOptionalTag(Tags.Biomes.IS_SPARSE_NETHER).addOptionalTag(Tags.Biomes.IS_SPARSE_END); - tag(forgeTagKey("is_dense")).addTag(forgeTagKey("is_dense/overworld")).addOptionalTag(Tags.Biomes.IS_DENSE_NETHER).addOptionalTag(Tags.Biomes.IS_DENSE_END); - tag(forgeTagKey("is_wet")).addTag(forgeTagKey("is_wet/overworld")).addOptionalTag(Tags.Biomes.IS_WET_NETHER).addOptionalTag(Tags.Biomes.IS_WET_END); - tag(forgeTagKey("is_dry")).addTag(forgeTagKey("is_dry/overworld")).addTag(forgeTagKey("is_dry/nether")).addTag(forgeTagKey("is_dry/end")); - tag(forgeTagKey("is_dead")); - - tag(forgeTagKey("is_water")).addTag(BiomeTags.IS_OCEAN).addTag(BiomeTags.IS_RIVER); - tag(forgeTagKey("is_mountain")).addTag(forgeTagKey("is_peak")).addTag(forgeTagKey("is_slope")); - tag(forgeTagKey("is_underground")).addTag(forgeTagKey("is_cave")); - } - - @SafeVarargs - private void tag(ResourceKey biome, TagKey... tags) { - for (TagKey key : tags) { - tag(key).add(biome); - } - } - - private static TagKey forgeTagKey(String path) { - return BiomeTags.create(Identifier.fromNamespaceAndPath("forge", path)); } @Override diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java index 29361d2233..ccf86f1f03 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java @@ -5,839 +5,476 @@ package net.minecraftforge.common.data; -import java.util.Locale; -import java.util.function.Consumer; - +import java.util.function.Function; import net.minecraft.data.tags.BlockItemTagsProvider; -import net.minecraft.data.tags.TagAppender; -import net.minecraft.resources.Identifier; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.references.BlockItemIds; +import net.minecraft.tags.BlockItemTagId; +import net.minecraft.tags.BlockItemTags; import net.minecraftforge.common.Tags; -import net.minecraftforge.registries.ForgeRegistries; - -public abstract class ForgeBlockItemTagsProvider extends BlockItemTagsProvider { - @Override - @SuppressWarnings({ "unchecked", "removal" }) - protected void run() { - tag(Tags.Blocks.BARRELS, Tags.Items.BARRELS) - .addTag(Tags.Blocks.BARRELS_WOODEN) - .addOptionalTag(Legacy.Blocks.BARRELS); - tag(Tags.Blocks.BARRELS_WOODEN, Tags.Items.BARRELS_WOODEN, Legacy.Blocks.BARRELS_WOODEN, Legacy.Items.BARRELS_WOODEN) - .add(Blocks.BARREL) - .addOptionalTag(Legacy.Blocks.BARRELS_WOODEN); - tag(Tags.Blocks.BOOKSHELVES, Tags.Items.BOOKSHELVES, Legacy.Blocks.BOOKSHELVES, Legacy.Items.BOOKSHELVES) - .add(Blocks.BOOKSHELF) - .addOptionalTag(Legacy.Blocks.BOOKSHELVES); - tag(Tags.Blocks.BUDDING_BLOCKS, Tags.Items.BUDDING_BLOCKS) - .add(Blocks.BUDDING_AMETHYST); - tag(Tags.Blocks.BUDS, Tags.Items.BUDS) - .add(Blocks.SMALL_AMETHYST_BUD) - .add(Blocks.MEDIUM_AMETHYST_BUD) - .add(Blocks.LARGE_AMETHYST_BUD); - tag(Tags.Blocks.CHAINS, Tags.Items.CHAINS) - .add(Blocks.IRON_CHAIN) - .addAll(Blocks.COPPER_CHAIN.asList()); - tag(Tags.Blocks.CHESTS, Tags.Items.CHESTS) - .addTags( - Tags.Blocks.CHESTS_ENDER, - Tags.Blocks.CHESTS_TRAPPED, - Tags.Blocks.CHESTS_WOODEN - ) - .addOptionalTag(Legacy.Blocks.CHESTS); - //copy(forgeBlockTagKey("chests/ender"), forgeItemTagKey("chests/ender")); - tag(Tags.Blocks.CHESTS_ENDER, Tags.Items.CHESTS_ENDER) - .add(Blocks.ENDER_CHEST); // forge:chests/ender - //copy(forgeBlockTagKey("chests/trapped"), forgeItemTagKey("chests/trapped"))); - tag(Tags.Blocks.CHESTS_TRAPPED, Tags.Items.CHESTS_TRAPPED) - .add(Blocks.TRAPPED_CHEST); // forge:chests/trapped - tag(Tags.Blocks.CHESTS_WOODEN, Tags.Items.CHESTS_WOODEN, Legacy.Blocks.CHESTS_WOODEN, Legacy.Items.CHESTS_WOODEN) - .add( - Blocks.CHEST, - Blocks.TRAPPED_CHEST - ) - .addOptionalTag(Legacy.Blocks.CHESTS_WOODEN); - tag(Tags.Blocks.CLUSTERS, Tags.Items.CLUSTERS) - .add(Blocks.AMETHYST_CLUSTER); - tag(Tags.Blocks.COBBLESTONES, Tags.Items.COBBLESTONES, Legacy.Blocks.COBBLESTONE, Legacy.Items.COBBLESTONE) - .addTags( - Tags.Blocks.COBBLESTONE_NORMAL, - Tags.Blocks.COBBLESTONE_INFESTED, - Tags.Blocks.COBBLESTONE_MOSSY, - Tags.Blocks.COBBLESTONE_DEEPSLATE - ) - .addOptionalTag(Legacy.Blocks.COBBLESTONE); - //copy(forgeBlockTagKey("cobblestone/normal"), forgeItemTagKey("cobblestone/normal")); - tag(Tags.Blocks.COBBLESTONE_NORMAL, Tags.Items.COBBLESTONE_NORMAL) - .add(Blocks.COBBLESTONE); // forge:cobblestone/normal - //copy(forgeBlockTagKey("cobblestone/infested"), forgeItemTagKey("cobblestone/infested")); - tag(Tags.Blocks.COBBLESTONE_INFESTED, Tags.Items.COBBLESTONE_INFESTED) - .add(Blocks.INFESTED_COBBLESTONE); // forge:cobblestone/infested - //copy(forgeBlockTagKey("cobblestone/mossy"), forgeItemTagKey("cobblestone/mossy")); - tag(Tags.Blocks.COBBLESTONE_MOSSY, Tags.Items.COBBLESTONE_MOSSY) - .add(Blocks.MOSSY_COBBLESTONE); // forge:cobblestone/mossy - //copy(forgeBlockTagKey("cobblestone/deepslate"), forgeItemTagKey("cobblestone/deepslate")); - tag(Tags.Blocks.COBBLESTONE_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE) - .add(Blocks.COBBLED_DEEPSLATE); // forge:cobblestone/deepslate - tag(Tags.Blocks.CONCRETES, Tags.Items.CONCRETES) - .add( - Blocks.WHITE_CONCRETE, - Blocks.ORANGE_CONCRETE, - Blocks.MAGENTA_CONCRETE, - Blocks.LIGHT_BLUE_CONCRETE, - Blocks.YELLOW_CONCRETE, - Blocks.LIME_CONCRETE, - Blocks.PINK_CONCRETE, - Blocks.GRAY_CONCRETE, - Blocks.LIGHT_GRAY_CONCRETE, - Blocks.CYAN_CONCRETE, - Blocks.PURPLE_CONCRETE, - Blocks.BLUE_CONCRETE, - Blocks.BROWN_CONCRETE, - Blocks.GREEN_CONCRETE, - Blocks.RED_CONCRETE, - Blocks.BLACK_CONCRETE - ); - //copy(forgeBlockTagKey("end_stones"), forgeItemTagKey("end_stones")); - tag(Tags.Blocks.END_STONES, Tags.Items.END_STONES) - .add(Blocks.END_STONE); // forge:end_stones - //copy(forgeBlockTagKey("fence_gates"), forgeItemTagKey("fence_gates")); - tag(Tags.Blocks.FENCE_GATES, Tags.Items.FENCE_GATES) - .addTags(Tags.Blocks.FENCE_GATES_WOODEN); // forge:fence_gates - //copy(forgeBlockTagKey("fence_gates/wooden"), forgeItemTagKey("fence_gates/wooden")); - tag(Tags.Blocks.FENCE_GATES_WOODEN, Tags.Items.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 - ); - //copy(forgeBlockTagKey("fences"), forgeItemTagKey("fences")); - tag(Tags.Blocks.FENCES, Tags.Items.FENCES) - .addTags( - Tags.Blocks.FENCES_NETHER_BRICK, - Tags.Blocks.FENCES_WOODEN - ); // forge:fences - //copy(forgeBlockTagKey("fences/nether_brick"), forgeItemTagKey("fences/nether_brick")); - tag(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Items.FENCES_NETHER_BRICK) - .add(Blocks.NETHER_BRICK_FENCE); // forge:fences/nether_brick - //copy(forgeBlockTagKey("fences/wooden"), forgeItemTagKey("fences/wooden")); - tag(Tags.Blocks.FENCES_WOODEN, Tags.Items.FENCES_WOODEN) - .addTag(BlockTags.WOODEN_FENCES); // forge:fences/wooden - tag(Tags.Blocks.FLOWERS_SMALL, Tags.Items.FLOWERS_SMALL) - .add( - Blocks.DANDELION, - Blocks.POPPY, - Blocks.BLUE_ORCHID, - Blocks.ALLIUM, - Blocks.AZURE_BLUET, - Blocks.RED_TULIP, - Blocks.ORANGE_TULIP, - Blocks.WHITE_TULIP, - Blocks.PINK_TULIP, - Blocks.OXEYE_DAISY, - Blocks.CORNFLOWER, - Blocks.LILY_OF_THE_VALLEY, - Blocks.WITHER_ROSE, - Blocks.TORCHFLOWER, - Blocks.OPEN_EYEBLOSSOM, - Blocks.CLOSED_EYEBLOSSOM - ) - .addOptionalTag(BlockTags.SMALL_FLOWERS); - tag(Tags.Blocks.FLOWERS_TALL, Tags.Items.FLOWERS_TALL) - .add( - Blocks.SUNFLOWER, - Blocks.LILAC, - Blocks.PEONY, - Blocks.ROSE_BUSH, - Blocks.PITCHER_PLANT - ) - .addOptionalTag(tagKey("tall_flowers")); //This is old vanilla tag, should it be removed? - tag(Tags.Blocks.FLOWERS, Tags.Items.FLOWERS) - .add( - Blocks.FLOWERING_AZALEA_LEAVES, - Blocks.FLOWERING_AZALEA, - Blocks.MANGROVE_PROPAGULE, - Blocks.PINK_PETALS, - Blocks.CHORUS_FLOWER, - Blocks.SPORE_BLOSSOM - ) - .addTags( - Tags.Blocks.FLOWERS_SMALL, - Tags.Blocks.FLOWERS_TALL - ) - .addOptionalTag(BlockTags.FLOWERS); - tag(Tags.Blocks.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS) - .addTags( - Tags.Blocks.GLASS_BLOCKS_COLORLESS, - Tags.Blocks.GLASS_BLOCKS_CHEAP, - Tags.Blocks.GLASS_BLOCKS_TINTED - ) - .addOptionalTag(Tags.Blocks.GLASS); - tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Items.GLASS_BLOCKS_COLORLESS) - .add(Blocks.GLASS) - .addOptionalTag(Tags.Blocks.GLASS_COLORLESS); - tag(Tags.Blocks.GLASS_BLOCKS_TINTED, Tags.Items.GLASS_BLOCKS_TINTED) - .add(Blocks.TINTED_GLASS) - .addOptionalTag(Legacy.Blocks.GLASS_TINTED); - - tag(Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Items.GLASS_BLOCKS_CHEAP, Legacy.Blocks.GLASS_SILICA, Legacy.Items.GLASS_SILICA) - .add( - Blocks.GLASS, - Blocks.WHITE_STAINED_GLASS, - Blocks.ORANGE_STAINED_GLASS, - Blocks.MAGENTA_STAINED_GLASS, - Blocks.LIGHT_BLUE_STAINED_GLASS, - Blocks.YELLOW_STAINED_GLASS, - Blocks.LIME_STAINED_GLASS, - Blocks.PINK_STAINED_GLASS, - Blocks.GRAY_STAINED_GLASS, - Blocks.LIGHT_GRAY_STAINED_GLASS, - Blocks.CYAN_STAINED_GLASS, - Blocks.PURPLE_STAINED_GLASS, - Blocks.BLUE_STAINED_GLASS, - Blocks.BROWN_STAINED_GLASS, - Blocks.GREEN_STAINED_GLASS, - Blocks.RED_STAINED_GLASS, - Blocks.BLACK_STAINED_GLASS - ) - .addOptionalTag(Legacy.Blocks.GLASS_SILICA); - tag(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES) - .addTags(Tags.Blocks.GLASS_PANES_COLORLESS) - .add( - Blocks.WHITE_STAINED_GLASS_PANE, - Blocks.ORANGE_STAINED_GLASS_PANE, - Blocks.MAGENTA_STAINED_GLASS_PANE, - Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, - Blocks.YELLOW_STAINED_GLASS_PANE, - Blocks.LIME_STAINED_GLASS_PANE, - Blocks.PINK_STAINED_GLASS_PANE, - Blocks.GRAY_STAINED_GLASS_PANE, - Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, - Blocks.CYAN_STAINED_GLASS_PANE, - Blocks.PURPLE_STAINED_GLASS_PANE, - Blocks.BLUE_STAINED_GLASS_PANE, - Blocks.BROWN_STAINED_GLASS_PANE, - Blocks.GREEN_STAINED_GLASS_PANE, - Blocks.RED_STAINED_GLASS_PANE, - Blocks.BLACK_STAINED_GLASS_PANE - ) - .addOptionalTag(Legacy.Blocks.GLASS_PANES); - tag(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS) - .add(Blocks.GLASS_PANE) - .addOptionalTag(forgeTagKey("glass_panes/colorless")); - tag(Tags.Blocks.GLAZED_TERRACOTTAS, Tags.Items.GLAZED_TERRACOTTAS) - .add( - Blocks.WHITE_GLAZED_TERRACOTTA, - Blocks.ORANGE_GLAZED_TERRACOTTA, - Blocks.MAGENTA_GLAZED_TERRACOTTA, - Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA, - Blocks.YELLOW_GLAZED_TERRACOTTA, - Blocks.LIME_GLAZED_TERRACOTTA, - Blocks.PINK_GLAZED_TERRACOTTA, - Blocks.GRAY_GLAZED_TERRACOTTA, - Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA, - Blocks.CYAN_GLAZED_TERRACOTTA, - Blocks.PURPLE_GLAZED_TERRACOTTA, - Blocks.BLUE_GLAZED_TERRACOTTA, - Blocks.BROWN_GLAZED_TERRACOTTA, - Blocks.GREEN_GLAZED_TERRACOTTA, - Blocks.RED_GLAZED_TERRACOTTA, - Blocks.BLACK_GLAZED_TERRACOTTA - ); - //copy(forgeBlockTagKey("gravel"), forgeItemTagKey("gravel")); - tag(Tags.Blocks.GRAVEL, Tags.Items.GRAVEL) - .add(Blocks.GRAVEL); // forge:gravel - //copy(forgeBlockTagKey("netherrack"), forgeItemTagKey("netherrack")); - tag(Tags.Blocks.NETHERRACK, Tags.Items.NETHERRACK) - .add(Blocks.NETHERRACK); // forge:netherrack - tag(Tags.Blocks.OBSIDIANS, Tags.Items.OBSIDIANS) - .addTags( - Tags.Blocks.OBSIDIANS_NORMAL, - Tags.Blocks.OBSIDIANS_CRYING - ) - .addOptionalTag(Legacy.Blocks.OBSIDIAN); - tag(Tags.Blocks.OBSIDIANS_NORMAL, Tags.Items.OBSIDIANS_NORMAL) - .add(Blocks.OBSIDIAN); - tag(Tags.Blocks.OBSIDIANS_CRYING, Tags.Items.OBSIDIANS_CRYING) - .add(Blocks.CRYING_OBSIDIAN); - tag(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, Tags.Items.ORE_BEARING_GROUND_DEEPSLATE) - .add(Blocks.DEEPSLATE); // forge:ore_bearing_ground/deepslate - tag(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, Tags.Items.ORE_BEARING_GROUND_NETHERRACK) - .add(Blocks.NETHERRACK); // forge:ore_bearing_ground/netherrack - tag(Tags.Blocks.ORE_BEARING_GROUND_STONE, Tags.Items.ORE_BEARING_GROUND_STONE) - .add(Blocks.STONE); // forge:ore_bearing_ground/stone - tag(Tags.Blocks.ORE_RATES_DENSE, Tags.Items.ORE_RATES_DENSE) - .add( - Blocks.COPPER_ORE, - Blocks.DEEPSLATE_COPPER_ORE, - Blocks.DEEPSLATE_LAPIS_ORE, - Blocks.DEEPSLATE_REDSTONE_ORE, - Blocks.LAPIS_ORE, - Blocks.REDSTONE_ORE - ); - tag(Tags.Blocks.ORE_RATES_SINGULAR, Tags.Items.ORE_RATES_SINGULAR) - .add( - Blocks.ANCIENT_DEBRIS, - Blocks.COAL_ORE, - Blocks.DEEPSLATE_COAL_ORE, - Blocks.DEEPSLATE_DIAMOND_ORE, - Blocks.DEEPSLATE_EMERALD_ORE, - Blocks.DEEPSLATE_GOLD_ORE, - Blocks.DEEPSLATE_IRON_ORE, - Blocks.DIAMOND_ORE, - Blocks.EMERALD_ORE, - Blocks.GOLD_ORE, - Blocks.IRON_ORE, - Blocks.NETHER_QUARTZ_ORE - ); - tag(Tags.Blocks.ORE_RATES_SPARSE, Tags.Items.ORE_RATES_SPARSE) - .add(Blocks.NETHER_GOLD_ORE); - tag(Tags.Blocks.ORES, Tags.Items.ORES) - .addTags( - Tags.Blocks.ORES_COAL, - Tags.Blocks.ORES_COPPER, - Tags.Blocks.ORES_DIAMOND, - Tags.Blocks.ORES_EMERALD, - Tags.Blocks.ORES_GOLD, - Tags.Blocks.ORES_IRON, - Tags.Blocks.ORES_LAPIS, - Tags.Blocks.ORES_NETHERITE_SCRAP, - Tags.Blocks.ORES_REDSTONE, - Tags.Blocks.ORES_QUARTZ - ) - .addOptionalTag(Legacy.Blocks.ORES); - tag(Tags.Blocks.ORES_COAL, Tags.Items.ORES_COAL) - .addTag(BlockTags.COAL_ORES); // forge:ores/coal - tag(Tags.Blocks.ORES_COPPER, Tags.Items.ORES_COPPER) - .addTag(BlockTags.COPPER_ORES); // forge:ores/copper - tag(Tags.Blocks.ORES_DIAMOND, Tags.Items.ORES_DIAMOND) - .addTag(BlockTags.DIAMOND_ORES); // forge:ores/diamond - tag(Tags.Blocks.ORES_EMERALD, Tags.Items.ORES_EMERALD) - .addTag(BlockTags.EMERALD_ORES); // forge:ores/emerald - tag(Tags.Blocks.ORES_GOLD, Tags.Items.ORES_GOLD) - .addTag(BlockTags.GOLD_ORES); // forge:ores/gold - tag(Tags.Blocks.ORES_IRON, Tags.Items.ORES_IRON) - .addTag(BlockTags.IRON_ORES); // forge:ores/iron - tag(Tags.Blocks.ORES_LAPIS, Tags.Items.ORES_LAPIS) - .addTag(BlockTags.LAPIS_ORES); // forge:ores/lapis - tag(Tags.Blocks.ORES_QUARTZ, Tags.Items.ORES_QUARTZ, Legacy.Blocks.ORES_QUARTZ, Legacy.Items.QUARTZ_ORES) - .add(Blocks.NETHER_QUARTZ_ORE) - .addOptionalTag(Legacy.Blocks.ORES_QUARTZ); - tag(Tags.Blocks.ORES_REDSTONE, Tags.Items.ORES_REDSTONE) - .addTag(BlockTags.REDSTONE_ORES); // forge:ores/redstone - tag(Tags.Blocks.ORES_NETHERITE_SCRAP, Tags.Items.ORES_NETHERITE_SCRAP, Legacy.Blocks.ORES_NETHERITE_SCRAP, Legacy.Items.ORES_NEHTERITE_SCRAP) - .add(Blocks.ANCIENT_DEBRIS) - .addOptionalTag(Legacy.Blocks.ORES_NETHERITE_SCRAP); - tag(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, Tags.Items.ORES_IN_GROUND_DEEPSLATE) - .add( - Blocks.DEEPSLATE_COAL_ORE, - Blocks.DEEPSLATE_COPPER_ORE, - Blocks.DEEPSLATE_DIAMOND_ORE, - Blocks.DEEPSLATE_EMERALD_ORE, - Blocks.DEEPSLATE_GOLD_ORE, - Blocks.DEEPSLATE_IRON_ORE, - Blocks.DEEPSLATE_LAPIS_ORE, - Blocks.DEEPSLATE_REDSTONE_ORE - ); - tag(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, Tags.Items.ORES_IN_GROUND_NETHERRACK) - .add( - Blocks.NETHER_GOLD_ORE, - Blocks.NETHER_QUARTZ_ORE - ); - tag(Tags.Blocks.ORES_IN_GROUND_STONE, Tags.Items.ORES_IN_GROUND_STONE) - .add( - Blocks.COAL_ORE, - Blocks.COPPER_ORE, - Blocks.DIAMOND_ORE, - Blocks.EMERALD_ORE, - Blocks.GOLD_ORE, - Blocks.IRON_ORE, - Blocks.LAPIS_ORE, - Blocks.REDSTONE_ORE - ); - tag(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES) - .add(Blocks.CRAFTING_TABLE); - tag(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, Tags.Items.PLAYER_WORKSTATIONS_FURNACES) - .add(Blocks.FURNACE); - tag(Tags.Blocks.PUMPKINS, Tags.Items.PUMPKINS) - .addTags( - Tags.Blocks.PUMPKINS_NORMAL, - Tags.Blocks.PUMPKINS_CARVED, - Tags.Blocks.PUMPKINS_JACK_O_LANTERNS - ); - tag(Tags.Blocks.PUMPKINS_NORMAL, Tags.Items.PUMPKINS_NORMAL) - .add(Blocks.PUMPKIN); - tag(Tags.Blocks.PUMPKINS_CARVED, Tags.Items.PUMPKINS_CARVED) - .add(Blocks.CARVED_PUMPKIN); - tag(Tags.Blocks.PUMPKINS_JACK_O_LANTERNS, Tags.Items.PUMPKINS_JACK_O_LANTERNS) - .add(Blocks.JACK_O_LANTERN); - tag(Tags.Blocks.ROPES, Tags.Items.ROPES); - tag(Tags.Blocks.SAND, Tags.Items.SAND) // forge:sand - .addTags( - Tags.Blocks.SAND_COLORLESS, - Tags.Blocks.SAND_RED - ); - tag(Tags.Blocks.SAND_COLORLESS, Tags.Items.SAND_COLORLESS) // forge:sand/colorless - .add(Blocks.SAND); - tag(Tags.Blocks.SAND_RED, Tags.Items.SAND_RED) // forge:sand/red - .add(Blocks.RED_SAND); - tag(Tags.Blocks.SANDSTONE_BLOCKS, Tags.Items.SANDSTONE_BLOCKS) - .addTags( - Tags.Blocks.SANDSTONE_RED_BLOCKS, - Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS - ) - .addOptionalTag(Legacy.Blocks.SANDSTONE); - tag(Tags.Blocks.SANDSTONE_SLABS, Tags.Items.SANDSTONE_SLABS) - .addTags( - Tags.Blocks.SANDSTONE_RED_SLABS, - Tags.Blocks.SANDSTONE_UNCOLORED_SLABS - ); - tag(Tags.Blocks.SANDSTONE_STAIRS, Tags.Items.SANDSTONE_STAIRS) - .addTags( - Tags.Blocks.SANDSTONE_RED_STAIRS, - Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS - ); - tag(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Items.SANDSTONE_RED_BLOCKS) - .add( - Blocks.RED_SANDSTONE, - Blocks.CUT_RED_SANDSTONE, - Blocks.CHISELED_RED_SANDSTONE, - Blocks.SMOOTH_RED_SANDSTONE - ); - tag(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Items.SANDSTONE_RED_SLABS) - .add( - Blocks.RED_SANDSTONE_SLAB, - Blocks.CUT_RED_SANDSTONE_SLAB, - Blocks.SMOOTH_RED_SANDSTONE_SLAB - ); - tag(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Items.SANDSTONE_RED_STAIRS) - .add( - Blocks.RED_SANDSTONE_STAIRS, - Blocks.SMOOTH_RED_SANDSTONE_STAIRS - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, Tags.Items.SANDSTONE_UNCOLORED_BLOCKS) - .add( - Blocks.SANDSTONE, - Blocks.CUT_SANDSTONE, - Blocks.CHISELED_SANDSTONE, - Blocks.SMOOTH_SANDSTONE - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, Tags.Items.SANDSTONE_UNCOLORED_SLABS) - .add( - Blocks.SANDSTONE_SLAB, - Blocks.CUT_SANDSTONE_SLAB, - Blocks.SMOOTH_SANDSTONE_SLAB - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, Tags.Items.SANDSTONE_UNCOLORED_STAIRS) - .add( - Blocks.SANDSTONE_STAIRS, - Blocks.SMOOTH_SANDSTONE_STAIRS - ); - tag(Tags.Blocks.STONES, Tags.Items.STONES) - .add( - Blocks.ANDESITE, - Blocks.DIORITE, - Blocks.GRANITE, - Blocks.STONE, - Blocks.DEEPSLATE, - Blocks.TUFF - ); - //.addOptionalTag(forgeTagKey("stone")); // can't add this because it would include infested/polished variants which aren't contained in Fabric's `c:stones` - tag(Tags.Blocks.STORAGE_BLOCKS, Tags.Items.STORAGE_BLOCKS) - .addTags( - Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, - Tags.Blocks.STORAGE_BLOCKS_COAL, - Tags.Blocks.STORAGE_BLOCKS_COPPER, - Tags.Blocks.STORAGE_BLOCKS_DIAMOND, - Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, - Tags.Blocks.STORAGE_BLOCKS_EMERALD, - Tags.Blocks.STORAGE_BLOCKS_GOLD, - Tags.Blocks.STORAGE_BLOCKS_IRON, - Tags.Blocks.STORAGE_BLOCKS_LAPIS, - Tags.Blocks.STORAGE_BLOCKS_NETHERITE, - Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, - Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, - Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, - Tags.Blocks.STORAGE_BLOCKS_REDSTONE, - Tags.Blocks.STORAGE_BLOCKS_SLIME, - Tags.Blocks.STORAGE_BLOCKS_WHEAT - ) - //.addOptionalTag(forgeTagKey("storage_blocks")); // can't add this because it would include contents from the non-common forge:storage_blocks/amethyst and forge:storage_blocks/quartz, which are not in the c namespace - .addOptionalTags( - Legacy.Blocks.STORAGE_BLOCKS_COAL, - Legacy.Blocks.STORAGE_BLOCKS_COPPER, - Legacy.Blocks.STORAGE_BLOCKS_DIAMOND, - Legacy.Blocks.STORAGE_BLOCKS_EMERALD, - Legacy.Blocks.STORAGE_BLOCKS_GOLD, - Legacy.Blocks.STORAGE_BLOCKS_IRON, - Legacy.Blocks.STORAGE_BLOCKS_LAPIS, - Legacy.Blocks.STORAGE_BLOCKS_NETHERITE, - Legacy.Blocks.STORAGE_BLOCKS_RAW_COPPER, - Legacy.Blocks.STORAGE_BLOCKS_RAW_GOLD, - Legacy.Blocks.STORAGE_BLOCKS_RAW_IRON, - Legacy.Blocks.STORAGE_BLOCKS_REDSTONE - ); - tag(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Items.STORAGE_BLOCKS_AMETHYST) - .add(Blocks.AMETHYST_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Items.STORAGE_BLOCKS_BONE_MEAL) - .add(Blocks.BONE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Items.STORAGE_BLOCKS_COAL, Legacy.Blocks.STORAGE_BLOCKS_COAL, Legacy.Items.STORAGE_BLOCKS_COAL) - .add(Blocks.COAL_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_COAL); - tag(Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Items.STORAGE_BLOCKS_COPPER, Legacy.Blocks.STORAGE_BLOCKS_COPPER, Legacy.Items.STORAGE_BLOCKS_COPPER) - .add(Blocks.COPPER_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_COPPER); - tag(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Items.STORAGE_BLOCKS_DIAMOND, Legacy.Blocks.STORAGE_BLOCKS_DIAMOND, Legacy.Items.STORAGE_BLOCKS_DIAMOND) - .add(Blocks.DIAMOND_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_DIAMOND); - tag(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, Tags.Items.STORAGE_BLOCKS_DRIED_KELP) - .add(Blocks.DRIED_KELP_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Items.STORAGE_BLOCKS_EMERALD, Legacy.Blocks.STORAGE_BLOCKS_EMERALD, Legacy.Items.STORAGE_BLOCKS_EMERALD) - .add(Blocks.EMERALD_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_EMERALD); - tag(Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Items.STORAGE_BLOCKS_GOLD, Legacy.Blocks.STORAGE_BLOCKS_GOLD, Legacy.Items.STORAGE_BLOCKS_GOLD) - .add(Blocks.GOLD_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_GOLD); - tag(Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Items.STORAGE_BLOCKS_IRON, Legacy.Blocks.STORAGE_BLOCKS_IRON, Legacy.Items.STORAGE_BLOCKS_IRON) - .add(Blocks.IRON_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_IRON); - tag(Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Items.STORAGE_BLOCKS_LAPIS, Legacy.Blocks.STORAGE_BLOCKS_LAPIS, Legacy.Items.STORAGE_BLOCKS_LAPIS) - .add(Blocks.LAPIS_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_LAPIS); - tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE, Legacy.Blocks.STORAGE_BLOCKS_NETHERITE, Legacy.Items.STORAGE_BLOCKS_NETHERITE) - .add(Blocks.NETHERITE_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_NETHERITE); - tag(Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Items.STORAGE_BLOCKS_QUARTZ) - .add(Blocks.QUARTZ_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Items.STORAGE_BLOCKS_RAW_COPPER, Legacy.Blocks.STORAGE_BLOCKS_RAW_COPPER, Legacy.Items.STORAGE_BLOCKS_RAW_COPPER) - .add(Blocks.RAW_COPPER_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_RAW_COPPER); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Items.STORAGE_BLOCKS_RAW_GOLD, Legacy.Blocks.STORAGE_BLOCKS_RAW_GOLD, Legacy.Items.STORAGE_BLOCKS_RAW_GOLD) - .add(Blocks.RAW_GOLD_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_RAW_GOLD); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON, Legacy.Blocks.STORAGE_BLOCKS_RAW_IRON, Legacy.Items.STORAGE_BLOCKS_RAW_IRON) - .add(Blocks.RAW_IRON_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_RAW_IRON); - tag(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE, Legacy.Blocks.STORAGE_BLOCKS_REDSTONE, Legacy.Items.STORAGE_BLOCKS_REDSTONE) - .add(Blocks.REDSTONE_BLOCK) - .addOptionalTag(Legacy.Blocks.STORAGE_BLOCKS_REDSTONE); - tag(Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Items.STORAGE_BLOCKS_SLIME) - .add(Blocks.SLIME_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_WHEAT, Tags.Items.STORAGE_BLOCKS_WHEAT) - .add(Blocks.HAY_BLOCK); - tag(Tags.Blocks.STRIPPED_LOGS, Tags.Items.STRIPPED_LOGS) - .add( - Blocks.STRIPPED_ACACIA_LOG, - Blocks.STRIPPED_BAMBOO_BLOCK, - Blocks.STRIPPED_BIRCH_LOG, - Blocks.STRIPPED_CHERRY_LOG, - Blocks.STRIPPED_DARK_OAK_LOG, - Blocks.STRIPPED_JUNGLE_LOG, - Blocks.STRIPPED_MANGROVE_LOG, - Blocks.STRIPPED_OAK_LOG, - Blocks.STRIPPED_SPRUCE_LOG - ); - tag(Tags.Blocks.STRIPPED_WOODS, Tags.Items.STRIPPED_WOODS) - .add( - Blocks.STRIPPED_ACACIA_WOOD, - Blocks.STRIPPED_BIRCH_WOOD, - Blocks.STRIPPED_CHERRY_WOOD, - Blocks.STRIPPED_DARK_OAK_WOOD, - Blocks.STRIPPED_JUNGLE_WOOD, - Blocks.STRIPPED_MANGROVE_WOOD, - Blocks.STRIPPED_OAK_WOOD, - Blocks.STRIPPED_SPRUCE_WOOD - ); - - // Backwards compat definitions for pre-1.21 legacy `forge:` tags. - // TODO: [Forge][Tags][Old] Remove backwards compat tag entries in 1.22 - tag(Legacy.Blocks.BARRELS, Legacy.Items.BARRELS) - .addTag(Legacy.Blocks.BARRELS_WOODEN); - - tag(Legacy.Blocks.CHESTS, Legacy.Items.CHESTS) - .addTags( - Tags.Blocks.CHESTS_ENDER, - Tags.Blocks.CHESTS_TRAPPED, - Legacy.Blocks.CHESTS_WOODEN - ); - - //copy(forgeBlockTagKey("glass/tinted"), forgeItemTagKey("glass/tinted")); - addColored(tag(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS)::add, Tags.Blocks.GLASS, "{color}_stained_glass"); - addColored(tag(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES)::add, Tags.Blocks.GLASS_PANES, "{color}_stained_glass_pane"); - - // tag(Tags.Blocks.GLASS, Tags.Items.GLASS, forgeBlockTagKey("glass"), forgeItemTagKey("glass")) // these are the same thing - tag(Tags.Blocks.GLASS, Tags.Items.GLASS) - .addTags( - Tags.Blocks.GLASS_COLORLESS, - Tags.Blocks.STAINED_GLASS, - Legacy.Blocks.GLASS_TINTED - ); - tag(Tags.Blocks.GLASS_COLORLESS, Tags.Items.GLASS_COLORLESS) - .add(Blocks.GLASS); - tag(Legacy.Blocks.GLASS_PANES, Legacy.Items.GLASS_PANES) - .addTags( - Legacy.Blocks.GLASS_PANES_COLORLESS, - Tags.Blocks.STAINED_GLASS_PANES - ); - tag(Legacy.Blocks.GLASS_PANES_COLORLESS, Legacy.Items.GLASS_PANES_COLORLESS) - .add(Blocks.GLASS_PANE); - tag(Legacy.Blocks.GLASS_TINTED, Legacy.Items.GLASS_TINTED) - .add(Blocks.TINTED_GLASS); - tag(Legacy.Blocks.OBSIDIAN, Legacy.Items.OBSIDIAN) - .add(Blocks.OBSIDIAN); - tag(Legacy.Blocks.ORES, Legacy.Items.ORES) - .addTags( - Tags.Blocks.ORES_COAL, - Tags.Blocks.ORES_COPPER, - Tags.Blocks.ORES_DIAMOND, - Tags.Blocks.ORES_EMERALD, - Tags.Blocks.ORES_GOLD, - Tags.Blocks.ORES_IRON, - Tags.Blocks.ORES_LAPIS, - Tags.Blocks.ORES_REDSTONE, - Legacy.Blocks.ORES_QUARTZ, - Legacy.Blocks.ORES_NETHERITE_SCRAP - ); - tag(Legacy.Blocks.SANDSTONE, Legacy.Items.SANDSTONE) - .add( - Blocks.SANDSTONE, - Blocks.CUT_SANDSTONE, - Blocks.CHISELED_SANDSTONE, - Blocks.SMOOTH_SANDSTONE, - Blocks.RED_SANDSTONE, - Blocks.CUT_RED_SANDSTONE, - Blocks.CHISELED_RED_SANDSTONE, - Blocks.SMOOTH_RED_SANDSTONE - ); - tag(Legacy.Blocks.STONE, Legacy.Items.STONE) - .add( - Blocks.ANDESITE, - Blocks.DIORITE, - Blocks.GRANITE, - Blocks.INFESTED_STONE, - Blocks.STONE, - Blocks.POLISHED_ANDESITE, - Blocks.POLISHED_DIORITE, - Blocks.POLISHED_GRANITE, - Blocks.DEEPSLATE, - Blocks.POLISHED_DEEPSLATE, - Blocks.INFESTED_DEEPSLATE, - Blocks.TUFF - ); - - tag(Legacy.Blocks.STORAGE_BLOCKS, Legacy.Items.STORAGE_BLOCKS) - .addTags( - Tags.Blocks.STORAGE_BLOCKS_AMETHYST, - Legacy.Blocks.STORAGE_BLOCKS_COAL, - Legacy.Blocks.STORAGE_BLOCKS_COPPER, - Legacy.Blocks.STORAGE_BLOCKS_DIAMOND, - Legacy.Blocks.STORAGE_BLOCKS_EMERALD, - Legacy.Blocks.STORAGE_BLOCKS_GOLD, - Legacy.Blocks.STORAGE_BLOCKS_IRON, - Legacy.Blocks.STORAGE_BLOCKS_LAPIS, - Tags.Blocks.STORAGE_BLOCKS_QUARTZ, - Legacy.Blocks.STORAGE_BLOCKS_RAW_COPPER, - Legacy.Blocks.STORAGE_BLOCKS_RAW_GOLD, - Legacy.Blocks.STORAGE_BLOCKS_RAW_IRON, - Legacy.Blocks.STORAGE_BLOCKS_REDSTONE, - Legacy.Blocks.STORAGE_BLOCKS_NETHERITE - ); - } - - private static TagKey forgeTagKey(String path) { - return BlockTags.create(Identifier.fromNamespaceAndPath("forge", path)); - } - - private static TagKey tagKey(String name) { - return BlockTags.create(Identifier.withDefaultNamespace(name)); - } - - private void addColored(Consumer consumer, TagKey group, String pattern) { - String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; - for (DyeColor color : DyeColor.values()) { - Identifier key = Identifier.fromNamespaceAndPath("minecraft", pattern.replace("{color}", color.getName())); - TagKey blockTag = getForgeTag(Tags.Blocks.class, prefix + color.getName()); - TagKey itemTag = getForgeTag(Tags.Items.class, prefix + color.getName()); - Block block = ForgeRegistries.BLOCKS.getValue(key); - if (block == null || block == Blocks.AIR) - throw new IllegalStateException("Unknown vanilla block: " + key.toString()); - tag(blockTag, itemTag).add(block); - consumer.accept(block); - } - } +import static net.minecraftforge.common.Tags.BlockItems.*; +import static net.minecraft.references.BlockItemIds.*; +public class ForgeBlockItemTagsProvider extends BlockItemTagsProvider { @SuppressWarnings("unchecked") - private static TagKey getForgeTag(Class cls, String name) { - try { - name = name.toUpperCase(Locale.ENGLISH); - return (TagKey)cls.getDeclaredField(name).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { - throw new IllegalStateException(cls.getName() + " is missing tag name: " + name); - } + protected ForgeBlockItemTagsProvider(final Function tagSupplier) { + super((Function)tagSupplier); } - private static Identifier forgeRl(String path) { - return Identifier.fromNamespaceAndPath("forge", path); + @Override + protected WrappedCombinedAppender tag(final BlockItemTagId tag) { + return (WrappedCombinedAppender)super.tag(tag); } - private TagAppender tag(TagKey block, TagKey item, TagKey oldBlock, TagKey oldItem) { - var tag = tag(block, item); - var old = tag(oldBlock, oldItem); - return wrap(tag, old, oldBlock); - } - - private static TagAppender wrap(TagAppender tag, TagAppender old, TagKey oldBlock) { - return new TagAppender() { - @Override - public TagAppender add(Block value) { - tag.add(value); - old.add(value); - return this; - } - - @Override - public TagAppender addOptional(Block value) { - tag.addOptional(value); - old.addOptional(value); - return this; - } - - @Override - public TagAppender addTag(TagKey value) { - tag.addTag(value); - old.addTag(value); - return this; - } - - @Override - public TagAppender addOptionalTag(TagKey value) { - tag.addOptionalTag(value); - if (value != oldBlock) - old.addOptionalTag(value); - return this; - } - - @Override - public TagAppender replace(boolean value) { - tag.replace(value); - old.replace(value); - return this; - } - - @Override - public TagAppender remove(Identifier value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public TagAppender remove(TagKey value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public TagAppender remove(Block value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public String getSourceName() { - return tag.getSourceName(); - } - }; - } - - private static class Legacy { - @Deprecated - private static class Blocks { - private static TagKey tag(String path) { - return BlockTags.create(forgeRl(path)); - } - - public static final TagKey BARRELS = tag("barrels"); - public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); - public static final TagKey BOOKSHELVES = tag("bookshelves"); - public static final TagKey CHESTS = tag("chests"); - public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); - public static final TagKey COBBLESTONE = tag("cobblestone"); - public static final TagKey GLASS_PANES = tag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final TagKey GLASS_SILICA = tag("glass/silica"); - public static final TagKey GLASS_TINTED = tag("glass/tinted"); - public static final TagKey OBSIDIAN = tag("obsidian"); - public static final TagKey ORES = tag("ores"); - public static final TagKey ORES_QUARTZ = tag("ores/quartz"); - public static final TagKey ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap"); - public static final TagKey SANDSTONE = tag("sandstone"); - public static final TagKey STONE = tag("stone"); - public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - } - - @Deprecated - private static class Items { - private static TagKey tag(String path) { - return ItemTags.create(forgeRl(path)); - } - - public static final TagKey BARRELS = tag("barrels"); - public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); - public static final TagKey BOOKSHELVES = tag("bookshelves"); - public static final TagKey CHESTS = tag("chests"); - public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); - public static final TagKey COBBLESTONE = tag("cobblestone"); - public static final TagKey GLASS_PANES = tag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final TagKey GLASS_SILICA = tag("glass/silica"); - public static final TagKey GLASS_TINTED = tag("glass/tinted"); - public static final TagKey OBSIDIAN = tag("obsidian"); - public static final TagKey ORES = tag("ores"); - public static final TagKey QUARTZ_ORES = tag("ores/quartz"); - public static final TagKey ORES_NEHTERITE_SCRAP = tag("ores/netherite_scrap"); - public static final TagKey SANDSTONE = tag("sandstone"); - public static final TagKey STONE = tag("stone"); - public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - } + @Override + protected void run() { + tag(BARRELS) + .addTag(BARRELS_WOODEN); + tag(BARRELS_WOODEN) + .add(BARREL); + tag(BARS_COPPER) + .addAll(COPPER_BARS.asList()); + tag(BARS_IRON) + .add(IRON_BARS); + tag(BARS) + .add(BARS_COPPER, BARS_IRON, BlockItemTags.BARS); + tag(BOOKSHELVES) + .add(BOOKSHELF); + tag(BUDDING_BLOCKS) + .add(BUDDING_AMETHYST); + tag(BUDS) + .add(SMALL_AMETHYST_BUD) + .add(MEDIUM_AMETHYST_BUD) + .add(LARGE_AMETHYST_BUD); + tag(CHAINS) + .add(IRON_CHAIN) + .addAll(COPPER_CHAIN.asList()); + tag(CHESTS_ENDER) + .add(ENDER_CHEST); + tag(CHESTS_TRAPPED) + .add(TRAPPED_CHEST); + tag(CHESTS_WOODEN) + .add(CHEST, TRAPPED_CHEST); + tag(CHESTS) + .addAll(COPPER_CHEST.asList()) + .add( + CHESTS_ENDER, + CHESTS_TRAPPED, + CHESTS_WOODEN + ); + tag(CLUSTERS) + .add(AMETHYST_CLUSTER); + tag(COBBLESTONES_NORMAL) + .add(COBBLESTONE); + tag(COBBLESTONES_INFESTED) + .add(INFESTED_COBBLESTONE); + tag(COBBLESTONES_MOSSY) + .add(MOSSY_COBBLESTONE); + tag(COBBLESTONES_DEEPSLATE) + .add(COBBLED_DEEPSLATE); + tag(COBBLESTONES) + .add( + COBBLESTONES_NORMAL, + COBBLESTONES_INFESTED, + COBBLESTONES_MOSSY, + COBBLESTONES_DEEPSLATE + ); + tag(CONCRETES) + .addAll(CONCRETE.asList()); + tag(END_STONES) + .add(END_STONE); + tag(FENCE_GATES) + .add(FENCE_GATES_WOODEN); + tag(FENCE_GATES_WOODEN) + .add( + OAK_FENCE_GATE, + SPRUCE_FENCE_GATE, + BIRCH_FENCE_GATE, + JUNGLE_FENCE_GATE, + ACACIA_FENCE_GATE, + DARK_OAK_FENCE_GATE, + CRIMSON_FENCE_GATE, + WARPED_FENCE_GATE, + MANGROVE_FENCE_GATE, + BAMBOO_FENCE_GATE, + CHERRY_FENCE_GATE + ); + tag(FENCES_NETHER_BRICK) + .add(NETHER_BRICK_FENCE); + tag(FENCES_WOODEN) + .addTag(BlockItemTags.WOODEN_FENCES); + tag(FENCES) + .add( + FENCES_NETHER_BRICK, + FENCES_WOODEN + ); + tag(FLOWERS_SMALL) + .add( + DANDELION, + POPPY, + BLUE_ORCHID, + ALLIUM, + AZURE_BLUET, + RED_TULIP, + ORANGE_TULIP, + WHITE_TULIP, + PINK_TULIP, + OXEYE_DAISY, + CORNFLOWER, + LILY_OF_THE_VALLEY, + WITHER_ROSE, + TORCHFLOWER, + OPEN_EYEBLOSSOM, + CLOSED_EYEBLOSSOM + ); + tag(FLOWERS_TALL) + .add( + SUNFLOWER, + LILAC, + PEONY, + ROSE_BUSH, + PITCHER_PLANT + ); + tag(FLOWERS) + .add( + FLOWERING_AZALEA_LEAVES, + FLOWERING_AZALEA, + MANGROVE_PROPAGULE, + PINK_PETALS, + CHORUS_FLOWER, + SPORE_BLOSSOM + ) + .add( + FLOWERS_SMALL, + FLOWERS_TALL + ) + .addOptional(BlockItemTags.FLOWERS); + tag(GLASS_BLOCKS) + .add( + GLASS_BLOCKS_COLORLESS, + GLASS_BLOCKS_CHEAP, + GLASS_BLOCKS_TINTED + ); + tag(GLASS_BLOCKS_COLORLESS) + .add(GLASS); + tag(GLASS_BLOCKS_TINTED) + .add(TINTED_GLASS); + tag(GLASS_BLOCKS_CHEAP) + .add(GLASS) + .addAll(STAINED_GLASS.asList()); + tag(GLASS_PANES) + .add(GLASS_PANES_COLORLESS) + .addAll(STAINED_GLASS_PANE.asList()); + tag(GLASS_PANES_COLORLESS) + .add(GLASS_PANE); + tag(GLAZED_TERRACOTTAS) + .addAll(GLAZED_TERRACOTTA.asList()); + tag(GRAVELS) + .add(GRAVEL); + tag(NATURAL_LOGS_NETHER) + .add(CRIMSON_STEM, WARPED_STEM); + tag(NATURAL_LOGS_OVERWORLD) + .add( + ACACIA_LOG, + BIRCH_LOG, + CHERRY_LOG, + DARK_OAK_LOG, + JUNGLE_LOG, + MANGROVE_LOG, + OAK_LOG, + PALE_OAK_LOG, + SPRUCE_LOG + ); + tag(NATURAL_LOGS) + .add(NATURAL_LOGS_NETHER, NATURAL_LOGS_OVERWORLD); + tag(NATURAL_WOODS) + .add( + ACACIA_WOOD, + BIRCH_WOOD, + CHERRY_WOOD, + CRIMSON_HYPHAE, + DARK_OAK_WOOD, + JUNGLE_WOOD, + MANGROVE_WOOD, + OAK_WOOD, + PALE_OAK_WOOD, + SPRUCE_WOOD, + WARPED_HYPHAE + ); + tag(NETHERRACKS) + .add(NETHERRACK); + tag(OBSIDIANS) + .add( + OBSIDIANS_NORMAL, + OBSIDIANS_CRYING + ); + tag(OBSIDIANS_NORMAL) + .add(OBSIDIAN); + tag(OBSIDIANS_CRYING) + .add(CRYING_OBSIDIAN); + tag(ORE_BEARING_GROUND_DEEPSLATE) + .add(DEEPSLATE); + tag(ORE_BEARING_GROUND_NETHERRACK) + .add(NETHERRACK); + tag(ORE_BEARING_GROUND_STONE) + .add(STONE); + tag(ORE_RATES_DENSE) + .add( + COPPER_ORE, + DEEPSLATE_COPPER_ORE, + DEEPSLATE_LAPIS_ORE, + DEEPSLATE_REDSTONE_ORE, + LAPIS_ORE, + REDSTONE_ORE + ); + tag(ORE_RATES_SINGULAR) + .add( + ANCIENT_DEBRIS, + COAL_ORE, + DEEPSLATE_COAL_ORE, + DEEPSLATE_DIAMOND_ORE, + DEEPSLATE_EMERALD_ORE, + DEEPSLATE_GOLD_ORE, + DEEPSLATE_IRON_ORE, + DIAMOND_ORE, + EMERALD_ORE, + GOLD_ORE, + IRON_ORE, + NETHER_QUARTZ_ORE + ); + tag(ORE_RATES_SPARSE) + .add(NETHER_GOLD_ORE); + tag(ORES_COAL) + .add(BlockItemTags.COAL_ORES); + tag(ORES_COPPER) + .add(BlockItemTags.COPPER_ORES); + tag(ORES_DIAMOND) + .add(BlockItemTags.DIAMOND_ORES); + tag(ORES_EMERALD) + .add(BlockItemTags.EMERALD_ORES); + tag(ORES_GOLD) + .add(BlockItemTags.GOLD_ORES); + tag(ORES_IRON) + .add(BlockItemTags.IRON_ORES); + tag(ORES_LAPIS) + .add(BlockItemTags.LAPIS_ORES); + tag(ORES_QUARTZ) + .add(NETHER_QUARTZ_ORE); + tag(ORES_REDSTONE) + .addTag(BlockItemTags.REDSTONE_ORES); + tag(ORES_NETHERITE_SCRAP) + .add(ANCIENT_DEBRIS); + tag(ORES) + .add( + ORES_COAL, + ORES_COPPER, + ORES_DIAMOND, + ORES_EMERALD, + ORES_GOLD, + ORES_IRON, + ORES_LAPIS, + ORES_NETHERITE_SCRAP, + ORES_REDSTONE, + ORES_QUARTZ + ); + tag(ORES_IN_GROUND_DEEPSLATE) + .add( + DEEPSLATE_COAL_ORE, + DEEPSLATE_COPPER_ORE, + DEEPSLATE_DIAMOND_ORE, + DEEPSLATE_EMERALD_ORE, + DEEPSLATE_GOLD_ORE, + DEEPSLATE_IRON_ORE, + DEEPSLATE_LAPIS_ORE, + DEEPSLATE_REDSTONE_ORE + ); + tag(ORES_IN_GROUND_NETHERRACK) + .add( + NETHER_GOLD_ORE, + NETHER_QUARTZ_ORE + ); + tag(ORES_IN_GROUND_STONE) + .add( + COAL_ORE, + COPPER_ORE, + DIAMOND_ORE, + EMERALD_ORE, + GOLD_ORE, + IRON_ORE, + LAPIS_ORE, + REDSTONE_ORE + ); + tag(PLAYER_WORKSTATIONS_CRAFTING_TABLES) + .add(CRAFTING_TABLE); + tag(PLAYER_WORKSTATIONS_FURNACES) + .add(FURNACE); + tag(PUMPKINS) + .add( + PUMPKINS_NORMAL, + PUMPKINS_CARVED, + PUMPKINS_JACK_O_LANTERNS + ); + tag(PUMPKINS_NORMAL) + .add(PUMPKIN); + tag(PUMPKINS_CARVED) + .add(CARVED_PUMPKIN); + tag(PUMPKINS_JACK_O_LANTERNS) + .add(JACK_O_LANTERN); + tag(ROPES); + tag(SANDS) + .add( + SANDS_COLORLESS, + SANDS_RED + ); + tag(SANDS_COLORLESS) + .add(SAND); + tag(SANDS_RED) + .add(RED_SAND); + tag(SANDSTONE_BLOCKS) + .add( + SANDSTONE_RED_BLOCKS, + SANDSTONE_UNCOLORED_BLOCKS + ); + tag(SANDSTONE_SLABS) + .add( + SANDSTONE_RED_SLABS, + SANDSTONE_UNCOLORED_SLABS + ); + tag(Tags.BlockItems.SANDSTONE_STAIRS) + .add( + SANDSTONE_RED_STAIRS, + SANDSTONE_UNCOLORED_STAIRS + ); + tag(SANDSTONE_RED_BLOCKS) + .add( + RED_SANDSTONE, + CUT_RED_SANDSTONE, + CHISELED_RED_SANDSTONE, + SMOOTH_RED_SANDSTONE + ); + tag(SANDSTONE_RED_SLABS) + .add( + RED_SANDSTONE_SLAB, + CUT_RED_SANDSTONE_SLAB, + SMOOTH_RED_SANDSTONE_SLAB + ); + tag(SANDSTONE_RED_STAIRS) + .add( + RED_SANDSTONE_STAIRS, + SMOOTH_RED_SANDSTONE_STAIRS + ); + tag(SANDSTONE_UNCOLORED_BLOCKS) + .add( + SANDSTONE, + CUT_SANDSTONE, + CHISELED_SANDSTONE, + SMOOTH_SANDSTONE + ); + tag(SANDSTONE_UNCOLORED_SLABS) + .add( + SANDSTONE_SLAB, + CUT_SANDSTONE_SLAB, + SMOOTH_SANDSTONE_SLAB + ); + tag(SANDSTONE_UNCOLORED_STAIRS) + .add( + BlockItemIds.SANDSTONE_STAIRS, + SMOOTH_SANDSTONE_STAIRS + ); + tag(STONES) + .add( + ANDESITE, + DIORITE, + GRANITE, + STONE, + DEEPSLATE, + TUFF + ); + tag(STORAGE_BLOCKS) + .add( + STORAGE_BLOCKS_BONE_MEAL, + STORAGE_BLOCKS_COAL, + STORAGE_BLOCKS_COPPER, + STORAGE_BLOCKS_DIAMOND, + STORAGE_BLOCKS_DRIED_KELP, + STORAGE_BLOCKS_EMERALD, + STORAGE_BLOCKS_GOLD, + STORAGE_BLOCKS_IRON, + STORAGE_BLOCKS_LAPIS, + STORAGE_BLOCKS_NETHERITE, + STORAGE_BLOCKS_RAW_COPPER, + STORAGE_BLOCKS_RAW_GOLD, + STORAGE_BLOCKS_RAW_IRON, + STORAGE_BLOCKS_REDSTONE, + STORAGE_BLOCKS_SLIME, + STORAGE_BLOCKS_WHEAT, + STORAGE_BLOCKS_RESIN + ); + tag(STORAGE_BLOCKS_AMETHYST) + .add(AMETHYST_BLOCK); + tag(STORAGE_BLOCKS_BONE_MEAL) + .add(BONE_BLOCK); + tag(STORAGE_BLOCKS_COAL) + .add(COAL_BLOCK); + tag(STORAGE_BLOCKS_COPPER) + .addAll(COPPER_BLOCK.asList()); + tag(STORAGE_BLOCKS_DIAMOND) + .add(DIAMOND_BLOCK); + tag(STORAGE_BLOCKS_DRIED_KELP) + .add(DRIED_KELP_BLOCK); + tag(STORAGE_BLOCKS_EMERALD) + .add(EMERALD_BLOCK); + tag(STORAGE_BLOCKS_GOLD) + .add(GOLD_BLOCK); + tag(STORAGE_BLOCKS_IRON) + .add(IRON_BLOCK); + tag(STORAGE_BLOCKS_LAPIS) + .add(LAPIS_BLOCK); + tag(STORAGE_BLOCKS_NETHERITE) + .add(NETHERITE_BLOCK); + tag(STORAGE_BLOCKS_QUARTZ) + .add(QUARTZ_BLOCK); + tag(STORAGE_BLOCKS_RAW_COPPER) + .add(RAW_COPPER_BLOCK); + tag(STORAGE_BLOCKS_RAW_GOLD) + .add(RAW_GOLD_BLOCK); + tag(STORAGE_BLOCKS_RAW_IRON) + .add(RAW_IRON_BLOCK); + tag(STORAGE_BLOCKS_RESIN) + .add(RESIN_BLOCK); + tag(STORAGE_BLOCKS_REDSTONE) + .add(REDSTONE_BLOCK); + tag(STORAGE_BLOCKS_SLIME) + .add(SLIME_BLOCK); + tag(STORAGE_BLOCKS_WHEAT) + .add(HAY_BLOCK); + tag(STRIPPED_LOGS) + .add( + STRIPPED_ACACIA_LOG, + STRIPPED_BAMBOO_BLOCK, + STRIPPED_BIRCH_LOG, + STRIPPED_CHERRY_LOG, + STRIPPED_CRIMSON_STEM, + STRIPPED_DARK_OAK_LOG, + STRIPPED_JUNGLE_LOG, + STRIPPED_MANGROVE_LOG, + STRIPPED_OAK_LOG, + STRIPPED_PALE_OAK_LOG, + STRIPPED_SPRUCE_LOG, + STRIPPED_WARPED_STEM + ); + tag(STRIPPED_WOODS) + .add( + STRIPPED_ACACIA_WOOD, + STRIPPED_BIRCH_WOOD, + STRIPPED_CHERRY_WOOD, + STRIPPED_CRIMSON_HYPHAE, + STRIPPED_DARK_OAK_WOOD, + STRIPPED_JUNGLE_WOOD, + STRIPPED_MANGROVE_WOOD, + STRIPPED_OAK_WOOD, + STRIPPED_PALE_OAK_WOOD, + STRIPPED_SPRUCE_WOOD, + STRIPPED_WARPED_HYPHAE + ); } } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 1fc605d5ed..989af417d3 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -6,14 +6,14 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.TagAppender; import net.minecraft.data.tags.VanillaBlockTagsProvider; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.Tags; @@ -25,7 +25,8 @@ import java.util.Locale; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -// We typically don't do static imports as S2S can't remap them {as they are not qualified}, however this conflicts with vanilla and our tag class names, and our tags don't get obfed so its one line of warning. +import static net.minecraft.references.BlockIds.*; +import static net.minecraft.references.BlockItemIds.*; import static net.minecraftforge.common.Tags.Blocks.*; @ApiStatus.Internal @@ -35,15 +36,8 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { } @Override - public void addTags(HolderLookup.Provider p_256380_) { - (new ForgeBlockItemTagsProvider() { - @Override - protected TagAppender tag(TagKey p_406922_, TagKey p_408417_) { - return ForgeBlockTagsProvider.this.tag(p_406922_); - } - }).run(); - tag(CHORUS_ADDITIONALLY_GROWS_ON) - .addTag(END_STONES); + public void addTags(HolderLookup.Provider p_256380_) { + new ForgeBlockItemTagsProvider(tagId -> WrappedCombinedAppender.block(this.tag(tagId.block()))).run(); addColored(DYED, "{color}_banner"); addColored(DYED, "{color}_bed"); addColored(DYED, "{color}_candle"); @@ -59,46 +53,82 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { addColored(DYED, "{color}_wool"); addColoredTags(tag(DYED)::addTag, DYED); tag(ENDERMAN_PLACE_ON_BLACKLIST); // forge:enderman_place_on_blacklist - tag(SKULLS).add(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD); + tag(SKULLS) + .add( // Has Items + SKELETON_SKULL, + WITHER_SKELETON_SKULL, + PLAYER_HEAD, + ZOMBIE_HEAD, + CREEPER_HEAD, + PIGLIN_HEAD, + DRAGON_HEAD + ) + .add( // Doesn't have items + SKELETON_WALL_SKULL, + WITHER_SKELETON_WALL_SKULL, + PLAYER_WALL_HEAD, + ZOMBIE_WALL_HEAD, + CREEPER_WALL_HEAD, + PIGLIN_WALL_HEAD, + DRAGON_WALL_HEAD + ); tag(HIDDEN_FROM_RECIPE_VIEWERS); tag(RELOCATION_NOT_SUPPORTED); - tag(VILLAGER_JOB_SITES).add( - Blocks.BARREL, Blocks.BLAST_FURNACE, Blocks.BREWING_STAND, Blocks.CARTOGRAPHY_TABLE, - Blocks.CAULDRON, Blocks.WATER_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.POWDER_SNOW_CAULDRON, - Blocks.COMPOSTER, Blocks.FLETCHING_TABLE, Blocks.GRINDSTONE, Blocks.LECTERN, - Blocks.LOOM, Blocks.SMITHING_TABLE, Blocks.SMOKER, Blocks.STONECUTTER); + tag(VILLAGER_JOB_SITES) + .add( // Has items + BARREL, + BLAST_FURNACE, + BREWING_STAND, + CARTOGRAPHY_TABLE, + CAULDRON, + COMPOSTER, + FLETCHING_TABLE, + GRINDSTONE, + LECTERN, + LOOM, + SMITHING_TABLE, + SMOKER, + STONECUTTER + ) + .add( // Doesn't have items + WATER_CAULDRON, + LAVA_CAULDRON, + POWDER_SNOW_CAULDRON + ); } private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (var color : DyeColor.values()) { - var key = Identifier.fromNamespaceAndPath("minecraft", pattern.replace("{color}", color.getName())); - TagKey tag = getForgeTag(prefix + color.getName()); + var key = Identifier.withDefaultNamespace(pattern.replace("{color}", color.getName())); + TagKey tag = getTag(prefix + color.getName()); var block = ForgeRegistries.BLOCKS.getValue(key); if (block == null || block == Blocks.AIR) throw new IllegalStateException("Unknown vanilla block: " + key); - tag(tag).add(block); + tag(tag) + .add(ResourceKey.create(Registries.BLOCK, key)); } } private static void addColoredTags(Consumer> consumer, TagKey group) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (var color : DyeColor.values()) { - TagKey tag = getForgeTag(prefix + color.getName()); + TagKey tag = getTag(prefix + color.getName()); consumer.accept(tag); } } @SuppressWarnings("unchecked") - private static TagKey getForgeTag(String name) { + private static TagKey getTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (TagKey) Tags.Blocks.class.getDeclaredField(name).get(null); + return (TagKey)Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new IllegalStateException(Tags.Blocks.class.getName() + " is missing tag name: " + name); } } + @SuppressWarnings("unused") private static TagKey forgeTagKey(String path) { return BlockTags.create(Identifier.fromNamespaceAndPath("forge", path)); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java index 84fd9d5132..53a4b33232 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java @@ -12,6 +12,7 @@ import net.minecraft.resources.Identifier; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypeIds; import org.jetbrains.annotations.ApiStatus; import java.util.concurrent.CompletableFuture; @@ -24,48 +25,48 @@ public final class ForgeEntityTypeTagsProvider extends EntityTypeTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override public void addTags(HolderLookup.Provider lookupProvider) { tag(BOSSES) - .add(EntityType.ENDER_DRAGON, EntityType.WITHER) - .addOptionalTag(forgeTagKey("bosses")); + .add(EntityTypeIds.ENDER_DRAGON, EntityTypeIds.WITHER); tag(MINECARTS).add( - EntityType.MINECART, - EntityType.CHEST_MINECART, - EntityType.FURNACE_MINECART, - EntityType.HOPPER_MINECART, - EntityType.SPAWNER_MINECART, - EntityType.TNT_MINECART, - EntityType.COMMAND_BLOCK_MINECART + EntityTypeIds.MINECART, + EntityTypeIds.CHEST_MINECART, + EntityTypeIds.FURNACE_MINECART, + EntityTypeIds.HOPPER_MINECART, + EntityTypeIds.SPAWNER_MINECART, + EntityTypeIds.TNT_MINECART, + EntityTypeIds.COMMAND_BLOCK_MINECART ); tag(BOATS).add( - EntityType.ACACIA_BOAT, - EntityType.ACACIA_CHEST_BOAT, - EntityType.BIRCH_BOAT, - EntityType.BIRCH_CHEST_BOAT, - EntityType.CHERRY_BOAT, - EntityType.CHERRY_CHEST_BOAT, - EntityType.DARK_OAK_BOAT, - EntityType.DARK_OAK_CHEST_BOAT, - EntityType.JUNGLE_BOAT, - EntityType.JUNGLE_CHEST_BOAT, - EntityType.MANGROVE_BOAT, - EntityType.MANGROVE_CHEST_BOAT, - EntityType.OAK_BOAT, - EntityType.OAK_CHEST_BOAT, - EntityType.PALE_OAK_BOAT, - EntityType.PALE_OAK_CHEST_BOAT, - EntityType.SPRUCE_BOAT, - EntityType.SPRUCE_CHEST_BOAT + EntityTypeIds.ACACIA_BOAT, + EntityTypeIds.ACACIA_CHEST_BOAT, + EntityTypeIds.BAMBOO_CHEST_RAFT, + EntityTypeIds.BAMBOO_RAFT, + EntityTypeIds.BIRCH_BOAT, + EntityTypeIds.BIRCH_CHEST_BOAT, + EntityTypeIds.CHERRY_BOAT, + EntityTypeIds.CHERRY_CHEST_BOAT, + EntityTypeIds.DARK_OAK_BOAT, + EntityTypeIds.DARK_OAK_CHEST_BOAT, + EntityTypeIds.JUNGLE_BOAT, + EntityTypeIds.JUNGLE_CHEST_BOAT, + EntityTypeIds.MANGROVE_BOAT, + EntityTypeIds.MANGROVE_CHEST_BOAT, + EntityTypeIds.OAK_BOAT, + EntityTypeIds.OAK_CHEST_BOAT, + EntityTypeIds.PALE_OAK_BOAT, + EntityTypeIds.PALE_OAK_CHEST_BOAT, + EntityTypeIds.SPRUCE_BOAT, + EntityTypeIds.SPRUCE_CHEST_BOAT ); + tag(ITEM_FRAMES).add(EntityTypeIds.ITEM_FRAME, EntityTypeIds.GLOW_ITEM_FRAME); tag(CAPTURING_NOT_SUPPORTED); tag(TELEPORTING_NOT_SUPPORTED); - - // Backwards compat definitions for pre-1.21 legacy `forge:` tags. - // TODO: Remove backwards compat tag entries in 1.22 - tag(forgeTagKey("bosses")).add(EntityType.ENDER_DRAGON, EntityType.WITHER); } + @SuppressWarnings("unused") private static TagKey> forgeTagKey(String path) { return EntityTypeTags.create(Identifier.fromNamespaceAndPath("forge", path)); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java index 85ae5aebf3..b63f67cdb9 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java @@ -8,10 +8,7 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.FluidTagsProvider; -import net.minecraft.resources.Identifier; -import net.minecraft.tags.FluidTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidIds; import net.minecraftforge.common.ForgeMod; import org.jetbrains.annotations.ApiStatus; @@ -24,10 +21,19 @@ public final class ForgeFluidTagsProvider extends FluidTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override public void addTags(HolderLookup.Provider lookupProvider) { - tag(WATER).add(net.minecraft.world.level.material.Fluids.WATER).add(net.minecraft.world.level.material.Fluids.FLOWING_WATER); - tag(LAVA).add(net.minecraft.world.level.material.Fluids.LAVA).add(net.minecraft.world.level.material.Fluids.FLOWING_LAVA); + tag(WATER) + .add( + FluidIds.WATER, + FluidIds.FLOWING_WATER + ); + tag(LAVA) + .add( + FluidIds.LAVA, + FluidIds.FLOWING_LAVA + ); tag(MILK) .addOptional(ForgeMod.MILK.getKey().identifier()) .addOptional(ForgeMod.FLOWING_MILK.getKey().identifier()); @@ -39,16 +45,7 @@ public final class ForgeFluidTagsProvider extends FluidTagsProvider { tag(RABBIT_STEW); tag(BEETROOT_SOUP); tag(HIDDEN_FROM_RECIPE_VIEWERS); - - // Backwards compat definitions for pre-1.21 legacy `forge:` tags. - // TODO: Remove backwards compat tag entries in 1.22 - tag(forgeTagKey("milk")) - .addOptional(ForgeMod.MILK.getKey().identifier()) - .addOptional(ForgeMod.FLOWING_MILK.getKey().identifier()); - } - - private static TagKey forgeTagKey(String path) { - return FluidTags.create(Identifier.fromNamespaceAndPath("forge", path)); + tag(EXPERIENCE); } @Override diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index d3b61c7d2a..e692ba0599 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -7,16 +7,18 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.TagAppender; import net.minecraft.data.tags.VanillaItemTagsProvider; +import net.minecraft.references.BlockItemId; +import net.minecraft.references.BlockItemIds; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Block; import net.minecraftforge.common.Tags; import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; @@ -25,6 +27,10 @@ import java.util.Locale; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; +import static net.minecraft.references.ItemIds.*; +import static net.minecraft.references.BlockItemIds.*; +import static net.minecraftforge.common.Tags.Items.*; + @ApiStatus.Internal public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { public ForgeItemTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { @@ -34,256 +40,523 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { @SuppressWarnings({ "unchecked", "removal" }) @Override public void addTags(HolderLookup.Provider lookupProvider) { - (new ForgeBlockItemTagsProvider() { - @Override - protected TagAppender tag(TagKey p_409856_, TagKey p_406371_) { - return new VanillaItemTagsProvider.BlockToItemConverter(ForgeItemTagsProvider.this.tag(p_406371_)); - } - }).run(); - tag(Tags.Items.BONES).add(Items.BONE); - tag(Tags.Items.BRICKS).addTags(Tags.Items.BRICKS_NORMAL, Tags.Items.BRICKS_NETHER); - tag(Tags.Items.BRICKS_NORMAL).add(Items.BRICK); - tag(Tags.Items.BRICKS_NETHER).add(Items.NETHER_BRICK); - tag(Tags.Items.BUCKETS_EMPTY).add(Items.BUCKET); - tag(Tags.Items.BUCKETS_WATER).add(Items.WATER_BUCKET); - tag(Tags.Items.BUCKETS_LAVA).add(Items.LAVA_BUCKET); - tag(Tags.Items.BUCKETS_MILK).add(Items.MILK_BUCKET); - tag(Tags.Items.BUCKETS_POWDER_SNOW).add(Items.POWDER_SNOW_BUCKET); - tag(Tags.Items.BUCKETS_ENTITY_WATER).add(Items.AXOLOTL_BUCKET, Items.COD_BUCKET, Items.PUFFERFISH_BUCKET, Items.TADPOLE_BUCKET, Items.TROPICAL_FISH_BUCKET, Items.SALMON_BUCKET); - tag(Tags.Items.BUCKETS).addTags(Tags.Items.BUCKETS_EMPTY, Tags.Items.BUCKETS_WATER, Tags.Items.BUCKETS_LAVA, Tags.Items.BUCKETS_MILK, Tags.Items.BUCKETS_POWDER_SNOW, Tags.Items.BUCKETS_ENTITY_WATER); - tag(Tags.Items.CONCRETE_POWDERS) - .add(Items.WHITE_CONCRETE_POWDER, Items.ORANGE_CONCRETE_POWDER, Items.MAGENTA_CONCRETE_POWDER, - Items.LIGHT_BLUE_CONCRETE_POWDER, Items.YELLOW_CONCRETE_POWDER, Items.LIME_CONCRETE_POWDER, - Items.PINK_CONCRETE_POWDER, Items.GRAY_CONCRETE_POWDER, Items.LIGHT_GRAY_CONCRETE_POWDER, - Items.CYAN_CONCRETE_POWDER, Items.PURPLE_CONCRETE_POWDER, Items.BLUE_CONCRETE_POWDER, - Items.BROWN_CONCRETE_POWDER, Items.GREEN_CONCRETE_POWDER, Items.RED_CONCRETE_POWDER, - Items.BLACK_CONCRETE_POWDER); - tag(Tags.Items.CROPS).addTags( - Tags.Items.CROPS_BEETROOT, Tags.Items.CROPS_CACTUS, Tags.Items.CROPS_CARROT, - Tags.Items.CROPS_COCOA_BEAN, Tags.Items.CROPS_MELON, Tags.Items.CROPS_NETHER_WART, - Tags.Items.CROPS_POTATO, Tags.Items.CROPS_PUMPKIN, Tags.Items.CROPS_SUGAR_CANE, - Tags.Items.CROPS_WHEAT - ).addOptionalTag(forgeItemTagKey("crops")); - tag(Tags.Items.CROPS_BEETROOT) - .add(Items.BEETROOT) - .addOptionalTag(forgeItemTagKey("crops/beetroot")); - tag(Tags.Items.CROPS_CACTUS).add(Items.CACTUS); - tag(Tags.Items.CROPS_CARROT) - .add(Items.CARROT) - .addOptionalTag(forgeItemTagKey("crops/carrot")); - tag(Tags.Items.CROPS_COCOA_BEAN).add(Items.COCOA_BEANS); - tag(Tags.Items.CROPS_MELON).add(Items.MELON); - tag(Tags.Items.CROPS_NETHER_WART) - .add(Items.NETHER_WART) - .addOptionalTag(forgeItemTagKey("crops/nether_wart")); - tag(Tags.Items.CROPS_POTATO) - .add(Items.POTATO) - .addOptionalTag(forgeItemTagKey("crops/potato")); - tag(Tags.Items.CROPS_PUMPKIN).add(Items.PUMPKIN); - tag(Tags.Items.CROPS_SUGAR_CANE).add(Items.SUGAR_CANE); - tag(Tags.Items.CROPS_WHEAT) - .add(Items.WHEAT) - .addOptionalTag(forgeItemTagKey("crops/wheat")); - addColored(Tags.Items.DYED, "{color}_banner"); - addColored(Tags.Items.DYED, "{color}_bed"); - addColored(Tags.Items.DYED, "{color}_candle"); - addColored(Tags.Items.DYED, "{color}_carpet"); - addColored(Tags.Items.DYED, "{color}_concrete"); - addColored(Tags.Items.DYED, "{color}_concrete_powder"); - addColored(Tags.Items.DYED, "{color}_glazed_terracotta"); - addColored(Tags.Items.DYED, "{color}_shulker_box"); - addColored(Tags.Items.DYED, "{color}_stained_glass"); - addColored(Tags.Items.DYED, "{color}_stained_glass_pane"); - addColored(Tags.Items.DYED, "{color}_terracotta"); - addColored(Tags.Items.DYED, "{color}_wool"); - addColoredTags(tag(Tags.Items.DYED)::addTags, Tags.Items.DYED); - tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_REDSTONE); - tag(Tags.Items.DUSTS_GLOWSTONE) - .add(Items.GLOWSTONE_DUST) - .addOptionalTag(forgeItemTagKey("dusts/glowstone")); - tag(Tags.Items.DUSTS_REDSTONE) - .add(Items.REDSTONE) - .addOptionalTag(forgeItemTagKey("dusts/redstone")); - addColored(Tags.Items.DYES, "{color}_dye"); - addColoredTags(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES); - tag(Tags.Items.EGGS).add(Items.EGG); // forge:eggs - tag(Tags.Items.ENCHANTING_FUELS).addTag(Tags.Items.GEMS_LAPIS); // forge:enchanting_fuels - tag(Tags.Items.ENDER_PEARLS) - .add(Items.ENDER_PEARL) - .addOptionalTag(forgeItemTagKey("ender_pearls")); - tag(Tags.Items.FEATHERS) - .add(Items.FEATHER) - .addOptionalTag(forgeItemTagKey("feathers")); - tag(Tags.Items.FERTILIZERS).add(Items.BONE_MEAL); - tag(Tags.Items.FOODS_FRUIT).add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.CHORUS_FRUIT, Items.MELON_SLICE); - tag(Tags.Items.FOODS_VEGETABLE).add(Items.CARROT, Items.GOLDEN_CARROT, Items.POTATO, Items.BEETROOT); - tag(Tags.Items.FOODS_BERRY).add(Items.SWEET_BERRIES, Items.GLOW_BERRIES); - tag(Tags.Items.FOODS_BREAD).add(Items.BREAD); - tag(Tags.Items.FOODS_COOKIE).add(Items.COOKIE); - tag(Tags.Items.FOODS_RAW_MEAT).add(Items.BEEF, Items.PORKCHOP, Items.CHICKEN, Items.RABBIT, Items.MUTTON); - tag(Tags.Items.FOODS_RAW_FISH).add(Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH); - tag(Tags.Items.FOODS_COOKED_MEAT).add(Items.COOKED_BEEF, Items.COOKED_PORKCHOP, Items.COOKED_CHICKEN, Items.COOKED_RABBIT, Items.COOKED_MUTTON); - tag(Tags.Items.FOODS_COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON); - tag(Tags.Items.FOODS_SOUP).add(Items.BEETROOT_SOUP, Items.MUSHROOM_STEW, Items.RABBIT_STEW, Items.SUSPICIOUS_STEW); - tag(Tags.Items.FOODS_CANDY); - tag(Tags.Items.FOODS_PIE).add(Items.PUMPKIN_PIE).addOptionalTag(forgeItemTagKey("foods/pie")); - tag(Tags.Items.FOODS_EDIBLE_WHEN_PLACED).add(Items.CAKE); - tag(Tags.Items.FOODS_FOOD_POISONING).add(Items.POISONOUS_POTATO, Items.PUFFERFISH, Items.SPIDER_EYE, Items.CHICKEN, Items.ROTTEN_FLESH); - tag(Tags.Items.FOODS_GOLDEN).add(Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_CARROT); - tag(Tags.Items.FOODS) - .add(Items.BAKED_POTATO, Items.HONEY_BOTTLE, Items.OMINOUS_BOTTLE, Items.DRIED_KELP) - .addTags(Tags.Items.FOODS_FRUIT, Tags.Items.FOODS_VEGETABLE, Tags.Items.FOODS_BERRY, Tags.Items.FOODS_BREAD, Tags.Items.FOODS_COOKIE, - Tags.Items.FOODS_RAW_MEAT, Tags.Items.FOODS_RAW_FISH, Tags.Items.FOODS_COOKED_MEAT, Tags.Items.FOODS_COOKED_FISH, - Tags.Items.FOODS_SOUP, Tags.Items.FOODS_CANDY, Tags.Items.FOODS_PIE, Tags.Items.FOODS_GOLDEN, - Tags.Items.FOODS_EDIBLE_WHEN_PLACED, Tags.Items.FOODS_FOOD_POISONING); - tag(Tags.Items.ANIMAL_FOODS) - .addTags(ItemTags.ARMADILLO_FOOD, ItemTags.AXOLOTL_FOOD, ItemTags.BEE_FOOD, ItemTags.CAMEL_FOOD, - ItemTags.CAT_FOOD, ItemTags.CHICKEN_FOOD, ItemTags.COW_FOOD, ItemTags.FOX_FOOD, ItemTags.FROG_FOOD, - ItemTags.GOAT_FOOD, ItemTags.HOGLIN_FOOD, ItemTags.HORSE_FOOD, ItemTags.LLAMA_FOOD, ItemTags.OCELOT_FOOD, - ItemTags.PANDA_FOOD, ItemTags.PARROT_FOOD, ItemTags.PIG_FOOD, ItemTags.PIGLIN_FOOD, ItemTags.RABBIT_FOOD, - ItemTags.SHEEP_FOOD, ItemTags.SNIFFER_FOOD, ItemTags.STRIDER_FOOD, ItemTags.TURTLE_FOOD, ItemTags.WOLF_FOOD); - tag(Tags.Items.GEMS) - .addTags(Tags.Items.GEMS_AMETHYST, Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_EMERALD, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_PRISMARINE, Tags.Items.GEMS_QUARTZ) - .addOptionalTag(forgeItemTagKey("gems")); - tag(Tags.Items.GEMS_AMETHYST) - .add(Items.AMETHYST_SHARD) - .addOptionalTag(forgeItemTagKey("gems/amethyst")); - tag(Tags.Items.GEMS_DIAMOND) - .add(Items.DIAMOND) - .addOptionalTag(forgeItemTagKey("gems/diamond")); - tag(Tags.Items.GEMS_EMERALD) - .add(Items.EMERALD) - .addOptionalTag(forgeItemTagKey("gems/emerald")); - tag(Tags.Items.GEMS_LAPIS) - .add(Items.LAPIS_LAZULI) - .addOptionalTag(forgeItemTagKey("gems/lapis")); - tag(Tags.Items.GEMS_PRISMARINE) - .add(Items.PRISMARINE_CRYSTALS) - .addOptionalTag(forgeItemTagKey("gems/prismarine")); - tag(Tags.Items.GEMS_QUARTZ) - .add(Items.QUARTZ) - .addOptionalTag(forgeItemTagKey("gems/quartz")); - tag(Tags.Items.GUNPOWDER).add(Items.GUNPOWDER); // forge:gunpowder - tag(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS); - tag(Tags.Items.INGOTS) - .addTags(Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE); - //.addOptionalTag(forgeItemTagKey("ingots")); // can't add because it would contain the contents of forge:ingots/brick and forge:ingots/nether_brick which are not in the c namespace - tag(Tags.Items.INGOTS_COPPER) - .add(Items.COPPER_INGOT) - .addOptionalTag(forgeItemTagKey("ingots/copper")); - tag(Tags.Items.INGOTS_GOLD) - .add(Items.GOLD_INGOT) - .addOptionalTag(forgeItemTagKey("ingots/gold")); - tag(Tags.Items.INGOTS_IRON) - .add(Items.IRON_INGOT) - .addOptionalTag(forgeItemTagKey("ingots/iron")); - tag(Tags.Items.INGOTS_NETHERITE) - .add(Items.NETHERITE_INGOT) - .addOptionalTag(forgeItemTagKey("ingots/netherite")); - tag(Tags.Items.LEATHERS) - .add(Items.LEATHER) - .addOptionalTag(forgeItemTagKey("leather")); - tag(Tags.Items.MUSHROOMS) - .add(Items.BROWN_MUSHROOM, Items.RED_MUSHROOM) - .addOptionalTag(forgeItemTagKey("mushrooms")); - tag(Tags.Items.MUSIC_DISCS).add(Items.MUSIC_DISC_13, Items.MUSIC_DISC_CAT, Items.MUSIC_DISC_BLOCKS, Items.MUSIC_DISC_CHIRP, - Items.MUSIC_DISC_FAR, Items.MUSIC_DISC_MALL, Items.MUSIC_DISC_MELLOHI, Items.MUSIC_DISC_STAL, Items.MUSIC_DISC_STRAD, - Items.MUSIC_DISC_WARD, Items.MUSIC_DISC_11, Items.MUSIC_DISC_WAIT, Items.MUSIC_DISC_OTHERSIDE, Items.MUSIC_DISC_5, - Items.MUSIC_DISC_PIGSTEP, Items.MUSIC_DISC_RELIC, Items.MUSIC_DISC_CREATOR, Items.MUSIC_DISC_CREATOR_MUSIC_BOX, - Items.MUSIC_DISC_PRECIPICE); - tag(Tags.Items.NETHER_STARS) - .add(Items.NETHER_STAR) - .addOptionalTag(forgeItemTagKey("nether_stars")); - tag(Tags.Items.NUGGETS) - .addTags(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_COPPER) - .addOptionalTag(forgeItemTagKey("nuggets")); - tag(Tags.Items.NUGGETS_COPPER) - .add(Items.COPPER_NUGGET); - tag(Tags.Items.NUGGETS_IRON) - .add(Items.IRON_NUGGET) - .addOptionalTag(forgeItemTagKey("nuggets/iron")); - tag(Tags.Items.NUGGETS_GOLD) - .add(Items.GOLD_NUGGET) - .addOptionalTag(forgeItemTagKey("nuggets/gold")); - tag(Tags.Items.RAW_MATERIALS) - .addTags(Tags.Items.RAW_MATERIALS_COPPER, Tags.Items.RAW_MATERIALS_GOLD, Tags.Items.RAW_MATERIALS_IRON) - .addOptionalTag(forgeItemTagKey("raw_materials")); - tag(Tags.Items.RAW_MATERIALS_COPPER) - .add(Items.RAW_COPPER) - .addOptionalTag(forgeItemTagKey("raw_materials/copper")); - tag(Tags.Items.RAW_MATERIALS_GOLD) - .add(Items.RAW_GOLD) - .addOptionalTag(forgeItemTagKey("raw_materials/gold")); - tag(Tags.Items.RAW_MATERIALS_IRON) - .add(Items.RAW_IRON) - .addOptionalTag(forgeItemTagKey("raw_materials/iron")); - tag(Tags.Items.RODS) - .addTags(Tags.Items.RODS_WOODEN, Tags.Items.RODS_BLAZE, Tags.Items.RODS_BREEZE) - .addOptionalTag(forgeItemTagKey("rods")); - tag(Tags.Items.RODS_BLAZE) - .add(Items.BLAZE_ROD) - .addOptionalTag(forgeItemTagKey("rods/blaze")); - tag(Tags.Items.RODS_BREEZE).add(Items.BREEZE_ROD); - tag(Tags.Items.RODS_WOODEN) - .add(Items.STICK) - .addOptionalTag(forgeItemTagKey("rods/wooden")); - tag(Tags.Items.SEEDS).addTags(Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, Tags.Items.SEEDS_WHEAT); - tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); - tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); - tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); - tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(Tags.Items.SLIME_BALLS) - .add(Items.SLIME_BALL) - .addOptionalTag(forgeItemTagKey("slimeballs")); - tag(Tags.Items.SHULKER_BOXES) - .add(Items.SHULKER_BOX, Items.WHITE_SHULKER_BOX, Items.ORANGE_SHULKER_BOX, - Items.MAGENTA_SHULKER_BOX, Items.LIGHT_BLUE_SHULKER_BOX, Items.YELLOW_SHULKER_BOX, - Items.LIME_SHULKER_BOX, Items.PINK_SHULKER_BOX, Items.GRAY_SHULKER_BOX, - Items.LIGHT_GRAY_SHULKER_BOX, Items.CYAN_SHULKER_BOX, Items.PURPLE_SHULKER_BOX, - Items.BLUE_SHULKER_BOX, Items.BROWN_SHULKER_BOX, Items.GREEN_SHULKER_BOX, - Items.RED_SHULKER_BOX, Items.BLACK_SHULKER_BOX); - tag(Tags.Items.STRINGS) - .add(Items.STRING) - .addOptionalTag(forgeItemTagKey("strings")); - tag(Tags.Items.VILLAGER_JOB_SITES).add( - Items.BARREL, Items.BLAST_FURNACE, Items.BREWING_STAND, Items.CARTOGRAPHY_TABLE, - Items.CAULDRON, Items.COMPOSTER, Items.FLETCHING_TABLE, Items.GRINDSTONE, - Items.LECTERN, Items.LOOM, Items.SMITHING_TABLE, Items.SMOKER, Items.STONECUTTER); + new ForgeBlockItemTagsProvider(tagId -> WrappedCombinedAppender.item(this.tag(tagId.item()))).run(); + tag(BONES).add(BONE); + tag(Tags.Items.BRICKS) + .addTags( + BRICKS_NORMAL, + BRICKS_NETHER, + BRICKS_RESIN + ); + tag(BRICKS_NORMAL).add(BRICK); + tag(BRICKS_NETHER).add(NETHER_BRICK); + tag(BRICKS_RESIN).add(RESIN_BRICK); + tag(BUCKETS_EMPTY).add(BUCKET); + tag(BUCKETS_WATER).add(WATER_BUCKET); + tag(BUCKETS_LAVA).add(LAVA_BUCKET); + tag(BUCKETS_MILK).add(MILK_BUCKET); + tag(BUCKETS_POWDER_SNOW).add(POWDER_SNOW); + tag(BUCKETS_ENTITY_WATER) + .add( + AXOLOTL_BUCKET, + COD_BUCKET, + PUFFERFISH_BUCKET, + TADPOLE_BUCKET, + TROPICAL_FISH_BUCKET, + SALMON_BUCKET + ); + tag(BUCKETS) + .addTags( + BUCKETS_EMPTY, + BUCKETS_WATER, + BUCKETS_LAVA, + BUCKETS_MILK, + BUCKETS_POWDER_SNOW, + BUCKETS_ENTITY_WATER + ); + tag(CLUMPS) + .addTag(CLUMPS_RESIN); + tag(CLUMPS_RESIN) + .add(RESIN_CLUMP); + tag(CONCRETE_POWDERS) + .addAll(BlockItemIds.CONCRETE_POWDER.map(BlockItemId::item).asList()); + tag(CROPS) + .addTags( + CROPS_BEETROOT, + CROPS_CACTUS, + CROPS_CARROT, + CROPS_COCOA_BEAN, + CROPS_MELON, + CROPS_NETHER_WART, + CROPS_POTATO, + CROPS_PUMPKIN, + CROPS_SUGAR_CANE, + CROPS_WHEAT + ); + tag(CROPS_BEETROOT).add(BEETROOT); + tag(CROPS_CACTUS).add(CACTUS); + tag(CROPS_CARROT).add(CARROT_CROP); + tag(CROPS_COCOA_BEAN).add(COCOA_CROP); + tag(CROPS_MELON).add(MELON); + tag(CROPS_NETHER_WART).add(NETHER_WART); + tag(CROPS_POTATO).add(POTATO_CROP); + tag(CROPS_PUMPKIN).add(PUMPKIN); + tag(CROPS_SUGAR_CANE).add(SUGAR_CANE); + tag(CROPS_WHEAT).add(WHEAT); + tag(DRINK_CONTAINING_BOTTLE) + .add( + POTION, + HONEY_BOTTLE, + OMINOUS_BOTTLE + ); + tag(DRINK_CONTAINING_BUCKET).add(MILK_BUCKET); + tag(DRINKS) + .addTags( + DRINKS_HONEY, + DRINKS_JUICE, + DRINKS_MAGIC, + DRINKS_MILK, + DRINKS_OMINOUS, + DRINKS_WATER, + DRINKS_WATERY + ); + tag(DRINKS_HONEY).add(HONEY_BOTTLE); + tag(DRINKS_JUICE); + tag(DRINKS_MAGIC) + .add( + OMINOUS_BOTTLE, + POTION + ); + tag(DRINKS_MILK).add(MILK_BUCKET); + tag(DRINKS_OMINOUS).add(OMINOUS_BOTTLE); + tag(DRINKS_WATER); + tag(DRINKS_WATERY).add(POTION); + addColored(DYED, "{color}_banner"); + addColored(DYED, "{color}_bed"); + addColored(DYED, "{color}_candle"); + addColored(DYED, "{color}_carpet"); + addColored(DYED, "{color}_concrete"); + addColored(DYED, "{color}_concrete_powder"); + addColored(DYED, "{color}_glazed_terracotta"); + addColored(DYED, "{color}_shulker_box"); + addColored(DYED, "{color}_stained_glass"); + addColored(DYED, "{color}_stained_glass_pane"); + addColored(DYED, "{color}_terracotta"); + addColored(DYED, "{color}_wool"); + addColoredTags(tag(DYED)::addTags, DYED); + tag(DUSTS) + .addTags( + DUSTS_GLOWSTONE, + DUSTS_REDSTONE + ); + tag(DUSTS_GLOWSTONE).add(GLOWSTONE_DUST); + tag(DUSTS_REDSTONE).add(REDSTONE_DUST); + addColored(DYES, "{color}_dye"); + addColoredTags(tag(DYES)::addTags, DYES); + tag(EGGS) + .add( + EGG, + BLUE_EGG, + BROWN_EGG + ); + tag(ENCHANTING_FUELS).addTag(GEMS_LAPIS); // forge:enchanting_fuels + tag(ENDER_PEARLS).add(ENDER_PEARL); + tag(FEATHERS).add(FEATHER); + tag(FERTILIZERS).add(BONE_MEAL); + tag(FOODS_FRUIT) + .add( + APPLE, + GOLDEN_APPLE, + ENCHANTED_GOLDEN_APPLE, + CHORUS_FRUIT, + MELON_SLICE + ); + tag(FOODS_VEGETABLE) + .add( + GOLDEN_CARROT, + BEETROOT + ) + .add( + CARROT_CROP, + POTATO_CROP + ); + tag(FOODS_BERRY) + .add( + SWEET_BERRY_CROP, + GLOW_BERRY_CROP + ); + tag(FOODS_BREAD).add(BREAD); + tag(FOODS_COOKIE).add(COOKIE); + tag(FOODS_DOUGH); + tag(FOODS_RAW_MEAT) + .add( + BEEF, + PORKCHOP, + CHICKEN, + RABBIT, + MUTTON + ); + tag(FOODS_RAW_FISH) + .add( + COD, + SALMON, + TROPICAL_FISH, + PUFFERFISH + ); + tag(FOODS_COOKED_MEAT) + .add( + COOKED_BEEF, + COOKED_PORKCHOP, + COOKED_CHICKEN, + COOKED_RABBIT, + COOKED_MUTTON + ); + tag(FOODS_COOKED_FISH) + .add( + COOKED_COD, + COOKED_SALMON + ); + tag(FOODS_SOUP) + .add( + BEETROOT_SOUP, + MUSHROOM_STEW, + RABBIT_STEW, + SUSPICIOUS_STEW + ); + tag(FOODS_CANDY); + tag(FOODS_PIE).add(PUMPKIN_PIE); + tag(FOODS_EDIBLE_WHEN_PLACED).add(CAKE); + tag(FOODS_FOOD_POISONING) + .add( + POISONOUS_POTATO, + PUFFERFISH, + SPIDER_EYE, + CHICKEN, + ROTTEN_FLESH + ); + tag(FOODS_GOLDEN) + .add( + GOLDEN_APPLE, + ENCHANTED_GOLDEN_APPLE, + GOLDEN_CARROT + ); + tag(FOODS) + .add( + BAKED_POTATO, + HONEY_BOTTLE, + OMINOUS_BOTTLE, + DRIED_KELP + ) + .addTags( + FOODS_FRUIT, + FOODS_VEGETABLE, + FOODS_BERRY, + FOODS_BREAD, + FOODS_COOKIE, + FOODS_RAW_MEAT, + FOODS_RAW_FISH, + FOODS_COOKED_MEAT, + FOODS_COOKED_FISH, + FOODS_SOUP, + FOODS_CANDY, + FOODS_PIE, + FOODS_GOLDEN, + FOODS_EDIBLE_WHEN_PLACED, + FOODS_FOOD_POISONING + ); + tag(ANIMAL_FOODS) + .addTags( + ItemTags.ARMADILLO_FOOD, + ItemTags.AXOLOTL_FOOD, + ItemTags.BEE_FOOD, + ItemTags.CAMEL_FOOD, + ItemTags.CAT_FOOD, + ItemTags.CHICKEN_FOOD, + ItemTags.COW_FOOD, + ItemTags.FOX_FOOD, + ItemTags.FROG_FOOD, + ItemTags.GOAT_FOOD, + ItemTags.HOGLIN_FOOD, + ItemTags.HORSE_FOOD, + ItemTags.LLAMA_FOOD, + ItemTags.OCELOT_FOOD, + ItemTags.PANDA_FOOD, + ItemTags.PARROT_FOOD, + ItemTags.PIG_FOOD, + ItemTags.PIGLIN_FOOD, + ItemTags.RABBIT_FOOD, + ItemTags.SHEEP_FOOD, + ItemTags.SNIFFER_FOOD, + ItemTags.STRIDER_FOOD, + ItemTags.TURTLE_FOOD, + ItemTags.WOLF_FOOD + ); + tag(GEMS) + .addTags( + GEMS_AMETHYST, + GEMS_DIAMOND, + GEMS_EMERALD, + GEMS_LAPIS, + GEMS_PRISMARINE, + GEMS_QUARTZ + ); + tag(GEMS_AMETHYST).add(AMETHYST_SHARD); + tag(GEMS_DIAMOND).add(DIAMOND); + tag(GEMS_EMERALD).add(EMERALD); + tag(GEMS_LAPIS).add(LAPIS_LAZULI); + tag(GEMS_PRISMARINE).add(PRISMARINE_CRYSTALS); + tag(GEMS_QUARTZ).add(QUARTZ); + tag(GUNPOWDERS).add(GUNPOWDER); + tag(HIDDEN_FROM_RECIPE_VIEWERS); + tag(INGOTS) + .addTags( + INGOTS_COPPER, + INGOTS_GOLD, + INGOTS_IRON, + INGOTS_NETHERITE + ); + tag(INGOTS_COPPER).add(COPPER_INGOT); + tag(INGOTS_GOLD).add(GOLD_INGOT); + tag(INGOTS_IRON).add(IRON_INGOT); + tag(INGOTS_NETHERITE).add(NETHERITE_INGOT); + tag(LEATHERS).add(LEATHER); + tag(MUSHROOMS) + .add( + BROWN_MUSHROOM, + RED_MUSHROOM + ); + tag(MUSIC_DISCS) + .add( + MUSIC_DISC_13, + MUSIC_DISC_CAT, + MUSIC_DISC_BLOCKS, + MUSIC_DISC_CHIRP, + MUSIC_DISC_FAR, + MUSIC_DISC_MALL, + MUSIC_DISC_MELLOHI, + MUSIC_DISC_STAL, + MUSIC_DISC_STRAD, + MUSIC_DISC_WARD, + MUSIC_DISC_11, + MUSIC_DISC_WAIT, + MUSIC_DISC_OTHERSIDE, + MUSIC_DISC_5, + MUSIC_DISC_PIGSTEP, + MUSIC_DISC_RELIC, + MUSIC_DISC_CREATOR, + MUSIC_DISC_CREATOR_MUSIC_BOX, + MUSIC_DISC_PRECIPICE, + MUSIC_DISC_LAVA_CHICKEN, + MUSIC_DISC_TEARS + ); + tag(NETHER_STARS).add(NETHER_STAR); + tag(NUGGETS) + .addTags( + NUGGETS_GOLD, + NUGGETS_IRON, + NUGGETS_COPPER + ); + tag(NUGGETS_COPPER).add(COPPER_NUGGET); + tag(NUGGETS_IRON).add(IRON_NUGGET); + tag(NUGGETS_GOLD).add(GOLD_NUGGET); + tag(POTIONS_BOTTLE) + .add( + POTION, + SPLASH_POTION, + LINGERING_POTION + ); + tag(POTIONS).addTags(POTIONS_BOTTLE); + tag(RAW_MATERIALS) + .addTags( + RAW_MATERIALS_COPPER, + RAW_MATERIALS_GOLD, + RAW_MATERIALS_IRON + ); + tag(RAW_MATERIALS_COPPER).add(RAW_COPPER); + tag(RAW_MATERIALS_GOLD).add(RAW_GOLD); + tag(RAW_MATERIALS_IRON).add(RAW_IRON); + tag(RODS) + .addTags( + RODS_WOODEN, + RODS_BLAZE, + RODS_BREEZE + ); + tag(RODS_BLAZE).add(BLAZE_ROD); + tag(RODS_BREEZE).add(BREEZE_ROD); + tag(RODS_WOODEN).add(STICK); + tag(SEEDS) + .addTags( + SEEDS_BEETROOT, + SEEDS_MELON, + SEEDS_PUMPKIN, + SEEDS_WHEAT + ); + tag(SEEDS_BEETROOT).add(BEETROOT_CROP); + tag(SEEDS_MELON).add(MELON_CROP); + tag(SEEDS_PUMPKIN).add(PUMPKIN_CROP); + tag(SEEDS_WHEAT).add(WHEAT_CROP); + tag(SLIME_BALLS).add(SLIME_BALL); + tag(SHULKER_BOXES) + .add( + SHULKER_BOX + ) + .addAll(BlockItemIds.DYED_SHULKER_BOX.map(BlockItemId::item).asList()); + tag(STRINGS).add(TRIPWIRE); + tag(VILLAGER_JOB_SITES) + .add( + BARREL, + BLAST_FURNACE, + BREWING_STAND, + CARTOGRAPHY_TABLE, + CAULDRON, + COMPOSTER, + FLETCHING_TABLE, + GRINDSTONE, + LECTERN, + LOOM, + SMITHING_TABLE, + SMOKER, + STONECUTTER + ); // Tools and Armors - tag(Tags.Items.TOOLS_SHIELD) - .add(Items.SHIELD) - .addOptionalTag(forgeItemTagKey("tools/shields")); - tag(Tags.Items.TOOLS_BOW) - .add(Items.BOW) - .addOptionalTag(forgeItemTagKey("tools/bows")); - tag(Tags.Items.TOOLS_BRUSH).add(Items.BRUSH); - tag(Tags.Items.TOOLS_CROSSBOW) - .add(Items.CROSSBOW) - .addOptionalTag(forgeItemTagKey("tools/crossbows")); - tag(Tags.Items.TOOLS_FISHING_ROD) - .add(Items.FISHING_ROD) - .addOptionalTag(forgeItemTagKey("tools/fishing_rods")); - tag(Tags.Items.TOOLS_SHEAR) - .add(Items.SHEARS) - .addOptionalTag(forgeItemTagKey("tools/shears")); - tag(Tags.Items.TOOLS_SPEAR).add(Items.TRIDENT); - tag(Tags.Items.TOOLS_MACE).add(Items.MACE); - tag(Tags.Items.TOOLS_IGNITER).add(Items.FLINT_AND_STEEL); - tag(Tags.Items.MINING_TOOL_TOOLS).add(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE, Items.GOLDEN_PICKAXE, Items.DIAMOND_PICKAXE, Items.NETHERITE_PICKAXE); - tag(Tags.Items.MELEE_WEAPON_TOOLS).add( - Items.MACE, Items.TRIDENT, - Items.WOODEN_SWORD, Items.STONE_SWORD, Items.GOLDEN_SWORD, Items.IRON_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD, - Items.WOODEN_AXE, Items.STONE_AXE, Items.GOLDEN_AXE, Items.IRON_AXE, Items.DIAMOND_AXE, Items.NETHERITE_AXE - ); - tag(Tags.Items.RANGED_WEAPON_TOOLS).add(Items.BOW, Items.CROSSBOW, Items.TRIDENT); - tag(Tags.Items.TOOLS) - .addTags(ItemTags.AXES, ItemTags.HOES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.SWORDS) - .addTags(Tags.Items.TOOLS_BOW, Tags.Items.TOOLS_BRUSH, Tags.Items.TOOLS_CROSSBOW, Tags.Items.TOOLS_FISHING_ROD, Tags.Items.TOOLS_SHEAR, Tags.Items.TOOLS_IGNITER, Tags.Items.TOOLS_SHIELD, Tags.Items.TOOLS_SPEAR, Tags.Items.TOOLS_MACE, Tags.Items.MINING_TOOL_TOOLS, Tags.Items.MELEE_WEAPON_TOOLS, Tags.Items.RANGED_WEAPON_TOOLS); - tag(Tags.Items.ARMORS) - .addTags(ItemTags.HEAD_ARMOR, ItemTags.CHEST_ARMOR, ItemTags.LEG_ARMOR, ItemTags.FOOT_ARMOR) - .addOptionalTag(forgeItemTagKey("armors")); - tag(Tags.Items.ENCHANTABLES) + tag(TOOLS_SHIELD).add(SHIELD); + tag(TOOLS_BOW).add(BOW); + tag(TOOLS_BRUSH).add(BRUSH); + tag(TOOLS_CROSSBOW).add(CROSSBOW); + tag(TOOLS_FISHING_ROD).add(FISHING_ROD); + tag(TOOLS_SHEAR).add(SHEARS); + tag(TOOLS_TRIDENT).add(TRIDENT); + tag(TOOLS_MACE).add(MACE); + tag(TOOLS_IGNITER).add(FLINT_AND_STEEL); + tag(MINING_TOOL_TOOLS) + .add( + WOODEN_PICKAXE, + STONE_PICKAXE, + COPPER_PICKAXE, + IRON_PICKAXE, + GOLDEN_PICKAXE, + DIAMOND_PICKAXE, + NETHERITE_PICKAXE + ); + tag(MELEE_WEAPON_TOOLS) + .add( + MACE, + TRIDENT, + WOODEN_SWORD, + STONE_SWORD, + COPPER_SWORD, + GOLDEN_SWORD, + IRON_SWORD, + DIAMOND_SWORD, + NETHERITE_SWORD, + WOODEN_AXE, + STONE_AXE, + COPPER_AXE, + GOLDEN_AXE, + IRON_AXE, + DIAMOND_AXE, + NETHERITE_AXE, + WOODEN_SPEAR, + STONE_SPEAR, + COPPER_SPEAR, + IRON_SPEAR, + GOLDEN_SPEAR, + DIAMOND_SPEAR, + NETHERITE_SPEAR + ); + tag(RANGED_WEAPON_TOOLS) + .add( + BOW, + CROSSBOW, + TRIDENT + ); + tag(TOOLS_WRENCH); + tag(TOOLS) + .addTags( + ItemTags.AXES, + ItemTags.HOES, + ItemTags.PICKAXES, + ItemTags.SHOVELS, + ItemTags.SWORDS + ) + .addTags( + TOOLS_BOW, + TOOLS_BRUSH, + TOOLS_CROSSBOW, + TOOLS_FISHING_ROD, + TOOLS_SHEAR, + TOOLS_IGNITER, + TOOLS_SHIELD, + TOOLS_TRIDENT, + TOOLS_MACE, + MINING_TOOL_TOOLS, + MELEE_WEAPON_TOOLS, + RANGED_WEAPON_TOOLS, + TOOLS_WRENCH + ); + tag(ARMORS_HORSE) + .add( + COPPER_HORSE_ARMOR, + DIAMOND_HORSE_ARMOR, + GOLDEN_HORSE_ARMOR, + IRON_HORSE_ARMOR, + LEATHER_HORSE_ARMOR, + NETHERITE_HORSE_ARMOR + ); + tag(ARMORS_NAUTILUS) + .add( + COPPER_NAUTILUS_ARMOR, + DIAMOND_NAUTILUS_ARMOR, + GOLDEN_NAUTILUS_ARMOR, + IRON_NAUTILUS_ARMOR, + NETHERITE_NAUTILUS_ARMOR + ); + tag(ARMORS_HUMANOID) + .add( + CHAINMAIL_BOOTS, + CHAINMAIL_CHESTPLATE, + CHAINMAIL_HELMET, + CHAINMAIL_LEGGINGS, + COPPER_BOOTS, + COPPER_CHESTPLATE, + COPPER_HELMET, + COPPER_LEGGINGS, + DIAMOND_BOOTS, + DIAMOND_CHESTPLATE, + DIAMOND_HELMET, + DIAMOND_LEGGINGS, + GOLDEN_BOOTS, + GOLDEN_CHESTPLATE, + GOLDEN_HELMET, + GOLDEN_LEGGINGS, + IRON_BOOTS, + IRON_CHESTPLATE, + IRON_HELMET, + IRON_LEGGINGS, + LEATHER_BOOTS, + LEATHER_CHESTPLATE, + LEATHER_HELMET, + LEATHER_LEGGINGS, + NETHERITE_BOOTS, + NETHERITE_CHESTPLATE, + NETHERITE_HELMET, + NETHERITE_LEGGINGS, + TURTLE_HELMET + ); + tag(ARMORS_WOLF).add(WOLF_ARMOR); + tag(ARMORS) + .addTags( + ItemTags.HEAD_ARMOR, + ItemTags.CHEST_ARMOR, + ItemTags.LEG_ARMOR, + ItemTags.FOOT_ARMOR, + ARMORS_HORSE, + ARMORS_NAUTILUS, + ARMORS_WOLF, + ARMORS_HUMANOID + ); + tag(ENCHANTABLES) .addTags( ItemTags.ARMOR_ENCHANTABLE, ItemTags.EQUIPPABLE_ENCHANTABLE, @@ -300,105 +573,50 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { ItemTags.DURABILITY_ENCHANTABLE, ItemTags.VANISHING_ENCHANTABLE ); - - tag(forgeItemTagKey("bones")).add(Items.BONE); + tag(SEEDS) + .addTags( + SEEDS_BEETROOT, + SEEDS_MELON, + SEEDS_PUMPKIN, + SEEDS_WHEAT, + SEEDS_PITCHER_PLANT, + SEEDS_TORCHFLOWER + ); + tag(SEEDS_BEETROOT).add(BEETROOT_CROP); + tag(SEEDS_MELON).add(MELON_CROP); + tag(SEEDS_PUMPKIN).add(PUMPKIN_CROP); + tag(SEEDS_WHEAT).add(WHEAT_CROP); + tag(SEEDS_PITCHER_PLANT).add(PITCHER_CROP); + tag(SEEDS_TORCHFLOWER).add(TORCHFLOWER_CROP); + tag(BONES).add(BONE); // Backwards compat definitions for pre-1.21 legacy `forge:` tags. // TODO: Remove backwards compat tag entries in 1.22 - tag(forgeItemTagKey("crops")) - .addTags(forgeItemTagKey("crops/beetroot"), forgeItemTagKey("crops/carrot"), forgeItemTagKey("crops/nether_wart"), - forgeItemTagKey("crops/potato"), forgeItemTagKey("crops/wheat")); - tag(forgeItemTagKey("crops/beetroot")).add(Items.BEETROOT); - tag(forgeItemTagKey("crops/carrot")).add(Items.CARROT); - tag(forgeItemTagKey("crops/nether_wart")).add(Items.NETHER_WART); - tag(forgeItemTagKey("crops/potato")).add(Items.POTATO); - tag(forgeItemTagKey("crops/wheat")).add(Items.WHEAT); - tag(forgeItemTagKey("foods/pie")).add(Items.PUMPKIN_PIE); - tag(forgeItemTagKey("dusts")).addTags(forgeItemTagKey("dusts/glowstone"), Tags.Items.DUSTS_PRISMARINE, forgeItemTagKey("dusts/redstone")); - tag(forgeItemTagKey("dusts/glowstone")).add(Items.GLOWSTONE_DUST); - tag(forgeItemTagKey("dusts/prismarine")).add(Items.PRISMARINE_SHARD); - tag(forgeItemTagKey("dusts/redstone")).add(Items.REDSTONE); addColored(tag(forgeItemTagKey("dyes"))::addTags, forgeItemTagKey("dyes"), "{color}_dye"); - tag(forgeItemTagKey("eggs")).add(Items.EGG); - tag(forgeItemTagKey("enchanting_fuels")).addTag(forgeItemTagKey("gems/lapis")); - tag(forgeItemTagKey("ender_pearls")).add(Items.ENDER_PEARL); - tag(forgeItemTagKey("feathers")).add(Items.FEATHER); - tag(forgeItemTagKey("gems")) - .addTags(forgeItemTagKey("gems/amethyst"), forgeItemTagKey("gems/diamond"), forgeItemTagKey("gems/emerald"), - forgeItemTagKey("gems/lapis"), forgeItemTagKey("gems/prismarine"), forgeItemTagKey("gems/quartz")); - tag(forgeItemTagKey("gems/amethyst")).add(Items.AMETHYST_SHARD); - tag(forgeItemTagKey("gems/diamond")).add(Items.DIAMOND); - tag(forgeItemTagKey("gems/emerald")).add(Items.EMERALD); - tag(forgeItemTagKey("gems/lapis")).add(Items.LAPIS_LAZULI); - tag(forgeItemTagKey("gems/prismarine")).add(Items.PRISMARINE_CRYSTALS); - tag(forgeItemTagKey("gems/quartz")).add(Items.QUARTZ); - tag(forgeItemTagKey("gunpowder")).add(Items.GUNPOWDER); - tag(forgeItemTagKey("heads")).add(Items.CREEPER_HEAD, Items.DRAGON_HEAD, Items.PLAYER_HEAD, Items.SKELETON_SKULL, Items.WITHER_SKELETON_SKULL, Items.ZOMBIE_HEAD); - tag(forgeItemTagKey("ingots")) - .addTags(forgeItemTagKey("ingots/brick"), forgeItemTagKey("ingots/copper"), forgeItemTagKey("ingots/gold"), - forgeItemTagKey("ingots/iron"), forgeItemTagKey("ingots/netherite"), forgeItemTagKey("ingots/nether_brick")); - tag(forgeItemTagKey("ingots/brick")).add(Items.BRICK); - tag(forgeItemTagKey("ingots/copper")).add(Items.COPPER_INGOT); - tag(forgeItemTagKey("ingots/gold")).add(Items.GOLD_INGOT); - tag(forgeItemTagKey("ingots/iron")).add(Items.IRON_INGOT); - tag(forgeItemTagKey("ingots/netherite")).add(Items.NETHERITE_INGOT); - tag(forgeItemTagKey("ingots/nether_brick")).add(Items.NETHER_BRICK); - tag(forgeItemTagKey("leather")).add(Items.LEATHER); - tag(forgeItemTagKey("mushrooms")).add(Items.BROWN_MUSHROOM, Items.RED_MUSHROOM); - tag(forgeItemTagKey("nether_stars")).add(Items.NETHER_STAR); - tag(forgeItemTagKey("nuggets")).addTags(forgeItemTagKey("nuggets/iron"), forgeItemTagKey("nuggets/gold")); - tag(forgeItemTagKey("nuggets/iron")).add(Items.IRON_NUGGET); - tag(forgeItemTagKey("nuggets/gold")).add(Items.GOLD_NUGGET); - tag(forgeItemTagKey("raw_materials")).addTags(forgeItemTagKey("raw_materials/copper"), forgeItemTagKey("raw_materials/gold"), forgeItemTagKey("raw_materials/iron")); - tag(forgeItemTagKey("raw_materials/copper")).add(Items.RAW_COPPER); - tag(forgeItemTagKey("raw_materials/gold")).add(Items.RAW_GOLD); - tag(forgeItemTagKey("raw_materials/iron")).add(Items.RAW_IRON); - tag(forgeItemTagKey("rods")).addTags(forgeItemTagKey("rods/blaze"), forgeItemTagKey("rods/wooden")); - tag(forgeItemTagKey("rods/blaze")).add(Items.BLAZE_ROD); - tag(forgeItemTagKey("rods/wooden")).add(Items.STICK); - tag(Tags.Items.SEEDS).addTags(Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, Tags.Items.SEEDS_WHEAT); - tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); - tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); - tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); - tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(forgeItemTagKey("shears")).add(Items.SHEARS); // yes, it's forge:shears not forge:tools/shears - tag(forgeItemTagKey("slimeballs")).add(Items.SLIME_BALL); - tag(forgeItemTagKey("string")).add(Items.STRING); - tag(forgeItemTagKey("tools/shields")).add(Items.SHIELD); - tag(forgeItemTagKey("tools/bows")).add(Items.BOW); - tag(forgeItemTagKey("tools/crossbows")).add(Items.CROSSBOW); - tag(forgeItemTagKey("tools/fishing_rods")).add(Items.FISHING_ROD); - tag(forgeItemTagKey("tools/tridents")).add(Items.TRIDENT); - tag(forgeItemTagKey("tools")) - .addTags(ItemTags.SWORDS, ItemTags.AXES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.HOES) - .addTags(forgeItemTagKey("tools/shields"), forgeItemTagKey("tools/bows"), forgeItemTagKey("tools/crossbows"), forgeItemTagKey("tools/fishing_rods"), forgeItemTagKey("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); - tag(Tags.Items.ARMORS_CHESTPLATES).add(Items.LEATHER_CHESTPLATE, Items.CHAINMAIL_CHESTPLATE, Items.IRON_CHESTPLATE, Items.GOLDEN_CHESTPLATE, Items.DIAMOND_CHESTPLATE, Items.NETHERITE_CHESTPLATE); - tag(Tags.Items.ARMORS_LEGGINGS).add(Items.LEATHER_LEGGINGS, Items.CHAINMAIL_LEGGINGS, Items.IRON_LEGGINGS, Items.GOLDEN_LEGGINGS, Items.DIAMOND_LEGGINGS, Items.NETHERITE_LEGGINGS); - tag(Tags.Items.ARMORS_BOOTS).add(Items.LEATHER_BOOTS, Items.CHAINMAIL_BOOTS, Items.IRON_BOOTS, Items.GOLDEN_BOOTS, Items.DIAMOND_BOOTS, Items.NETHERITE_BOOTS); - tag(forgeItemTagKey("armors")).addTags(Tags.Items.ARMORS_HELMETS, Tags.Items.ARMORS_CHESTPLATES, Tags.Items.ARMORS_LEGGINGS, Tags.Items.ARMORS_BOOTS); } private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { - Identifier key = Identifier.fromNamespaceAndPath("minecraft", pattern.replace("{color}", color.getName())); + Identifier key = Identifier.withDefaultNamespace(pattern.replace("{color}", color.getName())); TagKey tag = getForgeItemTag(prefix + color.getName()); Item item = BuiltInRegistries.ITEM.getValue(key); if (item == null || item == Items.AIR) throw new IllegalStateException("Unknown vanilla item: " + key); - tag(tag).add(item); + tag(tag) + .add(ResourceKey.create(Registries.ITEM, key)); } } private void addColored(Consumer> consumer, TagKey group, String pattern) { String prefix = group.location().getPath() + '/'; for (DyeColor color : DyeColor.values()) { - Identifier key = Identifier.fromNamespaceAndPath("minecraft", pattern.replace("{color}", color.getName())); + Identifier key = Identifier.withDefaultNamespace(pattern.replace("{color}", color.getName())); TagKey tag = forgeItemTagKey(prefix + color.getName()); Item item = ForgeRegistries.ITEMS.getValue(key); if (item == null || item == Items.AIR) - throw new IllegalStateException("Unknown vanilla item: " + key.toString()); - tag(tag).add(item); + throw new IllegalStateException("Unknown vanilla item: " + key); + tag(tag) + .add(ResourceKey.create(Registries.ITEM, key)); consumer.accept(tag); } } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java index b0238a8b72..13d6ff36c7 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java @@ -5,7 +5,7 @@ package net.minecraftforge.common.data; -import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; import net.minecraft.data.PackOutput; @@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableList; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.ValidationContext; +import net.minecraft.world.level.storage.loot.ValidationContextSource; import net.minecraft.world.level.storage.loot.entries.CompositeEntryBase; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; @@ -42,19 +42,19 @@ import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; * Currently used only for replacing shears item to shears_dig tool action */ public final class ForgeLootTableProvider extends LootTableProvider { - private static final String POOLS = "f_7915" + "6_"; // LootTable.Builder.pools - private static final String ENTRIES = "f_7902" + "3_"; // LootPool.entries - private static final String CONDITIONS = "f_7902" + "4_"; // LootPool.conditions - private static final String CHILDREN = "f_7942" + "8_"; // CompositeEntryBase.children - private static final String ENTRY_CONDITION = "f_7963" + "6_"; // LootPoolEntryContainer.conditions - private static final String TERMS = "f_28560" + "9_"; // CompositeLootItemCondition.terms + private static final String POOLS = "pools"; // LootTable.Builder.pools + private static final String ENTRIES = "entries"; // LootPool.entries + private static final String CONDITIONS = "conditions"; // LootPool.conditions + private static final String CHILDREN = "children"; // CompositeEntryBase.children + private static final String ENTRY_CONDITION = "conditions"; // LootPoolEntryContainer.conditions + private static final String TERMS = "terms"; // CompositeLootItemCondition.terms public ForgeLootTableProvider(PackOutput pack, CompletableFuture lookup) { super(pack, Set.of(), VanillaLootTableProvider.create(pack, lookup).getTables(), lookup); } @Override - protected void validate(Registry map, ValidationContext validationcontext, ProblemReporter report) { + protected void validate(Registry map, ValidationContextSource validationcontext, ProblemReporter report) { // Do not validate against all registered loot tables } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java index 85c5903508..e35675b7bd 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java @@ -22,6 +22,7 @@ import net.minecraft.data.recipes.packs.VanillaRecipeProvider; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -85,11 +86,11 @@ public final class ForgeRecipeProvider extends VanillaRecipeProvider { replace(Items.DIAMOND, Tags.Items.GEMS_DIAMOND); replace(Items.EMERALD, Tags.Items.GEMS_EMERALD); replace(Items.CHEST, Tags.Items.CHESTS_WOODEN); - replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONE_NORMAL); - replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE); + replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONES_NORMAL); + replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); replace(Items.STRING, Tags.Items.STRINGS); - exclude(getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); + exclude(getConversionRecipeName(Blocks.WOOL.pick(DyeColor.WHITE), Items.STRING)); exclude(Blocks.GOLD_BLOCK); exclude(Items.GOLD_NUGGET); @@ -98,7 +99,7 @@ public final class ForgeRecipeProvider extends VanillaRecipeProvider { exclude(Blocks.DIAMOND_BLOCK); exclude(Blocks.EMERALD_BLOCK); exclude(Blocks.NETHERITE_BLOCK); - exclude(Blocks.COPPER_BLOCK); + Blocks.COPPER_BLOCK.forEach(this::exclude); exclude(Blocks.AMETHYST_BLOCK); exclude(Blocks.COBBLESTONE_STAIRS); diff --git a/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java deleted file mode 100644 index 15a5fa84b1..0000000000 --- a/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import net.minecraft.client.renderer.texture.atlas.sources.SingleFile; -import net.minecraft.data.PackOutput; -import net.minecraft.resources.Identifier; - -import java.util.Optional; - -public class ForgeSpriteSourceProvider extends SpriteSourceProvider -{ - public ForgeSpriteSourceProvider(PackOutput output, ExistingFileHelper fileHelper) - { - super(output, fileHelper, "forge"); - } - - @Override - protected void addSources() - { - atlas(SpriteSourceProvider.BLOCKS_ATLAS).addSource(new SingleFile(Identifier.parse("forge:white"), Optional.empty())); - } -} diff --git a/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java b/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java index 3ee39c34a7..d4395ca4aa 100644 --- a/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java +++ b/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java @@ -7,7 +7,6 @@ package net.minecraftforge.common.data; import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; -import com.mojang.logging.LogUtils; import com.mojang.serialization.Codec; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; @@ -25,7 +24,6 @@ import net.minecraft.resources.Identifier; import net.minecraft.server.packs.PackType; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.data.ExistingFileHelper.ResourceType; -import org.slf4j.Logger; /** *

Dataprovider for using a Codec to generate jsons. @@ -36,9 +34,7 @@ import org.slf4j.Logger; * * @param the type of thing being generated. */ -public class JsonCodecProvider implements DataProvider -{ - private static final Logger LOGGER = LogUtils.getLogger(); +public class JsonCodecProvider implements DataProvider { protected final PackOutput output; protected final ExistingFileHelper existingFileHelper; protected final String modid; @@ -58,14 +54,11 @@ public class JsonCodecProvider implements DataProvider * @param entries Map of named entries to serialize to jsons. Paths for values are derived from the Identifier's entryid:entrypath as specified above. */ public JsonCodecProvider(PackOutput output, ExistingFileHelper existingFileHelper, String modid, DynamicOps dynamicOps, PackType packType, - String directory, Codec codec, Map entries) - { + String directory, Codec codec, Map entries) { // Track generated data so other dataproviders can validate if needed. final ResourceType resourceType = new ResourceType(packType, ".json", directory); for (Identifier id : entries.keySet()) - { existingFileHelper.trackGenerated(id, resourceType); - } this.output = output; this.existingFileHelper = existingFileHelper; this.modid = modid; @@ -77,8 +70,7 @@ public class JsonCodecProvider implements DataProvider } @Override - public CompletableFuture run(final CachedOutput cache) - { + public CompletableFuture run(final CachedOutput cache) { final Path outputFolder = this.output.getOutputFolder(this.packType == PackType.CLIENT_RESOURCES ? PackOutput.Target.RESOURCE_PACK : PackOutput.Target.DATA_PACK); @@ -108,14 +100,12 @@ public class JsonCodecProvider implements DataProvider return CompletableFuture.allOf(futuresBuilder.build().toArray(CompletableFuture[]::new)); } - protected void gather(BiConsumer consumer) - { + protected void gather(BiConsumer consumer) { this.entries.forEach(consumer); } @Override - public String getName() - { + public String getName() { return String.format("%s generator for %s", this.directory, this.modid); } @@ -125,8 +115,7 @@ public class JsonCodecProvider implements DataProvider * Null or empty arrays will not be written, and if the top-level json type is not JsonObject, attempting to add conditions will error. * @param conditions The name->condition map to apply. */ - public JsonCodecProvider setConditions(Map conditions) - { + public JsonCodecProvider setConditions(Map conditions) { this.conditions = conditions; return this; } diff --git a/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java b/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java deleted file mode 100644 index 9d3cbc21e5..0000000000 --- a/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import com.mojang.serialization.JsonOps; -import net.minecraft.client.renderer.texture.atlas.SpriteSource; -import net.minecraft.client.renderer.texture.atlas.SpriteSources; -import net.minecraft.data.PackOutput; -import net.minecraft.resources.Identifier; -import net.minecraft.server.packs.PackType; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.BiConsumer; - -/** - *

Data provider for atlas configuration files.
- * An atlas configuration is bound to a specific texture atlas such as the {@code minecraft:blocks} atlas and - * allows adding additional textures to the atlas by adding {@link SpriteSource}s to the configuration.

- *

See {@link SpriteSources} for the available sources and the constants in this class for the - * atlases used in vanilla Minecraft

- */ -public abstract class SpriteSourceProvider extends JsonCodecProvider> -{ - protected static final Identifier BLOCKS_ATLAS = Identifier.withDefaultNamespace("blocks"); - protected static final Identifier BANNER_PATTERNS_ATLAS = Identifier.withDefaultNamespace("banner_patterns"); - protected static final Identifier BEDS_ATLAS = Identifier.withDefaultNamespace("beds"); - protected static final Identifier CHESTS_ATLAS = Identifier.withDefaultNamespace("chests"); - protected static final Identifier SHIELD_PATTERNS_ATLAS = Identifier.withDefaultNamespace("shield_patterns"); - protected static final Identifier SHULKER_BOXES_ATLAS = Identifier.withDefaultNamespace("shulker_boxes"); - protected static final Identifier SIGNS_ATLAS = Identifier.withDefaultNamespace("signs"); - protected static final Identifier MOB_EFFECTS_ATLAS = Identifier.withDefaultNamespace("mob_effects"); - protected static final Identifier PAINTINGS_ATLAS = Identifier.withDefaultNamespace("paintings"); - protected static final Identifier PARTICLES_ATLAS = Identifier.withDefaultNamespace("particles"); - - private final Map atlases = new HashMap<>(); - - public SpriteSourceProvider(PackOutput output, ExistingFileHelper fileHelper, String modid) - { - super(output, fileHelper, modid, JsonOps.INSTANCE, PackType.CLIENT_RESOURCES, "atlases", SpriteSources.FILE_CODEC, Map.of()); - } - - @Override - protected final void gather(BiConsumer> consumer) - { - addSources(); - for (var entry : atlases.entrySet()) { - Identifier atlas = entry.getKey(); - SourceList srcList = entry.getValue(); - consumer.accept(atlas, srcList.sources); - } - } - - protected abstract void addSources(); - - /** - * Get or create a {@link SourceList} for the given atlas - * @param atlas The texture atlas the sources should be added to, see constants at the top for the format - * and the vanilla atlases - * @return an existing {@code SourceList} for the given atlas or a new one if not present yet - */ - protected final SourceList atlas(Identifier atlas) - { - return atlases.computeIfAbsent(atlas, $ -> new SourceList()); - } - - protected static final class SourceList - { - private final List sources = new ArrayList<>(); - - /** - * Add the given {@link SpriteSource} to this atlas configuration - * @param source The {@code SpriteSource} to be added - */ - public SourceList addSource(SpriteSource source) - { - sources.add(source); - return this; - } - } -} diff --git a/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java b/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java new file mode 100644 index 0000000000..d8f35f59ab --- /dev/null +++ b/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.data; + +import java.util.Arrays; +import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Stream; + +import net.minecraft.data.tags.BlockItemTagsProvider.CombinedAppender; +import net.minecraft.data.tags.TagAppender; +import net.minecraft.references.BlockItemId; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.BlockItemTagId; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public class WrappedCombinedAppender implements CombinedAppender { + private final Function> mapper; + private final Function> tagMapper; + private final TagAppender appender; + + public static WrappedCombinedAppender item(TagAppender appender) { + return new WrappedCombinedAppender(appender, BlockItemId::item, BlockItemTagId::item); + } + public static WrappedCombinedAppender block(TagAppender appender) { + return new WrappedCombinedAppender(appender, BlockItemId::block, BlockItemTagId::block); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected WrappedCombinedAppender( + TagAppender appender, + Function> mapper, + Function> tagMapper + ) { + this.appender = (TagAppender)appender; + this.mapper = (Function>)(Function)mapper; + this.tagMapper = (Function>)(Function)tagMapper; + } + + @Override + public WrappedCombinedAppender add(final BlockItemId... ids) { + return this.addAll(Arrays.stream(ids)); + } + + @Override + public WrappedCombinedAppender add(final BlockItemTagId... ids) { + for (var id : ids) + addTag(id); + return this; + } + + @Override + public WrappedCombinedAppender addAll(final Collection ids) { + return this.addAll(ids.stream()); + } + + @Override + public WrappedCombinedAppender addAll(Stream ids) { + appender.addAll(ids.map(mapper)); + return this; + } + + @Override + public WrappedCombinedAppender addTag(BlockItemTagId id) { + appender.addTag(tagMapper.apply(id)); + return this; + } + + public WrappedCombinedAppender addOptional(BlockItemId... ids) { + for (var id : ids) + appender.addOptional(mapper.apply(id)); + return this; + } + + public WrappedCombinedAppender addOptional(BlockItemTagId... ids) { + for (var id : ids) + appender.addOptionalTag(tagMapper.apply(id)); + return this; + } + +} diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java index 9705384ea1..95fe90bacd 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java @@ -13,7 +13,7 @@ import net.minecraft.util.Mth; public interface IForgeAbstractMinecart { public static float DEFAULT_MAX_SPEED_AIR_LATERAL = 0.4f; public static float DEFAULT_MAX_SPEED_AIR_VERTICAL = -1.0f; - public static double DEFAULT_AIR_DRAG = 0.95f; + public static float DEFAULT_AIR_DRAG = 0.95f; private AbstractMinecart self() { return (AbstractMinecart)this; @@ -72,8 +72,7 @@ public interface IForgeAbstractMinecart { void setMaxSpeedAirLateral(float value); float getMaxSpeedAirVertical(); void setMaxSpeedAirVertical(float value); - double getDragAir(); - void setDragAir(double value); + void setAirDrag(float value); /** * Called from Detector Rails to retrieve a redstone power level for comparators. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index f4a1159e12..ebbcb7009e 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -9,6 +9,7 @@ import java.util.Optional; import java.util.function.BiConsumer; import net.minecraft.client.Camera; +import net.minecraft.client.renderer.block.BlockAndTintGetter; import net.minecraft.util.RandomSource; import net.minecraft.world.attribute.EnvironmentAttributes; import net.minecraft.world.entity.Entity; @@ -39,13 +40,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; import net.minecraft.world.phys.Vec3; import net.minecraft.server.level.ServerLevel; -import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.client.model.data.ModelDataManager; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.IPlantable; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -54,7 +53,6 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; -import net.minecraftforge.fml.loading.FMLEnvironment; import org.jetbrains.annotations.Nullable; @SuppressWarnings("deprecation") @@ -356,8 +354,8 @@ public interface IForgeBlock { * @return True if the soil should be considered fertile. */ default boolean isFertile(BlockState state, BlockGetter level, BlockPos pos) { - if (state.getBlock() instanceof FarmBlock) - return state.getValue(FarmBlock.MOISTURE) > 0; + if (state.getBlock() instanceof FarmlandBlock) + return state.getValue(FarmlandBlock.MOISTURE) > 0; return false; } @@ -501,7 +499,7 @@ public interface IForgeBlock { */ @Nullable default PathType getBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob) { - return state.getBlock() == Blocks.LAVA ? PathType.LAVA : state.isBurning(level, pos) ? PathType.DAMAGE_FIRE : null; + return state.getBlock() == Blocks.LAVA ? PathType.LAVA : state.isBurning(level, pos) ? PathType.FIRE : null; } /** @@ -519,8 +517,8 @@ public interface IForgeBlock { */ @Nullable default PathType getAdjacentBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, PathType originalType) { - if (state.is(Blocks.SWEET_BERRY_BUSH)) return PathType.DANGER_OTHER; - else if (WalkNodeEvaluator.isBurningBlock(state)) return PathType.DANGER_FIRE; + if (state.is(Blocks.SWEET_BERRY_BUSH)) return PathType.DAMAGING_IN_NEIGHBOR; + else if (WalkNodeEvaluator.isBurningBlock(state)) return PathType.FIRE_IN_NEIGHBOR; else return null; } @@ -782,42 +780,6 @@ public interface IForgeBlock { } } - /** - * Whether this block hides the neighbors face pointed towards by the given direction. - *

- * This method should only be used for blocks you don't control, for your own blocks override - * {@link Block#skipRendering(BlockState, BlockState, Direction)} on the respective block instead - *

- * WARNING: This method is likely to be called from a worker thread! If you want to retrieve a - * {@link net.minecraft.world.level.block.entity.BlockEntity} from the given level, make sure to use - * {@link net.minecraftforge.common.extensions.IForgeBlockGetter#getExistingBlockEntity(BlockPos)} to not - * accidentally create a new or delete an old {@link net.minecraft.world.level.block.entity.BlockEntity} - * off of the main thread as this would cause a write operation to the given {@link BlockGetter} and cause - * a CME in the process. Any other direct or indirect write operation to the {@link BlockGetter} will have - * the same outcome. - * - * @param level The world - * @param pos The blocks position in the world - * @param state The blocks {@link BlockState} - * @param neighborState The neighboring blocks {@link BlockState} - * @param dir The direction towards the neighboring block - */ - default boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState state, BlockState neighborState, Direction dir) { - return false; - } - - /** - * Whether this block allows a neighboring block to hide the face of this block it touches. - * If this returns true, {@link IForgeBlockState#hidesNeighborFace(BlockGetter, BlockPos, BlockState, Direction)} - * will be called on the neighboring block. - */ - default boolean supportsExternalFaceHiding(BlockState state) { - if (FMLEnvironment.dist.isClient()) { - return !ForgeHooksClient.isBlockInSolidLayer(state); - } - return true; - } - /** * Called after the {@link BlockState} at the given {@link BlockPos} was changed and neighbors were updated. * This method is called on the server and client side. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java index 6139cae4e3..2647f0d75b 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java @@ -6,7 +6,6 @@ package net.minecraftforge.common.extensions; import net.minecraft.network.Connection; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index fac9e6576d..496168cb6e 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -9,6 +9,7 @@ import java.util.Optional; import java.util.function.BiConsumer; import net.minecraft.client.Camera; +import net.minecraft.client.renderer.block.BlockAndTintGetter; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -29,7 +30,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraftforge.common.IPlantable; import net.minecraft.core.Direction; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -628,31 +628,6 @@ public interface IForgeBlockState { return self().getBlock().canConnectRedstone(self(), level, pos, direction); } - /** - * Whether this block hides the neighbors face pointed towards by the given direction. - *

- * This method should only be used for blocks you don't control, for your own blocks override - * {@link net.minecraft.world.level.block.Block#skipRendering(BlockState, BlockState, Direction)} - * on the respective block instead - * - * @param level The world - * @param pos The blocks position in the world - * @param neighborState The neighboring blocks {@link BlockState} - * @param dir The direction towards the neighboring block - */ - default boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState neighborState, Direction dir) { - return self().getBlock().hidesNeighborFace(level, pos, self(), neighborState, dir); - } - - /** - * Whether this block allows a neighboring block to hide the face of this block it touches. - * If this returns true, {@link IForgeBlockState#hidesNeighborFace(BlockGetter, BlockPos, BlockState, Direction)} - * will be called on the neighboring block. - */ - default boolean supportsExternalFaceHiding() { - return self().getBlock().supportsExternalFaceHiding(self()); - } - /** * Called after the {@link BlockState} at the given {@link BlockPos} was changed and neighbors were updated. * This method is called on the server and client side. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java index d7d4976ef7..20f444e0a7 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java @@ -124,24 +124,21 @@ public interface IForgeEntity extends ICapabilitySerializable { * * @return True if this entity is being tracked by a world */ - // TODO: rename in 1.19 to isAddedToLevel - boolean isAddedToWorld(); + boolean isAddedToLevel(); /** * Called after the entity has been added to the world's * ticking list. Can be overriden, but needs to call super * to prevent MC-136995. */ - // TODO: rename in 1.19 to onAddedToLevel - void onAddedToWorld(); + void onAddedToLevel(); /** * Called after the entity has been removed to the world's * ticking list. Can be overriden, but needs to call super * to prevent MC-136995. */ - // TODO: rename in 1.19 to onRemovedFromLevel - void onRemovedFromWorld(); + void onRemovedFromLevel(); /** * Revives an entity that has been removed from a world. @@ -186,7 +183,9 @@ public interface IForgeEntity extends ICapabilitySerializable { * @param type the type of the fluid * @return the height of the fluid compared to the entity */ - double getFluidTypeHeight(FluidType type); + default double getFluidTypeHeight(FluidType type) { + return self().getFluidInteraction().getFluidHeight(type); + } /** * Returns the fluid type which is the highest on the bounding box of @@ -195,7 +194,9 @@ public interface IForgeEntity extends ICapabilitySerializable { * @return the fluid type which is the highest on the bounding box of * the entity */ - FluidType getMaxHeightFluidType(); + default FluidType getMaxHeightFluidType() { + return self().getFluidInteraction().getMaxHeightFluid(); + } /** * Returns whether the entity is within the fluid type of the state. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java index ab853ddf22..1e3822b3d7 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java @@ -157,4 +157,15 @@ public interface IForgeFluidState { default boolean canExtinguish(BlockGetter getter, BlockPos pos) { return self().getType().canExtinguish(self(), getter, pos); } + + /** + * Returns the Entity specific flow velocity of this fluid. + * @param getter the getter which can get the fluid + * @param pos the position of the fluid + * @param entity The entity current being effected by this fluid + * @return How much to move the player, this will + */ + default Vec3 getFlow(final BlockGetter level, final BlockPos pos, final Entity entity) { + return self().getFlow(level, pos); + } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java b/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java index 05227969b7..ebe3958717 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java @@ -18,7 +18,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.util.Util; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.state.BlockState; @@ -151,17 +151,17 @@ public interface IForgeGameTestHelper { * Create a mock server player in creative mode */ default ServerPlayer makeMockServerPlayer() { - return makeMockServerPlayer(GameType.CREATIVE); + return makeMockServerPlayerFull(GameType.CREATIVE); } /** * Create a mock server player in creative mode */ default ServerPlayer makeMockServerPlayer(boolean creative) { - return makeMockServerPlayer(creative ? GameType.CREATIVE : GameType.SURVIVAL); + return makeMockServerPlayerFull(creative ? GameType.CREATIVE : GameType.SURVIVAL); } - default ServerPlayer makeMockServerPlayer(GameType type) { + default ServerPlayer makeMockServerPlayerFull(GameType type) { var level = self().getLevel(); var cookie = CommonListenerCookie.createInitial(new GameProfile(UUID.randomUUID(), "test-mock-player"), false); var player = new ServerPlayer(level.getServer(), level, cookie.gameProfile(), cookie.clientInformation()); @@ -182,7 +182,7 @@ public interface IForgeGameTestHelper { */ default void addEventListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -190,7 +190,7 @@ public interface IForgeGameTestHelper { */ default void addMutableListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -198,7 +198,7 @@ public interface IForgeGameTestHelper { */ default void addRecordListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -206,7 +206,7 @@ public interface IForgeGameTestHelper { */ default void registerEventListener(Object handler) { var keys = MinecraftForge.EVENT_BUS.register(handler); - self().addCleanup(success -> MinecraftForge.EVENT_BUS.unregister(keys)); + self().addCleanup(_ -> MinecraftForge.EVENT_BUS.unregister(keys)); } /** @@ -276,7 +276,7 @@ public interface IForgeGameTestHelper { default void removeAllItemEntitiesInRange(BlockPos pos, double range) { BlockPos blockpos = this.self().absolutePos(pos); - for (ItemEntity itemEntity : this.self().getLevel().getEntities(EntityType.ITEM, new AABB(blockpos).inflate(range), Entity::isAlive)) { + for (ItemEntity itemEntity : this.self().getLevel().getEntities(EntityTypes.ITEM, new AABB(blockpos).inflate(range), Entity::isAlive)) { itemEntity.remove(Entity.RemovalReason.DISCARDED); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java b/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java index 15e3dbd64e..9180ca134f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java @@ -32,13 +32,13 @@ public interface IForgeHolderSet { return this instanceof ListBacked listBacked ? listBacked.unwrap().map( // serializes as tag name if this holderset is named - tag -> SerializationType.STRING, + _ -> SerializationType.STRING, list -> list.size() == 1 // if list has exactly one element then we have to check what kind, otherwise it's a list ? list.get(0).unwrap().map( // if holder has a key bound then it's serialized as that string, otherwise it's inlined as an object key -> key == null ? SerializationType.OBJECT : SerializationType.STRING, - value -> SerializationType.OBJECT) + _ -> SerializationType.OBJECT) : SerializationType.LIST) : SerializationType.UNKNOWN; // unsupported holderset impl, could be anything } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index 2f3cadae81..ec27cbdac2 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -24,6 +24,7 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStackTemplate; import net.minecraft.world.item.Items; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; @@ -158,7 +159,7 @@ public interface IForgeItem { * @return The resulting ItemStack */ @SuppressWarnings("deprecation") - default ItemStack getCraftingRemainder(ItemStack itemStack) { + default ItemStackTemplate getCraftingRemainder(ItemStack itemStack) { return self().getCraftingRemainder(); } @@ -325,26 +326,6 @@ public interface IForgeItem { return false; } - /** - * Checks whether an item can be enchanted with a certain enchantment. This - * applies specifically to enchanting an item in the enchanting table and is - * called when retrieving the list of possible enchantments for an item. - * Enchantments may additionally (or exclusively) be doing their own checks in - * {@link Enchantment#canApplyAtEnchantingTable(ItemStack)}; - * check the individual implementation for reference. By default this will check - * if the enchantment type is valid for this item type. - * - * @param stack the item stack to be enchanted - * @param enchantment the enchantment to be applied - * @return true if the enchantment can be applied to this item - * - * @deprecated Use {@link IForgeItemStack#canApplyAtEnchantingTable(Holder)} - */ - @Deprecated(forRemoval = true, since = "1.21.3") - default boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return enchantment.isPrimaryItem(stack); - } - /** * Checks whether an item can be enchanted with a certain enchantment. This * applies specifically to enchanting an item in the enchanting table and is @@ -359,7 +340,7 @@ public interface IForgeItem { * @return true if the enchantment can be applied to this item */ default boolean canApplyAtEnchantingTable(ItemStack stack, Holder enchantment) { - return canApplyAtEnchantingTable(stack, enchantment.value()); + return enchantment.value().isPrimaryItem(stack); } /** @@ -452,21 +433,6 @@ public interface IForgeItem { } */ - /** - * Can this Item disable a shield - * - * @param stack The ItemStack - * @param shield The shield in question - * @param entity The LivingEntity holding the shield - * @param attacker The LivingEntity holding the ItemStack - * @return True if this ItemStack can disable the shield in question. - * @deprecated Overriding this does nothing! Use {@link net.minecraft.core.component.DataComponents#WEAPON}. - */ - @Deprecated(forRemoval = true, since = "1.21.5") - default boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) { - return attacker.getSecondsToDisableBlocking() > 0.0F; - } - /** * @return the fuel burn time for this itemStack in a furnace. Return 0 to make * it not act as a fuel. Return -1 to let the default vanilla logic @@ -615,20 +581,9 @@ public interface IForgeItem { return false; } - /** - * @return The Default Capability Provider for this item, if any. - * - * @deprecated Use the itemstack-sensitive version instead: {@link #getCapabilityProvider(ItemStack)} - */ - @Nullable - @Deprecated(forRemoval = true, since = "1.21.4") - default ICapabilityProvider getCapabilityProvider() { - return null; - } - /** @return The Default Capability Provider for this item, if any, accounting for the given itemstack. */ @Nullable default ICapabilityProvider getCapabilityProvider(ItemStack stack) { - return this.getCapabilityProvider(); + return null; } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index f4a07d73a2..a0f5be3279 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -22,6 +22,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStackTemplate; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionResult; @@ -49,9 +50,9 @@ public interface IForgeItemStack { * ItemStack sensitive version of {@link Item#getCraftingRemainder()}. * Returns a full ItemStack instance of the result. * - * @return The resulting ItemStack + * @return The resulting ItemStackTemplate */ - default ItemStack getCraftingRemainder() { + default ItemStackTemplate getCraftingRemainder() { return self().getItem().getCraftingRemainder(self()); } @@ -117,25 +118,6 @@ public interface IForgeItemStack { return self().getItem().shouldCauseBlockBreakReset(self(), newStack); } - /** - * Checks whether an item can be enchanted with a certain enchantment. This - * applies specifically to enchanting an item in the enchanting table and is - * called when retrieving the list of possible enchantments for an item. - * Enchantments may additionally (or exclusively) be doing their own checks in - * {@link Enchantment#canApplyAtEnchantingTable(ItemStack)}; - * check the individual implementation for reference. By default this will check - * if the enchantment type is valid for this item type. - * - * @param enchantment the enchantment to be applied - * @return true if the enchantment can be applied to this item - * - * @deprecated Use {@link #canApplyAtEnchantingTable(Holder)} - */ - @Deprecated(forRemoval = true, since = "1.21.3") - default boolean canApplyAtEnchantingTable(Enchantment enchantment) { - return self().getItem().canApplyAtEnchantingTable(self(), enchantment); - } - /** * Checks whether an item can be enchanted with a certain enchantment. This * applies specifically to enchanting an item in the enchanting table and is @@ -167,18 +149,6 @@ public interface IForgeItemStack { return self().getItem().getEquipmentSlot(self()); } - /** - * Can this Item disable a shield - * - * @param shield The shield in question - * @param entity The LivingEntity holding the shield - * @param attacker The LivingEntity holding the ItemStack - * @return True if this ItemStack can disable the shield in question. - */ - default boolean canDisableShield(ItemStack shield, LivingEntity entity, LivingEntity attacker) { - return self().getItem().canDisableShield(self(), shield, entity, attacker); - } - /** * Called when a entity tries to play the 'swing' animation. * diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeLevelSummary.java b/src/main/java/net/minecraftforge/common/extensions/IForgeLevelSummary.java index a2ebdcdf6e..94f4679de3 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeLevelSummary.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeLevelSummary.java @@ -22,6 +22,6 @@ public interface IForgeLevelSummary { // NOTE: Because CorruptedLevelSummary and SymlinkLevelSummary can have null settings, we need to check it var settings = this.self().getSettings(); - return settings != null && settings.getLifecycle().equals(com.mojang.serialization.Lifecycle.experimental()); + return settings != null && settings.lifecycle().equals(com.mojang.serialization.Lifecycle.experimental()); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java index 8fd641d365..105e999129 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java @@ -11,7 +11,7 @@ import net.minecraft.tags.TagEntry; public interface IForgeRawTagBuilder { default TagBuilder getRawBuilder() { - return (TagBuilder) this; + return (TagBuilder)this; } /** @@ -43,11 +43,4 @@ public interface IForgeRawTagBuilder { default TagBuilder removeTag(final Identifier tagID, final String source) { return this.remove(TagEntry.tag(tagID), source); } - - /** - * Shorthand version of {@code replace(true)} - */ - default TagBuilder replace() { - return this.getRawBuilder().replace(true); - } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java index f861f2d107..411783fb40 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java @@ -11,9 +11,9 @@ import net.minecraft.resources.Identifier; import net.minecraft.tags.TagBuilder; import net.minecraft.tags.TagKey; -public interface IForgeTagAppender { - private TagAppender self() { - return (TagAppender)this; +public interface IForgeTagAppender { + private TagAppender self() { + return (TagAppender)this; } /** @@ -28,33 +28,8 @@ public interface IForgeTagAppender { return "unknown"; } - /** - * Adds a registry entry to the tag json's remove list. Callable during datageneration. - * - * @param entry The entry to remove - * @return The builder for chaining - */ - default TagAppender remove(final E entry) { - throw new UnsupportedOperationException("TagAppender.remove is not implemented in class: " + this.getClass()); - } - - /** - * Adds multiple registry entries to the tag json's remove list. Callable during datageneration. - * - * @param entries The entries to remove - * @return The builder for chaining - */ @SuppressWarnings("unchecked") - default TagAppender remove(final E first, final E...entries) { - this.remove(first); - for (E entry : entries) - this.remove(entry); - return self(); - } - - - @SuppressWarnings("unchecked") - default TagAppender addTags(TagKey... values) { + default TagAppender addTags(TagKey... values) { var builder = self(); for (TagKey value : values) { builder.addTag(value); @@ -62,25 +37,25 @@ public interface IForgeTagAppender { return builder; } - default TagAppender addOptional(Identifier location) { + default TagAppender addOptional(Identifier location) { self().getInternalBuilder().addOptionalElement(location); return self(); } @SuppressWarnings("unchecked") - default TagAppenderaddOptionalTags(TagKey... values) { + default TagAppender addOptionalTags(TagKey... values) { var builder = self(); for (var value : values) builder.addOptionalTag(value); return builder; } - default TagAppender replace() { + default TagAppender replace() { return replace(true); } - default TagAppender replace(boolean value) { - self().getInternalBuilder().replace(value); + default TagAppender replace(boolean value) { + self().getInternalBuilder().setReplace(value); return self(); } @@ -89,7 +64,7 @@ public interface IForgeTagAppender { * @param location The ID of the element to remove * @return The builder for chaining */ - default TagAppender remove(final Identifier location) { + default TagAppender remove(final Identifier location) { var builder = self(); builder.getInternalBuilder().removeElement(location, builder.getSourceName()); return builder; @@ -100,7 +75,7 @@ public interface IForgeTagAppender { * @param locations The IDs of the elements to remove * @return The builder for chaining */ - default TagAppender remove(final Identifier first, final Identifier... locations) { + default TagAppender remove(final Identifier first, final Identifier... locations) { this.remove(first); for (var location : locations) this.remove(location); @@ -113,7 +88,7 @@ public interface IForgeTagAppender { * @param resourceKey The resource key of the element to remove * @return The appender for chaining */ - default TagAppender remove(final ResourceKey resourceKey) { + default TagAppender remove(final ResourceKey resourceKey) { this.remove(resourceKey.identifier()); return self(); } @@ -123,7 +98,7 @@ public interface IForgeTagAppender { * @param tag The ID of the tag to remove * @return The builder for chaining */ - default TagAppender remove(TagKey tag) { + default TagAppender remove(TagKey tag) { var builder = self(); builder.getInternalBuilder().removeTag(tag.location(), builder.getSourceName()); return builder; @@ -135,7 +110,7 @@ public interface IForgeTagAppender { * @return The builder for chaining */ @SuppressWarnings("unchecked") - default TagAppender remove(TagKey first, TagKey...tags) { + default TagAppender remove(TagKey first, TagKey...tags) { this.remove(first); for (var tag : tags) this.remove(tag); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java index 246c8fc36f..3545074d78 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java @@ -26,7 +26,7 @@ public interface IForgeTransformation { * @see Transformation#identity() */ default boolean isIdentity() { - return self().equals(Transformation.identity()); + return self().equals(Transformation.IDENTITY); } /** @@ -89,7 +89,7 @@ public interface IForgeTransformation { */ default Transformation applyOrigin(Vector3f origin) { Transformation transform = self(); - if (transform.isIdentity()) return Transformation.identity(); + if (transform.isIdentity()) return Transformation.IDENTITY; Matrix4f ret = transform.getMatrixCopy(); Matrix4f tmp = new Matrix4f().translation(origin.x(), origin.y(), origin.z()); diff --git a/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java b/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java index 62129a0ed5..93d53ae5a4 100644 --- a/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java +++ b/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java @@ -11,10 +11,10 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.util.context.ContextKey; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStackTemplate; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import net.minecraftforge.common.ToolAction; import org.jetbrains.annotations.NotNull; @@ -27,11 +27,10 @@ public record CanToolPerformAction(ToolAction action) implements LootItemConditi public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(b -> b.group( ToolAction.CODEC.fieldOf("action").forGetter(CanToolPerformAction::action) ).apply(b, CanToolPerformAction::new)); - public static final LootItemConditionType TYPE = new LootItemConditionType(CODEC); @Override - public @NotNull LootItemConditionType getType() { - return TYPE; + public @NotNull MapCodec codec() { + return CODEC; } @Override @@ -41,8 +40,13 @@ public record CanToolPerformAction(ToolAction action) implements LootItemConditi @Override public boolean test(LootContext ctx) { - ItemStack itemstack = ctx.getOptionalParameter(LootContextParams.TOOL); - return itemstack != null && itemstack.canPerformAction(this.action); + var instance = ctx.getOptionalParameter(LootContextParams.TOOL); + ItemStack item = null; + if (instance instanceof ItemStack stack) + item = stack; + else if (instance instanceof ItemStackTemplate template) + item = template.create(); + return item != null && item.canPerformAction(this.action); } public static LootItemCondition.Builder canToolPerformAction(ToolAction action) { diff --git a/src/main/java/net/minecraftforge/common/loot/LootTableIdCondition.java b/src/main/java/net/minecraftforge/common/loot/LootTableIdCondition.java index fa757062b4..625d1688c4 100644 --- a/src/main/java/net/minecraftforge/common/loot/LootTableIdCondition.java +++ b/src/main/java/net/minecraftforge/common/loot/LootTableIdCondition.java @@ -8,7 +8,6 @@ package net.minecraftforge.common.loot; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.resources.Identifier; @@ -19,13 +18,11 @@ public record LootTableIdCondition(Identifier id) implements LootItemCondition { ).apply(b, LootTableIdCondition::new)); - // TODO Forge Registry at some point? - public static final LootItemConditionType TYPE = new LootItemConditionType(CODEC); public static final Identifier UNKNOWN_LOOT_TABLE = Identifier.fromNamespaceAndPath("forge", "unknown_loot_table"); @Override - public LootItemConditionType getType() { - return TYPE; + public MapCodec codec() { + return CODEC; } @Override diff --git a/src/main/java/net/minecraftforge/common/property/Properties.java b/src/main/java/net/minecraftforge/common/property/Properties.java index 8dfd551567..dfa87da024 100644 --- a/src/main/java/net/minecraftforge/common/property/Properties.java +++ b/src/main/java/net/minecraftforge/common/property/Properties.java @@ -5,12 +5,11 @@ package net.minecraftforge.common.property; -import net.minecraft.client.resources.model.ModelState; +import net.minecraft.client.renderer.block.dispatch.ModelState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraftforge.client.model.data.ModelProperty; -public class Properties -{ +public class Properties { /** * Property indicating if the model should be rendered in the static renderer or in the TESR. AnimationTESR sets it to false. */ diff --git a/src/main/java/net/minecraftforge/common/util/BrainBuilder.java b/src/main/java/net/minecraftforge/common/util/BrainBuilder.java index a70248b34d..096198c3f4 100644 --- a/src/main/java/net/minecraftforge/common/util/BrainBuilder.java +++ b/src/main/java/net/minecraftforge/common/util/BrainBuilder.java @@ -56,7 +56,7 @@ public class BrainBuilder { public BrainBuilder(Brain ignoredBrain) {} public Brain.Provider provider() { - return Brain.provider(this.memoryTypes, this.sensorTypes); + return Brain.provider(this.sensorTypes); } public Collection> getMemoryTypes() { @@ -110,7 +110,7 @@ public class BrainBuilder { /** You may use this as a helper method for adding a behavior to an Activity by priority to an entity's brain. */ public void addBehaviorToActivityByPriority(Integer priority, Activity activity, BehaviorControl behaviorControl) { - this.availableBehaviorsByPriority.computeIfAbsent(priority, (i) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).add(behaviorControl); + this.availableBehaviorsByPriority.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).add(behaviorControl); } /** You may use this as a helper method for adding memory requirements for an Activity to an entity's brain. */ @@ -129,12 +129,12 @@ public class BrainBuilder { @ApiStatus.Internal public void addAvailableBehaviorsByPriorityFrom(Map>>> addFrom) { - addFrom.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> this.availableBehaviorsByPriority.computeIfAbsent(priority, (p) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); + addFrom.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> this.availableBehaviorsByPriority.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); } @ApiStatus.Internal public void addAvailableBehaviorsByPriorityTo(Map>>> addTo){ - this.availableBehaviorsByPriority.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> addTo.computeIfAbsent(priority, (p) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); + this.availableBehaviorsByPriority.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> addTo.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); } @ApiStatus.Internal @@ -158,16 +158,16 @@ public class BrainBuilder { } private static void addMemoriesToEraseWhenActivityStoppedInternal(Map>> activityMemoriesToEraseWhenStopped, Activity activity, Collection> memories) { - activityMemoriesToEraseWhenStopped.computeIfAbsent(activity, (a) -> Sets.newHashSet()).addAll(memories); + activityMemoriesToEraseWhenStopped.computeIfAbsent(activity, (_) -> Sets.newHashSet()).addAll(memories); } private static void addRequirementsToActivityInternal(Map, MemoryStatus>>> activityRequirements, Activity activity, Collection, MemoryStatus>> requirements) { - activityRequirements.computeIfAbsent(activity, (a) -> Sets.newHashSet()).addAll(requirements); + activityRequirements.computeIfAbsent(activity, (_) -> Sets.newHashSet()).addAll(requirements); } @ApiStatus.Internal - public Brain makeBrain(Dynamic dynamic) { - Brain brain = Brain.provider(this.memoryTypes, this.sensorTypes).makeBrain(dynamic); + public Brain makeBrain(final E entity, final Brain.Packed packedBrain) { + Brain brain = Brain.provider(this.sensorTypes).makeBrain(entity, packedBrain); brain.copyFromBuilder(this); return brain; } diff --git a/src/main/java/net/minecraftforge/common/util/CenterChunkPosComparator.java b/src/main/java/net/minecraftforge/common/util/CenterChunkPosComparator.java index 3a7e2733fc..d8891d6dc3 100644 --- a/src/main/java/net/minecraftforge/common/util/CenterChunkPosComparator.java +++ b/src/main/java/net/minecraftforge/common/util/CenterChunkPosComparator.java @@ -9,58 +9,40 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.ChunkPos; // Sorter to load nearby chunks first -public class CenterChunkPosComparator implements java.util.Comparator -{ +public class CenterChunkPosComparator implements java.util.Comparator { private final int x; private final int z; - public CenterChunkPosComparator(ServerPlayer entityplayer) - { - x = (int) entityplayer.getX() >> 4; - z = (int) entityplayer.getZ() >> 4; + public CenterChunkPosComparator(ServerPlayer entityplayer) { + x = (int)entityplayer.getX() >> 4; + z = (int)entityplayer.getZ() >> 4; } @Override - public int compare(ChunkPos a, ChunkPos b) - { + public int compare(ChunkPos a, ChunkPos b) { if (a.equals(b)) - { return 0; - } // Subtract current position to set center point - int ax = a.x - this.x; - int az = a.z - this.z; - int bx = b.x - this.x; - int bz = b.z - this.z; + int ax = a.x() - this.x; + int az = a.z() - this.z; + int bx = b.x() - this.x; + int bz = b.z() - this.z; int result = ((ax - bx) * (ax + bx)) + ((az - bz) * (az + bz)); if (result != 0) - { return result; - } - if (ax < 0) - { + if (ax < 0) { if (bx < 0) - { return bz - az; - } else - { return -1; - } - } - else - { + } else { if (bx < 0) - { return 1; - } else - { return az - bz; - } } } } diff --git a/src/main/java/net/minecraftforge/common/util/INBTBuilder.java b/src/main/java/net/minecraftforge/common/util/INBTBuilder.java index 7584d25d4d..ddd2dd53ef 100644 --- a/src/main/java/net/minecraftforge/common/util/INBTBuilder.java +++ b/src/main/java/net/minecraftforge/common/util/INBTBuilder.java @@ -5,12 +5,10 @@ package net.minecraftforge.common.util; -import java.util.List; import java.util.UUID; import net.minecraft.core.UUIDUtil; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; public interface INBTBuilder { @@ -65,46 +63,16 @@ public interface INBTBuilder { return this; } - /** @deprecated Use {@link #putByteArray(String, byte...)} */ - @Deprecated(forRemoval = true, since = "1.21.5") - public Builder putByteArray(String key, List value) { - var array = new byte[value.size()]; - for (var i = 0; i < value.size(); i++) - array[i] = value.get(i); - - return this.putByteArray(key, array); - } - public Builder putIntArray(String key, int... value) { tag.putIntArray(key, value); return this; } - /** @deprecated Use {@link #putIntArray(String, int...)} */ - @Deprecated(forRemoval = true, since = "1.21.5") - public Builder putIntArray(String key, List value) { - var array = new int[value.size()]; - for (var i = 0; i < value.size(); i++) - array[i] = value.get(i); - - return this.putIntArray(key, array); - } - public Builder putLongArray(String key, long... value) { tag.putLongArray(key, value); return this; } - /** @deprecated Use {@link #putLongArray(String, long...)} */ - @Deprecated(forRemoval = true, since = "1.21.5") - public Builder putLongArray(String key, List value) { - var array = new long[value.size()]; - for (var i = 0; i < value.size(); i++) - array[i] = value.get(i); - - return this.putLongArray(key, array); - } - public Builder put(String key, boolean value) { tag.putBoolean(key, value); return this; diff --git a/src/main/java/net/minecraftforge/common/util/JsonUtils.java b/src/main/java/net/minecraftforge/common/util/JsonUtils.java index cbb5beabff..302e86d8e1 100644 --- a/src/main/java/net/minecraftforge/common/util/JsonUtils.java +++ b/src/main/java/net/minecraftforge/common/util/JsonUtils.java @@ -24,7 +24,6 @@ import com.google.gson.JsonSerializer; import com.google.gson.JsonSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.serialization.JsonOps; import net.minecraft.nbt.TagParser; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.GsonHelper; diff --git a/src/main/java/net/minecraftforge/common/util/LevelCapabilityData.java b/src/main/java/net/minecraftforge/common/util/LevelCapabilityData.java index ad6fa6586d..7c90f067aa 100644 --- a/src/main/java/net/minecraftforge/common/util/LevelCapabilityData.java +++ b/src/main/java/net/minecraftforge/common/util/LevelCapabilityData.java @@ -6,6 +6,7 @@ package net.minecraftforge.common.util; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.saveddata.SavedData; import net.minecraft.world.level.saveddata.SavedDataType; @@ -18,7 +19,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; public class LevelCapabilityData extends SavedData { public static SavedDataType type(ServerLevel level) { return new SavedDataType( - "capabilities", + Identifier.fromNamespaceAndPath("forge", "capabilities"), () -> new LevelCapabilityData(level), RecordCodecBuilder.create(b -> b.group( diff --git a/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java b/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java index 8020174ac0..5d47c42ba8 100644 --- a/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java +++ b/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java @@ -6,6 +6,7 @@ package net.minecraftforge.common.util; import net.minecraft.client.Minecraft; +import net.minecraft.network.PacketProcessor; import net.minecraft.server.MinecraftServer; import net.minecraft.server.TickTask; import net.minecraft.util.thread.BlockableEventLoop; @@ -20,7 +21,8 @@ import org.jetbrains.annotations.ApiStatus; public class LogicalSidedProvider { public static final LogicalSidedProvider> WORKQUEUE = new LogicalSidedProvider<>(Supplier::get, Supplier::get); - public static final LogicalSidedProvider> CLIENTWORLD = new LogicalSidedProvider<>((c)-> Optional.of(c.get().level), (s)->Optional.empty()); + public static final LogicalSidedProvider> CLIENTWORLD = new LogicalSidedProvider<>((c)-> Optional.of(c.get().level), (_)->Optional.empty()); + public static final LogicalSidedProvider PACKETS = new LogicalSidedProvider<>(client -> client.get().packetProcessor(), server -> server.get().packetProcessor()); public T get(LogicalSide side) { return side == LogicalSide.CLIENT ? clientSide.apply(client) : serverSide.apply(server); diff --git a/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java b/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java index 5cea000ae2..fdc4d70e39 100644 --- a/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java +++ b/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java @@ -60,7 +60,7 @@ public class MutableHashedLinkedMap implements Iterable> */ public MutableHashedLinkedMap(Strategy strategy) { - this(strategy, (k, v1, v2) -> v2); + this(strategy, (_, _, v2) -> v2); } /** diff --git a/src/main/java/net/minecraftforge/common/util/TransformationHelper.java b/src/main/java/net/minecraftforge/common/util/TransformationHelper.java index 45382997b0..b06bc1a23c 100644 --- a/src/main/java/net/minecraftforge/common/util/TransformationHelper.java +++ b/src/main/java/net/minecraftforge/common/util/TransformationHelper.java @@ -96,10 +96,10 @@ public final class TransformationHelper { public static Transformation slerp(Transformation one, Transformation that, float progress) { return new Transformation( - lerp(one.getTranslation(), that.getTranslation(), progress), - slerp(one.getLeftRotation(), that.getLeftRotation(), progress), - lerp(one.getScale(), that.getScale(), progress), - slerp(one.getRightRotation(), that.getRightRotation(), progress) + lerp(one.translation(), that.translation(), progress), + slerp(one.leftRotation(), that.leftRotation(), progress), + lerp(one.scale(), that.scale(), progress), + slerp(one.rightRotation(), that.rightRotation(), progress) ); } @@ -116,7 +116,7 @@ public final class TransformationHelper { if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isString()) { String transform = json.getAsString(); if (transform.equals("identity")) - return Transformation.identity(); + return Transformation.IDENTITY; throw new JsonParseException("TRSR: unknown default string: " + transform); } diff --git a/src/main/java/net/minecraftforge/common/world/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/world/ForgeChunkManager.java deleted file mode 100644 index 41878130bd..0000000000 --- a/src/main/java/net/minecraftforge/common/world/ForgeChunkManager.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.world; - -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.longs.LongSet; -import java.util.Map; -import java.util.UUID; -import net.minecraft.world.entity.Entity; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.TicketType; -import org.jetbrains.annotations.Unmodifiable; - -/** @deprecated Vanilla now handles all forced chunks using its new {@link TicketType} system. */ -@Deprecated(forRemoval = true, since = "1.21.5") -public class ForgeChunkManager { - private static T error() { - throw new UnsupportedOperationException("Mod used ForgeChnkManager when they should use vanilla's TicketType system, see Level.getChunkSource().addTicketWithRadius"); - } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - public static void setForcedChunkLoadingCallback(String modId, LoadingValidationCallback callback) { error(); } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - public static boolean hasForcedChunks(ServerLevel level) { return error(); } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - public static boolean forceChunk(ServerLevel level, String modId, BlockPos owner, int chunkX, int chunkZ, boolean add, boolean ticking) { return error(); } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - public static boolean forceChunk(ServerLevel level, String modId, Entity owner, int chunkX, int chunkZ, boolean add, boolean ticking) { return error(); } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - public static boolean forceChunk(ServerLevel level, String modId, UUID owner, int chunkX, int chunkZ, boolean add, boolean ticking) { return error(); } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - @FunctionalInterface - @Deprecated(forRemoval = true, since = "1.21.5") - public interface LoadingValidationCallback { - void validateTickets(ServerLevel level, TicketHelper ticketHelper); - } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - @Deprecated(forRemoval = true, since = "1.21.5") - public static class TicketHelper { - private TicketHelper() { } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public @Unmodifiable Map> getBlockTickets() { return error(); } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public @Unmodifiable Map> getEntityTickets() { return error(); } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public void removeAllTickets(BlockPos owner) { error(); } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public void removeAllTickets(UUID owner) { error(); } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public void removeTicket(BlockPos owner, long chunk, boolean ticking) { error(); } - /** @deprecated Use Vanilla's {@link TicketType} system */ - public void removeTicket(UUID owner, long chunk, boolean ticking) { error(); } - } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - @Deprecated(forRemoval = true, since = "1.21.5") - public static class TicketOwner implements Comparable { - private TicketOwner() { } - @Override public int compareTo(TicketOwner o) { return error(); } - } - - /** @deprecated Use Vanilla's {@link TicketType} system */ - @Deprecated(forRemoval = true, since = "1.21.5") - public static class TicketTracker { - public Map getChunks() { return error(); } - public boolean isEmpty() { return error(); } - } -} diff --git a/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java index 4356ef8353..5e62fcc7d8 100644 --- a/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java +++ b/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java @@ -76,7 +76,7 @@ public class StructureSettingsBuilder { * @param category Mob category */ public StructureSpawnOverrideBuilder getOrAddSpawnOverrides(MobCategory category) { - return spawnOverrides.computeIfAbsent(category, c -> new StructureSpawnOverrideBuilder(StructureSpawnOverride.BoundingBoxType.PIECE, Collections.emptyList())); + return spawnOverrides.computeIfAbsent(category, _ -> new StructureSpawnOverrideBuilder(StructureSpawnOverride.BoundingBoxType.PIECE, Collections.emptyList())); } /** diff --git a/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java b/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java index 5bce113110..f4ef0e774f 100644 --- a/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java +++ b/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java @@ -55,8 +55,6 @@ public final class GatherDataEvent implements IModBusEvent { public boolean includeClient() { return this.config.client; } public boolean includeDev() { return this.config.dev; } public boolean includeReports() { return this.config.reports; } - @Deprecated(forRemoval = true, since = "1.21.5") // Validation is always enabled, check things as you deem fit. - public boolean validate() { return this.config.validate; } public static final class DataGeneratorConfig { private final Set mods; @@ -67,13 +65,11 @@ public final class GatherDataEvent implements IModBusEvent { private final boolean client; private final boolean dev; private final boolean reports; - @Deprecated(forRemoval = true, since = "1.21.5") // Validation is always enabled, check things as you deem fit. - private final boolean validate; private final boolean flat; private final List generators = new ArrayList<>(); public DataGeneratorConfig(final Set mods, final Path path, final Collection inputs, final CompletableFuture lookupProvider, - final boolean server, final boolean client, final boolean dev, final boolean reports, final boolean validate, final boolean flat) { + final boolean server, final boolean client, final boolean dev, final boolean reports, final boolean flat) { this.mods = mods; this.path = path; this.inputs = inputs; @@ -82,7 +78,6 @@ public final class GatherDataEvent implements IModBusEvent { this.client = client; this.dev = dev; this.reports = reports; - this.validate = validate; this.flat = flat; } @@ -100,7 +95,7 @@ public final class GatherDataEvent implements IModBusEvent { } public DataGenerator makeGenerator(final Function pathEnhancer, final boolean shouldExecute) { - final DataGenerator generator = new DataGenerator(pathEnhancer.apply(path), DetectedVersion.tryDetectVersion(), shouldExecute); + final DataGenerator generator = new DataGenerator.Cached(pathEnhancer.apply(path), DetectedVersion.tryDetectVersion(), shouldExecute); if (shouldExecute) generators.add(generator); return generator; @@ -112,7 +107,7 @@ public final class GatherDataEvent implements IModBusEvent { paths.values().forEach(LamdbaExceptionUtils.rethrowConsumer(lst -> { DataGenerator parent = lst.get(0); for (int x = 1; x < lst.size(); x++) - lst.get(x).getProvidersView().forEach((name, provider) -> parent.addProvider(true, provider)); + lst.get(x).getProvidersView().forEach((_, provider) -> parent.addProvider(true, provider)); parent.run(); })); } diff --git a/src/main/java/net/minecraftforge/data/loading/DatagenModLoader.java b/src/main/java/net/minecraftforge/data/loading/DatagenModLoader.java index 59fd4b538e..65c3173adc 100644 --- a/src/main/java/net/minecraftforge/data/loading/DatagenModLoader.java +++ b/src/main/java/net/minecraftforge/data/loading/DatagenModLoader.java @@ -29,7 +29,7 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.OptionSpec; -public class DatagenModLoader { +public final class DatagenModLoader { private static final Logger LOGGER = LogManager.getLogger(); private static ExistingFileHelper existingFileHelper; private static boolean runningDataGen; @@ -71,7 +71,7 @@ public class DatagenModLoader { public boolean run( OptionSet options, Path output, Collection inputs, - boolean genServer, boolean genClient, boolean genDev, boolean genReports, boolean validate + boolean genServer, boolean genClient, boolean genDev, boolean genReports ) { var existingPacks = options.valuesOf(this.existing).stream().map(Paths::get).toList(); var existingMods = new HashSet<>(options.valuesOf(this.existingMod)); @@ -90,7 +90,7 @@ public class DatagenModLoader { Bootstrap.bootStrap(); if (genClient) ClientBootstrap.bootstrap(); - ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); + ModLoader.gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); var lookupProvider = CompletableFuture.supplyAsync(VanillaRegistries::createLookup, Util.backgroundExecutor()); var mods = new HashSet(); @@ -99,7 +99,7 @@ public class DatagenModLoader { mods.add(pattern); var m = Pattern.compile('^' + pattern + '$'); - ModList.get().forEachModInOrder(mc -> { + ModList.forEachModInOrder(mc -> { var id = mc.getModId(); if (!"forge".equals(id) && !"minecraft".equals(id) && m.matcher(id).matches()) mods.add(id); @@ -108,14 +108,14 @@ public class DatagenModLoader { LOGGER.info("Initializing Data Gatherer for mods {}", mods); var config = new GatherDataEvent.DataGeneratorConfig(mods, output, inputs, lookupProvider, genServer, - genClient, genDev, genReports, validate, flat); + genClient, genDev, genReports, flat); if (!mods.contains("forge")) { // If we aren't generating data for forge, automatically add forge as an existing so mods can access forge's data existingMods.add("forge"); } - existingFileHelper = new ExistingFileHelper(existingPacks, existingMods, validate, assetIndex, assetsDir); + existingFileHelper = new ExistingFileHelper(existingPacks, existingMods, assetIndex, assetsDir); ModLoader.runEventGenerator(mc -> new GatherDataEvent( mc, config.makeGenerator( diff --git a/src/main/java/net/minecraftforge/event/AddPackFindersEvent.java b/src/main/java/net/minecraftforge/event/AddPackFindersEvent.java index 124b2dc3f6..565593d123 100644 --- a/src/main/java/net/minecraftforge/event/AddPackFindersEvent.java +++ b/src/main/java/net/minecraftforge/event/AddPackFindersEvent.java @@ -8,10 +8,8 @@ package net.minecraftforge.event; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.server.packs.repository.RepositorySource; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.RecordEvent; -import net.minecraftforge.fml.event.IModBusEvent; import java.util.function.Consumer; @@ -23,12 +21,6 @@ import java.util.function.Consumer; public record AddPackFindersEvent(PackType getPackType, Consumer sourceAdder) implements RecordEvent { public static final EventBus BUS = EventBus.create(AddPackFindersEvent.class); - /** @deprecated {@link AddPackFindersEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - /** * Adds a new source to the list of pack finders. * diff --git a/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java b/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java index bf099cda38..ee93168dd4 100644 --- a/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java +++ b/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java @@ -41,11 +41,12 @@ public final class AddReloadListenerEvent extends MutableEvent { * @param listener the listener to add to the ResourceManager on reload */ public void addListener(PreparableReloadListener listener) { - listeners.add(new WrappedStateAwareListener(listener)); + listeners.add(new WrappedStateAwareListener(listener)); } public List getListeners() { - return List.copyOf(listeners); + if (listeners.isEmpty()) return List.of(); + return List.copyOf(listeners); } /** diff --git a/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java b/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java index 9608ef35e3..1036aa1a62 100644 --- a/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java +++ b/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java @@ -11,11 +11,9 @@ 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.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.RecordEvent; import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -39,12 +37,6 @@ public record BuildCreativeModeTabContentsEvent( ) implements RecordEvent, CreativeModeTab.Output { public static final EventBus BUS = EventBus.create(BuildCreativeModeTabContentsEvent.class); - /** @deprecated {@link BuildCreativeModeTabContentsEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - @ApiStatus.Internal public BuildCreativeModeTabContentsEvent {} diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 12a1374f79..e1cf718988 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -6,6 +6,7 @@ package net.minecraftforge.event; import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; @@ -20,16 +21,13 @@ import net.minecraft.core.component.DataComponentMap; import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.*; import net.minecraft.world.item.Item; +import net.minecraft.world.item.component.TooltipDisplay; import net.minecraft.world.level.chunk.storage.SerializableChunkData; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Result; -import net.minecraftforge.fml.ModLoader; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; -import com.mojang.authlib.GameProfile; import com.mojang.brigadier.CommandDispatcher; import net.minecraft.advancements.AdvancementHolder; @@ -76,7 +74,6 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.zombie.Zombie; import net.minecraft.world.entity.npc.villager.AbstractVillager; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownEnderpearl; import net.minecraft.world.flag.FeatureFlagSet; @@ -107,11 +104,9 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gamerules.GameRules; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.portal.PortalShape; -import net.minecraft.world.level.storage.PlayerDataStorage; import net.minecraft.world.level.storage.ServerLevelData; import net.minecraft.world.level.storage.ValueInput; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ToolAction; @@ -133,7 +128,6 @@ import net.minecraftforge.event.entity.EntityTravelToDimensionEvent; import net.minecraftforge.event.entity.ProjectileImpactEvent; import net.minecraftforge.event.entity.item.ItemExpireEvent; import net.minecraftforge.event.entity.living.AnimalTameEvent; -import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingBreatheEvent; import net.minecraftforge.event.entity.living.LivingChangeTargetEvent; @@ -168,7 +162,6 @@ import net.minecraftforge.event.entity.player.ArrowNockEvent; import net.minecraftforge.event.entity.player.BonemealEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.FillBucketEvent; -import net.minecraftforge.event.entity.player.ItemFishedEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PermissionsChangedEvent; import net.minecraftforge.event.entity.player.PlayerContainerEvent; @@ -199,7 +192,7 @@ import net.minecraftforge.event.level.ExplosionEvent; import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.event.level.NoteBlockEvent; import net.minecraftforge.event.level.PistonEvent; -import net.minecraftforge.event.level.SaplingGrowTreeEvent; +import net.minecraftforge.event.level.BlockFeatureGrowEvent; import net.minecraftforge.event.level.SleepFinishedTimeEvent; import net.minecraftforge.event.network.ChannelRegistrationChangeEvent; import net.minecraftforge.event.network.ConnectionStartEvent; @@ -362,8 +355,8 @@ public final class ForgeEventFactory { return BlockEvent.FluidPlaceBlockEvent.BUS.fire(new BlockEvent.FluidPlaceBlockEvent(level, pos, liquidPos, state)).getNewState(); } - public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable Player entityPlayer, List list, TooltipFlag flags) { - return ItemTooltipEvent.BUS.fire(new ItemTooltipEvent(itemStack, entityPlayer, list, flags)); + public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable Player entityPlayer, List list, TooltipFlag flags, Item.TooltipContext context, TooltipDisplay display) { + return ItemTooltipEvent.BUS.fire(new ItemTooltipEvent(itemStack, entityPlayer, list, flags, context, display)); } public static SummonAidEvent fireZombieSummonAid(Zombie zombie, Level level, int x, int y, int z, LivingEntity attacker, double summonChance) { @@ -500,7 +493,7 @@ public final class ForgeEventFactory { PlayerWakeUpEvent.BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateLevel)); } - public static void onPlayerFall(Player player, float distance, float multiplier) { + public static void onPlayerFall(Player player, double distance, float multiplier) { PlayerFlyableFallEvent.BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier)); } @@ -593,7 +586,7 @@ public final class ForgeEventFactory { var canContinueSleep = evt.getResult(); if (canContinueSleep == Result.DEFAULT) - return !rule.canSleep(player.level()); + return rule.canSleep(player.level()); else return canContinueSleep == Result.ALLOW; } @@ -652,8 +645,8 @@ public final class ForgeEventFactory { } @SuppressWarnings("removal") - public static SaplingGrowTreeEvent blockGrowFeature(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> holder) { - return SaplingGrowTreeEvent.BUS.fire(new SaplingGrowTreeEvent(level, randomSource, pos, holder)); + public static BlockFeatureGrowEvent blockGrowFeature(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> holder) { + return BlockFeatureGrowEvent.BUS.fire(new BlockFeatureGrowEvent(level, randomSource, pos, holder)); } public static BlockState alterGround(LevelSimulatedReader level, RandomSource random, BlockPos pos, BlockState altered) { @@ -685,8 +678,13 @@ public final class ForgeEventFactory { return SleepFinishedTimeEvent.BUS.fire(new SleepFinishedTimeEvent(level, newTime, minTime)).getNewTime(); } - public static List onResourceReload(ReloadableServerResources serverResources, HolderLookup.Provider lookupProvider) { - return AddReloadListenerEvent.BUS.fire(new AddReloadListenerEvent(serverResources, lookupProvider)).getListeners(); + public static List onResourceReload(ReloadableServerResources serverResources, HolderLookup.Provider lookupProvider, List vanilla) { + var modded = AddReloadListenerEvent.BUS.fire(new AddReloadListenerEvent(serverResources, lookupProvider)).getListeners(); + if (modded.isEmpty()) + return vanilla; + var ret = new ArrayList(vanilla); + ret.addAll(modded); + return ret; } public static void onCommandRegister(CommandDispatcher dispatcher, Commands.CommandSelection environment, CommandBuildContext context) { diff --git a/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java b/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java index 1cb7823e49..54d8f1342a 100644 --- a/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java +++ b/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java @@ -7,8 +7,6 @@ package net.minecraftforge.event; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; -import net.minecraft.core.component.DataComponents; -import net.minecraft.world.item.Item; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; import net.minecraftforge.eventbus.api.event.MutableEvent; diff --git a/src/main/java/net/minecraftforge/event/ModMismatchEvent.java b/src/main/java/net/minecraftforge/event/ModMismatchEvent.java index de10556d6c..23c79b742c 100644 --- a/src/main/java/net/minecraftforge/event/ModMismatchEvent.java +++ b/src/main/java/net/minecraftforge/event/ModMismatchEvent.java @@ -64,7 +64,7 @@ public final class ModMismatchEvent implements IModBusEvent { this.levelDirectory = levelDirectory; this.resolved = new HashMap<>(previousVersions.size()); this.versionDifferences = new HashMap<>(); - previousVersions.forEach((modId, version) -> versionDifferences.put(modId, new MismatchedVersionInfo(version, ModList.get() + previousVersions.forEach((modId, version) -> versionDifferences.put(modId, new MismatchedVersionInfo(version, ModList .getModContainerById(modId) .map(ModContainer::getModInfo) .map(IModInfo::getVersion) @@ -106,7 +106,7 @@ public final class ModMismatchEvent implements IModBusEvent { * Marks the mod version mismatch as having been resolved safely by the current mod. */ public void markResolved(String modId) { - final var resolvedBy = ModLoadingContext.get().getActiveContainer(); + final var resolvedBy = ModLoadingContext.get().getContainer(); resolved.putIfAbsent(modId, resolvedBy); } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityAttributeCreationEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityAttributeCreationEvent.java index 7b38115877..0390b9e2a7 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityAttributeCreationEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityAttributeCreationEvent.java @@ -11,10 +11,8 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.DefaultAttributes; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; -import net.minecraftforge.fml.event.IModBusEvent; /** * EntityAttributeCreationEvent.
@@ -24,12 +22,6 @@ import net.minecraftforge.fml.event.IModBusEvent; public final class EntityAttributeCreationEvent extends MutableEvent { public static final EventBus BUS = EventBus.create(EntityAttributeCreationEvent.class); - /** @deprecated {@link EntityAttributeCreationEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, AttributeSupplier> map; public EntityAttributeCreationEvent(Map, AttributeSupplier> map) { diff --git a/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java index 15b0f02b56..bb60c18578 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java @@ -11,10 +11,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.DefaultAttributes; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; -import net.minecraftforge.fml.event.IModBusEvent; import net.minecraftforge.registries.ForgeRegistries; import java.util.List; @@ -28,12 +26,6 @@ import java.util.Map; public final class EntityAttributeModificationEvent extends MutableEvent { public static final EventBus BUS = EventBus.create(EntityAttributeModificationEvent.class); - /** @deprecated {@link EntityAttributeModificationEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, AttributeSupplier.Builder> entityAttributes; private final List> entityTypes; @@ -49,7 +41,7 @@ public final class EntityAttributeModificationEvent extends MutableEvent { } public void add(EntityType entityType, Holder attribute, double value) { - var attributes = entityAttributes.computeIfAbsent(entityType, (type) -> new AttributeSupplier.Builder()); + var attributes = entityAttributes.computeIfAbsent(entityType, (_) -> new AttributeSupplier.Builder()); attributes.add(attribute, value); } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java index 495b8fcb3b..205e9475e0 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java @@ -11,7 +11,6 @@ import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownEnder import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; import net.minecraftforge.eventbus.api.event.characteristic.Cancellable; diff --git a/src/main/java/net/minecraftforge/event/entity/SpawnPlacementRegisterEvent.java b/src/main/java/net/minecraftforge/event/entity/SpawnPlacementRegisterEvent.java index 5c16aca80b..ae84057fc3 100644 --- a/src/main/java/net/minecraftforge/event/entity/SpawnPlacementRegisterEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/SpawnPlacementRegisterEvent.java @@ -16,11 +16,9 @@ import net.minecraft.world.entity.SpawnPlacementType; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.listener.Priority; -import net.minecraftforge.fml.event.IModBusEvent; import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; @@ -42,12 +40,6 @@ import org.jetbrains.annotations.ApiStatus; public final class SpawnPlacementRegisterEvent extends MutableEvent { public static final EventBus BUS = EventBus.create(SpawnPlacementRegisterEvent.class); - /** @deprecated {@link SpawnPlacementRegisterEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final Map, MergedSpawnPredicate> map; @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java index 204d9cc808..faa36fba87 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java @@ -8,12 +8,15 @@ package net.minecraftforge.event.entity.player; import java.util.List; import net.minecraft.client.Minecraft; +import net.minecraft.world.item.Item; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.Component; +import net.minecraft.world.item.component.TooltipDisplay; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,17 +28,40 @@ public final class ItemTooltipEvent extends MutableEvent implements PlayerEvent @NotNull private final ItemStack itemStack; private final List toolTip; + private final Item.TooltipContext context; + private final TooltipDisplay display; /** - * This event is fired in {@link ItemStack#getTooltipLines(Player, TooltipFlag)}, which in turn is called from its respective GUIContainer. + * + * This event is fired in {@link ItemStack#getTooltipLines(Item.TooltipContext, Player, TooltipFlag)}, which in turn is called from its respective GUIContainer. * Tooltips are also gathered with a null player during startup by {@link Minecraft#createSearchTrees()}. */ - public ItemTooltipEvent(@NotNull ItemStack itemStack, @Nullable Player player, List list, TooltipFlag flags) + @ApiStatus.Internal + public ItemTooltipEvent(@NotNull ItemStack itemStack, @Nullable Player player, List list, TooltipFlag flags, Item.TooltipContext context, TooltipDisplay display) { this.player = player; this.itemStack = itemStack; this.toolTip = list; this.flags = flags; + this.context = context; + this.display = display; + } + + + /** + * The {@link net.minecraft.world.item.Item.TooltipContext} for this tooltip. + */ + public Item.TooltipContext getContext() + { + return context; + } + + /** + * The {@link net.minecraft.world.item.component.TooltipDisplay} for this tooltip. + */ + public TooltipDisplay getDisplay() + { + return display; } /** diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java index 2b7a48e90f..578742a108 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java @@ -12,17 +12,16 @@ import org.jspecify.annotations.NullMarked; /** * Occurs when a player falls, but is able to fly. Doesn't need to be cancelable, this is mainly for notification purposes. - * @author Mithion */ @NullMarked public final class PlayerFlyableFallEvent extends MutableEvent implements PlayerEvent { public static final EventBus BUS = EventBus.create(PlayerFlyableFallEvent.class); private final Player player; - private float distance; + private double distance; private float multiplier; - public PlayerFlyableFallEvent(Player player, float distance, float multiplier) { + public PlayerFlyableFallEvent(Player player, double distance, float multiplier) { this.player = player; this.distance = distance; this.multiplier = multiplier; @@ -33,7 +32,7 @@ public final class PlayerFlyableFallEvent extends MutableEvent implements Player return player; } - public float getDistance() { return distance;} + public double getDistance() { return distance;} public void setDistance(float distance) { this.distance = distance; } public float getMultiplier() { return multiplier; } public void setMultiplier(float multiplier) { this.multiplier = multiplier; } 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 00bc8bb10a..a75afa4cd2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -7,7 +7,6 @@ package net.minecraftforge.event.entity.player; import com.google.common.base.Preconditions; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -101,34 +100,6 @@ public sealed abstract class PlayerInteractEvent implements PlayerEvent, Inherit } } - /** - * This event is fired on both sides when the player right clicks an entity. - * It is responsible for all general entity interactions. - * - * This event is fired only if the result of the above {@link EntityInteractSpecific} is not {@link InteractionResult#SUCCESS}. - * This event's state affects whether {@link Entity#interact(Player, InteractionHand)} and - * {@link Item#interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand)} are called. - * - * Let result be {@link InteractionResult#SUCCESS} if {@link Entity#interact(Player, InteractionHand)} or - * {@link Item#interactLivingEntity(ItemStack, Player, LivingEntity, InteractionHand)} return true, - * or {@link #cancellationResult} if the event is cancelled. - * If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then try {@link RightClickItem}. - */ - public static final class EntityInteract extends PlayerInteractEvent implements Cancellable { - public static final CancellableEventBus BUS = CancellableEventBus.create(EntityInteract.class); - - private final Entity target; - - public EntityInteract(Player player, InteractionHand hand, Entity target) { - super(player, hand, target.blockPosition(), null); - this.target = target; - } - - public Entity getTarget() { - return target; - } - } - /** * This event is fired on both sides whenever the player right clicks while targeting a block.
* This event controls which of {@link Item#onItemUseFirst}, {@link Block#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)}, diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java index 193db7b4f7..f621059db6 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java @@ -5,11 +5,8 @@ package net.minecraftforge.event.entity.player; -import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.core.BlockPos; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.eventbus.api.event.characteristic.Cancellable; @@ -26,26 +23,9 @@ public final class PlayerSetSpawnEvent extends MutableEvent implements Cancellab private final Player player; private final @Nullable ServerPlayer.RespawnConfig config; - @Deprecated(forRemoval = true, since = "1.21.5") - private final ResourceKey spawnLevel; - @Deprecated(forRemoval = true, since = "1.21.5") - private final boolean forced; - @Deprecated(forRemoval = true, since = "1.21.5") - private final @Nullable BlockPos newSpawn; - public PlayerSetSpawnEvent(ServerPlayer player, @Nullable ServerPlayer.RespawnConfig config) { this.player = player; this.config = config; - - if (config == null) { - this.forced = false; - this.spawnLevel = Level.OVERWORLD; - this.newSpawn = null; - } else { - this.forced = config.forced(); - this.spawnLevel = config.respawnData().dimension(); - this.newSpawn = config.respawnData().pos(); - } } @Override @@ -57,31 +37,4 @@ public final class PlayerSetSpawnEvent extends MutableEvent implements Cancellab public @Nullable ServerPlayer.RespawnConfig getConfig() { return this.config; } - - /** - * @return If the new spawn point is forced - * @deprecated Use {@link ServerPlayer.RespawnConfig#forced()} via {@link #getConfig()} - */ - @Deprecated(forRemoval = true, since = "1.21.5") - public boolean isForced() { - return this.forced; - } - - /** - * @return The new spawn position, or {@code null} if the spawn position is being reset - * @deprecated Use {@link ServerPlayer.RespawnConfig#pos()} via {@link #getConfig()} - */ - @Deprecated(forRemoval = true, since = "1.21.5") - public @Nullable BlockPos getNewSpawn() { - return this.newSpawn; - } - - /** - * @return The new spawn dimension, defaulting to {@link Level#OVERWORLD} if it is {@code null} - * @deprecated Use {@link ServerPlayer.RespawnConfig#dimension()} via {@link #getConfig()} - */ - @Deprecated(forRemoval = true, since = "1.21.5") - public ResourceKey getSpawnLevel() { - return this.spawnLevel; - } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java b/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java index 94b7c520ec..60c941005e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java @@ -7,7 +7,6 @@ package net.minecraftforge.event.entity.player; import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; import net.minecraftforge.common.util.HasResult; import net.minecraftforge.common.util.Result; import net.minecraftforge.eventbus.api.bus.EventBus; @@ -22,7 +21,7 @@ import java.util.Optional; * This event has a result. {@link HasResult}
* * setResult(ALLOW) informs game that player can sleep at this time.
- * setResult(DEFAULT) causes game to check !{@link Level#isDay()} instead. + * setResult(DEFAULT) causes game to check {@link net.minecraft.world.attribute.BedRule#canSleep()} instead. */ public final class SleepingTimeCheckEvent extends MutableEvent implements PlayerEvent, HasResult { public static final EventBus BUS = EventBus.create(SleepingTimeCheckEvent.class); diff --git a/src/main/java/net/minecraftforge/event/level/BlockEvent.java b/src/main/java/net/minecraftforge/event/level/BlockEvent.java index 50ffcc8392..b2394776b9 100644 --- a/src/main/java/net/minecraftforge/event/level/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/level/BlockEvent.java @@ -80,7 +80,7 @@ public sealed interface BlockEvent int fortuneLevel = EnchantmentHelper.getItemEnchantmentLevel(lookup.getOrThrow(Enchantments.FORTUNE), player.getMainHandItem()); int silkTouchLevel = EnchantmentHelper.getItemEnchantmentLevel(lookup.getOrThrow(Enchantments.SILK_TOUCH), player.getMainHandItem()); - this.exp = state.getExpDrop(level, level.random, pos, fortuneLevel, silkTouchLevel); + this.exp = state.getExpDrop(level, level.getRandom(), pos, fortuneLevel, silkTouchLevel); } } diff --git a/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/level/BlockFeatureGrowEvent.java similarity index 87% rename from src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java rename to src/main/java/net/minecraftforge/event/level/BlockFeatureGrowEvent.java index 25a3398a00..3cf96ac609 100644 --- a/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/level/BlockFeatureGrowEvent.java @@ -30,10 +30,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: Rename to BlockFeatureGrowEvent in 1.20 -@Deprecated(forRemoval = true, since = "1.21.1") // Dont remove, rename -public final class SaplingGrowTreeEvent implements LevelEvent, HasResult { - public static final EventBus BUS = EventBus.create(SaplingGrowTreeEvent.class); +public final class BlockFeatureGrowEvent implements LevelEvent, HasResult { + public static final EventBus BUS = EventBus.create(BlockFeatureGrowEvent.class); private final LevelAccessor level; private final RandomSource randomSource; @@ -42,7 +40,7 @@ public final class SaplingGrowTreeEvent implements LevelEvent, HasResult { private Holder> feature; private Result result = Result.DEFAULT; - public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> feature) { + public BlockFeatureGrowEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> feature) { this.level = level; this.randomSource = randomSource; this.pos = pos; diff --git a/src/main/java/net/minecraftforge/event/level/LevelEvent.java b/src/main/java/net/minecraftforge/event/level/LevelEvent.java index 2197622234..b8340ce4bf 100644 --- a/src/main/java/net/minecraftforge/event/level/LevelEvent.java +++ b/src/main/java/net/minecraftforge/event/level/LevelEvent.java @@ -40,7 +40,7 @@ import org.jspecify.annotations.NullMarked; @NullMarked public sealed interface LevelEvent extends InheritableEvent permits ChunkEvent, LevelEvent.CreateSpawnPosition, LevelEvent.Load, LevelEvent.PotentialSpawns, LevelEvent.Save, - LevelEvent.Unload, SaplingGrowTreeEvent, SleepFinishedTimeEvent { + LevelEvent.Unload, BlockFeatureGrowEvent, SleepFinishedTimeEvent { EventBus BUS = EventBus.create(LevelEvent.class); /** diff --git a/src/main/java/net/minecraftforge/event/village/VillagerTradesEvent.java b/src/main/java/net/minecraftforge/event/village/VillagerTradesEvent.java deleted file mode 100644 index 696fa748e1..0000000000 --- a/src/main/java/net/minecraftforge/event/village/VillagerTradesEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.village; - -import java.util.List; - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.entity.npc.villager.VillagerData; -import net.minecraft.world.entity.npc.villager.VillagerProfession; -import net.minecraft.world.entity.npc.villager.VillagerTrades.ItemListing; -import net.minecraftforge.event.server.ServerAboutToStartEvent; -import net.minecraftforge.eventbus.api.bus.EventBus; -import net.minecraftforge.eventbus.api.event.RecordEvent; -import org.jspecify.annotations.NullMarked; - -/** - * VillagerTradesEvent is fired during the {@link ServerAboutToStartEvent}. It is used to gather the trade lists for each profession. - *

It is fired once for each registered villager profession.

- *

Villagers pick two trades from their trade map, based on their level.

- *

Villager level is increased by successful trades.

- *

The map is populated for levels 1-5 (inclusive), so getting a value will never return null for those keys.

- *

Levels outside of this range do nothing, as specified by {@link VillagerData#canLevelUp(int)} which is called before attempting to level up.

- *

To add trades to the merchant, simply add new trades to the list.

- */ -@NullMarked -public record VillagerTradesEvent( - Int2ObjectMap> getTrades, - ResourceKey getType -) implements RecordEvent { - public static final EventBus BUS = EventBus.create(VillagerTradesEvent.class); -} diff --git a/src/main/java/net/minecraftforge/event/village/WandererTradesEvent.java b/src/main/java/net/minecraftforge/event/village/WandererTradesEvent.java deleted file mode 100644 index b90983ec71..0000000000 --- a/src/main/java/net/minecraftforge/event/village/WandererTradesEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.village; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import net.minecraftforge.eventbus.api.bus.EventBus; -import net.minecraftforge.eventbus.api.event.InheritableEvent; -import net.minecraftforge.eventbus.api.event.MutableEvent; -import org.apache.commons.lang3.tuple.Pair; - -import net.minecraft.util.Util; -import net.minecraft.world.entity.npc.villager.VillagerTrades.ItemListing; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.server.ServerAboutToStartEvent; - -/** - * WandererTradesEvent is fired during the {@link ServerAboutToStartEvent}. It is used to gather the trade lists for the wandering merchant. - * It is fired on the {@link MinecraftForge#EVENT_BUS}. - * The wandering merchant picks {@link Pool#rolls} from each {@link Pool} - * To add trades to the merchant, simply add new trades to the list. {@link BasicItemListing} provides a default implementation. -*/ -public class WandererTradesEvent extends MutableEvent implements InheritableEvent { - public static final EventBus BUS = EventBus.create(WandererTradesEvent.class); - - protected List pools; - - public WandererTradesEvent(List> pools) { - this.pools = pools.stream().map(Pool::new).collect(Util.toMutableList()); - } - - public List getPools() { - return pools; - } - - public static class Pool { - private int rolls; - private final List entries; - - public Pool(Pair data) { - this(Arrays.asList(data.getLeft()), data.getRight()); - } - - public Pool(List entries, int rolls) { - this.rolls = rolls; - this.entries = new ArrayList<>(entries); - } - - public int getRolls() { - return this.rolls; - } - - public void setRolls(int value) { - this.rolls = value; - } - - public List getEntries() { - return this.entries; - } - } -} diff --git a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java index 071068ad1b..51f59dcc55 100644 --- a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java @@ -9,7 +9,6 @@ import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.core.dispenser.BlockSource; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.DispenserBlockEntity; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.core.BlockPos; diff --git a/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java index ed23c0ce8c..889182e6cc 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java @@ -44,7 +44,7 @@ public final class FluidInteractionRegistry */ public static synchronized void addInteraction(FluidType source, InteractionInformation interaction) { - INTERACTIONS.computeIfAbsent(source, s -> new ArrayList<>()).add(interaction); + INTERACTIONS.computeIfAbsent(source, _ -> new ArrayList<>()).add(interaction); } /** @@ -86,7 +86,7 @@ public final class FluidInteractionRegistry // Lava + Soul Soil (Below) + Blue Ice = Basalt addInteraction(ForgeMod.LAVA_TYPE.get(), new InteractionInformation( - (level, currentPos, relativePos, currentState) -> level.getBlockState(currentPos.below()).is(Blocks.SOUL_SOIL) && level.getBlockState(relativePos).is(Blocks.BLUE_ICE), + (level, currentPos, relativePos, _) -> level.getBlockState(currentPos.below()).is(Blocks.SOUL_SOIL) && level.getBlockState(relativePos).is(Blocks.BLUE_ICE), Blocks.BASALT.defaultBlockState() )); } @@ -109,7 +109,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(FluidType type, BlockState state) { - this(type, fluidState -> state); + this(type, _ -> state); } /** @@ -120,7 +120,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(HasFluidInteraction predicate, BlockState state) { - this(predicate, fluidState -> state); + this(predicate, _ -> state); } /** @@ -132,7 +132,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(FluidType type, Function getState) { - this((level, currentPos, relativePos, currentState) -> level.getFluidState(relativePos).getFluidType() == type, getState); + this((level, _, relativePos, _) -> level.getFluidState(relativePos).getFluidType() == type, getState); } /** @@ -143,7 +143,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(HasFluidInteraction predicate, Function getState) { - this(predicate, (level, currentPos, relativePos, currentState) -> + this(predicate, (level, currentPos, _, currentState) -> { level.setBlockAndUpdate(currentPos, ForgeEventFactory.fireFluidPlaceBlockEvent(level, currentPos, currentPos, getState.apply(currentState))); level.levelEvent(1501, currentPos, 0); diff --git a/src/main/java/net/minecraftforge/fluids/FluidType.java b/src/main/java/net/minecraftforge/fluids/FluidType.java index d10891e26c..6ed4881ee5 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidType.java +++ b/src/main/java/net/minecraftforge/fluids/FluidType.java @@ -24,7 +24,6 @@ import net.minecraft.world.entity.vehicle.boat.AbstractBoat; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; -import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; @@ -499,7 +498,7 @@ public class FluidType { * @param pos the position of the fluid * @return the light level emitted by the fluid */ - public int getLightLevel(FluidState state, BlockAndTintGetter getter, BlockPos pos) { + public int getLightLevel(FluidState state, LevelReader getter, BlockPos pos) { return this.getLightLevel(); } @@ -515,7 +514,7 @@ public class FluidType { * @param pos the position of the fluid * @return the density of the fluid */ - public int getDensity(FluidState state, BlockAndTintGetter getter, BlockPos pos) { + public int getDensity(FluidState state, LevelReader getter, BlockPos pos) { return this.getDensity(); } @@ -531,7 +530,7 @@ public class FluidType { * @param pos the position of the fluid * @return the temperature of the fluid */ - public int getTemperature(FluidState state, BlockAndTintGetter getter, BlockPos pos) { + public int getTemperature(FluidState state, LevelReader getter, BlockPos pos) { return this.getTemperature(); } @@ -548,7 +547,7 @@ public class FluidType { * @param pos the position of the fluid * @return the viscosity of the fluid */ - public int getViscosity(FluidState state, BlockAndTintGetter getter, BlockPos pos) { + public int getViscosity(FluidState state, LevelReader getter, BlockPos pos) { return this.getViscosity(); } @@ -717,7 +716,7 @@ public class FluidType { * @param state the state of the fluid * @return the {@link BlockState} of a fluid */ - public BlockState getBlockForFluidState(BlockAndTintGetter getter, BlockPos pos, FluidState state) { + public BlockState getBlockForFluidState(LevelReader getter, BlockPos pos, FluidState state) { return state.createLegacyBlock(); } @@ -730,7 +729,7 @@ public class FluidType { * @param stack the stack holding the fluid * @return the {@link FluidState} being placed */ - public FluidState getStateForPlacement(BlockAndTintGetter getter, BlockPos pos, FluidStack stack) { + public FluidState getStateForPlacement(LevelReader getter, BlockPos pos, FluidStack stack) { return stack.getFluid().defaultFluidState(); } @@ -742,7 +741,7 @@ public class FluidType { * @param state the state of the fluid being placed * @return {@code true} if the fluid can be placed, {@code false} otherwise */ - public final boolean canBePlacedInLevel(BlockAndTintGetter getter, BlockPos pos, FluidState state) { + public final boolean canBePlacedInLevel(LevelReader getter, BlockPos pos, FluidState state) { return !this.getBlockForFluidState(getter, pos, state).isAir(); } @@ -754,7 +753,7 @@ public class FluidType { * @param stack the stack holding the fluid * @return {@code true} if the fluid can be placed, {@code false} otherwise */ - public final boolean canBePlacedInLevel(BlockAndTintGetter getter, BlockPos pos, FluidStack stack) { + public final boolean canBePlacedInLevel(LevelReader getter, BlockPos pos, FluidStack stack) { return this.canBePlacedInLevel(getter, pos, this.getStateForPlacement(getter, pos, stack)); } @@ -807,7 +806,7 @@ public class FluidType { */ public void onVaporize(@Nullable LivingEntity entity, Level level, BlockPos pos, FluidStack stack) { SoundEvent sound = this.getSound(entity, level, pos, SoundActions.FLUID_VAPORIZE); - level.playSound(entity, pos, sound != null ? sound : SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.8F); + level.playSound(entity, pos, sound != null ? sound : SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (level.getRandom().nextFloat() - level.getRandom().nextFloat()) * 0.8F); for (int l = 0; l < 8; ++l) level.addAlwaysVisibleParticle(ParticleTypes.LARGE_SMOKE, (double) pos.getX() + Math.random(), (double) pos.getY() + Math.random(), (double) pos.getZ() + Math.random(), 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java index ae4057b339..6691466196 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java @@ -25,7 +25,7 @@ public class FluidTank implements IFluidHandler, IFluidTank { protected int capacity; public FluidTank(int capacity) { - this(capacity, e -> true); + this(capacity, _ -> true); } public FluidTank(int capacity, Predicate validator) { diff --git a/src/main/java/net/minecraftforge/fml/core/ModStateProvider.java b/src/main/java/net/minecraftforge/fml/core/ModStateProvider.java index 22928054f9..a8bc157a04 100644 --- a/src/main/java/net/minecraftforge/fml/core/ModStateProvider.java +++ b/src/main/java/net/minecraftforge/fml/core/ModStateProvider.java @@ -6,10 +6,10 @@ package net.minecraftforge.fml.core; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.fml.IModLoadingState; import net.minecraftforge.fml.IModStateProvider; import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingPhase; import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.ModLoadingState; @@ -55,7 +55,7 @@ public class ModStateProvider implements IModStateProvider { */ public static final ModLoadingState CONSTRUCT = ModLoadingState.of("CONSTRUCT", ModLoadingPhase.GATHER) .after(VALIDATE) - .message(ml -> "Constructing %d mods".formatted(ml.size())) + .message(() -> "Constructing %d mods".formatted(ModList.size())) .withTransition(new ParallelTransition(ModLoadingStage.CONSTRUCT, FMLConstructModEvent::new)); /** @@ -63,9 +63,9 @@ public class ModStateProvider implements IModStateProvider { * {@linkplain Dist#CLIENT client-side} mod configurations. */ public static final ModLoadingState CONFIG_LOAD = ModLoadingState.of("CONFIG_LOAD", ModLoadingPhase.LOAD) - .withInline(ml -> { - if (FMLEnvironment.dist.isClient()) ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()); - ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); + .withInline(() -> { + if (FMLEnvironment.dist.isClient()) ConfigTracker.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()); + ConfigTracker.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); }); /** @@ -128,7 +128,7 @@ public class ModStateProvider implements IModStateProvider { */ public static final ModLoadingState COMPLETE = ModLoadingState.of("COMPLETE", ModLoadingPhase.COMPLETE) .after(PROCESS_IMC) - .message(ml -> "completing load of %d mods".formatted(ml.size())) + .message(() -> "completing load of %d mods".formatted(ModList.size())) .withTransition(new ParallelTransition(ModLoadingStage.COMPLETE, FMLLoadCompleteEvent::new)); /** diff --git a/src/main/java/net/minecraftforge/gametest/ForgeGameTestHooks.java b/src/main/java/net/minecraftforge/gametest/ForgeGameTestHooks.java index 18f5e8c8dc..96c63c1b9f 100644 --- a/src/main/java/net/minecraftforge/gametest/ForgeGameTestHooks.java +++ b/src/main/java/net/minecraftforge/gametest/ForgeGameTestHooks.java @@ -148,7 +148,8 @@ public class ForgeGameTestHooks { gametest.manualOnly(), gametest.maxAttempts(), gametest.requiredSuccesses(), - gametest.skyAccess() + gametest.skyAccess(), + gametest.padding() ); MethodHandle handle = unreflect(method, owner); diff --git a/src/main/java/net/minecraftforge/gametest/GameTest.java b/src/main/java/net/minecraftforge/gametest/GameTest.java index 5dbe878367..ba5df3ebe3 100644 --- a/src/main/java/net/minecraftforge/gametest/GameTest.java +++ b/src/main/java/net/minecraftforge/gametest/GameTest.java @@ -30,4 +30,5 @@ public @interface GameTest { int maxAttempts() default 1; int requiredSuccesses() default 1; boolean skyAccess() default false; + int padding() default 0; } diff --git a/src/main/java/net/minecraftforge/internal/BrandingControl.java b/src/main/java/net/minecraftforge/internal/BrandingControl.java index a34bd3cd5c..e5fe979a44 100644 --- a/src/main/java/net/minecraftforge/internal/BrandingControl.java +++ b/src/main/java/net/minecraftforge/internal/BrandingControl.java @@ -38,7 +38,7 @@ public final class BrandingControl { // We only have Forge Betas on the "XX.0.XX" versions anyways. boolean beta = "0".equals(forge[0].split("\\.")[1]); var name = beta ? "§eForge Beta§f " : "Forge "; - list.add(name + forge[0] + " (" + ForgeI18n.parseMessage("fml.menu.loadingmods", ModList.get().size()) + ")"); + list.add(name + forge[0] + " (" + ForgeI18n.parseMessage("fml.menu.loadingmods", ModList.size()) + ")"); // Extra forge version info (like branch) if (forge.length > 1) list.add("Branch " + forge[1]); diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index 77e30187d7..102b92ec45 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -123,7 +123,7 @@ public class ItemHandlerHelper { // play sound if something got picked up if (remainder.isEmpty() || remainder.getCount() != stack.getCount()) { level.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(), - SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((level.random.nextFloat() - level.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); + SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((level.getRandom().nextFloat() - level.getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F); } // drop remaining itemstack into the level diff --git a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java index d27881f3bd..c37b61a4f9 100644 --- a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java +++ b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java @@ -16,7 +16,6 @@ import net.minecraft.world.phys.AABB; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraft.core.Direction; import net.minecraft.core.BlockPos; -import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; @@ -162,7 +161,7 @@ public class VanillaInventoryCodeHooks { double x = hopper.getLevelX() + (double) hopperFacing.getStepX(); double y = hopper.getLevelY() + (double) hopperFacing.getStepY(); double z = hopper.getLevelZ() + (double) hopperFacing.getStepZ(); - return getItemHandler(level, x, y, z, hopperFacing.getOpposite()); + return getItemHandlerPair(level, BlockPos.containing(x, y, z), hopperFacing.getOpposite()); } private static boolean isFull(IItemHandler itemHandler) { @@ -208,7 +207,7 @@ public class VanillaInventoryCodeHooks { if (entities.isEmpty()) return Optional.empty(); - var rand = level.random.nextInt(entities.size()); + var rand = level.getRandom().nextInt(entities.size()); var entity = entities.get(rand); return entity.getCapability(ForgeCapabilities.ITEM_HANDLER, side).resolve(); } @@ -224,18 +223,6 @@ public class VanillaInventoryCodeHooks { return entity.getCapability(ForgeCapabilities.ITEM_HANDLER, side).resolve(); } - /** - * I don't think anyone should be using this. If they are they probably want the non-pair version. - * As the only use for knowing the object holding the IItemHandler is for hopper cooldowns - */ - @Deprecated(forRemoval = true, since = "1.21.8") - public static Optional> getItemHandler(Level worldIn, double x, double y, double z, final Direction side) { - int i = Mth.floor(x); - int j = Mth.floor(y); - int k = Mth.floor(z); - return getItemHandlerPair(worldIn, new BlockPos(i, j, k), side); - } - private static Optional> getItemHandlerPair(Level level, BlockPos pos, Direction side) { var state = level.getBlockState(pos); diff --git a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java index f6266850af..7d9f873153 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java @@ -55,11 +55,11 @@ public class SidedInvWrapper implements IItemHandlerModifiable if (inv instanceof BrewingStandBlockEntity) this.slotLimit = wrapperSlot -> getSlot(inv, wrapperSlot, side) < 3 ? 1 : inv.getMaxStackSize(); else - this.slotLimit = wrapperSlot -> inv.getMaxStackSize(); + this.slotLimit = _ -> inv.getMaxStackSize(); if (inv instanceof AbstractFurnaceBlockEntity) this.newStackInsertLimit = (wrapperSlot, invSlot, stack) -> invSlot == 1 && stack.is(Items.BUCKET) ? 1 : Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); else - this.newStackInsertLimit = (wrapperSlot, invSlot, stack) -> Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); + this.newStackInsertLimit = (wrapperSlot, _, stack) -> Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); } public static int getSlot(WorldlyContainer inv, int slot, @Nullable Direction side) diff --git a/src/main/java/net/minecraftforge/logging/CrashReportAnalyser.java b/src/main/java/net/minecraftforge/logging/CrashReportAnalyser.java index 172bb587e5..6423a819c0 100644 --- a/src/main/java/net/minecraftforge/logging/CrashReportAnalyser.java +++ b/src/main/java/net/minecraftforge/logging/CrashReportAnalyser.java @@ -122,21 +122,20 @@ public final class CrashReportAnalyser { * Iterates over all loaded mods, resolving and caching their package names with the corresponding {@link IModInfo}. * **/ private static void cacheModList() { - ModList modList = ModList.get(); ModuleLayer gameLayer = FMLLoader.getGameLayer(); - if (modList != null) { - modList.getMods().forEach(iModInfo -> { - //Don't cache minecraft or forge as they will always be included in the stacktrace - if (!iModInfo.getModId().equals("forge") && !iModInfo.getModId().equals("minecraft")) { - Set packages = new HashSet<>(); + ModList.getMods().forEach(iModInfo -> { + //Don't cache minecraft or forge as they will always be included in the stacktrace + if (!iModInfo.getModId().equals("forge") && !iModInfo.getModId().equals("minecraft")) { + Set packages = new HashSet<>(); - gameLayer.findModule(iModInfo.getModId()).ifPresent(module -> packages.addAll(module.getPackages())); + gameLayer.findModule(iModInfo.getModId()).ifPresent(module -> packages.addAll(module.getPackages())); - packages.forEach(s -> PACKAGE_MOD_CACHE.put(s, iModInfo)); + for (String s : packages) { + PACKAGE_MOD_CACHE.put(s, iModInfo); } - }); - } + } + }); } private static void identifyByClass(StackTraceElement stackTraceElement) { diff --git a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java index acea58bf7f..4f951fbbac 100644 --- a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java +++ b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java @@ -26,7 +26,7 @@ public class CrashReportExtender { public static void extendSystemReport(final SystemReport systemReport) { for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables()) { if (call.isActive()) - systemReport.setDetail(call.getLabel(), call); + systemReport.setDetail(call.getLabel(), call::get); } } diff --git a/src/main/java/net/minecraftforge/network/Channel.java b/src/main/java/net/minecraftforge/network/Channel.java index 29d1894313..70b6a35da8 100644 --- a/src/main/java/net/minecraftforge/network/Channel.java +++ b/src/main/java/net/minecraftforge/network/Channel.java @@ -116,8 +116,8 @@ public abstract class Channel { @FunctionalInterface public static interface VersionTest { - public static final VersionTest ACCEPT_MISSING = (status, version) -> status == Status.MISSING; - public static final VersionTest ACCEPT_VANILLA = (status, version) -> status == Status.VANILLA; + public static final VersionTest ACCEPT_MISSING = (status, _) -> status == Status.MISSING; + public static final VersionTest ACCEPT_VANILLA = (status, _) -> status == Status.VANILLA; public static VersionTest exact(int version) { return (status, remoteVersion) -> status == Status.PRESENT && version == remoteVersion; } diff --git a/src/main/java/net/minecraftforge/network/ChannelBuilder.java b/src/main/java/net/minecraftforge/network/ChannelBuilder.java index 809f1cadb3..ec9860d1ce 100644 --- a/src/main/java/net/minecraftforge/network/ChannelBuilder.java +++ b/src/main/java/net/minecraftforge/network/ChannelBuilder.java @@ -143,7 +143,7 @@ public class ChannelBuilder { * @param factory A factory that creates a new instance of the context data */ public ChannelBuilder attribute(AttributeKey key, Supplier factory) { - return this.attribute(key, con -> factory.get()); + return this.attribute(key, _ -> factory.get()); } /** diff --git a/src/main/java/net/minecraftforge/network/ForgePacketHandler.java b/src/main/java/net/minecraftforge/network/ForgePacketHandler.java index 9e89f184fc..c258e4004d 100644 --- a/src/main/java/net/minecraftforge/network/ForgePacketHandler.java +++ b/src/main/java/net/minecraftforge/network/ForgePacketHandler.java @@ -216,7 +216,7 @@ public class ForgePacketHandler { var missing = new HashSet(); for (var id : missingMods) { var key = Identifier.fromNamespaceAndPath(id, ""); - var container = ModList.get().getModContainerById(id).orElse(null); + var container = ModList.getModContainerById(id).orElse(null); if (container != null) mismatched.put(key, new NetworkMismatchData.Version(container.getModInfo().getVersion().toString(), "")); else @@ -253,7 +253,7 @@ public class ForgePacketHandler { LOGGER.debug(MARKER, "Received config sync from server for {}", msg.name()); if (!ctx.getConnection().isMemoryConnection()) { - var cfg = ConfigTracker.INSTANCE.fileMap().get(msg.name()); + var cfg = ConfigTracker.fileMap().get(msg.name()); if (cfg != null) cfg.acceptSyncedConfig(msg.data()); } diff --git a/src/main/java/net/minecraftforge/network/ServerStatusPing.java b/src/main/java/net/minecraftforge/network/ServerStatusPing.java index 2db987c848..65f50192e4 100644 --- a/src/main/java/net/minecraftforge/network/ServerStatusPing.java +++ b/src/main/java/net/minecraftforge/network/ServerStatusPing.java @@ -87,8 +87,8 @@ public record ServerStatusPing( ServerStatusPing.BYTE_BUF_CODEC.optionalFieldOf("d").forGetter(ping -> Optional.of(ping.toBuf())), - ChannelData.CODEC.listOf().optionalFieldOf("channels").forGetter(ping -> Optional.of(List.of())), - ModInfo.CODEC.listOf().optionalFieldOf("mods").forGetter(ping -> Optional.of(List.of())), + ChannelData.CODEC.listOf().optionalFieldOf("channels").forGetter(_ -> Optional.of(List.of())), + ModInfo.CODEC.listOf().optionalFieldOf("mods").forGetter(_ -> Optional.of(List.of())), // legacy versions see truncated lists, modern versions ignore this truncated flag (binary data has its own) Codec.BOOL.optionalFieldOf("truncated").forGetter(ping -> Optional.of(ping.isTruncated())) @@ -103,7 +103,7 @@ public record ServerStatusPing( public ServerStatusPing() { this( NetworkRegistry.buildChannelVersionsForListPing(), - Util.make(new HashMap<>(), map -> ModList.get().forEachModContainer((modid, mc) -> + Util.make(new HashMap<>(), map -> ModList.forEachModContainer((modid, mc) -> map.put(modid, mc.getCustomExtension(IExtensionPoint.DisplayTest.class) .map(IExtensionPoint.DisplayTest::suppliedVersion) .map(Supplier::get) diff --git a/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java b/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java index a92b980ff0..d1ac6c817a 100644 --- a/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java +++ b/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java @@ -23,7 +23,7 @@ public class SimpleConfigurationTask implements ConfigurationTask { } public SimpleConfigurationTask(Type type, Runnable task) { - this(type, c -> task.run()); + this(type, _ -> task.run()); } @Override diff --git a/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java b/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java index a70e4959c3..91c39f5d06 100644 --- a/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java +++ b/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java @@ -20,7 +20,7 @@ public class NetworkFilters { private static final Logger LOGGER = LogManager.getLogger(); private static final Map> instances = ImmutableMap.of( - "forge:vanilla_filter", manager -> new VanillaConnectionNetworkFilter()/*, + "forge:vanilla_filter", _ -> new VanillaConnectionNetworkFilter()/*, "forge:forge_fixes", ForgeConnectionNetworkFilter::new*/ ); diff --git a/src/main/java/net/minecraftforge/network/packets/ModVersions.java b/src/main/java/net/minecraftforge/network/packets/ModVersions.java index ced848b1c7..64822a70b2 100644 --- a/src/main/java/net/minecraftforge/network/packets/ModVersions.java +++ b/src/main/java/net/minecraftforge/network/packets/ModVersions.java @@ -22,7 +22,7 @@ public record ModVersions(Map mods) { private static final int MAX_LENGTH = 0x100; public static ModVersions create() { - return new ModVersions(ModList.get().getMods().stream().collect(Collectors.toMap( + return new ModVersions(ModList.getMods().stream().collect(Collectors.toMap( IModInfo::getModId, mod -> new Info(mod.getDisplayName(), mod.getVersion().toString()) ))); diff --git a/src/main/java/net/minecraftforge/network/packets/OpenContainer.java b/src/main/java/net/minecraftforge/network/packets/OpenContainer.java index f4aa4bd3ee..ed8332e09c 100644 --- a/src/main/java/net/minecraftforge/network/packets/OpenContainer.java +++ b/src/main/java/net/minecraftforge/network/packets/OpenContainer.java @@ -70,7 +70,7 @@ public class OpenContainer { var s = ((MenuScreens.ScreenConstructor)f).create(c, inv, msg.getName()); mc.player.containerMenu = s.getMenu(); - mc.setScreen(s); + mc.gui.setScreen(s); }); } finally { msg.getAdditionalData().release(); diff --git a/src/main/java/net/minecraftforge/network/packets/RegistryList.java b/src/main/java/net/minecraftforge/network/packets/RegistryList.java index 8b0109ca0f..531c363e09 100644 --- a/src/main/java/net/minecraftforge/network/packets/RegistryList.java +++ b/src/main/java/net/minecraftforge/network/packets/RegistryList.java @@ -28,7 +28,7 @@ public record RegistryList( public static RegistryList decode(FriendlyByteBuf buf) { var token = buf.readVarInt(); var normal = buf.readList(FriendlyByteBuf::readIdentifier); - List>> datapacks = buf.readList(b -> ResourceKey.createRegistryKey(buf.readIdentifier())); + List>> datapacks = buf.readList(_ -> ResourceKey.createRegistryKey(buf.readIdentifier())); return new RegistryList(token, normal, datapacks); } diff --git a/src/main/java/net/minecraftforge/network/simple/SimpleFlow.java b/src/main/java/net/minecraftforge/network/simple/SimpleFlow.java index bd9f3a5b1e..c1906d1633 100644 --- a/src/main/java/net/minecraftforge/network/simple/SimpleFlow.java +++ b/src/main/java/net/minecraftforge/network/simple/SimpleFlow.java @@ -28,7 +28,7 @@ public interface SimpleFlow extends SimplePro */ default SimpleFlow addMain(Class type, StreamCodec codec, BiConsumer handler) { return add(type, codec, (msg, ctx) -> { - ctx.enqueueWork(() -> handler.accept(msg, ctx)); + net.minecraftforge.common.ForgeHooks.enqueuePacket(handler, msg, ctx); ctx.setPacketHandled(true); }); } diff --git a/src/main/java/net/minecraftforge/network/tasks/ModVersionsTask.java b/src/main/java/net/minecraftforge/network/tasks/ModVersionsTask.java index 3cdc6cc95b..664af5222e 100644 --- a/src/main/java/net/minecraftforge/network/tasks/ModVersionsTask.java +++ b/src/main/java/net/minecraftforge/network/tasks/ModVersionsTask.java @@ -15,13 +15,11 @@ import net.minecraftforge.network.config.ConfigurationTaskContext; import net.minecraftforge.network.packets.ModVersions; /** - * Sends the list of known channels to the client using the - * Plugin Channel - * register messages. + * Sends a list of mods and their versions, this is easily spoofed so should not be relied on for anti-cheats. */ @ApiStatus.Internal public class ModVersionsTask implements ConfigurationTask { - public static final Type TYPE = new Type("forge:channel_list"); + public static final Type TYPE = new Type("forge:mod_versions"); @Override public void start(ConfigurationTaskContext ctx) { diff --git a/src/main/java/net/minecraftforge/network/tasks/SyncConfigTask.java b/src/main/java/net/minecraftforge/network/tasks/SyncConfigTask.java index 30d0cda37e..f74762c78d 100644 --- a/src/main/java/net/minecraftforge/network/tasks/SyncConfigTask.java +++ b/src/main/java/net/minecraftforge/network/tasks/SyncConfigTask.java @@ -32,7 +32,7 @@ class SyncConfigTask extends SimpleConfigurationTask { } private static void run(ConfigurationTaskContext ctx) { - for (var cfg : ConfigTracker.INSTANCE.configSets().get(ModConfig.Type.SERVER)) { + for (var cfg : ConfigTracker.configSets().get(ModConfig.Type.SERVER)) { try { var pkt = new ConfigData(cfg.getFileName(), Files.readAllBytes(cfg.getFullPath())); NetworkInitialization.CONFIG.send(pkt, ctx.getConnection()); diff --git a/src/main/java/net/minecraftforge/registries/DataPackRegistriesHooks.java b/src/main/java/net/minecraftforge/registries/DataPackRegistriesHooks.java index e2355d8f79..bcfd6e21b9 100644 --- a/src/main/java/net/minecraftforge/registries/DataPackRegistriesHooks.java +++ b/src/main/java/net/minecraftforge/registries/DataPackRegistriesHooks.java @@ -8,6 +8,7 @@ package net.minecraftforge.registries; import net.minecraft.core.Registry; import net.minecraft.core.RegistrySynchronization; import net.minecraft.resources.RegistryDataLoader; +import net.minecraft.resources.RegistryValidator; import net.minecraft.resources.ResourceKey; import org.jetbrains.annotations.ApiStatus; @@ -48,7 +49,7 @@ public final class DataPackRegistriesHooks { if (data.networkCodec() != null) { NETWORKABLE_REGISTRIES.add(loaderData.key()); SYNCHRONIZED_REGISTRIES_CUSTOM.add(loaderData.key()); - SYNCHRONIZED_REGISTRIES.add(new RegistryDataLoader.RegistryData<>(loaderData.key(), data.networkCodec(), false)); + SYNCHRONIZED_REGISTRIES.add(new RegistryDataLoader.RegistryData(loaderData.key(), data.networkCodec(), RegistryValidator.none())); } } diff --git a/src/main/java/net/minecraftforge/registries/DataPackRegistryEvent.java b/src/main/java/net/minecraftforge/registries/DataPackRegistryEvent.java index 8aa6103e21..e29aab2581 100644 --- a/src/main/java/net/minecraftforge/registries/DataPackRegistryEvent.java +++ b/src/main/java/net/minecraftforge/registries/DataPackRegistryEvent.java @@ -12,12 +12,9 @@ import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.core.Registry; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.resources.ResourceKey; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; 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.Nullable; @@ -33,12 +30,6 @@ public sealed interface DataPackRegistryEvent { final class NewRegistry extends MutableEvent implements DataPackRegistryEvent { public static final EventBus BUS = EventBus.create(NewRegistry.class); - /** @deprecated {@link DataPackRegistryEvent.NewRegistry} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private final List> registryDataList = new ArrayList<>(); @ApiStatus.Internal @@ -76,8 +67,8 @@ public sealed interface DataPackRegistryEvent { * The data will be synced using the network codec and accessible via {@link ClientPacketListener#registryAccess()}. * @see #dataPackRegistry(ResourceKey, Codec) */ - public void dataPackRegistry(ResourceKey> registryKey, Codec codec, @Nullable Codec networkCodec) { - this.registryDataList.add(new DataPackRegistryData<>(new RegistryDataLoader.RegistryData<>(registryKey, codec, false), networkCodec)); + public void dataPackRegistry(ResourceKey> registryKey, Codec codec, @Nullable Codec networkCodec) { + this.registryDataList.add(new DataPackRegistryData<>(new RegistryDataLoader.RegistryData(registryKey, codec), networkCodec)); } void process() { diff --git a/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java b/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java index 8555028689..3e4a2e2cf7 100644 --- a/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java +++ b/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java @@ -155,7 +155,7 @@ public class DeferredRegisterData implements RegistryBootstrap { * @see #register(String, Supplier) */ public RegistryObject register(final String name, final Supplier factory) { - return register(name, ctx -> factory.get()); + return register(name, _ -> factory.get()); } /** diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 6c10c9b8cc..1be1a30af7 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntRBTreeMap; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; -import net.minecraft.nbt.Tag; import net.minecraft.tags.TagKey; import net.minecraftforge.common.util.LogMessageAdapter; import net.minecraftforge.fml.ModLoadingContext; @@ -498,7 +497,7 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist } private Holder.Reference bindDelegate(ResourceKey rkey, V value) { - Holder.Reference delegate = delegatesByName.computeIfAbsent(rkey.identifier(), k -> Holder.Reference.createStandAlone(this.getWrapperOrThrow(), rkey)); + Holder.Reference delegate = delegatesByName.computeIfAbsent(rkey.identifier(), _ -> Holder.Reference.createStandAlone(this.getWrapperOrThrow(), rkey)); delegate.bindKey(rkey); delegate.bindValue(value); delegatesByValue.put(value, delegate); diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index ea39ca668b..626daf0ebf 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -88,7 +88,7 @@ public class GameData { private static boolean hasInit = false; private static final boolean DISABLE_VANILLA_REGISTRIES = Boolean.parseBoolean(System.getProperty("forge.disableVanillaGameData", "false")); // Use for unit tests/debugging - private static final BiConsumer> LOCK_VANILLA = (name, reg) -> reg.slaves.values().stream().filter(o -> o instanceof ILockableRegistry).forEach(o -> ((ILockableRegistry)o).lock()); + private static final BiConsumer> LOCK_VANILLA = (_, reg) -> reg.slaves.values().stream().filter(o -> o instanceof ILockableRegistry).forEach(o -> ((ILockableRegistry)o).lock()); private static Set vanillaRegistryOrder = null; static { @@ -301,13 +301,13 @@ public class GameData { LOGGER.warn(REGISTRIES, "Can't revert to {} GameData state without a valid snapshot.", target.getName()); return; } - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.resetDelegates()); LOGGER.debug(REGISTRIES, "Reverting to {} data state.", target.getName()); for (var r : RegistryManager.ACTIVE.registries.entrySet()) loadRegistry(r.getKey(), target, RegistryManager.ACTIVE, true); - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.bake()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.bake()); // the id mapping has reverted, fire remap events for those that care about id changes if (fireEvents) { fireRemapEvent(ImmutableMap.of(), true); @@ -570,12 +570,12 @@ public class GameData { LOGGER.info(REGISTRIES, "Injecting existing registry data into this {} instance", EffectiveSide.get()); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.validateContent(name)); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.dump(name)); - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.resetDelegates()); // Update legacy names snapshot = snapshot.entrySet().stream() .sorted(Map.Entry.comparingByKey()) // FIXME Registries need dependency ordering, this makes sure blocks are done before items (for ItemCallbacks) but it's lazy as hell - .collect(Collectors.toMap(e -> RegistryManager.ACTIVE.updateLegacyName(e.getKey()), Map.Entry::getValue, (k1, k2) -> k1, LinkedHashMap::new)); + .collect(Collectors.toMap(e -> RegistryManager.ACTIVE.updateLegacyName(e.getKey()), Map.Entry::getValue, (k1, _) -> k1, LinkedHashMap::new)); if (isLocalWorld) { Identifier[] missingRegs = snapshot.keySet().stream().filter(name -> !RegistryManager.ACTIVE.registries.containsKey(name)).toArray(Identifier[]::new); @@ -667,7 +667,7 @@ public class GameData { if (injectFrozenData) { // 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) -> { + RegistryManager.ACTIVE.registries.forEach((name, _) -> { loadFrozenDataToStagingRegistry(STAGING, name, remaps.get(name)); }); } @@ -677,7 +677,7 @@ public class GameData { // Load the STAGING registry into the ACTIVE registry //for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) - RegistryManager.ACTIVE.registries.forEach((key, value) -> { + RegistryManager.ACTIVE.registries.forEach((key, _) -> { loadRegistry(key, STAGING, RegistryManager.ACTIVE, true); }); diff --git a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java index 2911d9c7b4..6b993e36d9 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java @@ -18,6 +18,7 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.MappedRegistry; import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponentLookup; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; import net.minecraft.tags.TagKey; @@ -249,7 +250,7 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr } protected Holder.Reference getOrCreateHolderOrThrow(ResourceKey key) { - return this.holdersByName.computeIfAbsent(key.identifier(), k -> { + return this.holdersByName.computeIfAbsent(key.identifier(), _ -> { if (this.isIntrusive()) { throw new IllegalStateException("This registry can't create new holders without value"); } else { @@ -321,6 +322,7 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr this.bindAllUnboundTagsToEmpty(); } + this.componentLookup = new DataComponentLookup<>(this.holdersById); this.frozenTags = MappedRegistry.TagSet.fromMap(this.tags); this.delegate.onBindTags(this.tags); this.refreshTagsInHoldersForge(); @@ -371,9 +373,9 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr } @Override - public void bindTag(TagKey key, List> newTags) { + public void bindTags(Map, List>> pendingTags) { this.validateWrite(); - this.getOrCreateTagForRegistration(key).bind(newTags); + pendingTags.forEach((id, values) -> this.getOrCreateTagForRegistration(id).bind(values)); } @Override @@ -524,7 +526,7 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr if (this.isIntrusive()) return this.intrusiveHolderCallback.apply(value); - return this.holdersByName.computeIfAbsent(key.identifier(), k -> Holder.Reference.createStandAlone(this, key)); + return this.holdersByName.computeIfAbsent(key.identifier(), _ -> Holder.Reference.createStandAlone(this, key)); } private List> getSortedHolders() { diff --git a/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java b/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java index 17a1230028..b7c8716f55 100644 --- a/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java +++ b/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java @@ -14,10 +14,8 @@ import java.util.function.Consumer; import java.util.function.Supplier; import net.minecraft.core.MappedRegistry; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraftforge.eventbus.api.bus.BusGroup; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; -import net.minecraftforge.fml.event.IModBusEvent; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -27,12 +25,6 @@ import org.slf4j.Logger; public final class NewRegistryEvent extends MutableEvent { public static final EventBus BUS = EventBus.create(NewRegistryEvent.class); - /** @deprecated {@link NewRegistryEvent} is no longer an {@link IModBusEvent}, so use {@link #BUS} directly. */ - @Deprecated(forRemoval = true, since = "1.21.9") - public static EventBus getBus(BusGroup modBusGroup) { - return BUS; - } - private static final Logger LOGGER = LogUtils.getLogger(); private final List> registries = new ArrayList<>(); diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java index 8af55397ba..53da06fb0a 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java @@ -54,7 +54,7 @@ class ObjectHolderRegistry { static void applyObjectHolders() { try { LOGGER.debug(ForgeRegistry.REGISTRIES, "Applying holder lookups"); - applyObjectHolders(key -> true); + applyObjectHolders(_ -> true); LOGGER.debug(ForgeRegistry.REGISTRIES, "Holder lookups applied"); } catch (RuntimeException e) { // It is more important that the calling contexts continue without exception to prevent further cascading errors diff --git a/src/main/java/net/minecraftforge/registries/RegistryObject.java b/src/main/java/net/minecraftforge/registries/RegistryObject.java index 9c49544727..96fe8b5cac 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryObject.java +++ b/src/main/java/net/minecraftforge/registries/RegistryObject.java @@ -481,8 +481,8 @@ public final class RegistryObject implements Supplier { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (obj instanceof RegistryObject o) { - return Objects.equals(o.name, name); + if (obj instanceof RegistryObject o) { + return o.key == key && Objects.equals(o.name, name); } return false; } diff --git a/src/main/java/net/minecraftforge/registries/tags/ITag.java b/src/main/java/net/minecraftforge/registries/tags/ITag.java index bf5675d83c..cb5aa57e57 100644 --- a/src/main/java/net/minecraftforge/registries/tags/ITag.java +++ b/src/main/java/net/minecraftforge/registries/tags/ITag.java @@ -9,7 +9,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.RandomSource; import java.util.Optional; -import java.util.Random; import java.util.stream.Stream; /** diff --git a/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java b/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java index 078f25eecb..5f92b1bbe6 100644 --- a/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java +++ b/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java @@ -49,9 +49,9 @@ public class DelegatingPackResources extends AbstractPackResources { Map> map = new HashMap<>(); for (PackResources pack : packList) { for (String namespace : pack.getNamespaces(type)) - map.computeIfAbsent(namespace, k -> new ArrayList<>()).add(pack); + map.computeIfAbsent(namespace, _ -> new ArrayList<>()).add(pack); } - map.replaceAll((k, list) -> ImmutableList.copyOf(list)); + map.replaceAll((_, list) -> ImmutableList.copyOf(list)); return ImmutableMap.copyOf(map); } diff --git a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java index 05876cfdbd..17a7df9f22 100644 --- a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java +++ b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Consumer; -import java.util.stream.Collectors; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; @@ -45,7 +44,9 @@ public class ResourcePackLoader { } public static List getPackNames() { - return ModList.get().applyForEachModFile(mf->"mod:"+mf.getModInfos().getFirst().getModId()).filter(n->!n.equals("mod:minecraft")).toList(); + return ModList.applyForEachModFile(mf -> "mod:" + mf.getModInfos().getFirst().getModId()) + .filter(n -> !n.equals("mod:minecraft")) + .toList(); } public static Comparator> getSorter() { @@ -53,7 +54,7 @@ public class ResourcePackLoader { order.add("vanilla"); order.add("mod_resources"); - ModList.get().getModFiles().stream() + ModList.getModFiles().stream() .filter(mf -> mf.requiredLanguageLoaders().stream().noneMatch(ls->ls.languageName().equals("minecraft"))) .map(e -> e.getMods().getFirst().getModId()) .map(e -> "mod:" + e) @@ -79,10 +80,10 @@ public class ResourcePackLoader { private static void findPacks(Consumer packAcceptor, boolean client) { var type = client ? PackType.CLIENT_RESOURCES : PackType.SERVER_DATA; - var version = DetectedVersion.BUILT_IN.packVersion(PackType.CLIENT_RESOURCES); + var version = DetectedVersion.BUILT_IN.packVersion(type); var hiddenPacks = new ArrayList(); - for (var mod : ModList.get().getModFiles()) { + for (var mod : ModList.getModFiles()) { if (mod.requiredLanguageLoaders().stream().anyMatch(ls -> ls.languageName().equals("minecraft"))) continue; @@ -101,7 +102,7 @@ public class ResourcePackLoader { if (pack == null) { // Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong - ModLoader.get().addWarning(new ModLoadingWarning(modinfo, ModLoadingStage.ERROR, "fml.modloading.brokenresources", file)); + ModLoader.addWarning(new ModLoadingWarning(modinfo, ModLoadingStage.ERROR, "fml.modloading.brokenresources", file)); continue; } diff --git a/src/main/java/net/minecraftforge/server/LanguageHook.java b/src/main/java/net/minecraftforge/server/LanguageHook.java index aef19ffb38..2bcaac981b 100644 --- a/src/main/java/net/minecraftforge/server/LanguageHook.java +++ b/src/main/java/net/minecraftforge/server/LanguageHook.java @@ -73,7 +73,7 @@ public class LanguageHook { } for (var namespace : pack.getNamespaces(PackType.CLIENT_RESOURCES)) { - byNamespace.computeIfAbsent(namespace, k -> new ArrayList<>()).add(pack); + byNamespace.computeIfAbsent(namespace, _ -> new ArrayList<>()).add(pack); } } diff --git a/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java index 4823a6deef..8f9224d7d1 100644 --- a/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java +++ b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java @@ -71,7 +71,7 @@ public class ServerLifecycleHooks { currentServer = server; // on the dedi server we need to force the stuff to setup properly LogicalSidedProvider.setServer(()->server); - ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server)); + ConfigTracker.loadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server)); runModifiers(server); return !ServerAboutToStartEvent.BUS.post(new ServerAboutToStartEvent(server)); } @@ -98,7 +98,7 @@ public class ServerLifecycleHooks { latch.countDown(); exitLatch = null; } - ConfigTracker.INSTANCE.unloadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server)); + ConfigTracker.unloadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server)); } public static MinecraftServer getCurrentServer() { diff --git a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java index a055a81018..e7497a6289 100644 --- a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java @@ -40,7 +40,7 @@ public class ConfigCommand { private static int showFile(final CommandContext context) { final String modId = context.getArgument("mod", String.class); final ModConfig.Type type = context.getArgument("type", ModConfig.Type.class); - final String configFileName = ConfigTracker.INSTANCE.getConfigFileName(modId, type); + final String configFileName = ConfigTracker.getConfigFileName(modId, type); if (configFileName != null) { File f = new File(configFileName); context.getSource().sendSuccess(() -> Component.translatable("commands.config.getwithtype", diff --git a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java index 8b39580af9..dd46e3e2fb 100644 --- a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java @@ -32,7 +32,7 @@ class DimensionsCommand { Map> types = new HashMap<>(); for (ServerLevel dim : ctx.getSource().getServer().getAllLevels()) { - types.computeIfAbsent(reg.getKey(dim.dimensionType()), k -> new ArrayList<>()).add(dim.dimension().identifier()); + types.computeIfAbsent(reg.getKey(dim.dimensionType()), _ -> new ArrayList<>()).add(dim.dimension().identifier()); } types.keySet().stream().sorted().forEach(key -> { diff --git a/src/main/java/net/minecraftforge/server/command/EntityCommand.java b/src/main/java/net/minecraftforge/server/command/EntityCommand.java index 370eb90be7..e1cce7ad99 100644 --- a/src/main/java/net/minecraftforge/server/command/EntityCommand.java +++ b/src/main/java/net/minecraftforge/server/command/EntityCommand.java @@ -52,7 +52,7 @@ class EntityCommand return Commands.literal("list") .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)) .then(Commands.argument("filter", StringArgumentType.string()) - .suggests((ctx, builder) -> SharedSuggestionProvider.suggest(ForgeRegistries.ENTITY_TYPES.getKeys().stream().map(Identifier::toString).map(StringArgumentType::escapeIfRequired), builder)) + .suggests((_, builder) -> SharedSuggestionProvider.suggest(ForgeRegistries.ENTITY_TYPES.getKeys().stream().map(Identifier::toString).map(StringArgumentType::escapeIfRequired), builder)) .then(Commands.argument("dim", DimensionArgument.dimension()) .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), DimensionArgument.getDimension(ctx, "dim").dimension())) ) @@ -76,8 +76,8 @@ class EntityCommand Map>> list = Maps.newHashMap(); level.getEntities().getAll().forEach(e -> { - MutablePair> info = list.computeIfAbsent(ForgeRegistries.ENTITY_TYPES.getKey(e.getType()), k -> MutablePair.of(0, Maps.newHashMap())); - ChunkPos chunk = new ChunkPos(e.blockPosition()); + MutablePair> info = list.computeIfAbsent(ForgeRegistries.ENTITY_TYPES.getKey(e.getType()), _ -> MutablePair.of(0, Maps.newHashMap())); + ChunkPos chunk = ChunkPos.containing(e.blockPosition()); info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); }); @@ -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(); } diff --git a/src/main/java/net/minecraftforge/server/command/ModIdArgument.java b/src/main/java/net/minecraftforge/server/command/ModIdArgument.java index 1ef36bceb7..3f997e895d 100644 --- a/src/main/java/net/minecraftforge/server/command/ModIdArgument.java +++ b/src/main/java/net/minecraftforge/server/command/ModIdArgument.java @@ -35,7 +35,7 @@ public class ModIdArgument implements ArgumentType { @Override public CompletableFuture listSuggestions(final CommandContext context, final SuggestionsBuilder builder) { - return SharedSuggestionProvider.suggest(ModList.get().applyForEachModContainer(ModContainer::getModId), builder); + return SharedSuggestionProvider.suggest(ModList.applyForEachModContainer(ModContainer::getModId), builder); } @Override diff --git a/src/main/java/net/minecraftforge/server/command/ModListCommand.java b/src/main/java/net/minecraftforge/server/command/ModListCommand.java index 0d0875f664..f041056435 100644 --- a/src/main/java/net/minecraftforge/server/command/ModListCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ModListCommand.java @@ -21,7 +21,7 @@ class ModListCommand { .requires(Commands.hasPermission(Commands.LEVEL_ALL)) .executes(ctx -> { ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.mods.list", - ModList.get().applyForEachModFile(modFile -> + ModList.applyForEachModFile(modFile -> // locator - filename : firstmod (version) - numberofmods\n String.format(Locale.ROOT, "%s %s : %s (%s) - %d", modFile.getProvider().name().replace(' ', '_'), diff --git a/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java b/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java index a13e0f723d..3607092b37 100644 --- a/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java +++ b/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java @@ -16,8 +16,7 @@ import org.apache.logging.log4j.Logger; import java.io.File; import java.util.List; -public class ServerModLoader -{ +public final class ServerModLoader { private static final Logger LOGGER = LogManager.getLogger(); private static boolean hasErrors = false; @@ -27,9 +26,9 @@ public class ServerModLoader }); LanguageHook.loadForgeAndMCLangs(); try { - ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); - ModLoader.get().loadMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); - ModLoader.get().finishMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); + ModLoader.gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); + ModLoader.loadMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); + ModLoader.finishMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{}); } catch (LoadingFailedException error) { ServerModLoader.hasErrors = true; // In case its not loaded properly @@ -37,7 +36,7 @@ public class ServerModLoader CrashReportExtender.dumpModLoadingCrashReport(LOGGER, error, new File(".")); throw error; } - List warnings = ModLoader.get().getWarnings(); + List warnings = ModLoader.getWarnings(); if (!warnings.isEmpty()) { LOGGER.warn(Logging.LOADING, "Mods loaded with {} warnings", warnings.size()); warnings.forEach(warning -> LOGGER.warn(Logging.LOADING, warning.formatToString())); diff --git a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java index 3488ff22e8..cca380e653 100644 --- a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java +++ b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java @@ -9,7 +9,6 @@ import net.minecraft.IdentifierException; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.ForgeConfig; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.server.ServerLifecycleHooks; import net.minecraftforge.server.permission.events.PermissionGatherEvent; import net.minecraftforge.server.permission.exceptions.UnregisteredPermissionException; diff --git a/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java b/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java index 8a218a0fef..bc1f62b19c 100644 --- a/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java +++ b/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java @@ -7,7 +7,6 @@ package net.minecraftforge.server.permission.handler; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.StringRepresentable; import net.minecraftforge.server.permission.PermissionAPI; import net.minecraftforge.server.permission.events.PermissionGatherEvent; import net.minecraftforge.server.permission.nodes.PermissionDynamicContext; diff --git a/src/main/java/net/minecraftforge/server/timings/TimeTracker.java b/src/main/java/net/minecraftforge/server/timings/TimeTracker.java index 1a3c322aa6..2499b92952 100644 --- a/src/main/java/net/minecraftforge/server/timings/TimeTracker.java +++ b/src/main/java/net/minecraftforge/server/timings/TimeTracker.java @@ -108,7 +108,7 @@ public class TimeTracker currentlyTracking = null; return; } - int[] timings = this.timings.computeIfAbsent(object, k -> new int[101]); + int[] timings = this.timings.computeIfAbsent(object, _ -> new int[101]); int idx = timings[100] = (timings[100] + 1) % 100; timings[idx] = (int) (nanoTime - timing); } diff --git a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java index 13cc0057ed..ab596a8040 100644 --- a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java @@ -13,7 +13,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; -public class ForgeVersion { +public final class ForgeVersion { private static final Logger LOGGER = LogManager.getLogger(); // This is Forge's Mod Id, used for the ForgeMod and resource locations public static final String MOD_ID = "forge"; @@ -42,12 +42,12 @@ public class ForgeVersion { } public static VersionChecker.Status getStatus() { - return VersionChecker.getResult(ModList.get().getModFileById(MOD_ID).getMods().getFirst()).status(); + return VersionChecker.getResult(ModList.getModFileById(MOD_ID).getMods().getFirst()).status(); } @Nullable public static String getTarget() { - VersionChecker.CheckResult res = VersionChecker.getResult(ModList.get().getModFileById(MOD_ID).getMods().getFirst()); + VersionChecker.CheckResult res = VersionChecker.getResult(ModList.getModFileById(MOD_ID).getMods().getFirst()); return res.target() == null ? "" : res.target().toString(); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 9c80d51926..e8e53a3ff5 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,817 +1,755 @@ -public net.minecraft.advancements.CriteriaTriggers m_10595_(Ljava/lang/String;Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; # register -default net.minecraft.client.KeyMapping f_90817_ # isDown -public net.minecraft.client.Minecraft f_90987_ # textureManager -public-f net.minecraft.client.Options f_92059_ # keyMappings +public net.minecraft.advancements.triggers.CriteriaTriggers register(Ljava/lang/String;Lnet/minecraft/advancements/triggers/CriterionTrigger;)Lnet/minecraft/advancements/triggers/CriterionTrigger; +default net.minecraft.client.KeyMapping isDown +public net.minecraft.client.Minecraft textureManager +public-f net.minecraft.client.Options keyMappings public net.minecraft.client.Options$FieldAccess -public net.minecraft.client.color.item.ItemTintSources f_371619_ # ID_MAPPER -#group protected net.minecraft.client.data.models.BlockModelGenerators *() -protected net.minecraft.client.data.models.BlockModelGenerators m_372042_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;)V # registerSimpleItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372065_()V # createCartographyTable -protected net.minecraft.client.data.models.BlockModelGenerators m_372090_()V # createPitcherCrop -protected net.minecraft.client.data.models.BlockModelGenerators m_372114_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/renderer/block/model/multipart/Condition;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # addSlotStateAndRotationVariants -protected net.minecraft.client.data.models.BlockModelGenerators m_372121_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createWeightedPressurePlate -protected net.minecraft.client.data.models.BlockModelGenerators m_372128_()V # createSmithingTable -protected net.minecraft.client.data.models.BlockModelGenerators m_372129_()V # createPetrifiedOakSlab -protected net.minecraft.client.data.models.BlockModelGenerators m_372134_()V # createFarmland -protected net.minecraft.client.data.models.BlockModelGenerators m_372158_()V # createBookshelf -protected net.minecraft.client.data.models.BlockModelGenerators m_372188_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createAxisAlignedPillarBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372190_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;)V # createMultiface -protected net.minecraft.client.data.models.BlockModelGenerators m_372196_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # copyTrapdoorModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372199_()V # createStructureBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372209_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; # createFlatItemModelWithBlockTexture -protected net.minecraft.client.data.models.BlockModelGenerators m_372231_()Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; # createRotatedPillar -protected net.minecraft.client.data.models.BlockModelGenerators m_372234_(Lnet/minecraft/world/level/block/Block;)V # createRotatedMirroredVariantBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372247_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createTrapdoor -protected net.minecraft.client.data.models.BlockModelGenerators m_372261_()V # createBamboo -protected net.minecraft.client.data.models.BlockModelGenerators m_372277_()V # createSnifferEgg -protected net.minecraft.client.data.models.BlockModelGenerators m_372283_(Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/client/renderer/block/model/Variant; # lambda$static$0 -protected net.minecraft.client.data.models.BlockModelGenerators m_372285_(Lnet/minecraft/world/level/block/Block;)V # createLeafLitter -protected net.minecraft.client.data.models.BlockModelGenerators m_372302_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createButton -protected net.minecraft.client.data.models.BlockModelGenerators m_372307_()V # createMangrovePropagule -protected net.minecraft.client.data.models.BlockModelGenerators m_372310_()V # createPointedDripstone -protected net.minecraft.client.data.models.BlockModelGenerators m_372325_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/model/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createMirroredColumnGenerator -protected net.minecraft.client.data.models.BlockModelGenerators m_372364_(Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; # createBooleanModelDispatch -protected net.minecraft.client.data.models.BlockModelGenerators m_372368_()V # createJigsaw -protected net.minecraft.client.data.models.BlockModelGenerators m_372383_()V # createAmethystClusters -protected net.minecraft.client.data.models.BlockModelGenerators m_372396_([Lnet/minecraft/world/level/block/Block;)V # createCampfires -protected net.minecraft.client.data.models.BlockModelGenerators m_372397_(Lnet/minecraft/world/level/block/Block;)V # createLantern -protected net.minecraft.client.data.models.BlockModelGenerators m_372399_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/MultiVariantGenerator; # createSimpleBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372406_()V # createObserver -protected net.minecraft.client.data.models.BlockModelGenerators m_372418_()V # createDaylightDetector -protected net.minecraft.client.data.models.BlockModelGenerators m_372455_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V # createRotatedPillarWithHorizontalVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_372502_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/client/data/models/model/TextureMapping;)V # createCrossBlockWithDefaultItem -protected net.minecraft.client.data.models.BlockModelGenerators m_372503_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createStems -protected net.minecraft.client.data.models.BlockModelGenerators m_372507_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;)V # createAirLikeBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372519_()V # createGrindstone -protected net.minecraft.client.data.models.BlockModelGenerators m_372527_(Lnet/minecraft/world/level/block/Block;)V # registerSimpleFlatItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372545_()V # createLightBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372548_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createCoral -protected net.minecraft.client.data.models.BlockModelGenerators m_372620_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # copyCopperBulbModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372644_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)V # createGrassLikeBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372663_()V # createFrostedIce -protected net.minecraft.client.data.models.BlockModelGenerators m_372681_(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;[Lnet/minecraft/world/level/block/Block;)V # createColoredBlockWithStateRotations -protected net.minecraft.client.data.models.BlockModelGenerators m_372696_()V # createEndPortalFrame -protected net.minecraft.client.data.models.BlockModelGenerators m_372705_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createOrientableTrapdoor -protected net.minecraft.client.data.models.BlockModelGenerators m_372711_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createDoor -protected net.minecraft.client.data.models.BlockModelGenerators m_372719_()V # createChorusFlower -protected net.minecraft.client.data.models.BlockModelGenerators m_372720_()V # createCocoa -protected net.minecraft.client.data.models.BlockModelGenerators m_372724_()V # createSmallDripleaf -protected net.minecraft.client.data.models.BlockModelGenerators m_372726_(Lnet/minecraft/world/level/block/Block;)V # createMultiface -protected net.minecraft.client.data.models.BlockModelGenerators m_372729_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createGrowingPlant -protected net.minecraft.client.data.models.BlockModelGenerators m_372730_()V # createBeds -protected net.minecraft.client.data.models.BlockModelGenerators m_372737_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createCrossBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372739_()V # createNetherPortalBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372745_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createNetherRoots -protected net.minecraft.client.data.models.BlockModelGenerators m_372768_(Lnet/minecraft/world/level/block/Block;)V # createAmethystCluster -protected net.minecraft.client.data.models.BlockModelGenerators m_372788_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # copyDoorModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372818_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; # createTopFireModels -protected net.minecraft.client.data.models.BlockModelGenerators m_372820_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$1 -protected net.minecraft.client.data.models.BlockModelGenerators m_372825_(II)Lnet/minecraft/client/renderer/block/model/Variant; # createTurtleEggModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372827_()V # createMuddyMangroveRoots -protected net.minecraft.client.data.models.BlockModelGenerators m_372830_(Lnet/minecraft/world/level/block/Block;)V # createFlowerBed -protected net.minecraft.client.data.models.BlockModelGenerators m_372831_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # copyModel -protected net.minecraft.client.data.models.BlockModelGenerators m_372857_()V # createSweetBerryBush -protected net.minecraft.client.data.models.BlockModelGenerators m_372870_()V # createSculkCatalyst -protected net.minecraft.client.data.models.BlockModelGenerators m_372876_()V # createBigDripLeafBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_372882_(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;[Lnet/minecraft/world/level/block/Block;)V # createColoredBlockWithRandomRotations -protected net.minecraft.client.data.models.BlockModelGenerators m_372884_()V # createLever -protected net.minecraft.client.data.models.BlockModelGenerators m_372888_(Lnet/minecraft/core/FrontAndTop;)Lnet/minecraft/client/renderer/block/model/VariantMutator; # applyRotation -protected net.minecraft.client.data.models.BlockModelGenerators m_372908_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Z)V # createChest -protected net.minecraft.client.data.models.BlockModelGenerators m_372933_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createPlantWithDefaultItem -protected net.minecraft.client.data.models.BlockModelGenerators m_372942_()V # createStonecutter -protected net.minecraft.client.data.models.BlockModelGenerators m_372944_(Lnet/minecraft/world/level/block/Block;)V # createCreakingHeart -protected net.minecraft.client.data.models.BlockModelGenerators m_372948_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/model/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createNorthWestMirroredCubeGenerator -protected net.minecraft.client.data.models.BlockModelGenerators m_372954_()V # createSmoothStoneSlab -protected net.minecraft.client.data.models.BlockModelGenerators m_372958_()V # createDirtPath -protected net.minecraft.client.data.models.BlockModelGenerators m_372959_()V # createComparator -protected net.minecraft.client.data.models.BlockModelGenerators m_372960_(Lnet/minecraft/world/level/block/Block;)V # createTintedDoublePlant -protected net.minecraft.client.data.models.BlockModelGenerators m_372976_(Lnet/minecraft/world/level/block/Block;)V # createAzalea -protected net.minecraft.client.data.models.BlockModelGenerators m_373004_(Lnet/minecraft/world/level/block/Block;)V # createCommandBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373008_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V # createShulkerBox -protected net.minecraft.client.data.models.BlockModelGenerators m_373026_(Lnet/minecraft/world/item/Item;)V # registerSimpleFlatItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373035_(Lnet/minecraft/world/level/block/Block;)V # createItemWithGrassTint -protected net.minecraft.client.data.models.BlockModelGenerators m_373046_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; # createFlatItemModelWithBlockTextureAndOverlay -protected net.minecraft.client.data.models.BlockModelGenerators m_373071_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/client/data/models/model/TextureMapping;)V # createCrossBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373072_(Lnet/minecraft/world/level/block/Block;)V # createParticleOnlyBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373089_(Lnet/minecraft/world/item/Item;)Lnet/minecraft/resources/Identifier; # createFlatItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373098_()V # createCaveVines -protected net.minecraft.client.data.models.BlockModelGenerators m_373159_()V # createComposter -protected net.minecraft.client.data.models.BlockModelGenerators m_373171_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Ljava/util/function/BiFunction;)V # createCraftingTableLike -protected net.minecraft.client.data.models.BlockModelGenerators m_373177_()V # createTrialSpawner -protected net.minecraft.client.data.models.BlockModelGenerators m_373181_()V # createVine -protected net.minecraft.client.data.models.BlockModelGenerators m_373188_()V # createInfestedStone -protected net.minecraft.client.data.models.BlockModelGenerators m_373195_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/special/SpecialModelRenderer$Unbaked;)V # generateSimpleSpecialItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373216_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; # createFloorFireModels -protected net.minecraft.client.data.models.BlockModelGenerators m_373228_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; # family -protected net.minecraft.client.data.models.BlockModelGenerators m_373255_()V # createPumpkins -protected net.minecraft.client.data.models.BlockModelGenerators m_373266_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createPressurePlate -protected net.minecraft.client.data.models.BlockModelGenerators m_373285_(Lnet/minecraft/world/level/block/state/properties/Property;Ljava/lang/Comparable;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; # createEmptyOrFullDispatch -protected net.minecraft.client.data.models.BlockModelGenerators m_373293_()V # createTripwire -protected net.minecraft.client.data.models.BlockModelGenerators m_373303_(Lnet/minecraft/world/level/block/Block;)V # createMossyCarpet -protected net.minecraft.client.data.models.BlockModelGenerators m_373329_()V # createSculkSensor -protected net.minecraft.client.data.models.BlockModelGenerators m_373330_()V # createPistonHeads -protected net.minecraft.client.data.models.BlockModelGenerators m_373332_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createStairs -protected net.minecraft.client.data.models.BlockModelGenerators m_373333_()V # createBanners -protected net.minecraft.client.data.models.BlockModelGenerators m_373336_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createCrossBlockWithDefaultItem -protected net.minecraft.client.data.models.BlockModelGenerators m_373340_()V # createSnowBlocks -protected net.minecraft.client.data.models.BlockModelGenerators m_373341_(Lnet/minecraft/core/Direction;Lnet/minecraft/world/level/block/state/properties/DripstoneThickness;)Lnet/minecraft/client/data/models/MultiVariant; # createPointedDripstoneVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_373342_(Lnet/minecraft/world/level/block/Block;)V # createDispenserBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373358_()V # createSculkShrieker -protected net.minecraft.client.data.models.BlockModelGenerators m_373367_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createRotatedPillarWithHorizontalVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_373371_(Lnet/minecraft/world/level/block/Block;)V # createNonTemplateModelBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373393_()V # createRedstoneTorch -protected net.minecraft.client.data.models.BlockModelGenerators m_373406_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)V # createAxisAlignedPillarBlockCustomModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373413_(Lnet/minecraft/world/level/block/Block;)V # createMultifaceBlockStates -protected net.minecraft.client.data.models.BlockModelGenerators m_373423_()V # createGrassBlocks -protected net.minecraft.client.data.models.BlockModelGenerators m_373424_()V # createChiseledBookshelf -protected net.minecraft.client.data.models.BlockModelGenerators m_373437_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createNonTemplateModelBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373466_(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/Identifier;)V # registerSimpleItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373467_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/model/TextureMapping;)V # createPistonVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_373468_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/color/item/ItemTintSource;)V # registerSimpleTintedItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373481_(Lnet/minecraft/world/level/block/Block;)V # createMushroomBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373523_()V # createRepeater -protected net.minecraft.client.data.models.BlockModelGenerators m_373526_()V # createRedstoneLamp -protected net.minecraft.client.data.models.BlockModelGenerators m_373558_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V # createFurnace -protected net.minecraft.client.data.models.BlockModelGenerators m_373573_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createSlab -protected net.minecraft.client.data.models.BlockModelGenerators m_373578_()V # createPitcherPlant -protected net.minecraft.client.data.models.BlockModelGenerators m_373608_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createPlant -protected net.minecraft.client.data.models.BlockModelGenerators m_373622_(Lnet/minecraft/world/level/block/Block;Ljava/util/function/Function;)V # createBeeNest -protected net.minecraft.client.data.models.BlockModelGenerators m_373634_()V # createScaffolding -protected net.minecraft.client.data.models.BlockModelGenerators m_373643_()V # createVault -protected net.minecraft.client.data.models.BlockModelGenerators m_373660_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createPillarBlockUVLocked -protected net.minecraft.client.data.models.BlockModelGenerators m_373680_(Lnet/minecraft/world/level/block/Block;)V # createCopperBulb -protected net.minecraft.client.data.models.BlockModelGenerators m_373694_()V # createCauldrons -protected net.minecraft.client.data.models.BlockModelGenerators m_373697_()V # createSoulFire -protected net.minecraft.client.data.models.BlockModelGenerators m_373701_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createWall -protected net.minecraft.client.data.models.BlockModelGenerators m_373707_(Lnet/minecraft/world/level/block/Block;)V # createPottedAzalea -protected net.minecraft.client.data.models.BlockModelGenerators m_373721_(Lnet/minecraft/world/level/block/Block;)V # createNonTemplateHorizontalBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373723_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createGlassBlocks -protected net.minecraft.client.data.models.BlockModelGenerators m_373729_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V # createHorizontallyRotatedBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373730_(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/util/function/Function;)Lnet/minecraft/resources/Identifier; # createSuffixedVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_373795_(ILjava/lang/String;Lnet/minecraft/client/data/models/model/TextureMapping;)Lnet/minecraft/client/renderer/block/model/Variant; # createTurtleEggModel -protected net.minecraft.client.data.models.BlockModelGenerators m_373801_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/resources/Identifier; # createFlatItemModelWithBlockTexture -protected net.minecraft.client.data.models.BlockModelGenerators m_373808_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/model/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createMirroredCubeGenerator -protected net.minecraft.client.data.models.BlockModelGenerators m_373813_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/resources/Identifier;)V # createHead -protected net.minecraft.client.data.models.BlockModelGenerators m_373825_(Lnet/minecraft/world/level/block/Block;)V # createAnvil -protected net.minecraft.client.data.models.BlockModelGenerators m_373827_()V # createTallSeagrass -protected net.minecraft.client.data.models.BlockModelGenerators m_373843_()V # createHeads -protected net.minecraft.client.data.models.BlockModelGenerators m_373844_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createLightningRod -protected net.minecraft.client.data.models.BlockModelGenerators m_373862_()V # createFire -protected net.minecraft.client.data.models.BlockModelGenerators m_373864_()V # createBrewingStand -protected net.minecraft.client.data.models.BlockModelGenerators m_373879_()V # createMagmaBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373916_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/properties/Property;[I)V # createCropBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_373929_()V # createSunflower -protected net.minecraft.client.data.models.BlockModelGenerators m_373936_()V # createLilyPad -protected net.minecraft.client.data.models.BlockModelGenerators m_373941_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; # createSideFireModels -protected net.minecraft.client.data.models.BlockModelGenerators m_373945_()V # createTurtleEgg -protected net.minecraft.client.data.models.BlockModelGenerators m_373974_()V # createBell -protected net.minecraft.client.data.models.BlockModelGenerators m_373984_(Lnet/minecraft/world/level/block/Block;)V # createPassiveRail -protected net.minecraft.client.data.models.BlockModelGenerators m_373989_(Lnet/minecraft/world/level/block/Block;)V # createRotatableColumn -protected net.minecraft.client.data.models.BlockModelGenerators m_374000_(Lnet/minecraft/world/level/block/Block;)V # createRotatedVariantBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374002_(Lnet/minecraft/data/BlockFamily;)V # lambda$run$62 -protected net.minecraft.client.data.models.BlockModelGenerators m_374004_()V # createCalibratedSculkSensor -protected net.minecraft.client.data.models.BlockModelGenerators m_374006_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;)V # createPumpkinVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_374030_()V # createChests -protected net.minecraft.client.data.models.BlockModelGenerators m_374031_(Ljava/lang/Comparable;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Comparable;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createEmptyOrFullDispatch$24 -protected net.minecraft.client.data.models.BlockModelGenerators m_374041_(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)V # registerSimpleFlatItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_374042_(Lnet/minecraft/world/level/block/Block;)V # createTrapdoor -protected net.minecraft.client.data.models.BlockModelGenerators m_374126_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)V # createDoubleBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374134_(I)Lnet/minecraft/client/data/models/MultiVariant; # createBambooModels -protected net.minecraft.client.data.models.BlockModelGenerators m_374141_(Lnet/minecraft/world/level/block/Block;)V # createBrushableBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374146_(Lnet/minecraft/world/level/block/Block;)V # createHangingMoss -protected net.minecraft.client.data.models.BlockModelGenerators m_374177_()V # createCrafterBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374216_(Lnet/minecraft/world/level/block/Block;)V # createOrientableTrapdoor -protected net.minecraft.client.data.models.BlockModelGenerators m_374249_()V # createChorusPlant -protected net.minecraft.client.data.models.BlockModelGenerators m_374256_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createFullAndCarpetBlocks -protected net.minecraft.client.data.models.BlockModelGenerators m_374265_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;)V # createAirLikeBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374268_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V # createBanner -protected net.minecraft.client.data.models.BlockModelGenerators m_374273_()V # createNetherrack -protected net.minecraft.client.data.models.BlockModelGenerators m_374284_()V # createInfestedDeepslate -protected net.minecraft.client.data.models.BlockModelGenerators m_374293_()V # createPistons -protected net.minecraft.client.data.models.BlockModelGenerators m_374299_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createFence -protected net.minecraft.client.data.models.BlockModelGenerators m_374303_(Lnet/minecraft/world/level/block/Block;)V # createNyliumBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374308_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createCandleAndCandleCake -protected net.minecraft.client.data.models.BlockModelGenerators m_374339_()V # createRedstoneWire -protected net.minecraft.client.data.models.BlockModelGenerators m_374347_()V # createBarrel -protected net.minecraft.client.data.models.BlockModelGenerators m_374348_()V # createRespawnAnchor -protected net.minecraft.client.data.models.BlockModelGenerators m_374353_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; # createParticleOnlyBlockModel -protected net.minecraft.client.data.models.BlockModelGenerators m_374355_()V # createFrogspawnBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374363_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createDoublePlantWithDefaultItem -protected net.minecraft.client.data.models.BlockModelGenerators m_374369_(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)V # registerTwoLayerFlatItemModel -protected net.minecraft.client.data.models.BlockModelGenerators m_374411_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V # createBed -protected net.minecraft.client.data.models.BlockModelGenerators m_374412_()V # createTripwireHook -protected net.minecraft.client.data.models.BlockModelGenerators m_374415_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createCustomFence -protected net.minecraft.client.data.models.BlockModelGenerators m_374416_()V # createHopper -protected net.minecraft.client.data.models.BlockModelGenerators m_374434_(Lnet/minecraft/world/level/block/Block;)V # createDoor -protected net.minecraft.client.data.models.BlockModelGenerators m_374440_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createCopperBulb -protected net.minecraft.client.data.models.BlockModelGenerators m_374454_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createCoralFans -protected net.minecraft.client.data.models.BlockModelGenerators m_374464_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createNormalTorch -protected net.minecraft.client.data.models.BlockModelGenerators m_374484_()V # createSeaPickle -protected net.minecraft.client.data.models.BlockModelGenerators m_374486_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V # createDoublePlant -protected net.minecraft.client.data.models.BlockModelGenerators m_374496_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$WoodProvider; # woodProvider -protected net.minecraft.client.data.models.BlockModelGenerators m_374498_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Z)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; # createFenceGate -protected net.minecraft.client.data.models.BlockModelGenerators m_374511_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/world/level/block/state/properties/Property;[I)V # createCrossBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_374514_(Lnet/minecraft/world/level/block/Block;)V # createActiveRail -protected net.minecraft.client.data.models.BlockModelGenerators m_374532_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/renderer/block/model/multipart/Condition;Lnet/minecraft/client/renderer/block/model/VariantMutator;Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Lnet/minecraft/client/data/models/model/ModelTemplate;Z)V # addBookSlotModel -protected net.minecraft.client.data.models.BlockModelGenerators m_374546_()V # createCakeBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_382774_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/world/level/block/entity/vault/VaultState;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createVault$34 -protected net.minecraft.client.data.models.BlockModelGenerators m_382777_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;Lnet/minecraft/world/level/block/state/properties/Property;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$createMultifaceBlockStates$48 -protected net.minecraft.client.data.models.BlockModelGenerators m_382778_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/world/level/block/state/properties/SculkSensorPhase;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createSculkSensor$35 -protected net.minecraft.client.data.models.BlockModelGenerators m_382780_(Ljava/util/function/Function;Lnet/minecraft/world/level/block/state/StateHolder;Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/core/Direction;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$selectMultifaceProperties$47 -protected net.minecraft.client.data.models.BlockModelGenerators m_382783_(Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/util/random/Weighted; # lambda$variants$9 -protected net.minecraft.client.data.models.BlockModelGenerators m_382786_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$3 -protected net.minecraft.client.data.models.BlockModelGenerators m_382787_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$2 -protected net.minecraft.client.data.models.BlockModelGenerators m_382788_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/RailShape;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createActiveRail$20 -protected net.minecraft.client.data.models.BlockModelGenerators m_382791_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;Lnet/minecraft/world/level/block/state/properties/Property;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$createMossyCarpet$50 -protected net.minecraft.client.data.models.BlockModelGenerators m_382792_(Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createTurtleEgg$43 -protected net.minecraft.client.data.models.BlockModelGenerators m_382793_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;Lnet/minecraft/world/level/block/state/properties/Property;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$createMossyCarpet$53 -protected net.minecraft.client.data.models.BlockModelGenerators m_382794_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$4 -protected net.minecraft.client.data.models.BlockModelGenerators m_382795_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/renderer/block/model/multipart/Condition;Lnet/minecraft/client/renderer/block/model/VariantMutator;Lcom/mojang/datafixers/util/Pair;)V # lambda$addSlotStateAndRotationVariants$59 -protected net.minecraft.client.data.models.BlockModelGenerators m_382796_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/world/level/block/state/properties/SculkSensorPhase;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createCalibratedSculkSensor$36 -protected net.minecraft.client.data.models.BlockModelGenerators m_382800_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$8 -protected net.minecraft.client.data.models.BlockModelGenerators m_382801_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;Lnet/minecraft/world/level/block/state/properties/Property;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$createMultifaceBlockStates$49 -protected net.minecraft.client.data.models.BlockModelGenerators m_382802_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$7 -protected net.minecraft.client.data.models.BlockModelGenerators m_382807_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$5 -protected net.minecraft.client.data.models.BlockModelGenerators m_382808_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createSculkCatalyst$55 -protected net.minecraft.client.data.models.BlockModelGenerators m_382809_(Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # lambda$static$6 -protected net.minecraft.client.data.models.BlockModelGenerators m_382810_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createCopperBulb$29 -protected net.minecraft.client.data.models.BlockModelGenerators m_382811_(Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createTrialSpawner$33 -protected net.minecraft.client.data.models.BlockModelGenerators m_384704_(Lnet/minecraft/world/level/block/state/StateHolder;Ljava/util/function/Function;)Ljava/util/Map; # selectMultifaceProperties -protected net.minecraft.client.data.models.BlockModelGenerators m_384866_()Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # condition -protected net.minecraft.client.data.models.BlockModelGenerators m_385280_(Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/client/data/models/MultiVariant; # variant -protected net.minecraft.client.data.models.BlockModelGenerators m_385381_(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/data/models/MultiVariant; # plainVariant -protected net.minecraft.client.data.models.BlockModelGenerators m_385921_([Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/client/data/models/MultiVariant; # variants -protected net.minecraft.client.data.models.BlockModelGenerators m_386106_()V # createTestBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_386644_([Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/renderer/block/model/multipart/Condition; # or -protected net.minecraft.client.data.models.BlockModelGenerators m_387650_(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/block/model/Variant; # plainModel -protected net.minecraft.client.data.models.BlockModelGenerators m_388125_(Lnet/minecraft/client/renderer/block/model/Variant;Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/client/data/models/MultiVariant; # createRotatedVariants -protected net.minecraft.client.data.models.BlockModelGenerators m_388369_(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; # createCreakingHeartModel -protected net.minecraft.client.data.models.BlockModelGenerators m_388485_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;)V # createSegmentedBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_389054_(Lnet/minecraft/client/renderer/block/model/Variant;)Lnet/minecraft/client/data/models/MultiVariant; # createRotatedVariants -protected net.minecraft.client.data.models.BlockModelGenerators m_402965_()V # createDriedGhastBlock -protected net.minecraft.client.data.models.BlockModelGenerators m_414128_(Ljava/util/function/BiConsumer;Lcom/mojang/datafixers/util/Pair;)V # lambda$forEachHorizontalDirection$57 -protected net.minecraft.client.data.models.BlockModelGenerators m_414129_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/core/Direction;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$createChiseledBookshelf$58 -protected net.minecraft.client.data.models.BlockModelGenerators m_414130_(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/SideChainPart;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/core/Direction;Lnet/minecraft/client/renderer/block/model/VariantMutator;)V # lambda$addShelfPart$56 -protected net.minecraft.client.data.models.BlockModelGenerators m_415593_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createCopperLantern -protected net.minecraft.client.data.models.BlockModelGenerators m_416066_(Lnet/minecraft/core/Direction;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/SideChainPart;)Lnet/minecraft/client/renderer/block/model/multipart/Condition; # shelfCondition -protected net.minecraft.client.data.models.BlockModelGenerators m_416075_(Lnet/minecraft/world/level/block/Block;)V # createBarsAndItem -protected net.minecraft.client.data.models.BlockModelGenerators m_416125_(Ljava/util/function/BiConsumer;)V # forEachHorizontalDirection -protected net.minecraft.client.data.models.BlockModelGenerators m_416737_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createCopperChain -protected net.minecraft.client.data.models.BlockModelGenerators m_416934_(Lnet/minecraft/world/level/block/state/properties/EnumProperty;Ljava/lang/Enum;[Ljava/lang/Enum;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # condition -protected net.minecraft.client.data.models.BlockModelGenerators m_416996_()V # createCopperChests -protected net.minecraft.client.data.models.BlockModelGenerators m_417208_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)V # createBars -protected net.minecraft.client.data.models.BlockModelGenerators m_417848_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;)V # createCopperGolemStatue -protected net.minecraft.client.data.models.BlockModelGenerators m_418505_(Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Z)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; # condition -protected net.minecraft.client.data.models.BlockModelGenerators m_418983_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createShelf -protected net.minecraft.client.data.models.BlockModelGenerators m_419554_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;)V # createCopperChainItem -protected net.minecraft.client.data.models.BlockModelGenerators m_419661_()V # createCopperGolemStatues -protected net.minecraft.client.data.models.BlockModelGenerators m_420119_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/SideChainPart;)V # addShelfPart -protected net.minecraft.client.data.models.BlockModelGenerators m_420286_([Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/renderer/block/model/multipart/Condition; # and -protected net.minecraft.client.data.models.BlockModelGenerators m_420564_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V # createBarsAndItem -protected net.minecraft.client.data.models.BlockModelGenerators m_437529_([ILit/unimi/dsi/fastutil/ints/Int2ObjectMap;Lnet/minecraft/world/level/block/Block;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createCropBlock$26 -protected net.minecraft.client.data.models.BlockModelGenerators m_437530_(Ljava/lang/Integer;)Lnet/minecraft/resources/Identifier; # lambda$createDriedGhastBlock$44 -protected net.minecraft.client.data.models.BlockModelGenerators m_437531_([Lnet/minecraft/resources/Identifier;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createRespawnAnchor$61 -protected net.minecraft.client.data.models.BlockModelGenerators m_437532_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createGrassBlocks$32 -protected net.minecraft.client.data.models.BlockModelGenerators m_437533_(Lnet/minecraft/world/level/block/Block;Ljava/lang/Integer;Lnet/minecraft/world/level/block/state/properties/DoubleBlockHalf;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createPitcherCrop$19 -protected net.minecraft.client.data.models.BlockModelGenerators m_437534_(Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createSnowBlocks$38 -protected net.minecraft.client.data.models.BlockModelGenerators m_437535_(Ljava/lang/Boolean;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createTripwireHook$42 -protected net.minecraft.client.data.models.BlockModelGenerators m_437536_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Ljava/lang/Boolean;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createMangrovePropagule$30 -protected net.minecraft.client.data.models.BlockModelGenerators m_437537_(Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$static$13 -protected net.minecraft.client.data.models.BlockModelGenerators m_437538_(Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createSweetBerryBush$41 -protected net.minecraft.client.data.models.BlockModelGenerators m_437539_(Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$static$12 -protected net.minecraft.client.data.models.BlockModelGenerators m_437540_(Lnet/minecraft/world/level/block/Block;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createHangingMoss$54 -protected net.minecraft.client.data.models.BlockModelGenerators m_437541_(Lnet/minecraft/world/level/block/Block;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createBrushableBlock$15 -protected net.minecraft.client.data.models.BlockModelGenerators m_437542_(Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/lang/String;Lnet/minecraft/client/data/models/model/TextureMapping;Lnet/minecraft/client/data/models/BlockModelGenerators$BookSlotModelCacheKey;)Lnet/minecraft/resources/Identifier; # lambda$addBookSlotModel$60 -protected net.minecraft.client.data.models.BlockModelGenerators m_437543_(Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$static$10 -protected net.minecraft.client.data.models.BlockModelGenerators m_437544_([ILnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createCrossBlock$17 -protected net.minecraft.client.data.models.BlockModelGenerators m_437545_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createBarrel$23 -protected net.minecraft.client.data.models.BlockModelGenerators m_437546_(Ljava/util/function/Function;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createDriedGhastBlock$45 -protected net.minecraft.client.data.models.BlockModelGenerators m_437547_(Lnet/minecraft/client/data/models/model/TextureMapping;Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/data/models/model/TextureMapping; # lambda$createChorusFlower$28 -protected net.minecraft.client.data.models.BlockModelGenerators m_437548_(Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$static$11 -protected net.minecraft.client.data.models.BlockModelGenerators m_437549_(Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createSnifferEgg$46 -protected net.minecraft.client.data.models.BlockModelGenerators m_437550_(Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$static$14 -protected net.minecraft.client.data.models.BlockModelGenerators m_437551_(Lnet/minecraft/world/level/block/state/properties/StructureMode;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createStructureBlock$39 -protected net.minecraft.client.data.models.BlockModelGenerators m_437552_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createGrassBlocks$31 -protected net.minecraft.client.data.models.BlockModelGenerators m_437553_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createMossyCarpet$52 -protected net.minecraft.client.data.models.BlockModelGenerators m_437554_(Lnet/minecraft/client/data/models/model/TextureMapping;Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/data/models/model/TextureMapping; # lambda$createCommandBlock$21 -protected net.minecraft.client.data.models.BlockModelGenerators m_437555_(Ljava/util/Map;Lnet/minecraft/world/level/block/state/properties/TestBlockMode;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createTestBlock$40 -protected net.minecraft.client.data.models.BlockModelGenerators m_437556_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createMossyCarpet$51 -protected net.minecraft.client.data.models.BlockModelGenerators m_437557_(Ljava/lang/String;I)Lnet/minecraft/util/random/Weighted; # lambda$createBambooModels$22 -protected net.minecraft.client.data.models.BlockModelGenerators m_437558_(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createRepeater$37 -protected net.minecraft.client.data.models.BlockModelGenerators m_437559_(Lnet/minecraft/world/level/block/Block;I)Lnet/minecraft/resources/Identifier; # lambda$createCropBlock$25 -protected net.minecraft.client.data.models.BlockModelGenerators m_437560_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/lang/Integer;)Lnet/minecraft/client/data/models/MultiVariant; # lambda$createStems$18 -protected net.minecraft.client.data.models.BlockModelGenerators m_437561_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createFurnace$27 -protected net.minecraft.client.data.models.BlockModelGenerators m_437562_(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;Lnet/minecraft/client/data/models/model/TextureMapping;)V # lambda$createCreakingHeartModel$16 +public net.minecraft.client.color.item.ItemTintSources ID_MAPPER +#group protected net.minecraft.client.data.AtlasProvider *() +protected net.minecraft.client.data.AtlasProvider armorTrims()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider bannerPatterns()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider blocksList()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider extractAllMaterialAssets()Ljava/util/stream/Stream; +protected net.minecraft.client.data.AtlasProvider forMapper(Lnet/minecraft/client/renderer/SpriteMapper;)Lnet/minecraft/client/renderer/texture/atlas/SpriteSource; +protected net.minecraft.client.data.AtlasProvider forMaterial(Lnet/minecraft/client/resources/model/sprite/SpriteId;)Lnet/minecraft/client/renderer/texture/atlas/SpriteSource; +protected net.minecraft.client.data.AtlasProvider guiSprites()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider itemsList()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider noPrefixMapper(Ljava/lang/String;)Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider patternTextures()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider shieldPatterns()Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider simpleMapper(Lnet/minecraft/client/renderer/SpriteMapper;)Ljava/util/List; +protected net.minecraft.client.data.AtlasProvider storeAtlas(Lnet/minecraft/data/CachedOutput;Lnet/minecraft/resources/Identifier;Ljava/util/List;)Ljava/util/concurrent/CompletableFuture; #endgroup -protected net.minecraft.client.data.models.BlockModelGenerators f_371124_ # itemModelOutput -protected net.minecraft.client.data.models.BlockModelGenerators f_371133_ # modelOutput -protected net.minecraft.client.data.models.BlockModelGenerators f_371615_ # blockStateOutput +#group protected net.minecraft.client.data.models.BlockModelGenerators *() +protected net.minecraft.client.data.models.BlockModelGenerators addBookSlotModel(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/renderer/block/dispatch/multipart/Condition;Lnet/minecraft/client/renderer/block/dispatch/VariantMutator;Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Lnet/minecraft/client/data/models/model/ModelTemplate;Z)V +protected net.minecraft.client.data.models.BlockModelGenerators addShelfPart(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/SideChainPart;)V +protected net.minecraft.client.data.models.BlockModelGenerators addSlotStateAndRotationVariants(Lnet/minecraft/client/data/models/blockstates/MultiPartGenerator;Lnet/minecraft/client/renderer/block/dispatch/multipart/Condition;Lnet/minecraft/client/renderer/block/dispatch/VariantMutator;)V +protected net.minecraft.client.data.models.BlockModelGenerators and([Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/renderer/block/dispatch/multipart/Condition; +protected net.minecraft.client.data.models.BlockModelGenerators applyRotation(Lnet/minecraft/core/FrontAndTop;)Lnet/minecraft/client/renderer/block/dispatch/VariantMutator; +protected net.minecraft.client.data.models.BlockModelGenerators condition()Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; +protected net.minecraft.client.data.models.BlockModelGenerators condition(Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Z)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; +protected net.minecraft.client.data.models.BlockModelGenerators condition(Lnet/minecraft/world/level/block/state/properties/EnumProperty;Ljava/lang/Enum;[Ljava/lang/Enum;)Lnet/minecraft/client/data/models/blockstates/ConditionBuilder; +protected net.minecraft.client.data.models.BlockModelGenerators copyCopperBulbModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators copyDoorModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators copyModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators copyTrapdoorModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createActiveRail(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAirLikeBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/resources/model/sprite/Material;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAirLikeBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAmethystCluster(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAmethystClusters()V +protected net.minecraft.client.data.models.BlockModelGenerators createAnvil(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAxisAlignedPillarBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createAxisAlignedPillarBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAxisAlignedPillarBlockCustomModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)V +protected net.minecraft.client.data.models.BlockModelGenerators createAzalea(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBamboo()V +protected net.minecraft.client.data.models.BlockModelGenerators createBambooModels(I)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createBanner(Lnet/minecraft/world/item/DyeColor;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBarrel()V +protected net.minecraft.client.data.models.BlockModelGenerators createBars(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBarsAndItem(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBarsAndItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBed(Lnet/minecraft/world/item/DyeColor;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBed(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createBeeNest(Lnet/minecraft/world/level/block/Block;Ljava/util/function/Function;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBell()V +protected net.minecraft.client.data.models.BlockModelGenerators createBigDripLeafBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createBookshelf()V +protected net.minecraft.client.data.models.BlockModelGenerators createBooleanModelDispatch(Lnet/minecraft/world/level/block/state/properties/BooleanProperty;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; +protected net.minecraft.client.data.models.BlockModelGenerators createBrewingStand()V +protected net.minecraft.client.data.models.BlockModelGenerators createBrushableBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createButton(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createCakeBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createCalibratedSculkSensor()V +protected net.minecraft.client.data.models.BlockModelGenerators createCampfires([Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCandleAndCandleCake(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCartographyTable()V +protected net.minecraft.client.data.models.BlockModelGenerators createCauldrons()V +protected net.minecraft.client.data.models.BlockModelGenerators createCaveVines()V +protected net.minecraft.client.data.models.BlockModelGenerators createChest(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/MultiblockChestResources;Z)V +protected net.minecraft.client.data.models.BlockModelGenerators createChest(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Z)V +protected net.minecraft.client.data.models.BlockModelGenerators createChests()V +protected net.minecraft.client.data.models.BlockModelGenerators createChiseledBookshelf()V +protected net.minecraft.client.data.models.BlockModelGenerators createChorusFlower()V +protected net.minecraft.client.data.models.BlockModelGenerators createChorusPlant()V +protected net.minecraft.client.data.models.BlockModelGenerators createCocoa()V +protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithRandomRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Ljava/util/List;)V +protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithStateRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Ljava/util/List;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCommandBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createComparator()V +protected net.minecraft.client.data.models.BlockModelGenerators createComposter()V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperBulb(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperBulb(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createCopperChain(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperChainItem(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperChests()V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperGolemStatue(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperGolemStatues()V +protected net.minecraft.client.data.models.BlockModelGenerators createCopperLantern(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCoral(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCoralFans(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrafterBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createCraftingTableLike(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Ljava/util/function/BiFunction;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCreakingHeart(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCreakingHeartModel(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createCropBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/properties/Property;[I)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrossBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrossBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/client/data/models/model/TextureMapping;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrossBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/world/level/block/state/properties/Property;[I)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrossBlockWithDefaultItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCrossBlockWithDefaultItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;Lnet/minecraft/client/data/models/model/TextureMapping;)V +protected net.minecraft.client.data.models.BlockModelGenerators createCustomFence(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createDaylightDetector()V +protected net.minecraft.client.data.models.BlockModelGenerators createDirtPath()V +protected net.minecraft.client.data.models.BlockModelGenerators createDispenserBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createDoor(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createDoor(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createDoubleBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)V +protected net.minecraft.client.data.models.BlockModelGenerators createDoublePlant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createDoublePlantWithDefaultItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createDriedGhastBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createEmptyOrFullDispatch(Lnet/minecraft/world/level/block/state/properties/Property;Ljava/lang/Comparable;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; +protected net.minecraft.client.data.models.BlockModelGenerators createEndPortalFrame()V +protected net.minecraft.client.data.models.BlockModelGenerators createFarmland()V +protected net.minecraft.client.data.models.BlockModelGenerators createFence(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createFenceGate(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Z)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createFire()V +protected net.minecraft.client.data.models.BlockModelGenerators createFlatItemModel(Lnet/minecraft/world/item/Item;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createFlatItemModelWithBlockTexture(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createFlatItemModelWithBlockTexture(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createFlatItemModelWithBlockTextureAndOverlay(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createFloorFireModels(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createFlowerBed(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createFrogspawnBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createFrostedIce()V +protected net.minecraft.client.data.models.BlockModelGenerators createFullAndCarpetBlocks(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createFurnace(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V +protected net.minecraft.client.data.models.BlockModelGenerators createGlassBlocks(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createGrassBlocks()V +protected net.minecraft.client.data.models.BlockModelGenerators createGrassLikeBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)V +protected net.minecraft.client.data.models.BlockModelGenerators createGrindstone()V +protected net.minecraft.client.data.models.BlockModelGenerators createGrowingPlant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createHangingMoss(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createHangingSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createHead(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/resources/Identifier;)V +protected net.minecraft.client.data.models.BlockModelGenerators createHeads()V +protected net.minecraft.client.data.models.BlockModelGenerators createHopper()V +protected net.minecraft.client.data.models.BlockModelGenerators createHorizontallyRotatedBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V +protected net.minecraft.client.data.models.BlockModelGenerators createInfestedDeepslate()V +protected net.minecraft.client.data.models.BlockModelGenerators createInfestedStone()V +protected net.minecraft.client.data.models.BlockModelGenerators createItemWithGrassTint(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createJigsaw()V +protected net.minecraft.client.data.models.BlockModelGenerators createLantern(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createLeafLitter(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createLever()V +protected net.minecraft.client.data.models.BlockModelGenerators createLightBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createLightningRod(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createLilyPad()V +protected net.minecraft.client.data.models.BlockModelGenerators createMagmaBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createMangrovePropagule()V +protected net.minecraft.client.data.models.BlockModelGenerators createMirroredColumnGenerator(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/dispatch/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createMirroredCubeGenerator(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/dispatch/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createMossyCarpet(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createMuddyMangroveRoots()V +protected net.minecraft.client.data.models.BlockModelGenerators createMultiface(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createMultiface(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.BlockModelGenerators createMultifaceBlockStates(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createMushroomBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNetherPortalBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createNetherRoots(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNetherrack()V +protected net.minecraft.client.data.models.BlockModelGenerators createNonTemplateHorizontalBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNonTemplateModelBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNonTemplateModelBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNormalTorch(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createNorthWestMirroredCubeGenerator(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/renderer/block/dispatch/Variant;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createNyliumBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createObserver()V +protected net.minecraft.client.data.models.BlockModelGenerators createOrientableTrapdoor(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createOrientableTrapdoor(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createParticleOnlyBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createParticleOnlyBlockModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createPassiveRail(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPetrifiedOakSlab()V +protected net.minecraft.client.data.models.BlockModelGenerators createPillarBlockUVLocked(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;Ljava/util/function/BiConsumer;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createPistonHeads()V +protected net.minecraft.client.data.models.BlockModelGenerators createPistonVariant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/model/TextureMapping;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPistons()V +protected net.minecraft.client.data.models.BlockModelGenerators createPitcherCrop()V +protected net.minecraft.client.data.models.BlockModelGenerators createPitcherPlant()V +protected net.minecraft.client.data.models.BlockModelGenerators createPlant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPlantWithDefaultItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPottedAzalea(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPressurePlate(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createPumpkinVariant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;)V +protected net.minecraft.client.data.models.BlockModelGenerators createPumpkins()V +protected net.minecraft.client.data.models.BlockModelGenerators createRedstoneLamp()V +protected net.minecraft.client.data.models.BlockModelGenerators createRedstoneTorch()V +protected net.minecraft.client.data.models.BlockModelGenerators createRedstoneWire()V +protected net.minecraft.client.data.models.BlockModelGenerators createRepeater()V +protected net.minecraft.client.data.models.BlockModelGenerators createRespawnAnchor()V +protected net.minecraft.client.data.models.BlockModelGenerators createRotatableColumn(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedMirroredVariantBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedPillar()Lnet/minecraft/client/data/models/blockstates/PropertyDispatch; +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedPillarWithHorizontalVariant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedPillarWithHorizontalVariant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedVariantBlock(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedVariants(Lnet/minecraft/client/renderer/block/dispatch/Variant;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createRotatedVariants(Lnet/minecraft/client/renderer/block/dispatch/Variant;Lnet/minecraft/client/renderer/block/dispatch/Variant;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createScaffolding()V +protected net.minecraft.client.data.models.BlockModelGenerators createSculkCatalyst()V +protected net.minecraft.client.data.models.BlockModelGenerators createSculkSensor()V +protected net.minecraft.client.data.models.BlockModelGenerators createSculkShrieker()V +protected net.minecraft.client.data.models.BlockModelGenerators createSeaPickle()V +protected net.minecraft.client.data.models.BlockModelGenerators createSegmentedBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;Lnet/minecraft/client/data/models/MultiVariant;Ljava/util/function/Function;)V +protected net.minecraft.client.data.models.BlockModelGenerators createShelf(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createShulkerBox(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V +protected net.minecraft.client.data.models.BlockModelGenerators createSideFireModels(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createSimpleBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/MultiVariantGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createSlab(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createSmallDripleaf()V +protected net.minecraft.client.data.models.BlockModelGenerators createSmithingTable()V +protected net.minecraft.client.data.models.BlockModelGenerators createSmoothStoneSlab()V +protected net.minecraft.client.data.models.BlockModelGenerators createSnifferEgg()V +protected net.minecraft.client.data.models.BlockModelGenerators createSnowBlocks()V +protected net.minecraft.client.data.models.BlockModelGenerators createSoulFire()V +protected net.minecraft.client.data.models.BlockModelGenerators createSpeleothem(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createSpeleothemVariant(Lnet/minecraft/core/Direction;Lnet/minecraft/world/level/block/state/properties/SpeleothemThickness;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createStairs(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createStems(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createStonecutter()V +protected net.minecraft.client.data.models.BlockModelGenerators createStructureBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createSuffixedVariant(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/util/function/Function;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators createSunflower()V +protected net.minecraft.client.data.models.BlockModelGenerators createSweetBerryBush()V +protected net.minecraft.client.data.models.BlockModelGenerators createTallSeagrass()V +protected net.minecraft.client.data.models.BlockModelGenerators createTestBlock()V +protected net.minecraft.client.data.models.BlockModelGenerators createTintedDoublePlant(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createTopFireModels(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createTrapdoor(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createTrapdoor(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createTrialSpawner()V +protected net.minecraft.client.data.models.BlockModelGenerators createTripwire()V +protected net.minecraft.client.data.models.BlockModelGenerators createTripwireHook()V +protected net.minecraft.client.data.models.BlockModelGenerators createTrivialBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TexturedModel$Provider;)V +protected net.minecraft.client.data.models.BlockModelGenerators createTrivialCube(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createTurtleEgg()V +protected net.minecraft.client.data.models.BlockModelGenerators createTurtleEggModel(II)Lnet/minecraft/client/renderer/block/dispatch/Variant; +protected net.minecraft.client.data.models.BlockModelGenerators createTurtleEggModel(ILjava/lang/String;Lnet/minecraft/client/data/models/model/TextureMapping;)Lnet/minecraft/client/renderer/block/dispatch/Variant; +protected net.minecraft.client.data.models.BlockModelGenerators createVault()V +protected net.minecraft.client.data.models.BlockModelGenerators createVine()V +protected net.minecraft.client.data.models.BlockModelGenerators createWall(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; +protected net.minecraft.client.data.models.BlockModelGenerators createWeightedPressurePlate(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators family(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators forEachHorizontalDirection(Ljava/util/function/BiConsumer;)V +protected net.minecraft.client.data.models.BlockModelGenerators generateSimpleSpecialItemModel(Lnet/minecraft/world/level/block/Block;Ljava/util/Optional;Lnet/minecraft/client/renderer/special/SpecialModelRenderer$Unbaked;)V +protected net.minecraft.client.data.models.BlockModelGenerators or([Lnet/minecraft/client/data/models/blockstates/ConditionBuilder;)Lnet/minecraft/client/renderer/block/dispatch/multipart/Condition; +protected net.minecraft.client.data.models.BlockModelGenerators plainModel(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/block/dispatch/Variant; +protected net.minecraft.client.data.models.BlockModelGenerators plainVariant(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleFlatItemModel(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleFlatItemModel(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleFlatItemModel(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleItemModel(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/Identifier;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleItemModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerSimpleTintedItemModel(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/color/item/ItemTintSource;)V +protected net.minecraft.client.data.models.BlockModelGenerators registerTwoLayerFlatItemModel(Lnet/minecraft/world/level/block/Block;Ljava/lang/String;)V +protected net.minecraft.client.data.models.BlockModelGenerators selectMultifaceProperties(Lnet/minecraft/world/level/block/state/StateHolder;Ljava/util/function/Function;)Ljava/util/Map; +protected net.minecraft.client.data.models.BlockModelGenerators shelfCondition(Lnet/minecraft/core/Direction;Ljava/lang/Boolean;Lnet/minecraft/world/level/block/state/properties/SideChainPart;)Lnet/minecraft/client/renderer/block/dispatch/multipart/Condition; +protected net.minecraft.client.data.models.BlockModelGenerators variant(Lnet/minecraft/client/renderer/block/dispatch/Variant;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators variants([Lnet/minecraft/client/renderer/block/dispatch/Variant;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators woodProvider(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$WoodProvider; +#endgroup +protected net.minecraft.client.data.models.BlockModelGenerators blockStateOutput +protected net.minecraft.client.data.models.BlockModelGenerators itemModelOutput +protected net.minecraft.client.data.models.BlockModelGenerators modelOutput public net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider #group protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider *() -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_372389_(Lnet/minecraft/world/level/block/Block;)V # trapdoor -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_373052_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; # door -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_373078_(Lnet/minecraft/client/data/models/model/ModelTemplate;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/resources/Identifier; # getOrCreateModel -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_373633_(Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;)V # lambda$generateFor$1 -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_373732_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; # fullBlockVariant -protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider m_437563_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; # lambda$getOrCreateModel$0 +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider door(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider fullBlockVariant(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider getOrCreateModel(Lnet/minecraft/client/data/models/model/ModelTemplate;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider hangingSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/data/BlockFamily$Variant;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider pillar(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider trapdoor(Lnet/minecraft/world/level/block/Block;)V #endgroup public net.minecraft.client.data.models.BlockModelGenerators$PlantType public net.minecraft.client.data.models.BlockModelGenerators$WoodProvider #group protected net.minecraft.client.data.models.ItemModelGenerators *() -protected net.minecraft.client.data.models.ItemModelGenerators m_372103_(Lnet/minecraft/world/item/Item;I)V # generateDyedItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372177_(Lnet/minecraft/world/item/Item;)V # generateBundleModels -protected net.minecraft.client.data.models.ItemModelGenerators m_372280_(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)V # generateFlatItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372299_(Lnet/minecraft/world/item/Item;)V # generateClockItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372587_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)V # generateLayeredItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372592_(Lnet/minecraft/world/item/Item;)Ljava/util/List; # createCompassModels -protected net.minecraft.client.data.models.ItemModelGenerators m_372634_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)Lnet/minecraft/resources/Identifier; # generateLayeredItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372677_(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/Identifier;)V # addPotionTint -protected net.minecraft.client.data.models.ItemModelGenerators m_372690_(Lnet/minecraft/world/item/Item;)V # generateCrossbow -protected net.minecraft.client.data.models.ItemModelGenerators m_372771_(Lnet/minecraft/world/item/Item;)V # generateGoatHorn -protected net.minecraft.client.data.models.ItemModelGenerators m_372861_(Lnet/minecraft/world/item/Item;)V # generatePotion -protected net.minecraft.client.data.models.ItemModelGenerators m_372885_(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)Lnet/minecraft/resources/Identifier; # generateLayeredItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372915_(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/color/item/ItemTintSource;)V # generateItemWithTintedOverlay -protected net.minecraft.client.data.models.ItemModelGenerators m_372919_(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/Identifier;Z)V # generateTrimmableItem -protected net.minecraft.client.data.models.ItemModelGenerators m_372969_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; # createFlatItemModel -protected net.minecraft.client.data.models.ItemModelGenerators m_373030_(Lnet/minecraft/world/item/Item;)V # generateShield -protected net.minecraft.client.data.models.ItemModelGenerators m_373037_(Lnet/minecraft/world/item/Item;)V # generateStandardCompassItem -protected net.minecraft.client.data.models.ItemModelGenerators m_373158_(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; # generateBundleCoverModel -protected net.minecraft.client.data.models.ItemModelGenerators m_373235_(Lnet/minecraft/world/item/Item;)V # generateTippedArrow -protected net.minecraft.client.data.models.ItemModelGenerators m_373294_(Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;)Lnet/minecraft/client/renderer/item/ItemModel$Unbaked; # createFlatModelDispatch -protected net.minecraft.client.data.models.ItemModelGenerators m_373463_(Lnet/minecraft/world/item/Item;)V # declareCustomModelItem -protected net.minecraft.client.data.models.ItemModelGenerators m_373547_(Lnet/minecraft/world/item/Item;)V # generateSpyglass -protected net.minecraft.client.data.models.ItemModelGenerators m_373727_(Lnet/minecraft/world/item/Item;)V # generateElytra -protected net.minecraft.client.data.models.ItemModelGenerators m_373789_(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/renderer/item/properties/conditional/ConditionalItemModelProperty;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;)V # generateBooleanDispatch -protected net.minecraft.client.data.models.ItemModelGenerators m_373819_(Lnet/minecraft/world/item/Item;Ljava/lang/String;Lnet/minecraft/client/color/item/ItemTintSource;)V # generateItemWithTintedOverlay -protected net.minecraft.client.data.models.ItemModelGenerators m_373839_(Lnet/minecraft/world/item/Item;)V # generateTrident -protected net.minecraft.client.data.models.ItemModelGenerators m_373858_(Lnet/minecraft/world/item/Item;Ljava/lang/String;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; # createFlatItemModel -protected net.minecraft.client.data.models.ItemModelGenerators m_373869_(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; # createFlatItemModel -protected net.minecraft.client.data.models.ItemModelGenerators m_373892_(Lnet/minecraft/world/item/Item;)V # generateTwoLayerDyedItem -protected net.minecraft.client.data.models.ItemModelGenerators m_374089_(Lnet/minecraft/world/item/Item;)V # generateBow -protected net.minecraft.client.data.models.ItemModelGenerators m_374190_(Lnet/minecraft/world/item/Item;)V # generateFishingRod -protected net.minecraft.client.data.models.ItemModelGenerators m_374289_(Lnet/minecraft/world/item/Item;)V # generateBrush -protected net.minecraft.client.data.models.ItemModelGenerators m_374337_(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)V # generateFlatItem -protected net.minecraft.client.data.models.ItemModelGenerators m_374365_(Lnet/minecraft/world/item/Item;)V # generateRecoveryCompassItem -protected net.minecraft.client.data.models.ItemModelGenerators m_440296_(Lnet/minecraft/world/item/Item;)V # generateSpear -protected net.minecraft.client.data.models.ItemModelGenerators m_443417_(Lnet/minecraft/world/item/Item;I)V # generateItemWithTintedBaseLayer +protected net.minecraft.client.data.models.ItemModelGenerators addPotionTint(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/Identifier;)V +protected net.minecraft.client.data.models.ItemModelGenerators createCompassModels(Lnet/minecraft/world/item/Item;)Ljava/util/List; +protected net.minecraft.client.data.models.ItemModelGenerators createFlatItemModel(Lnet/minecraft/world/item/Item;Ljava/lang/String;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators createFlatItemModel(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators createFlatItemModel(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators createFlatModelDispatch(Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;)Lnet/minecraft/client/renderer/item/ItemModel$Unbaked; +protected net.minecraft.client.data.models.ItemModelGenerators declareCustomModelItem(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateBooleanDispatch(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/renderer/item/properties/conditional/ConditionalItemModelProperty;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;Lnet/minecraft/client/renderer/item/ItemModel$Unbaked;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateBow(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateBrush(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateBundleCoverModel(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators generateBundleModels(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateClockItem(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateCrossbow(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateDyedItem(Lnet/minecraft/world/item/Item;I)V +protected net.minecraft.client.data.models.ItemModelGenerators generateElytra(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateFishingRod(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateFlatItem(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateFlatItem(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;Lnet/minecraft/client/data/models/model/ModelTemplate;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateGoatHorn(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateItemWithTintedBaseLayer(Lnet/minecraft/world/item/Item;I)V +protected net.minecraft.client.data.models.ItemModelGenerators generateItemWithTintedOverlay(Lnet/minecraft/world/item/Item;Ljava/lang/String;Lnet/minecraft/client/color/item/ItemTintSource;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateItemWithTintedOverlay(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/color/item/ItemTintSource;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateLayeredItem(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/resources/model/sprite/Material;Lnet/minecraft/client/resources/model/sprite/Material;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators generateLayeredItem(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/resources/model/sprite/Material;Lnet/minecraft/client/resources/model/sprite/Material;Lnet/minecraft/client/resources/model/sprite/Material;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateLayeredItem(Lnet/minecraft/world/item/Item;Lnet/minecraft/client/resources/model/sprite/Material;Lnet/minecraft/client/resources/model/sprite/Material;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.ItemModelGenerators generatePotion(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateRecoveryCompassItem(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateShield(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateSpear(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateSpyglass(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateStandardCompassItem(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateTippedArrow(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateTrident(Lnet/minecraft/world/item/Item;)V +protected net.minecraft.client.data.models.ItemModelGenerators generateTrimmableItem(Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/Identifier;Z)V +protected net.minecraft.client.data.models.ItemModelGenerators generateTwoLayerDyedItem(Lnet/minecraft/world/item/Item;)V #endgroup -protected net.minecraft.client.data.models.ItemModelGenerators f_370758_ # modelOutput -protected net.minecraft.client.data.models.ItemModelGenerators f_370978_ # itemModelOutput +protected net.minecraft.client.data.models.ItemModelGenerators itemModelOutput +protected net.minecraft.client.data.models.ItemModelGenerators modelOutput public net.minecraft.client.data.models.ModelProvider$BlockStateGeneratorCollector -public net.minecraft.client.data.models.ModelProvider$BlockStateGeneratorCollector ()V # constructor +public net.minecraft.client.data.models.ModelProvider$BlockStateGeneratorCollector ()V public net.minecraft.client.data.models.ModelProvider$ItemInfoCollector -public net.minecraft.client.data.models.ModelProvider$ItemInfoCollector ()V # constructor +public net.minecraft.client.data.models.ModelProvider$ItemInfoCollector ()V public net.minecraft.client.data.models.ModelProvider$SimpleModelCollector -public net.minecraft.client.data.models.ModelProvider$SimpleModelCollector ()V # constructor -#group public net.minecraft.client.gui.Gui *() -public 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_193836_()V # tickAutosaveIndicator -public net.minecraft.client.gui.Gui m_232354_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;IIII)V # renderArmor -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;Lnet/minecraft/client/DeltaTracker;)V # renderCrosshair -public net.minecraft.client.gui.Gui m_280154_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;)V # renderVignette -public net.minecraft.client.gui.Gui m_280155_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/resources/Identifier;F)V # renderTextureOverlay -public net.minecraft.client.gui.Gui m_280173_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderPlayerHealth -public net.minecraft.client.gui.Gui m_280250_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderVehicleHealth -public net.minecraft.client.gui.Gui m_280278_(Lnet/minecraft/client/gui/GuiGraphics;F)V # renderSpyglassOverlay -public net.minecraft.client.gui.Gui m_280295_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderSelectedItemName -public net.minecraft.client.gui.Gui m_280339_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderDemoOverlay -public net.minecraft.client.gui.Gui m_280379_(Lnet/minecraft/client/gui/GuiGraphics;F)V # renderPortalOverlay -public net.minecraft.client.gui.Gui m_280523_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderEffects -public net.minecraft.client.gui.Gui m_280585_(Lnet/minecraft/client/gui/GuiGraphics;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V # renderSlot -public net.minecraft.client.gui.Gui m_280593_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Gui$HeartType;IIZZZ)V # renderHeart -public net.minecraft.client.gui.Gui m_303979_(Lnet/minecraft/world/scores/PlayerScoreEntry;)Z # lambda$displayScoreboardSidebar$7 -public net.minecraft.client.gui.Gui m_303980_(I)[Lnet/minecraft/client/gui/Gui$1DisplayEntry; # lambda$displayScoreboardSidebar$9 -public net.minecraft.client.gui.Gui m_303981_(Lnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/network/chat/numbers/NumberFormat;Lnet/minecraft/world/scores/PlayerScoreEntry;)Lnet/minecraft/client/gui/Gui$1DisplayEntry; # lambda$displayScoreboardSidebar$8 -public net.minecraft.client.gui.Gui m_318727_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderCameraOverlays -public net.minecraft.client.gui.Gui m_319215_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderHotbarAndDecorations -public net.minecraft.client.gui.Gui m_320053_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderTabList -public net.minecraft.client.gui.Gui m_320133_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;II)V # renderFood -public net.minecraft.client.gui.Gui m_320668_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderTitle -public net.minecraft.client.gui.Gui m_322096_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderChat -public net.minecraft.client.gui.Gui m_322680_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderSleepOverlay -public net.minecraft.client.gui.Gui m_323286_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderScoreboardSidebar -public net.minecraft.client.gui.Gui m_324281_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderOverlayMessage -public net.minecraft.client.gui.Gui m_324469_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderItemHotbar -public net.minecraft.client.gui.Gui m_349660_(Ljava/lang/String;)Ljava/lang/String; # lambda$renderCameraOverlays$5 -public net.minecraft.client.gui.Gui m_351658_(III)I # getCurrentAirSupplyBubble -public net.minecraft.client.gui.Gui m_352455_(ILnet/minecraft/world/entity/player/Player;I)V # playAirBubblePoppedSound -public net.minecraft.client.gui.Gui m_353157_(IZ)I # getEmptyBubbleDelayDuration -public net.minecraft.client.gui.Gui m_355810_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;III)V # renderAirBubbles -public net.minecraft.client.gui.Gui m_355965_(II)I # getAirBubbleYLine -public net.minecraft.client.gui.Gui m_356285_(Lnet/minecraft/client/gui/GuiGraphics;F)V # renderConfusionOverlay -public net.minecraft.client.gui.Gui m_400570_(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer; # lambda$new$3 -public net.minecraft.client.gui.Gui m_400572_(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer; # lambda$new$2 -public net.minecraft.client.gui.Gui m_400573_(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer; # lambda$new$1 -public net.minecraft.client.gui.Gui m_400574_()Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer; # lambda$new$0 -public net.minecraft.client.gui.Gui m_401964_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V # renderBossOverlay -public net.minecraft.client.gui.Gui m_402852_()Z # willPrioritizeExperienceInfo -public net.minecraft.client.gui.Gui m_402918_()Lnet/minecraft/client/gui/Gui$ContextualInfo; # nextContextualInfoState -public net.minecraft.client.gui.Gui m_403208_()Z # willPrioritizeJumpInfo -public net.minecraft.client.gui.Gui m_403250_(Lnet/minecraft/client/gui/GuiGraphics;Z)V # renderSubtitleOverlay -public net.minecraft.client.gui.Gui m_414133_(Lnet/minecraft/client/gui/GuiGraphics;)V # lambda$renderSubtitleOverlay$4 -public net.minecraft.client.gui.Gui m_437571_(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/resources/Identifier; # lambda$getMobEffectSprite$6 -public net.minecraft.client.gui.Gui m_93012_(I)I # getVisibleVehicleHeartRows -public net.minecraft.client.gui.Gui m_93020_(Lnet/minecraft/world/entity/Entity;)V # updateVignetteBrightness -public net.minecraft.client.gui.Gui m_93022_(Lnet/minecraft/world/entity/LivingEntity;)I # getVehicleMaxHearts -public net.minecraft.client.gui.Gui m_93024_(Lnet/minecraft/world/phys/HitResult;)Z # canRenderCrosshairForSpectator -public net.minecraft.client.gui.Gui m_93066_()V # tick -public net.minecraft.client.gui.Gui m_93092_()Lnet/minecraft/world/entity/player/Player; # getCameraPlayer -public net.minecraft.client.gui.Gui m_93093_()Lnet/minecraft/world/entity/LivingEntity; # getPlayerVehicleWithHealth +public net.minecraft.client.data.models.ModelProvider$SimpleModelCollector ()V +public net.minecraft.client.gui.GuiGraphicsExtractor componentHoverEffect(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Style;II)V +#group public net.minecraft.client.gui.Hud *() +public net.minecraft.client.gui.Hud canRenderCrosshairForSpectator(Lnet/minecraft/world/phys/HitResult;)Z +public net.minecraft.client.gui.Hud displayScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/scores/Objective;)V +public net.minecraft.client.gui.Hud extractAirBubbles(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;III)V +public net.minecraft.client.gui.Hud extractArmor(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIII)V +public net.minecraft.client.gui.Hud extractBossOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractCameraOverlays(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractChat(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractConfusionOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractCrosshair(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractDemoOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractEffects(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractFood(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;II)V +public net.minecraft.client.gui.Hud extractHeart(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/gui/Hud$HeartType;IIZZZ)V +public net.minecraft.client.gui.Hud extractHearts(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V +public net.minecraft.client.gui.Hud extractHotbarAndDecorations(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractItemHotbar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractOverlayMessage(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractPlayerHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractPortalOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractSelectedItemName(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractSleepOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractSlot(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V +public net.minecraft.client.gui.Hud extractSpyglassOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractSubtitleOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Z)V +public net.minecraft.client.gui.Hud extractTabList(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractTextureOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/resources/Identifier;F)V +public net.minecraft.client.gui.Hud extractTitle(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractVehicleHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractVignette(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/Entity;)V +public net.minecraft.client.gui.Hud getAirBubbleYLine(II)I +public net.minecraft.client.gui.Hud getCameraPlayer()Lnet/minecraft/world/entity/player/Player; +public net.minecraft.client.gui.Hud getCurrentAirSupplyBubble(III)I +public net.minecraft.client.gui.Hud getEmptyBubbleDelayDuration(IZ)I +public net.minecraft.client.gui.Hud getPlayerVehicleWithHealth()Lnet/minecraft/world/entity/LivingEntity; +public net.minecraft.client.gui.Hud getVehicleMaxHearts(Lnet/minecraft/world/entity/LivingEntity;)I +public net.minecraft.client.gui.Hud getVisibleVehicleHeartRows(I)I +public net.minecraft.client.gui.Hud nextContextualInfoState()Lnet/minecraft/client/gui/Hud$ContextualInfo; +public net.minecraft.client.gui.Hud playAirBubblePoppedSound(ILnet/minecraft/world/entity/player/Player;I)V +public net.minecraft.client.gui.Hud tick()V +public net.minecraft.client.gui.Hud tickAutosaveIndicator()V +public net.minecraft.client.gui.Hud updateVignetteBrightness(Lnet/minecraft/world/entity/Entity;)V +public net.minecraft.client.gui.Hud willPrioritizeExperienceInfo()Z +public net.minecraft.client.gui.Hud willPrioritizeJumpInfo()Z #endgroup -public net.minecraft.client.gui.GuiGraphics$ScissorStack -public net.minecraft.client.gui.GuiGraphics$ScissorStack ()V # constructor -protected net.minecraft.client.gui.components.AbstractButton f_290895_ # SPRITES -protected net.minecraft.client.gui.components.AbstractSelectionList$Entry f_93521_ # list -protected net.minecraft.client.gui.components.AbstractSliderButton m_293290_()Lnet/minecraft/resources/Identifier; # getHandleSprite -protected net.minecraft.client.gui.components.AbstractSliderButton m_293389_()Lnet/minecraft/resources/Identifier; # getSprite -public net.minecraft.client.gui.components.ChatComponent m_93814_()I # getHeight -public net.minecraft.client.gui.components.ChatComponent m_93815_()D # getScale -protected net.minecraft.client.gui.components.DebugScreenOverlay m_286013_(Lnet/minecraft/client/gui/GuiGraphics;Ljava/util/List;Z)V # renderLines -public net.minecraft.client.gui.screens.MenuScreens m_96206_(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V # register +protected net.minecraft.client.gui.components.AbstractButton SPRITES +protected net.minecraft.client.gui.components.AbstractSelectionList$Entry list +protected net.minecraft.client.gui.components.AbstractSliderButton getHandleSprite()Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.gui.components.AbstractSliderButton getSprite()Lnet/minecraft/resources/Identifier; +public net.minecraft.client.gui.components.ChatComponent getHeight()I +public net.minecraft.client.gui.components.ChatComponent getScale()D +public net.minecraft.client.gui.components.ChatComponent getWidth()I +public net.minecraft.client.gui.components.debug.DebugScreenEntries register(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier; +public net.minecraft.client.gui.screens.MenuScreens register(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V public net.minecraft.client.gui.screens.MenuScreens$ScreenConstructor -public net.minecraft.client.gui.screens.Screen f_169369_ # renderables -protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_351642_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderSlotHighlightBack -protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_352078_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderSlotHighlightFront -public net.minecraft.client.model.geom.LayerDefinitions f_171106_ # OUTER_ARMOR_DEFORMATION -public net.minecraft.client.model.geom.LayerDefinitions f_171107_ # INNER_ARMOR_DEFORMATION -public net.minecraft.client.multiplayer.ClientPacketListener f_104899_ # commands -public net.minecraft.client.multiplayer.ClientPacketListener f_399181_ # COMMAND_NODE_BUILDER -public net.minecraft.client.multiplayer.SessionSearchTrees f_336706_ # CREATIVE_TAGS -public net.minecraft.client.multiplayer.SessionSearchTrees f_337599_ # CREATIVE_NAMES +public net.minecraft.client.gui.screens.Screen renderables +public net.minecraft.client.model.geom.LayerDefinitions INNER_ARMOR_DEFORMATION +public net.minecraft.client.model.geom.LayerDefinitions OUTER_ARMOR_DEFORMATION +public net.minecraft.client.multiplayer.ClientPacketListener COMMAND_NODE_BUILDER +public net.minecraft.client.multiplayer.ClientPacketListener commands +public net.minecraft.client.multiplayer.SessionSearchTrees CREATIVE_NAMES +public net.minecraft.client.multiplayer.SessionSearchTrees CREATIVE_TAGS public net.minecraft.client.multiplayer.SessionSearchTrees$Key -public net.minecraft.client.multiplayer.SessionSearchTrees$Key ()V # constructor -public net.minecraft.client.particle.ParticleResources m_415611_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleResources$SpriteParticleRegistration;)V # register -public net.minecraft.client.particle.ParticleResources m_419483_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider;)V # register +public net.minecraft.client.multiplayer.SessionSearchTrees$Key ()V +public net.minecraft.client.particle.ParticleResources register(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider;)V +public net.minecraft.client.particle.ParticleResources register(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleResources$SpriteParticleRegistration;)V public net.minecraft.client.particle.ParticleResources$SpriteParticleRegistration -public net.minecraft.client.player.ClientInput f_381292_ # moveVector -private-f net.minecraft.client.renderer.LevelRenderer f_348825_ # weatherEffectRenderer -public net.minecraft.client.renderer.LevelRenderer m_109817_()Z # shouldShowEntityOutlines +public net.minecraft.client.player.ClientInput moveVector +private-f net.minecraft.client.renderer.LevelRenderer weatherEffectRenderer #group public net.minecraft.client.renderer.RenderPipelines * -public net.minecraft.client.renderer.RenderPipelines f_379621_ # GUI_TEXTURED_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380033_ # DEBUG_FILLED_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380078_ # TERRAIN_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380180_ # TEXT_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380191_ # PARTICLE_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380221_ # FOG_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380403_ # END_PORTAL_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_380564_ # OUTLINE_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_381014_ # CLOUDS_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_381310_ # WEATHER_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_381389_ # PIPELINES_BY_LOCATION -public net.minecraft.client.renderer.RenderPipelines f_381976_ # ENTITY_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_382486_ # LINES_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_382524_ # GUI_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_382587_ # BEACON_BEAM_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_398868_ # MATRICES_PROJECTION_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_399346_ # GLOBALS_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_399373_ # ENTITY_EMISSIVE_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_400011_ # MATRICES_FOG_LIGHT_DIR_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_400219_ # MATRICES_FOG_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_412883_ # GUI_TEXT_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_434495_ # BLOCK_SNIPPET -public net.minecraft.client.renderer.RenderPipelines f_435549_ # GENERIC_BLOCKS_SNIPPET +public net.minecraft.client.renderer.RenderPipelines ALPHA_CUTOUT_THRESHOLD_CUTOUT_TERRAIN +public net.minecraft.client.renderer.RenderPipelines ALPHA_CUTOUT_THRESHOLD_DEFAULT +public net.minecraft.client.renderer.RenderPipelines BEACON_BEAM_SNIPPET +public net.minecraft.client.renderer.RenderPipelines BLOCK_SNIPPET +public net.minecraft.client.renderer.RenderPipelines CLOUDS_SNIPPET +public net.minecraft.client.renderer.RenderPipelines DEBUG_FILLED_SNIPPET +public net.minecraft.client.renderer.RenderPipelines END_PORTAL_SNIPPET +public net.minecraft.client.renderer.RenderPipelines ENTITY_EMISSIVE_SNIPPET +public net.minecraft.client.renderer.RenderPipelines ENTITY_SNIPPET +public net.minecraft.client.renderer.RenderPipelines GENERIC_BLOCKS_SNIPPET +public net.minecraft.client.renderer.RenderPipelines GLOBALS_SNIPPET +public net.minecraft.client.renderer.RenderPipelines GUI_SNIPPET +public net.minecraft.client.renderer.RenderPipelines GUI_TEXTURED_SNIPPET +public net.minecraft.client.renderer.RenderPipelines GUI_TEXT_SNIPPET +public net.minecraft.client.renderer.RenderPipelines ITEM_SNIPPET +public net.minecraft.client.renderer.RenderPipelines LINES_SNIPPET +public net.minecraft.client.renderer.RenderPipelines MATRICES_FOG_LIGHT_DIR_SNIPPET +public net.minecraft.client.renderer.RenderPipelines MATRICES_FOG_SNIPPET +public net.minecraft.client.renderer.RenderPipelines OUTLINE_SNIPPET +public net.minecraft.client.renderer.RenderPipelines PARTICLE_SNIPPET +public net.minecraft.client.renderer.RenderPipelines PIPELINES_BY_LOCATION +public net.minecraft.client.renderer.RenderPipelines TERRAIN_SNIPPET +public net.minecraft.client.renderer.RenderPipelines TEXT_SNIPPET +public net.minecraft.client.renderer.RenderPipelines WEATHER_SNIPPET +public net.minecraft.client.renderer.RenderPipelines WORLD_TEXT_SNIPPET #endgroup -public net.minecraft.client.renderer.block.model.BlockElement$Deserializer -public net.minecraft.client.renderer.block.model.BlockElement$Deserializer ()V # constructor -public net.minecraft.client.renderer.block.model.BlockElementFace$Deserializer -public net.minecraft.client.renderer.block.model.BlockElementFace$Deserializer ()V # constructor -public net.minecraft.client.renderer.block.model.BlockModel f_111418_ # parent -public net.minecraft.client.renderer.block.model.BlockModel f_370667_ # textureSlots -public net.minecraft.client.renderer.block.model.ItemModelGenerator m_111638_(ILjava/lang/String;Lnet/minecraft/client/renderer/texture/SpriteContents;)Ljava/util/List; # processFrames -public net.minecraft.client.renderer.block.model.ItemTransform$Deserializer -public net.minecraft.client.renderer.block.model.ItemTransform$Deserializer ()V # constructor -public net.minecraft.client.renderer.block.model.ItemTransform$Deserializer f_111769_ # DEFAULT_ROTATION -public net.minecraft.client.renderer.block.model.ItemTransform$Deserializer f_111770_ # DEFAULT_TRANSLATION -public net.minecraft.client.renderer.block.model.ItemTransform$Deserializer f_111771_ # DEFAULT_SCALE -public net.minecraft.client.renderer.block.model.ItemTransforms$Deserializer -public net.minecraft.client.renderer.block.model.ItemTransforms$Deserializer ()V # constructor -public net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher f_112253_ # fontRenderer - needed for rendering text in TESR items before entering world -public net.minecraft.client.renderer.blockentity.BlockEntityRenderers m_173590_(Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/client/renderer/blockentity/BlockEntityRendererProvider;)V # register -protected net.minecraft.client.renderer.blockentity.ChestRenderer m_420143_(Lnet/minecraft/world/level/block/entity/BlockEntity;Z)Lnet/minecraft/client/renderer/blockentity/state/ChestRenderState$ChestMaterialType; # getChestMaterial -public net.minecraft.client.renderer.blockentity.SkullBlockRenderer f_112519_ # SKIN_BY_TYPE -public net.minecraft.client.renderer.entity.EntityRenderDispatcher f_114362_ # renderers -public net.minecraft.client.renderer.entity.EntityRenderers m_174036_(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/client/renderer/entity/EntityRendererProvider;)V # register -public net.minecraft.client.renderer.entity.ItemRenderer m_115162_(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Ljava/util/List;[III)V # renderQuadList -public net.minecraft.client.renderer.entity.LivingEntityRenderer m_115326_(Lnet/minecraft/client/renderer/entity/layers/RenderLayer;)Z # addLayer -protected net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer m_117078_(Lnet/minecraft/client/renderer/entity/state/HumanoidRenderState;Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/client/model/HumanoidModel; # getArmorModel -protected net.minecraft.client.renderer.entity.layers.WingsLayer m_356494_(Lnet/minecraft/client/renderer/entity/state/HumanoidRenderState;)Lnet/minecraft/resources/Identifier; # getPlayerElytraTexture -public net.minecraft.client.renderer.rendertype.RenderType m_446098_(Ljava/lang/String;Lnet/minecraft/client/renderer/rendertype/RenderSetup;)Lnet/minecraft/client/renderer/rendertype/RenderType; # create -public net.minecraft.client.renderer.texture.SpriteContents f_243731_ # byMipLevel -default net.minecraft.client.renderer.texture.SpriteContents f_244575_ # animatedTexture -default net.minecraft.client.renderer.texture.SpriteContents m_245088_()I # getFrameCount -public net.minecraft.client.resources.ClientPackSource m_246691_(Ljava/nio/file/Path;)Lnet/minecraft/server/packs/VanillaPackResources; # createVanillaPackSource +public net.minecraft.client.renderer.blockentity.BlockEntityRenderers register(Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/client/renderer/blockentity/BlockEntityRendererProvider;)V +protected net.minecraft.client.renderer.blockentity.ChestRenderer getChestMaterial(Lnet/minecraft/world/level/block/entity/BlockEntity;Z)Lnet/minecraft/client/renderer/blockentity/state/ChestRenderState$ChestMaterialType; +public net.minecraft.client.renderer.blockentity.SkullBlockRenderer SKIN_BY_TYPE +public net.minecraft.client.renderer.entity.EntityRenderDispatcher renderers +public net.minecraft.client.renderer.entity.EntityRenderers register(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/client/renderer/entity/EntityRendererProvider;)V +public net.minecraft.client.renderer.entity.LivingEntityRenderer addLayer(Lnet/minecraft/client/renderer/entity/layers/RenderLayer;)Z +protected net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer getArmorModel(Lnet/minecraft/client/renderer/entity/state/HumanoidRenderState;Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/client/model/HumanoidModel; +protected net.minecraft.client.renderer.entity.layers.WingsLayer getPlayerElytraTexture(Lnet/minecraft/client/renderer/entity/state/HumanoidRenderState;)Lnet/minecraft/resources/Identifier; +public net.minecraft.client.renderer.rendertype.RenderType create(Ljava/lang/String;Lnet/minecraft/client/renderer/rendertype/RenderSetup;)Lnet/minecraft/client/renderer/rendertype/RenderType; +default net.minecraft.client.renderer.texture.SpriteContents animatedTexture +public net.minecraft.client.renderer.texture.SpriteContents byMipLevel +default net.minecraft.client.renderer.texture.SpriteContents getFrameCount()I +public net.minecraft.client.renderer.texture.SpriteContents$AnimatedTexture +public net.minecraft.client.renderer.texture.SpriteContents$AnimatedTexture getFrameX(I)I +public net.minecraft.client.renderer.texture.SpriteContents$AnimatedTexture getFrameY(I)I +public net.minecraft.client.resources.ClientPackSource createVanillaPackSource(Ljava/nio/file/Path;)Lnet/minecraft/server/packs/VanillaPackResources; public net.minecraft.client.resources.model.ModelDiscovery$ModelWrapper -public net.minecraft.client.sounds.SoundEngine f_120217_ # soundManager -public net.minecraft.commands.CommandSourceStack f_81288_ # source -public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121229_()V # finalizePredicates -public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121317_()V # parseOptions -public net.minecraft.commands.arguments.selector.options.EntitySelectorOptions m_121453_(Ljava/lang/String;Lnet/minecraft/commands/arguments/selector/options/EntitySelectorOptions$Modifier;Ljava/util/function/Predicate;Lnet/minecraft/network/chat/Component;)V # register -public net.minecraft.core.Holder$Reference m_205769_(Ljava/util/Collection;)V # bindTags -public net.minecraft.core.Holder$Reference m_246870_(Lnet/minecraft/resources/ResourceKey;)V # bindKey -public net.minecraft.core.Holder$Reference m_247654_(Ljava/lang/Object;)V # bindValue +public net.minecraft.client.resources.model.cuboid.ItemModelGenerator NORTH_FACE_UVS +public net.minecraft.client.resources.model.cuboid.ItemModelGenerator SOUTH_FACE_UVS +public net.minecraft.client.resources.model.cuboid.ItemModelGenerator bakeExtrudedSprite(Lnet/minecraft/client/resources/model/geometry/QuadCollection$Builder;Lnet/minecraft/client/resources/model/ModelBaker$Interner;Lnet/minecraft/client/renderer/block/dispatch/ModelState;Lnet/minecraft/client/resources/model/geometry/BakedQuad$MaterialInfo;)V +public net.minecraft.client.resources.model.cuboid.ItemModelGenerator bakeSideFaces(Lnet/minecraft/client/resources/model/geometry/QuadCollection$Builder;Lnet/minecraft/client/resources/model/ModelBaker$Interner;Lnet/minecraft/client/renderer/block/dispatch/ModelState;Lnet/minecraft/client/resources/model/geometry/BakedQuad$MaterialInfo;)V +public net.minecraft.client.sounds.SoundEngine soundManager +public net.minecraft.commands.CommandSourceStack source +public net.minecraft.commands.arguments.selector.EntitySelectorParser finalizePredicates()V +public net.minecraft.commands.arguments.selector.EntitySelectorParser parseOptions()V +public net.minecraft.commands.arguments.selector.options.EntitySelectorOptions register(Ljava/lang/String;Lnet/minecraft/commands/arguments/selector/options/EntitySelectorOptions$Modifier;Ljava/util/function/Predicate;Lnet/minecraft/network/chat/Component;)V +public net.minecraft.core.Holder$Reference bindKey(Lnet/minecraft/resources/ResourceKey;)V +public net.minecraft.core.Holder$Reference bindTags(Ljava/util/Collection;)V +public net.minecraft.core.Holder$Reference bindValue(Ljava/lang/Object;)V public net.minecraft.core.Holder$Reference$Type -public net.minecraft.core.HolderSet$Named (Lnet/minecraft/core/HolderOwner;Lnet/minecraft/tags/TagKey;)V # constructor -public net.minecraft.core.HolderSet$Named m_205835_(Ljava/util/List;)V # bind -protected net.minecraft.core.IdMapper f_122653_ # nextId -protected net.minecraft.core.IdMapper f_122654_ # tToId - internal map -protected net.minecraft.core.IdMapper f_122655_ # idToT - internal index list -protected net.minecraft.core.MappedRegistry f_244282_ # unregisteredIntrusiveHolders -protected net.minecraft.core.MappedRegistry m_245420_(Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/core/Holder$Reference; # getOrCreateHolderOrThrow -protected net.minecraft.core.MappedRegistry m_354248_(Lnet/minecraft/tags/TagKey;)Lnet/minecraft/core/HolderSet$Named; # getOrCreateTagForRegistration +public net.minecraft.core.HolderSet$Named (Lnet/minecraft/core/HolderOwner;Lnet/minecraft/tags/TagKey;)V +public net.minecraft.core.HolderSet$Named bind(Ljava/util/List;)V +protected net.minecraft.core.IdMapper idToT +protected net.minecraft.core.IdMapper nextId +protected net.minecraft.core.IdMapper tToId +protected net.minecraft.core.MappedRegistry componentLookup +protected net.minecraft.core.MappedRegistry getOrCreateHolderOrThrow(Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/core/Holder$Reference; +protected net.minecraft.core.MappedRegistry getOrCreateTagForRegistration(Lnet/minecraft/tags/TagKey;)Lnet/minecraft/core/HolderSet$Named; +protected net.minecraft.core.MappedRegistry unregisteredIntrusiveHolders protected net.minecraft.core.MappedRegistry$TagSet -public net.minecraft.core.RegistrySetBuilder$LazyHolder m_247654_(Ljava/lang/Object;)V # bindValue -public net.minecraft.core.particles.SimpleParticleType (Z)V # constructor -protected net.minecraft.data.loot.BlockLootSubProvider m_245335_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createSilkTouchOnlyTable -protected net.minecraft.data.loot.BlockLootSubProvider m_245602_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createPotFlowerItemTable -protected net.minecraft.data.loot.BlockLootSubProvider m_246900_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition$Builder;Lnet/minecraft/world/level/storage/loot/entries/LootPoolEntryContainer$Builder;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createSelfDropDispatchTable -protected net.minecraft.data.recipes.RecipeProvider m_176523_(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;)Lnet/minecraft/world/level/block/Block; # getBaseBlock -protected net.minecraft.data.recipes.RecipeProvider m_176658_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # buttonBuilder -protected net.minecraft.data.recipes.RecipeProvider m_176678_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # fenceBuilder -protected net.minecraft.data.recipes.RecipeProvider m_176684_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # fenceGateBuilder -protected net.minecraft.data.recipes.RecipeProvider m_176720_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # trapdoorBuilder -protected net.minecraft.data.recipes.RecipeProvider m_176726_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # signBuilder -protected net.minecraft.data.recipes.RecipeProvider m_245792_(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/ShapedRecipeBuilder; # cutBuilder -protected net.minecraft.data.recipes.RecipeProvider m_245864_(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # wallBuilder -protected net.minecraft.data.recipes.RecipeProvider m_247174_(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # polishedBuilder -protected net.minecraft.data.recipes.RecipeProvider m_247347_(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; # pressurePlateBuilder -protected net.minecraft.data.recipes.packs.VanillaRecipeProvider (Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/data/recipes/RecipeOutput;)V # constructor -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_243671_ # COAL_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_243779_ # IRON_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_243908_ # COPPER_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_243974_ # DIAMOND_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_244369_ # GOLD_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_244430_ # EMERALD_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_244565_ # REDSTONE_SMELTABLES -public net.minecraft.data.recipes.packs.VanillaRecipeProvider f_244628_ # LAPIS_SMELTABLES -public-f net.minecraft.data.registries.RegistriesDatapackGenerator m_6055_()Ljava/lang/String; # getName -protected net.minecraft.data.tags.TagsProvider f_126543_ # builders -public-f net.minecraft.data.tags.TagsProvider m_6055_()Ljava/lang/String; # getName -public net.minecraft.data.tags.VanillaItemTagsProvider$BlockToItemConverter -public net.minecraft.resources.Identifier m_441545_(C)Z # validNamespaceChar -protected net.minecraft.server.MinecraftServer f_302313_ # nextTickTimeNanos -public net.minecraft.server.MinecraftServer f_303727_ # tickTimesNanos -public net.minecraft.server.MinecraftServer$ReloadableResources -public net.minecraft.server.dedicated.DedicatedServer f_139600_ # consoleInput -public net.minecraft.server.level.ServerChunkCache f_8329_ # level -public net.minecraft.server.level.ServerLevel m_142646_()Lnet/minecraft/world/level/entity/LevelEntityGetter; # getEntities -public net.minecraft.server.level.ServerPlayer f_8940_ # containerCounter -public net.minecraft.server.level.ServerPlayer m_143399_(Lnet/minecraft/world/inventory/AbstractContainerMenu;)V # initMenu -public net.minecraft.server.level.ServerPlayer m_9217_()V # nextContainerCounter -public net.minecraft.server.network.ServerConfigurationPacketListenerImpl m_293514_(Lnet/minecraft/server/network/ConfigurationTask$Type;)V # finishCurrentTask -public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector -public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector (Lnet/minecraft/world/level/validation/DirectoryValidator;)V # constructor -public net.minecraft.server.packs.repository.ServerPacksSource m_246173_()Lnet/minecraft/server/packs/VanillaPackResources; # createVanillaPackSource -public net.minecraft.server.packs.resources.FallbackResourceManager f_10599_ # fallbacks -protected net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener (Lcom/mojang/serialization/DynamicOps;Lcom/mojang/serialization/Codec;Lnet/minecraft/resources/FileToIdConverter;)V # constructor -public net.minecraft.util.datafix.fixes.StructuresBecomeConfiguredFix$Conversion -public net.minecraft.util.thread.BlockableEventLoop m_18689_(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # submitAsync -#group public net.minecraft.world.damagesource.DamageSource *() #All methods public, most are already -public net.minecraft.world.damagesource.DamageSource (Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;)V # constructor +public net.minecraft.core.RegistrySetBuilder$LazyHolder bindValue(Ljava/lang/Object;)V +public net.minecraft.core.particles.SimpleParticleType (Z)V +protected net.minecraft.data.loot.BlockLootSubProvider createPotFlowerItemTable(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; +protected net.minecraft.data.loot.BlockLootSubProvider createSilkTouchOnlyTable(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; +#group protected net.minecraft.data.recipes.RecipeProvider *() +protected net.minecraft.data.recipes.RecipeProvider bricksBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider buttonBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider cutBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/ShapedRecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider fenceBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider fenceGateBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider generateCraftingRecipe(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/ItemLike;)V +protected net.minecraft.data.recipes.RecipeProvider generateSmeltingRecipe(Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/ItemLike;)V +protected net.minecraft.data.recipes.RecipeProvider generateStonecutterRecipe(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.data.recipes.RecipeProvider getBaseBlockForCrafting(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;)Lnet/minecraft/world/level/block/Block; +protected net.minecraft.data.recipes.RecipeProvider getCraftingCriterionName(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/ItemLike;)Ljava/lang/String; +protected net.minecraft.data.recipes.RecipeProvider has(Lnet/minecraft/advancements/predicates/MinMaxBounds$Ints;Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider insideOf(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/predicates/ItemPredicate$Builder;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/predicates/ItemPredicate;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider nineBlockStorageRecipes(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V +protected net.minecraft.data.recipes.RecipeProvider oreCooking(Lnet/minecraft/world/item/crafting/AbstractCookingRecipe$Factory;Ljava/util/List;Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/item/crafting/CookingBookCategory;Lnet/minecraft/world/level/ItemLike;FILjava/lang/String;Ljava/lang/String;)V +protected net.minecraft.data.recipes.RecipeProvider pillarBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider polishedBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider pressurePlateBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider signBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider simpleCookingRecipe(Ljava/lang/String;Lnet/minecraft/world/item/crafting/AbstractCookingRecipe$Factory;ILnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;F)V +protected net.minecraft.data.recipes.RecipeProvider smeltingResultFromBase(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;)V +protected net.minecraft.data.recipes.RecipeProvider tilesBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; +protected net.minecraft.data.recipes.RecipeProvider wallBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; #endgroup -protected net.minecraft.world.entity.Entity f_19843_ # ENTITY_COUNTER -public net.minecraft.world.entity.Entity f_399955_ # LOGGER -public net.minecraft.world.entity.Entity m_20078_()Ljava/lang/String; # getEncodeId -public net.minecraft.world.entity.Mob f_21345_ # goalSelector -public net.minecraft.world.entity.Mob f_21346_ # targetSelector -public net.minecraft.world.entity.ai.memory.MemoryModuleType (Ljava/util/Optional;)V # constructor -public net.minecraft.world.entity.ai.sensing.SensorType (Ljava/util/function/Supplier;)V # constructor -protected net.minecraft.world.entity.item.PrimedTnt m_32103_()V # explode - make it easier to extend TNTEntity with custom explosion logic -protected net.minecraft.world.entity.monster.skeleton.AbstractSkeleton m_442492_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -protected net.minecraft.world.entity.monster.skeleton.Parched m_442492_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -protected net.minecraft.world.entity.monster.skeleton.Skeleton m_442492_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -protected net.minecraft.world.entity.monster.skeleton.Stray m_442492_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -protected net.minecraft.world.entity.monster.skeleton.WitherSkeleton m_442492_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -protected net.minecraft.world.entity.monster.zombie.Zombie f_436498_ # conversionTime -public net.minecraft.world.entity.npc.villager.VillagerTrades$DyedArmorForEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$EmeraldForItems -public net.minecraft.world.entity.npc.villager.VillagerTrades$EmeraldsForVillagerTypeItem -public net.minecraft.world.entity.npc.villager.VillagerTrades$EnchantBookForEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$EnchantedItemForEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$FailureItemListing -public net.minecraft.world.entity.npc.villager.VillagerTrades$ItemsAndEmeraldsToItems -public net.minecraft.world.entity.npc.villager.VillagerTrades$ItemsForEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$SuspiciousStewForEmerald -public net.minecraft.world.entity.npc.villager.VillagerTrades$TippedArrowForItemsAndEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$TreasureMapForEmeralds -public net.minecraft.world.entity.npc.villager.VillagerTrades$TypeSpecificTrade -public net.minecraft.world.entity.player.Player m_6915_()V # closeContainer -protected net.minecraft.world.entity.projectile.Projectile (Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V # constructor -private-f net.minecraft.world.entity.raid.Raid$RaiderType f_37813_ # VALUES -public net.minecraft.world.entity.schedule.Activity (Ljava/lang/String;)V # constructor -public net.minecraft.world.inventory.AnvilMenu f_39000_ # repairItemCountCost +protected net.minecraft.data.recipes.packs.VanillaRecipeProvider (Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/data/recipes/RecipeOutput;)V +public net.minecraft.data.recipes.packs.VanillaRecipeProvider COAL_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider COPPER_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider DIAMOND_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider EMERALD_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider GOLD_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider IRON_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider LAPIS_SMELTABLES +public net.minecraft.data.recipes.packs.VanillaRecipeProvider REDSTONE_SMELTABLES +public-f net.minecraft.data.registries.RegistriesDatapackGenerator getName()Ljava/lang/String; +protected net.minecraft.data.tags.TagsProvider builders +public-f net.minecraft.data.tags.TagsProvider getName()Ljava/lang/String; +public net.minecraft.resources.Identifier validNamespaceChar(C)Z +public net.minecraft.resources.RegistryDataLoader$RegistryData (Lnet/minecraft/resources/ResourceKey;Lcom/mojang/serialization/Codec;)V +protected net.minecraft.server.MinecraftServer nextTickTimeNanos +public net.minecraft.server.MinecraftServer tickTimesNanos +public net.minecraft.server.MinecraftServer$ReloadableResources +public net.minecraft.server.dedicated.DedicatedServer consoleInput +public net.minecraft.server.level.ServerChunkCache level +public net.minecraft.server.level.ServerLevel getEntities()Lnet/minecraft/world/level/entity/LevelEntityGetter; +public net.minecraft.server.level.ServerPlayer containerCounter +public net.minecraft.server.level.ServerPlayer initMenu(Lnet/minecraft/world/inventory/AbstractContainerMenu;)V +public net.minecraft.server.level.ServerPlayer nextContainerCounter()V +public net.minecraft.server.network.ServerConfigurationPacketListenerImpl finishCurrentTask(Lnet/minecraft/server/network/ConfigurationTask$Type;)V +public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector +public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector (Lnet/minecraft/world/level/validation/DirectoryValidator;)V +public net.minecraft.server.packs.repository.ServerPacksSource createVanillaPackSource()Lnet/minecraft/server/packs/VanillaPackResources; +public net.minecraft.server.packs.resources.FallbackResourceManager fallbacks +protected net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener (Lcom/mojang/serialization/DynamicOps;Lcom/mojang/serialization/Codec;Lnet/minecraft/resources/FileToIdConverter;)V +public net.minecraft.util.datafix.fixes.StructuresBecomeConfiguredFix$Conversion +public net.minecraft.util.thread.BlockableEventLoop submitAsync(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; +#group public net.minecraft.world.damagesource.DamageSource *() #All methods public, most are already +public net.minecraft.world.damagesource.DamageSource (Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;)V +#endgroup +public net.minecraft.world.entity.Entity LOGGER +public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String; +public net.minecraft.world.entity.Mob goalSelector +public net.minecraft.world.entity.Mob targetSelector +public net.minecraft.world.entity.ai.memory.MemoryModuleType (Ljava/util/Optional;)V +public net.minecraft.world.entity.ai.sensing.SensorType (Ljava/util/function/Supplier;)V +protected net.minecraft.world.entity.item.PrimedTnt explode()V +protected net.minecraft.world.entity.monster.skeleton.AbstractSkeleton getStepSound()Lnet/minecraft/sounds/SoundEvent; +protected net.minecraft.world.entity.monster.skeleton.Parched getStepSound()Lnet/minecraft/sounds/SoundEvent; +protected net.minecraft.world.entity.monster.skeleton.Skeleton getStepSound()Lnet/minecraft/sounds/SoundEvent; +protected net.minecraft.world.entity.monster.skeleton.Stray getStepSound()Lnet/minecraft/sounds/SoundEvent; +protected net.minecraft.world.entity.monster.skeleton.WitherSkeleton getStepSound()Lnet/minecraft/sounds/SoundEvent; +protected net.minecraft.world.entity.monster.zombie.Zombie conversionTime +public net.minecraft.world.entity.player.Player closeContainer()V +protected net.minecraft.world.entity.projectile.Projectile (Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V +public net.minecraft.world.entity.raid.Raid$RaiderType +private-f net.minecraft.world.entity.raid.Raid$RaiderType VALUES +public net.minecraft.world.entity.schedule.Activity (Ljava/lang/String;)V +public net.minecraft.world.inventory.AnvilMenu repairItemCountCost public net.minecraft.world.inventory.BrewingStandMenu$PotionSlot -public net.minecraft.world.inventory.MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V # constructor +public net.minecraft.world.inventory.MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V public net.minecraft.world.inventory.MenuType$MenuSupplier public net.minecraft.world.item.CreativeModeTab$Output public net.minecraft.world.item.CreativeModeTab$TabVisibility -public net.minecraft.world.item.CreativeModeTabs f_256725_ # COLORED_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_256731_ # SPAWN_EGGS -public net.minecraft.world.item.CreativeModeTabs f_256750_ # SEARCH -public net.minecraft.world.item.CreativeModeTabs f_256776_ # NATURAL_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_256788_ # BUILDING_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_256791_ # FUNCTIONAL_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_256797_ # COMBAT -public net.minecraft.world.item.CreativeModeTabs f_256837_ # OP_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_256839_ # FOOD_AND_DRINKS -public net.minecraft.world.item.CreativeModeTabs f_256869_ # TOOLS_AND_UTILITIES -public net.minecraft.world.item.CreativeModeTabs f_256917_ # HOTBAR -public net.minecraft.world.item.CreativeModeTabs f_256968_ # INGREDIENTS -public net.minecraft.world.item.CreativeModeTabs f_257028_ # REDSTONE_BLOCKS -public net.minecraft.world.item.CreativeModeTabs f_257039_ # INVENTORY +public net.minecraft.world.item.CreativeModeTabs BUILDING_BLOCKS +public net.minecraft.world.item.CreativeModeTabs COLORED_BLOCKS +public net.minecraft.world.item.CreativeModeTabs COMBAT +public net.minecraft.world.item.CreativeModeTabs FOOD_AND_DRINKS +public net.minecraft.world.item.CreativeModeTabs FUNCTIONAL_BLOCKS +public net.minecraft.world.item.CreativeModeTabs HOTBAR +public net.minecraft.world.item.CreativeModeTabs INGREDIENTS +public net.minecraft.world.item.CreativeModeTabs INVENTORY +public net.minecraft.world.item.CreativeModeTabs NATURAL_BLOCKS +public net.minecraft.world.item.CreativeModeTabs OP_BLOCKS +public net.minecraft.world.item.CreativeModeTabs REDSTONE_BLOCKS +public net.minecraft.world.item.CreativeModeTabs SEARCH +public net.minecraft.world.item.CreativeModeTabs SPAWN_EGGS +public net.minecraft.world.item.CreativeModeTabs TOOLS_AND_UTILITIES #group public net.minecraft.world.item.Item #endgroup -private-f net.minecraft.world.item.ItemDisplayContext f_268735_ # id -public net.minecraft.world.item.ItemStackLinkedSet f_260558_ # TYPE_AND_TAG +private-f net.minecraft.world.item.ItemDisplayContext id +public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG public net.minecraft.world.item.alchemy.PotionBrewing$Mix -public net.minecraft.world.item.alchemy.PotionBrewing$Mix f_43533_ # ingredient -public net.minecraft.world.item.context.BlockPlaceContext (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V # constructor -public net.minecraft.world.item.context.UseOnContext (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V # constructor +public net.minecraft.world.item.alchemy.PotionBrewing$Mix ingredient +public net.minecraft.world.item.context.BlockPlaceContext (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V +public net.minecraft.world.item.context.UseOnContext (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V public-f net.minecraft.world.item.crafting.Ingredient -protected net.minecraft.world.item.crafting.Ingredient (Lnet/minecraft/core/HolderSet;)V # constructor -public net.minecraft.world.level.Level f_46437_ # oRainLevel -public net.minecraft.world.level.Level f_46438_ # rainLevel -public net.minecraft.world.level.Level f_46439_ # oThunderLevel -public net.minecraft.world.level.Level f_46440_ # thunderLevel +protected net.minecraft.world.item.crafting.Ingredient (Lnet/minecraft/core/HolderSet;)V +public net.minecraft.world.level.Level oRainLevel +public net.minecraft.world.level.Level oThunderLevel +public net.minecraft.world.level.Level rainLevel +public net.minecraft.world.level.Level thunderLevel public net.minecraft.world.level.biome.Biome$ClimateSettings -protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder f_254648_ # features -protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder f_254678_ # carvers -protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder m_255276_(I)V # addFeatureStepsUpTo +protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder addFeatureStepsUpTo(I)V +protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder carvers +protected net.minecraft.world.level.biome.BiomeGenerationSettings$PlainBuilder features #group protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder * -protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_380225_ # dryFoliageColorOverride -protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48006_ # waterColor -protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48009_ # foliageColorOverride -protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48010_ # grassColorOverride -protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48011_ # grassColorModifier +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder dryFoliageColorOverride +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder foliageColorOverride +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder grassColorModifier +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder grassColorOverride +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder waterColor #endgroup -protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48362_ # spawners -protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48363_ # mobSpawnCosts -protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48364_ # creatureGenerationProbability +protected net.minecraft.world.level.biome.MobSpawnSettings$Builder creatureGenerationProbability +protected net.minecraft.world.level.biome.MobSpawnSettings$Builder mobSpawnCosts +protected net.minecraft.world.level.biome.MobSpawnSettings$Builder spawners #group public net.minecraft.world.level.block.Block -public net.minecraft.world.level.block.AttachedStemBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.AzaleaBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BarrierBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BaseCoralFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BaseCoralPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BaseCoralWallFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BigDripleafBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BigDripleafStemBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BlastFurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.BushBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ButtonBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;ILnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CactusBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CakeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CandleCakeBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CartographyTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CarvedPumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ChestBlock (Ljava/util/function/Supplier;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ChorusFlowerBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ChorusPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CoralFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CoralPlantBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CoralWallFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CraftingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CreakingHeartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.CropBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.DecoratedPotBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.DirtPathBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.DispenserBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.DoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.DryVegetationBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.EnchantingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.EndGatewayBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -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.FarmBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.FlowerBedBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.FungusBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.FurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.GrindstoneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.HalfTransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.HangingRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.IronBarsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.JigsawBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.JukeboxBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.KelpBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.KelpPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.LadderBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.LecternBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.LeverBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.LiquidBlock (Lnet/minecraft/world/level/material/FlowingFluid;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.LoomBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.MangroveRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.NetherWartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.NyliumBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.PlayerHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.PlayerWallHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.PoweredRailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.PressurePlateBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.PumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.RailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.RedstoneTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.RedstoneWallTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.RepeaterBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.RootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SaplingBlock (Lnet/minecraft/world/level/block/grower/TreeGrower;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ScaffoldingBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SeaPickleBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SeagrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.ShortDryGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SmithingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SmokerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SnowLayerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SnowyDirtBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SpawnerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.StairBlock (Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.StemBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.StructureBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.StructureVoidBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.SugarCaneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.TallDryGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.TallGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.TorchBlock (Lnet/minecraft/core/particles/SimpleParticleType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.TransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.TrapDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WallSkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WallTorchBlock (Lnet/minecraft/core/particles/SimpleParticleType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WaterlilyBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WaterloggedTransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringCopperBarsBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringCopperChainBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringCopperDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringCopperGrateBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringCopperTrapDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringLanternBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeatheringLightningRodBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WeightedPressurePlateBlock (ILnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WetSpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WitherSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WitherWallSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor -public net.minecraft.world.level.block.WoolCarpetBlock (Lnet/minecraft/world/item/DyeColor;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor +public net.minecraft.world.level.block.AttachedStemBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.AzaleaBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BarrierBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BaseCoralFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BaseCoralPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BaseCoralWallFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BigDripleafBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BigDripleafStemBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BlastFurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.BushBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ButtonBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;ILnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CactusBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CakeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CandleCakeBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CartographyTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CarvedPumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ChestBlock (Ljava/util/function/Supplier;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ChorusFlowerBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ChorusPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CoralFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CoralPlantBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CoralWallFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CraftingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CreakingHeartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.CropBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.DecoratedPotBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.DirtPathBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.DispenserBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.DoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.DryVegetationBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.EnchantingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.EndGatewayBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.EndPortalBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.EndRodBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.EnderChestBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.FarmlandBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.FlowerBedBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.FurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.GrindstoneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.HalfTransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.HangingRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.IronBarsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.JigsawBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.JukeboxBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.KelpBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.KelpPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LadderBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LecternBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LeverBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LilyPadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LiquidBlock (Lnet/minecraft/world/level/material/FlowingFluid;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.LoomBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.MangroveRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.NetherFungusBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.NetherRootsBlock (Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.NetherWartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.NyliumBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.PlayerHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.PlayerWallHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.PoweredRailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.PressurePlateBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.PumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.RailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.RedstoneTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.RedstoneWallTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.RepeaterBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SaplingBlock (Lnet/minecraft/world/level/block/grower/TreeGrower;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ScaffoldingBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SeaPickleBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SeagrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.ShortDryGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SmithingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SmokerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SnowLayerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SnowyBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SpawnerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.StairBlock (Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.StemBlock (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/tags/TagKey;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.StructureBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.StructureVoidBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.SugarCaneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.TallDryGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.TallGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.TorchBlock (Lnet/minecraft/core/particles/SimpleParticleType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.TransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.TrapDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WallSkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WallTorchBlock (Lnet/minecraft/core/particles/SimpleParticleType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WaterloggedTransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringCopperBarsBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringCopperChainBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringCopperDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringCopperGrateBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringCopperTrapDoorBlock (Lnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringLanternBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeatheringLightningRodBlock (Lnet/minecraft/world/level/block/WeatheringCopper$WeatherState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WeightedPressurePlateBlock (ILnet/minecraft/world/level/block/state/properties/BlockSetType;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WetSpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WitherSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WitherWallSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +public net.minecraft.world.level.block.WoolCarpetBlock (Lnet/minecraft/world/item/DyeColor;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V #endgroup -public net.minecraft.world.level.block.Block m_49805_(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;I)V # popExperience -public net.minecraft.world.level.block.FireBlock m_221164_(Lnet/minecraft/world/level/block/state/BlockState;)I # getBurnOdds -public net.minecraft.world.level.block.FireBlock m_221166_(Lnet/minecraft/world/level/block/state/BlockState;)I # getIgniteOdds -public net.minecraft.world.level.block.entity.BlockEntityType (Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;Ljava/util/Set;)V # constructor +public net.minecraft.world.level.block.Block popExperience(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;I)V +public net.minecraft.world.level.block.FireBlock getBurnOdds(Lnet/minecraft/world/level/block/state/BlockState;)I +public net.minecraft.world.level.block.FireBlock getIgniteOdds(Lnet/minecraft/world/level/block/state/BlockState;)I +public net.minecraft.world.level.block.entity.BlockEntityType (Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;Ljava/util/Set;)V 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.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.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.status.ChunkStatus (Lnet/minecraft/world/level/chunk/status/ChunkStatus;Ljava/util/EnumSet;Lnet/minecraft/world/level/chunk/status/ChunkType;)V # constructor -public net.minecraft.world.level.gamerules.GameRules m_439121_(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;III)Lnet/minecraft/world/level/gamerules/GameRule; # registerInteger -public net.minecraft.world.level.gamerules.GameRules m_441993_(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;IIILnet/minecraft/world/flag/FeatureFlagSet;)Lnet/minecraft/world/level/gamerules/GameRule; # registerInteger -public net.minecraft.world.level.gamerules.GameRules m_442919_(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;II)Lnet/minecraft/world/level/gamerules/GameRule; # registerInteger -public net.minecraft.world.level.gamerules.GameRules m_446320_(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Z)Lnet/minecraft/world/level/gamerules/GameRule; # registerBoolean -public net.minecraft.world.level.gamerules.GameRules m_447562_(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Lnet/minecraft/world/level/gamerules/GameRuleType;Lcom/mojang/brigadier/arguments/ArgumentType;Lcom/mojang/serialization/Codec;Ljava/lang/Object;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/world/level/gamerules/GameRules$VisitorCaller;Ljava/util/function/ToIntFunction;)Lnet/minecraft/world/level/gamerules/GameRule; # register -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 -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_157999_ # aquiferLocationCache -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158000_ # shouldScheduleFluidUpdate -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158002_ # minGridX -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158003_ # minGridY -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158004_ # minGridZ -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158005_ # gridSizeX -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_158006_ # gridSizeZ -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158024_(II)D # similarity -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158027_(III)I # getIndex -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158039_(I)I # gridX -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158045_(I)I # gridY -protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158047_(I)I # gridZ -protected net.minecraft.world.level.levelgen.Beardifier m_223925_(IIII)D # getBeardContribution -private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64114_ # ALL_BLOCKS -private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64115_ # GRID_WIDTH -private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64116_ # GRID_HEIGHT +public net.minecraft.world.level.block.entity.HopperBlockEntity isOnCustomCooldown()Z +public net.minecraft.world.level.block.entity.HopperBlockEntity setCooldown(I)V +public net.minecraft.world.level.block.state.properties.BlockSetType register(Lnet/minecraft/world/level/block/state/properties/BlockSetType;)Lnet/minecraft/world/level/block/state/properties/BlockSetType; +public net.minecraft.world.level.block.state.properties.WoodType register(Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType; +public net.minecraft.world.level.chunk.status.ChunkStatus (Lnet/minecraft/world/level/chunk/status/ChunkStatus;Ljava/util/EnumSet;Lnet/minecraft/world/level/chunk/status/ChunkType;)V +public net.minecraft.world.level.gamerules.GameRules register(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Lnet/minecraft/world/level/gamerules/GameRuleType;Lcom/mojang/brigadier/arguments/ArgumentType;Lcom/mojang/serialization/Codec;Ljava/lang/Object;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/world/level/gamerules/GameRules$VisitorCaller;Ljava/util/function/ToIntFunction;)Lnet/minecraft/world/level/gamerules/GameRule; +public net.minecraft.world.level.gamerules.GameRules registerBoolean(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;Z)Lnet/minecraft/world/level/gamerules/GameRule; +public net.minecraft.world.level.gamerules.GameRules registerInteger(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;II)Lnet/minecraft/world/level/gamerules/GameRule; +public net.minecraft.world.level.gamerules.GameRules registerInteger(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;III)Lnet/minecraft/world/level/gamerules/GameRule; +public net.minecraft.world.level.gamerules.GameRules registerInteger(Ljava/lang/String;Lnet/minecraft/world/level/gamerules/GameRuleCategory;IIILnet/minecraft/world/flag/FeatureFlagSet;)Lnet/minecraft/world/level/gamerules/GameRule; +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer aquiferCache +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer aquiferLocationCache +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer barrierNoise +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer getIndex(III)I +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer gridSizeX +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer gridSizeZ +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer gridX(I)I +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer gridY(I)I +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer gridZ(I)I +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer lavaNoise +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer minGridX +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer minGridY +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer minGridZ +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer shouldScheduleFluidUpdate +protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer similarity(II)D +protected net.minecraft.world.level.levelgen.Beardifier getBeardContribution(IIII)D +private-f net.minecraft.world.level.levelgen.DebugLevelSource ALL_BLOCKS +private-f net.minecraft.world.level.levelgen.DebugLevelSource GRID_HEIGHT +private-f net.minecraft.world.level.levelgen.DebugLevelSource GRID_WIDTH public-f net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator -protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_224239_(Lnet/minecraft/world/level/LevelHeightAccessor;Lnet/minecraft/world/level/levelgen/RandomState;IILorg/apache/commons/lang3/mutable/MutableObject;Ljava/util/function/Predicate;)Ljava/util/OptionalInt; # iterateNoiseColumn +protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator iterateNoiseColumn(Lnet/minecraft/world/level/LevelHeightAccessor;Lnet/minecraft/world/level/levelgen/RandomState;IILorg/apache/commons/lang3/mutable/MutableObject;Ljava/util/function/Predicate;)Ljava/util/OptionalInt; #group public net.minecraft.world.level.levelgen.NoiseGeneratorSettings *() -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_255038_(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # caves -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_255186_(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # end -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_255226_(Lnet/minecraft/data/worldgen/BootstrapContext;ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # overworld -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_255230_(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # floatingIslands -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_255410_(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # nether -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_64474_(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App; # lambda$static$0 +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings caves(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings end(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings floatingIslands(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings nether(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings overworld(Lnet/minecraft/data/worldgen/BootstrapContext;ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; #endgroup -public net.minecraft.world.level.levelgen.feature.featuresize.FeatureSizeType (Lcom/mojang/serialization/MapCodec;)V # constructor -public net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType (Lcom/mojang/serialization/MapCodec;)V # constructor -public net.minecraft.world.level.levelgen.feature.rootplacers.RootPlacerType (Lcom/mojang/serialization/MapCodec;)V # constructor -public net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType (Lcom/mojang/serialization/MapCodec;)V # constructor -public net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType (Lcom/mojang/serialization/MapCodec;)V # constructor -public net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType (Lcom/mojang/serialization/MapCodec;)V # constructor -protected net.minecraft.world.level.portal.PortalForcer f_77648_ # level -public net.minecraft.world.level.storage.LevelResource (Ljava/lang/String;)V # constructor -private-f net.minecraft.world.level.storage.loot.LootPool f_79028_ # rolls -private-f net.minecraft.world.level.storage.loot.LootPool f_79029_ # bonusRolls -public net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction m_80683_(Ljava/util/function/Function;)Lnet/minecraft/world/level/storage/loot/functions/LootItemConditionalFunction$Builder; # simpleBuilder -public net.minecraft.world.level.storage.loot.functions.ModifyContainerContents (Ljava/util/List;Lnet/minecraft/world/level/storage/loot/ContainerComponentManipulator;Lnet/minecraft/world/level/storage/loot/functions/LootItemFunction;)V # constructor -public net.minecraft.world.level.storage.loot.functions.SetFireworksFunction (Ljava/util/List;Ljava/util/Optional;Ljava/util/Optional;)V # constructor -public net.minecraft.world.level.storage.loot.functions.SetItemFunction (Ljava/util/List;Lnet/minecraft/core/Holder;)V # constructor -public net.minecraft.world.level.storage.loot.functions.SetWritableBookPagesFunction (Ljava/util/List;Ljava/util/List;Lnet/minecraft/world/level/storage/loot/functions/ListOperation;)V # constructor -public net.minecraft.world.level.storage.loot.functions.SetWrittenBookPagesFunction (Ljava/util/List;Ljava/util/List;Lnet/minecraft/world/level/storage/loot/functions/ListOperation;)V # constructor -public net.minecraft.world.level.storage.loot.functions.ToggleTooltips (Ljava/util/List;Ljava/util/Map;)V # constructor -public net/minecraft/client/gui/components/debug/DebugScreenEntries m_419600_(Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier; # register -public net/minecraft/world/entity/npc/villager/VillagerTrades$EmeraldsForVillagerTypeItem \ No newline at end of file +public net.minecraft.world.level.levelgen.feature.featuresize.FeatureSizeType (Lcom/mojang/serialization/MapCodec;)V +public net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType (Lcom/mojang/serialization/MapCodec;)V +public net.minecraft.world.level.levelgen.feature.rootplacers.RootPlacerType (Lcom/mojang/serialization/MapCodec;)V +public net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType (Lcom/mojang/serialization/MapCodec;)V +public net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType (Lcom/mojang/serialization/MapCodec;)V +public net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType (Lcom/mojang/serialization/MapCodec;)V +protected net.minecraft.world.level.portal.PortalForcer level +public net.minecraft.world.level.storage.LevelResource (Ljava/lang/String;)V +private-f net.minecraft.world.level.storage.loot.LootPool bonusRolls +private-f net.minecraft.world.level.storage.loot.LootPool rolls +public net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction simpleBuilder(Ljava/util/function/Function;)Lnet/minecraft/world/level/storage/loot/functions/LootItemConditionalFunction$Builder; +public net.minecraft.world.level.storage.loot.functions.ModifyContainerContents (Ljava/util/List;Lnet/minecraft/world/level/storage/loot/ContainerComponentManipulator;Lnet/minecraft/world/level/storage/loot/functions/LootItemFunction;)V +public net.minecraft.world.level.storage.loot.functions.SetFireworksFunction (Ljava/util/List;Ljava/util/Optional;Ljava/util/Optional;)V +public net.minecraft.world.level.storage.loot.functions.SetItemFunction (Ljava/util/List;Lnet/minecraft/core/Holder;)V +public net.minecraft.world.level.storage.loot.functions.SetWritableBookPagesFunction (Ljava/util/List;Ljava/util/List;Lnet/minecraft/world/level/storage/loot/functions/ListOperation;)V +public net.minecraft.world.level.storage.loot.functions.SetWrittenBookPagesFunction (Ljava/util/List;Ljava/util/List;Lnet/minecraft/world/level/storage/loot/functions/ListOperation;)V +public net.minecraft.world.level.storage.loot.functions.ToggleTooltips (Ljava/util/List;Ljava/util/Map;)V \ No newline at end of file diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index fd1f4f25b4..e69de29bb2 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -1,65 +0,0 @@ -com/mojang/blaze3d/vertex/VertexConsumer.putBulkData(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lnet/minecraft/client/renderer/block/model/BakedQuad;[FFFFF[IIZ)V=|p_85996_,p_85997_,p_85998_,p_85999_,p_86000_,p_86001_,alpha,p_86002_,p_86003_,p_86004_ -net/minecraft/client/Options.processOptionsForge(Lnet/minecraft/client/Options$FieldAccess;)V=|p_168428_ -net/minecraft/client/gui/Gui.renderSelectedItemName(Lnet/minecraft/client/gui/GuiGraphics;I)V=|p_283501_,yShift -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/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/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.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_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/BlockElementFace.(Lnet/minecraft/core/Direction;ILjava/lang/String;Lnet/minecraft/client/renderer/block/model/BlockFaceUV;Lnet/minecraftforge/client/model/ForgeFaceData;)V=|p_111359_,p_111360_,p_111361_,p_111362_,faceData -net/minecraft/client/renderer/block/model/ItemTransform.(Lorg/joml/Vector3f;Lorg/joml/Vector3f;Lorg/joml/Vector3f;Lorg/joml/Vector3f;)V=|p_254427_,p_254496_,p_254022_,rightRotation -net/minecraft/client/renderer/block/model/ItemTransforms.(Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lcom/google/common/collect/ImmutableMap;)V=|p_111798_,p_111799_,p_111800_,p_111801_,p_111802_,p_111803_,p_111804_,p_111805_,moddedTransforms -net/minecraft/client/resources/model/MultiPartBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)Ljava/util/List;=|p_235050_,p_235051_,p_235052_,modelData,renderType -net/minecraft/client/resources/model/WeightedBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)Ljava/util/List;=|p_235058_,p_235059_,p_235060_,modelData,renderType -net/minecraft/data/registries/RegistriesDatapackGenerator.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/Set;)V=|p_256643_,p_255780_,modIds -net/minecraft/data/tags/BannerPatternTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256451_,p_256420_,modId,existingFileHelper -net/minecraft/data/tags/BiomeTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_255800_,p_256205_,modId,existingFileHelper -net/minecraft/data/tags/CatVariantTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256547_,p_256090_,modId,existingFileHelper -net/minecraft/data/tags/DamageTypeTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_270719_,p_270256_,modId,existingFileHelper -net/minecraft/data/tags/EntityTypeTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256095_,p_256572_,modId,existingFileHelper -net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256604_,p_255962_,modId,existingFileHelper -net/minecraft/data/tags/FluidTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_255941_,p_256600_,modId,existingFileHelper -net/minecraft/data/tags/GameEventTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256060_,p_255621_,modId,existingFileHelper -net/minecraft/data/tags/InstrumentTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256418_,p_256038_,modId,existingFileHelper -net/minecraft/data/tags/IntrinsicHolderTagsProvider$IntrinsicTagAppender.(Lnet/minecraft/tags/TagBuilder;Ljava/util/function/Function;Ljava/lang/String;)V=|p_256108_,p_256433_,modId -net/minecraft/data/tags/IntrinsicHolderTagsProvider.(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/util/function/Function;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_275304_,p_275709_,p_275227_,p_275311_,p_275566_,modId,existingFileHelper -net/minecraft/data/tags/IntrinsicHolderTagsProvider.(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/function/Function;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256164_,p_256155_,p_256488_,p_256168_,modId,existingFileHelper -net/minecraft/data/tags/ItemTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_275343_,p_275729_,p_275322_,modId,existingFileHelper -net/minecraft/data/tags/ItemTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_275204_,p_275194_,p_275207_,p_275634_,modId,existingFileHelper -net/minecraft/data/tags/PaintingVariantTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_255750_,p_256184_,modId,existingFileHelper -net/minecraft/data/tags/PoiTypeTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256012_,p_256617_,modId,existingFileHelper -net/minecraft/data/tags/StructureTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256522_,p_256661_,modId,existingFileHelper -net/minecraft/data/tags/TagsProvider$TagAppender.(Lnet/minecraft/tags/TagBuilder;Ljava/lang/String;)V=|p_236454_,modId -net/minecraft/data/tags/TagsProvider.(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_256596_,p_255886_,p_256513_,modId,existingFileHelper -net/minecraft/data/tags/TagsProvider.(Lnet/minecraft/data/PackOutput;Lnet/minecraft/resources/ResourceKey;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_275432_,p_275476_,p_275222_,p_275565_,modId,existingFileHelper -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/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 -net/minecraft/server/level/ServerChunkCache.removeRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V=|p_8439_,p_8440_,p_8441_,p_8442_,forceTicks -net/minecraft/server/level/ServerPlayerGameMode.removeBlock(Lnet/minecraft/core/BlockPos;Z)Z=|p_180235_1_,canHarvest -net/minecraft/server/level/Ticket.(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;Z)V=|p_9425_,p_9426_,p_9427_,forceTicks -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/item/BoneMealItem.applyBonemeal(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;)Z=|p_40628_,p_40629_,p_40630_,player -net/minecraft/world/item/BucketItem.emptyContents(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/phys/BlockHitResult;Lnet/minecraft/world/item/ItemStack;)Z=|p_150716_,p_150717_,p_150718_,p_150719_,container -net/minecraft/world/item/ItemStack.onItemUse(Lnet/minecraft/world/item/context/UseOnContext;Ljava/util/function/Function;)Lnet/minecraft/world/InteractionResult;=|p_41662_,callback -net/minecraft/world/item/ItemStack.onItemUseFirst(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;=|p_41662_ -net/minecraft/world/level/Level.markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V=|p_46605_,levelchunk,blockstate,p_46606_,p_46607_,p_46608_ -net/minecraft/world/level/LevelSettings.(Ljava/lang/String;Lnet/minecraft/world/level/GameType;ZLnet/minecraft/world/Difficulty;ZLnet/minecraft/world/level/GameRules;Lnet/minecraft/world/level/WorldDataConfiguration;Lcom/mojang/serialization/Lifecycle;)V=|p_250485_,p_250207_,p_251631_,p_252122_,p_248961_,p_248536_,p_249797_,lifecycle -net/minecraft/world/level/block/Block.dropResources(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemStack;Z)V=|p_49882_,p_49883_,p_49884_,p_49885_,p_49886_,p_49887_,dropXp -net/minecraft/world/level/block/ConcretePowderBlock.shouldSolidify(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)Z=|p_52081_,p_52082_,p_52083_,fluidState -net/minecraft/world/level/block/ConcretePowderBlock.touchesLiquid(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z=|p_52065_,p_52066_,state -net/minecraft/world/level/block/FlowerPotBlock.(Ljava/util/function/Supplier;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|emptyPot,p_53528_,properties -net/minecraft/world/level/block/LiquidBlock.(Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|p_54694_,p_54695_ -net/minecraft/world/level/block/PoweredRailBlock.(Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Z)V=|p_55218_,isPoweredRail -net/minecraft/world/level/chunk/ChunkAccess.findBlocks(Ljava/util/function/BiPredicate;Ljava/util/function/BiConsumer;)V=|p_285343_,p_285030_ -net/minecraft/world/level/chunk/ImposterProtoChunk.findBlocks(Ljava/util/function/BiPredicate;Ljava/util/function/BiConsumer;)V=|p_285343_,p_285030_ -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_ \ No newline at end of file diff --git a/src/test/generated/chorus_block_placement/data/forge/tags/block/chorus_additionally_grows_on.json b/src/test/generated/chorus_block_placement/data/minecraft/tags/block/supports_chorus_plant.json similarity index 100% rename from src/test/generated/chorus_block_placement/data/forge/tags/block/chorus_additionally_grows_on.json rename to src/test/generated/chorus_block_placement/data/minecraft/tags/block/supports_chorus_plant.json diff --git a/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json b/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json index b94b56867e..e31ac7bd9e 100644 --- a/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json +++ b/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", @@ -15,7 +14,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/test/generated/conditional_recipe/data/forge/tags/item/eggs.json b/src/test/generated/conditional_recipe/data/c/tags/item/eggs.json similarity index 100% rename from src/test/generated/conditional_recipe/data/forge/tags/item/eggs.json rename to src/test/generated/conditional_recipe/data/c/tags/item/eggs.json diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json index 7691fc96a8..28864758b4 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:dirt" ], diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json index e850d76310..3555d79245 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json @@ -7,7 +7,6 @@ }, "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, @@ -27,7 +26,6 @@ }, "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:oak_log" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json index b5c8b8b418..20abbe0ff3 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json @@ -7,8 +7,6 @@ { "recipe": { "type": "minecraft:smelting", - "category": "blocks", - "cookingtime": 200, "experience": 0.1, "ingredient": "minecraft:dirt", "result": { diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json index fd1e0dcd93..2cba199ad6 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json @@ -7,8 +7,6 @@ { "recipe": { "type": "minecraft:smelting", - "category": "blocks", - "cookingtime": 200, "experience": 0.1, "ingredient": "minecraft:bee_nest", "result": { diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json index 45f9b7db70..f5ab62d51d 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json index 87e16af726..bafc16fe6a 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:oak_log" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json index 2ef7076198..dfd27c1f91 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json @@ -7,14 +7,12 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:redstone_ore", "minecraft:redstone_ore", "minecraft:redstone_ore" ], "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json index a09798c3bf..e2b9cc1e38 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:redstone_ore", "minecraft:redstone_ore", @@ -15,7 +14,6 @@ "minecraft:redstone_ore" ], "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/singe_item_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/singe_item_true_conditions.json index dfb56e5b21..0c88fa1f0c 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/singe_item_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/singe_item_true_conditions.json @@ -9,7 +9,6 @@ "type": "minecraft:stonecutting", "ingredient": "minecraft:redstone_ore", "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/single_item_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/single_item_false_conditions.json index 5024cb0967..25dbe81b78 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/single_item_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/single_item_false_conditions.json @@ -9,7 +9,6 @@ "type": "minecraft:stonecutting", "ingredient": "minecraft:dirt", "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json index d71142b0b9..aed90aac7d 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json @@ -8,14 +8,12 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:iron_ore", "minecraft:iron_ore", "minecraft:iron_ore" ], "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json index 0bab445e9f..fc6f8db17a 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json @@ -8,14 +8,12 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:gold_ore", "minecraft:gold_ore", "minecraft:gold_ore" ], "result": { - "count": 1, "id": "minecraft:diamond_block" } } diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json index 72939248d3..159452af28 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json @@ -35,7 +35,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, diff --git a/src/test/generated/criterion_test/data/criterion_test/advancement/break_glass_with_fish.json b/src/test/generated/criterion_test/data/criterion_test/advancement/break_glass_with_fish.json index 7cdb0f8b10..967adbc59a 100644 --- a/src/test/generated/criterion_test/data/criterion_test/advancement/break_glass_with_fish.json +++ b/src/test/generated/criterion_test/data/criterion_test/advancement/break_glass_with_fish.json @@ -17,7 +17,6 @@ "display": { "description": "Fish wins!", "icon": { - "count": 1, "id": "minecraft:cod" }, "title": "Fish vs Glass" diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json index 524d6ec129..8c38c4c5f2 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json @@ -1,33 +1,20 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:compound", "children": [ { "type": "forge:nbt", - "stack": { - "components": { - "minecraft:custom_data": { - "display_name": "{\"text\":\"Test Item\"}" - } - }, - "count": 1, - "id": "minecraft:dirt" - } + "items": "minecraft:dirt", + "nbt": "{display_name:'{\"text\":\"Test Item\"}'}", + "strict": true }, { "type": "forge:nbt", - "stack": { - "components": { - "minecraft:custom_data": { - "display_name": "{\"text\":\"Test Item\"}" - } - }, - "count": 1, - "id": "minecraft:oak_log" - } + "items": "minecraft:oak_log", + "nbt": "{display_name:'{\"text\":\"Test Item\"}'}", + "strict": true } ] } @@ -37,7 +24,6 @@ " X " ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json index f7d5568ece..b4d51b4867 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:difference", @@ -14,7 +13,6 @@ " X " ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json index 7729c0489f..67d91348ce 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:intersection", @@ -16,7 +15,6 @@ " X " ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json index 509f47aec6..005938a3fd 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { - "type": "forge:partial_nbt", + "type": "forge:nbt", "items": [ "minecraft:wooden_pickaxe", "minecraft:stone_pickaxe", "minecraft:iron_pickaxe" ], - "nbt": "{damage:3}" + "nbt": "{damage:3}", + "strict": false } }, "pattern": [ @@ -17,7 +17,6 @@ "XXX" ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json index 0953c62977..95e0518b01 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json @@ -1,22 +1,21 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { - "type": "forge:partial_nbt", + "type": "forge:nbt", "items": [ "minecraft:wooden_pickaxe", "minecraft:stone_pickaxe", "minecraft:iron_pickaxe" ], - "nbt": "{display_name:'{\"text\":\"Test Item\"}'}" + "nbt": "{display_name:'{\"text\":\"Test Item\"}'}", + "strict": false } }, "pattern": [ "XXX" ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json index 70a54060f7..38bf02b628 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json @@ -1,25 +1,17 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:nbt", - "stack": { - "components": { - "minecraft:custom_data": { - "display_name": "{\"text\":\"Test Item\"}" - } - }, - "count": 1, - "id": "minecraft:diamond_pickaxe" - } + "items": "minecraft:diamond_pickaxe", + "nbt": "{display_name:'{\"text\":\"Test Item\"}'}", + "strict": true } }, "pattern": [ "XXX" ], "result": { - "count": 1, "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json b/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json index 9a0c146055..8004016926 100644 --- a/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json +++ b/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:survives_explosion" diff --git a/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json b/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json index 252f3538fc..95deedae5d 100644 --- a/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json +++ b/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:survives_explosion" diff --git a/src/test/generated/mdk_datagen/pack.mcmeta b/src/test/generated/mdk_datagen/pack.mcmeta index a567fe20b0..e0bd3459be 100644 --- a/src/test/generated/mdk_datagen/pack.mcmeta +++ b/src/test/generated/mdk_datagen/pack.mcmeta @@ -1,9 +1,9 @@ { "pack": { "description": "${mod_id} resources", - "max_format": 94, + "max_format": 107, "min_format": [ - 94, + 107, 1 ] } diff --git a/src/test/generated/villager_type_test/data/forge/test_instance/villager_type_test/emeralds_for_villager_type.json b/src/test/generated/modify_overlay_test/data/forge/test_instance/modify_overlay_test/replace_renderer.json similarity index 64% rename from src/test/generated/villager_type_test/data/forge/test_instance/villager_type_test/emeralds_for_villager_type.json rename to src/test/generated/modify_overlay_test/data/forge/test_instance/modify_overlay_test/replace_renderer.json index 0a2a7af615..f018811795 100644 --- a/src/test/generated/villager_type_test/data/forge/test_instance/villager_type_test/emeralds_for_villager_type.json +++ b/src/test/generated/modify_overlay_test/data/forge/test_instance/modify_overlay_test/replace_renderer.json @@ -1,7 +1,7 @@ { "type": "minecraft:function", "environment": "minecraft:default", - "function": "forge:villager_type_test/emeralds_for_villager_type", + "function": "forge:modify_overlay_test/replace_renderer", "max_ticks": 100, "structure": "forge:empty3x3x3" } \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/dry_vegitation.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/dry_vegitation.json index 77da6e5424..d12c3253cb 100644 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/dry_vegitation.json +++ b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/dry_vegitation.json @@ -3,5 +3,5 @@ "environment": "minecraft:default", "function": "forge:plant_type_placement/dry_vegitation", "max_ticks": 100, - "structure": "forge:empty31x3x3" + "structure": "forge:empty32x3x3" } \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_fungus.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_fungus.json deleted file mode 100644 index 6fb405074e..0000000000 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_fungus.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minecraft:function", - "environment": "minecraft:default", - "function": "forge:plant_type_placement/nether_fungus", - "max_ticks": 100, - "structure": "forge:empty15x3x2" -} \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_vegitation.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_vegitation.json deleted file mode 100644 index ceaf682111..0000000000 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/nether_vegitation.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minecraft:function", - "environment": "minecraft:default", - "function": "forge:plant_type_placement/nether_vegitation", - "max_ticks": 100, - "structure": "forge:empty14x3x3" -} \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/withrose.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/simple.json similarity index 51% rename from src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/withrose.json rename to src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/simple.json index b45a510c99..eaaa791261 100644 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/withrose.json +++ b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/simple.json @@ -1,7 +1,7 @@ { "type": "minecraft:function", "environment": "minecraft:default", - "function": "forge:plant_type_placement/withrose", + "function": "forge:plant_type_placement/simple", "max_ticks": 100, - "structure": "forge:empty4x3x4" + "structure": "forge:empty16x3x8" } \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegetation.json similarity index 50% rename from src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation.json rename to src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegetation.json index 064822d49f..6092eb1805 100644 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation.json +++ b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegetation.json @@ -1,7 +1,7 @@ { "type": "minecraft:function", "environment": "minecraft:default", - "function": "forge:plant_type_placement/vegitation", + "function": "forge:plant_type_placement/vegetation", "max_ticks": 100, - "structure": "forge:empty11x3x30" + "structure": "forge:empty11x3x33" } \ No newline at end of file diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation_and_clay.json b/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation_and_clay.json deleted file mode 100644 index 971f5a3bed..0000000000 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/vegitation_and_clay.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minecraft:function", - "environment": "minecraft:default", - "function": "forge:plant_type_placement/vegitation_and_clay", - "max_ticks": 100, - "structure": "forge:empty12x3x3" -} \ No newline at end of file diff --git a/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_bogged.json b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_bogged.json new file mode 100644 index 0000000000..524b689a40 --- /dev/null +++ b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_bogged.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:shears_behavior/custom_shears_shear_bogged", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_mooshroom.json b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_mooshroom.json new file mode 100644 index 0000000000..a3feb9f485 --- /dev/null +++ b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_mooshroom.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:shears_behavior/custom_shears_shear_mooshroom", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sheep.json b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sheep.json new file mode 100644 index 0000000000..233ee31e38 --- /dev/null +++ b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sheep.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:shears_behavior/custom_shears_shear_sheep", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_snowgolem.json b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_snowgolem.json new file mode 100644 index 0000000000..a064501d08 --- /dev/null +++ b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_snowgolem.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:shears_behavior/custom_shears_shear_snowgolem", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sulfur_cube_block.json b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sulfur_cube_block.json new file mode 100644 index 0000000000..c7d041cc68 --- /dev/null +++ b/src/test/generated/shears_behavior/data/forge/test_instance/shears_behavior/custom_shears_shear_sulfur_cube_block.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:shears_behavior/custom_shears_shear_sulfur_cube_block", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_legacy.json b/src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_common.json similarity index 71% rename from src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_legacy.json rename to src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_common.json index 3014996381..0e9b8de485 100644 --- a/src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_legacy.json +++ b/src/test/generated/tags_test/data/forge/test_instance/tags_test/cobble_in_common.json @@ -1,7 +1,7 @@ { "type": "minecraft:function", "environment": "minecraft:default", - "function": "forge:tags_test/cobble_in_legacy", + "function": "forge:tags_test/cobble_in_common", "max_ticks": 100, "structure": "forge:empty3x3x3" } \ No newline at end of file diff --git a/src/test/generated/test_helper_mod/pack.mcmeta b/src/test/generated/test_helper_mod/pack.mcmeta index d575010cae..46d7c8bc4e 100644 --- a/src/test/generated/test_helper_mod/pack.mcmeta +++ b/src/test/generated/test_helper_mod/pack.mcmeta @@ -1,9 +1,9 @@ { "pack": { "description": "Forge tests resource pack", - "max_format": 94, + "max_format": 107, "min_format": [ - 94, + 107, 1 ] } diff --git a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/netherwart.json b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_daytime.json similarity index 69% rename from src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/netherwart.json rename to src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_daytime.json index ffe17ef076..05ce627ab6 100644 --- a/src/test/generated/plant_type_placement/data/forge/test_instance/plant_type_placement/netherwart.json +++ b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_daytime.json @@ -1,7 +1,7 @@ { "type": "minecraft:function", "environment": "minecraft:default", - "function": "forge:plant_type_placement/netherwart", + "function": "forge:try_sleep/sleep_daytime", "max_ticks": 100, "structure": "forge:empty3x3x3" } \ No newline at end of file diff --git a/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_normally.json b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_normally.json new file mode 100644 index 0000000000..5fbf79b1f9 --- /dev/null +++ b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_normally.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:try_sleep/sleep_normally", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_obstructed.json b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_obstructed.json new file mode 100644 index 0000000000..f9a5613d1c --- /dev/null +++ b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_obstructed.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:try_sleep/sleep_obstructed", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_unsafe.json b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_unsafe.json new file mode 100644 index 0000000000..125be21460 --- /dev/null +++ b/src/test/generated/try_sleep/data/forge/test_instance/try_sleep/sleep_unsafe.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:function", + "environment": "minecraft:default", + "function": "forge:try_sleep/sleep_unsafe", + "max_ticks": 100, + "structure": "forge:empty3x3x3" +} \ No newline at end of file diff --git a/src/test/java/com/example/examplemod/ExampleMod.java b/src/test/java/com/example/examplemod/ExampleMod.java index 3b914dbdfb..86a8af6ba1 100644 --- a/src/test/java/com/example/examplemod/ExampleMod.java +++ b/src/test/java/com/example/examplemod/ExampleMod.java @@ -68,7 +68,7 @@ public final class ExampleMod { 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) -> { + .displayItems((_, 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()); diff --git a/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java b/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java index 0f71af4cb3..220d8eb750 100644 --- a/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java +++ b/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java @@ -35,7 +35,7 @@ public class LightingEventTest extends BaseTestMod { @GameTest public static void testLightingEventFires(GameTestHelper helper) { var eventFired = helper.boolFlag("eventFired"); - helper.addEventListener(ChunkEvent.LightingCalculated.BUS, event -> eventFired.set(true)); + helper.addEventListener(ChunkEvent.LightingCalculated.BUS, _ -> eventFired.set(true)); var random = RandomSource.create(); var level = helper.getLevel(); @@ -51,7 +51,7 @@ public class LightingEventTest extends BaseTestMod { chunk = level.getChunk(origin.offset(x, 0, z)); // If the chunk is already ticking, we can't force it - chunk = chunkSource.isPositionTicking(chunk.getPos().toLong()) ? null : chunk; + chunk = chunkSource.isPositionTicking(chunk.getPos().pack()) ? null : chunk; } if (chunk == null) { diff --git a/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java b/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java index ac9434ccac..6ace81ca45 100644 --- a/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java @@ -20,14 +20,13 @@ import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.client.renderer.entity.state.PigRenderState; -import net.minecraft.client.renderer.item.BlockModelWrapper; import net.minecraft.client.renderer.item.ItemStackRenderState; import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.animal.cow.Cow; import net.minecraft.world.entity.animal.pig.Pig; import net.minecraft.world.item.Item; @@ -100,8 +99,8 @@ public class AdditionalModelTest extends BaseTestMod { if (model == null) helper.fail("Failed to retreive " + key + " item model"); - if (!(model instanceof BlockModelWrapper)) - helper.fail("Itme Model was " + model.getClass() + " when BlockModelWrapper expected"); + if (model == manager.getMissingModel()) + helper.fail("Itme Model was the missing model"); helper.succeed(); } @@ -110,8 +109,8 @@ public class AdditionalModelTest extends BaseTestMod { public static void block_model(GameTestHelper helper) { var manager = Minecraft.getInstance().getModelManager(); - var model = manager.getBlockModelShaper().getBlockModel(COW_HEAD_STATE.any()); - helper.assertValueNotEqual(manager.getMissingBlockStateModel(), model, MODID, "Failed to retreive block model"); + var model = manager.getBlockStateModelSet().get(COW_HEAD_STATE.any()); + helper.assertValueNotEqual(manager.getBlockStateModelSet().missingModel(), model, MODID, "Failed to retreive block model"); helper.succeed(); } @@ -119,7 +118,7 @@ public class AdditionalModelTest extends BaseTestMod { // An example on how to render both the item and block model variants public void onAddLayers(EntityRenderersEvent.AddLayers event) { // Pigs get a block on their head, this is a test of going through the ItemModel loader - LivingEntityRenderer pig = event.getEntityRenderer(EntityType.PIG); + LivingEntityRenderer pig = event.getEntityRenderer(EntityTypes.PIG); pig.addLayer(new RenderLayer<>(pig) { @Override public void submit(PoseStack stack, SubmitNodeCollector source, int light, PigRenderState state, float xRot, float yRot) { @@ -143,7 +142,7 @@ public class AdditionalModelTest extends BaseTestMod { // Cows get a block on their head, this is a test of going through the BlockModel loader - LivingEntityRenderer cow = event.getEntityRenderer(EntityType.COW); + LivingEntityRenderer cow = event.getEntityRenderer(EntityTypes.COW); cow.addLayer(new RenderLayer<>(cow) { @Override public void submit(PoseStack stack, SubmitNodeCollector source, int light, LivingEntityRenderState cowState, float xRot, float yRot) { @@ -159,7 +158,7 @@ public class AdditionalModelTest extends BaseTestMod { var state = new MovingBlockRenderState(); state.blockState = COW_HEAD_STATE.any(); - source.submitMovingBlock(stack, state); + source.submitMovingBlock(stack, state, 0); stack.popPose(); } } diff --git a/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java b/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java index e7805e2eec..20576bda84 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java @@ -25,9 +25,9 @@ import java.util.Map; @Mod(CustomParticleTypeTest.MOD_ID) public class CustomParticleTypeTest extends BaseTestMod { public static final String MOD_ID = "custom_particle_type_test"; - private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("GRP_ONE"); - private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("GRP_TWO"); - private static final ParticleRenderType CUSTOM_TYPE_DUP = new ParticleRenderType("GRP_DUP"); + private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("GRP_ONE", "G1"); + private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("GRP_TWO", "G2"); + private static final ParticleRenderType CUSTOM_TYPE_DUP = new ParticleRenderType("GRP_DUP", "GD"); public CustomParticleTypeTest(FMLJavaModLoadingContext context) { super(context, false, false); diff --git a/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java b/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java new file mode 100644 index 0000000000..c5e117e7eb --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.debug.client; + +import java.util.function.Consumer; + +import net.minecraft.client.renderer.block.FluidModel; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.item.BucketItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.material.PushReaction; +import net.minecraftforge.client.event.ModelEvent.BakeFluidModels; +import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; +import net.minecraftforge.common.SoundActions; +import net.minecraftforge.fluids.FluidType; +import net.minecraftforge.fluids.ForgeFlowingFluid; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.gametest.GameTestNamespace; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; +import net.minecraftforge.test.BaseTestMod; + +@GameTestNamespace("forge") +@Mod(FluidBucketModelTest.MODID) +public class FluidBucketModelTest extends BaseTestMod { + public static final String MODID = "fluid_bucket_model"; + + private static final DeferredRegister BLOCKS = DeferredRegister.create(Registries.BLOCK, MODID); + private static final DeferredRegister ITEMS = DeferredRegister.create(Registries.ITEM, MODID); + private static final DeferredRegister FLUIDS = DeferredRegister.create(Registries.FLUID, MODID); + private static final DeferredRegister FLUID_TYPES = DeferredRegister.create(ForgeRegistries.FLUID_TYPES, MODID); + + + private static ForgeFlowingFluid.Properties FLUID_PROPERTIES; + private static final RegistryObject GAS_STILL = FLUIDS.register("gas", () -> new ForgeFlowingFluid.Source(FLUID_PROPERTIES)); + private static final RegistryObject GAS_FLOWING = FLUIDS.register("gas_flowing", () -> new ForgeFlowingFluid.Flowing(FLUID_PROPERTIES)); + + private static final FluidType.Properties GAS_PROPERTIES = FluidType.Properties.create() + .lightLevel(10) + .density(-1600) + .viscosity(100) + .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL) + .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY) + .sound(SoundActions.FLUID_VAPORIZE, SoundEvents.FIRE_EXTINGUISH); + + private static final Identifier GAS_STILL_TEXTURE = rl("minecraft", "block/water_still"); + private static final Identifier GAS_FLOWING_TEXTURE = rl("minecraft", "block/water_flow"); + + public static final RegistryObject GAS_TYPE = FLUID_TYPES.register("gas", () -> { + return new FluidType(GAS_PROPERTIES) { + @Override + public void initializeClient(final Consumer consumer) { + consumer.accept(new IClientFluidTypeExtensions() { + @Override + public Identifier getStillTexture() { + return GAS_STILL_TEXTURE; + } + @Override + public Identifier getFlowingTexture() { + return GAS_FLOWING_TEXTURE; + } + }); + } + }; + }); + + public static final RegistryObject GAS_BLOCK = BLOCKS.register("gas", () -> new LiquidBlock( + GAS_STILL, + Block.Properties.of() + .replaceable() + .noCollision() + .strength(100) + .pushReaction(PushReaction.DESTROY) + .noLootTable() + .liquid() + .sound(SoundType.EMPTY) + .setId(BLOCKS.key("gas")) + )); + + public static final RegistryObject GAS_BUCKET = ITEMS.register("gas_bucket", () -> new BucketItem(GAS_STILL, new Item.Properties().setId(ITEMS.key("gas_bucket")))); + + static { + FLUID_PROPERTIES = new ForgeFlowingFluid.Properties(GAS_TYPE, GAS_STILL, GAS_FLOWING).block(GAS_BLOCK).bucket(GAS_BUCKET); + } + + + public static final RegistryObject BUCKET = ITEMS.register("bucket", () -> new BucketItem(() -> Fluids.LAVA, new Item.Properties().setId(ITEMS.key("bucket")))); + + public FluidBucketModelTest(FMLJavaModLoadingContext context) { + super(context, false, true); + this.testItem(_ -> BUCKET.get().getDefaultInstance()); + BakeFluidModels.BUS.addListener(this::registerFluidModels); + } + + private void registerFluidModels(BakeFluidModels event) { + var gas_model = new FluidModel.Unbaked( + new Material(GAS_STILL_TEXTURE), + new Material(GAS_FLOWING_TEXTURE), + null, + null + ); + var gas_baked = gas_model.bake(event.materials(), () -> "Gas"); + event.register(GAS_STILL.get(), gas_baked); + event.register(GAS_FLOWING.get(), gas_baked); + } +} diff --git a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java index 984de47374..cb11d6a649 100644 --- a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java +++ b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java @@ -7,7 +7,7 @@ package net.minecraftforge.debug.client; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -35,11 +35,11 @@ public class GuiLayeringTest { public static void guiOpen(ScreenEvent.Init.Post event) { if (event.getScreen() instanceof AbstractContainerScreen && ENABLED) { event.addListener(Button.builder(Component.literal("Test Gui Layering"), btn -> { - Minecraft.getInstance().pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); + Minecraft.getInstance().gui.pushLayer(new TestLayer(Component.literal("LayerScreen"))); }).pos(2,2).size(150, 20).build()); event.addListener(Button.builder(Component.literal("Test Gui Normal"), btn -> { - Minecraft.getInstance().setScreen(new TestLayer(Component.literal("LayerScreen"))); + Minecraft.getInstance().gui.setScreen(new TestLayer(Component.literal("LayerScreen"))); }).pos(2, 25).size(150, 20).build()); } } @@ -50,10 +50,9 @@ public class GuiLayeringTest { } @Override - public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(graphics, mouseX, mouseY, partialTicks); - graphics.drawString(this.font, this.title, this.width / 2, 15, 0xFFFFFF); - super.render(graphics, mouseX, mouseY, partialTicks); + public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTicks) { + graphics.text(this.font, this.title, this.width / 2, 15, 0xFFFFFF); + super.extractRenderState(graphics, mouseX, mouseY, partialTicks); } @Override @@ -79,15 +78,15 @@ public class GuiLayeringTest { } private void closeStack(Button button) { - this.minecraft.setScreen(null); + this.minecraft.gui.setScreen(null); } private void popLayerButton(Button button) { - this.minecraft.popGuiLayer(); + this.minecraft.gui.popLayer(); } private void pushLayerButton(Button button) { - this.minecraft.pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); + this.minecraft.gui.pushLayer(new TestLayer(Component.literal("LayerScreen"))); } } } diff --git a/src/test/java/net/minecraftforge/debug/client/ModelRenderLayerTest.java b/src/test/java/net/minecraftforge/debug/client/ModelRenderLayerTest.java index 3ed1b416c0..d9a8f6d0fe 100644 --- a/src/test/java/net/minecraftforge/debug/client/ModelRenderLayerTest.java +++ b/src/test/java/net/minecraftforge/debug/client/ModelRenderLayerTest.java @@ -4,6 +4,8 @@ */ package net.minecraftforge.debug.client; +/* + This should no longer be necessary in 26.1 as Material's now define their layers. import net.minecraft.client.Minecraft; import net.minecraft.client.data.models.BlockModelGenerators; @@ -11,7 +13,6 @@ import net.minecraft.client.data.models.ItemModelGenerators; import net.minecraft.client.data.models.model.ItemModelUtils; import net.minecraft.client.data.models.model.ModelTemplates; import net.minecraft.client.data.models.model.TextureMapping; -import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.chunk.ChunkSectionLayer; import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; @@ -209,3 +210,4 @@ public class ModelRenderLayerTest extends BaseTestMod { } } } +*/ diff --git a/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java b/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java index 4dd35eb55c..dfe6e7c623 100644 --- a/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java +++ b/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java @@ -5,6 +5,7 @@ package net.minecraftforge.debug.client; +import net.minecraft.client.Minecraft; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.resources.Identifier; import net.minecraftforge.client.event.AddGuiOverlayLayersEvent; @@ -31,14 +32,20 @@ public class ModifyOverlayTest extends BaseTestMod { private static final Identifier myStackName = name("my_stack_name"); private static final ForgeLayeredDraw myLayerStack = new ForgeLayeredDraw(myStackName); - private static final ForgeLayer notAddedLayer = (gg, tr) -> {}; - private static final ForgeLayer layerA = (gg,tr) -> {}; + private static final ForgeLayer notAddedLayer = (_, _) -> {}; + private static final ForgeLayer layerA = (_,_) -> {}; private static final Identifier layerAName = name("layer_a"); - private static final ForgeLayer layerB = (gg,tr) -> {}; + private static final ForgeLayer layerB = (_,_) -> {}; private static final Identifier layerBName = name("layer_b"); - private static final ForgeLayer layerC = (gg,tr) -> {}; + private static final ForgeLayer layerC = (_,_) -> {}; private static final Identifier layerCName = name("layer_c"); + private static final IForgeGameTestHelper.BoolFlag detectReplaceFlag = new IForgeGameTestHelper.BoolFlag("det_replace_flag"); + // Wrapper renderer since we just need to change the callee location to test + private static final ForgeLayer replacementRenderer = (gg, tracker) -> { + Minecraft.getInstance().gui.hud.extractEffects(gg, tracker); + detectReplaceFlag.set(true); + }; private static final IForgeGameTestHelper.BoolFlag detectConditionFlag = new IForgeGameTestHelper.BoolFlag("det_cond_flag"); private static final IForgeGameTestHelper.BoolFlag detectConditionStackFlag = new IForgeGameTestHelper.BoolFlag("det_cond_stack_flag"); @@ -78,6 +85,7 @@ public class ModifyOverlayTest extends BaseTestMod { }); } + @SuppressWarnings("unchecked") @GameTest public static void ordered_layers(GameTestHelper helper) { // Test that layers are in the correct order. @@ -89,9 +97,9 @@ public class ModifyOverlayTest extends BaseTestMod { var field1 = cls.getDeclaredField("namedLayers"); field.setAccessible(true); field1.setAccessible(true); - Map> VROOT = ((Map>) field.get(drawStack)); - var PSS = ((ForgeLayeredDraw) VROOT.get(PRE_SLEEP_STACK).getKey()); - check = ((Map) field1.get(PSS)); + var VROOT = ((Map>) field.get(drawStack)); + var PSS = ((ForgeLayeredDraw)VROOT.get(PRE_SLEEP_STACK).getKey()); + check = ((Map)field1.get(PSS)); internalLayersList = getInternalLayersList(PSS); } catch (Exception e) { helper.fail("Threw a " + e.getMessage() + " when trying to get the inner layer list."); @@ -119,6 +127,13 @@ public class ModifyOverlayTest extends BaseTestMod { }); } + @GameTest + public static void replace_renderer(GameTestHelper helper) { + helper.assertTrue(detectReplaceFlag.getBool(), "Replace flag was not set."); + detectReplaceFlag.set(false); + helper.succeed(); + } + private void overlayTestListener(AddGuiOverlayLayersEvent event) { drawStack = event.getLayeredDraw(); var layeredDraw = event.getLayeredDraw(); @@ -128,6 +143,7 @@ public class ModifyOverlayTest extends BaseTestMod { // Layers have to be present to be ordered against, of course, but we tested for that already above. pEffects.addAbove(layerBName, POTION_EFFECTS, layerB); pEffects.addAbove(layerCName, layerBName, layerC); + layeredDraw.replace(PRE_SLEEP_STACK, POTION_EFFECTS, replacementRenderer); layeredDraw.addBelow(PRE_SLEEP_STACK, layerAName, layerBName, layerA); layeredDraw.addConditionTo(PRE_SLEEP_STACK, BOSS_OVERLAY, () -> { if (enableConditionFlag.getBool()) { @@ -139,7 +155,7 @@ public class ModifyOverlayTest extends BaseTestMod { } }); - myLayerStack.add(name("my_inner_layer_name"), (gg, tr) -> { + myLayerStack.add(name("my_inner_layer_name"), (_, _) -> { detectConditionStackFlag.set(true); }); // Demonstrates that entire stacks can have conditions attached diff --git a/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java b/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java index f6d675a01f..30cf1ab57f 100644 --- a/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java +++ b/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java @@ -7,12 +7,12 @@ package net.minecraftforge.debug.client; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.navigation.ScreenPosition; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState; -import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraftforge.client.event.RegisterPictureInPictureRendererEvent; @@ -70,7 +70,7 @@ public class PictureInPictureTest extends BaseTestMod { return; RENDER_FRAMES--; var window = Minecraft.getInstance().getWindow(); - event.getGuiGraphics().getRenderState().submitPicturesInPictureState(new TestPipRendererState( + event.getGuiGraphics().getRenderState().addPicturesInPictureState(new TestPipRendererState( event.getGuiGraphics(), 10, 10, @@ -80,21 +80,17 @@ public class PictureInPictureTest extends BaseTestMod { } private void registerTestPip(RegisterPictureInPictureRendererEvent event) { - event.register(new TestPipRenderer(event.getBufferSource())); + event.register(new TestPipRenderer()); } static class TestPipRenderer extends PictureInPictureRenderer { - protected TestPipRenderer(MultiBufferSource.BufferSource bufferSource) { - super(bufferSource); - } - @Override public Class getRenderStateClass() { return TestPipRendererState.class; } @Override - protected void renderToTexture(TestPipRendererState state, PoseStack poseStack) { + protected void renderToTexture(TestPipRendererState state, PoseStack poseStack, SubmitNodeCollector collector) { var graphics = state.graphics(); int red = Color.red.getRGB(); int x1 = state.x0 - 1; @@ -115,8 +111,8 @@ public class PictureInPictureTest extends BaseTestMod { } } - record TestPipRendererState(GuiGraphics graphics, int x0, int y0, int x1, int y1, ScreenRectangle scissorArea, ScreenRectangle bounds) implements PictureInPictureRenderState { - public TestPipRendererState(GuiGraphics graphics, int x0, int y0, int x1, int y1, ScreenRectangle scissorArea) { + record TestPipRendererState(GuiGraphicsExtractor graphics, int x0, int y0, int x1, int y1, ScreenRectangle scissorArea, ScreenRectangle bounds) implements PictureInPictureRenderState { + public TestPipRendererState(GuiGraphicsExtractor graphics, int x0, int y0, int x1, int y1, ScreenRectangle scissorArea) { this(graphics, x0, y0, x1, y1, scissorArea, PictureInPictureRenderState.getBounds(x0, y0, x1, y1, scissorArea)); } diff --git a/src/test/java/net/minecraftforge/debug/client/RenderFrameLayerTest.java b/src/test/java/net/minecraftforge/debug/client/RenderFrameLayerTest.java index 1c9b4e8cf8..7289f76007 100644 --- a/src/test/java/net/minecraftforge/debug/client/RenderFrameLayerTest.java +++ b/src/test/java/net/minecraftforge/debug/client/RenderFrameLayerTest.java @@ -5,8 +5,9 @@ package net.minecraftforge.debug.client; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.renderer.LevelTargetBundle; -import net.minecraft.client.renderer.state.LevelRenderState; +import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraftforge.client.FramePassManager; import net.minecraftforge.client.event.AddFramePassEvent; import net.minecraftforge.common.extensions.IForgeGameTestHelper; @@ -23,6 +24,8 @@ import net.minecraft.world.phys.AABB; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.framegraph.FramePass; +import org.jetbrains.annotations.NotNull; +import org.jspecify.annotations.NullMarked; @GameTestNamespace("forge") @Mod(RenderFrameLayerTest.MODID) @@ -48,10 +51,11 @@ public class RenderFrameLayerTest extends BaseTestMod { /** * If this is working, two white line box cubes will be rendered at ground level in a superflat world around (0,0) */ + @NullMarked public static void renderTest(AddFramePassEvent event) { FramePassManager.PassDefinition def = new FramePassManager.PassDefinition() { @Override - public void extracts(LevelTargetBundle bundle, FramePass pass) { + public void extracts(LevelTargetBundle bundle, FramePass pass, DeltaTracker dt) { bundle.main = pass.readsAndWrites(bundle.main); } @@ -59,7 +63,7 @@ public class RenderFrameLayerTest extends BaseTestMod { public void executes(LevelRenderState state) { PoseStack ps = new PoseStack(); passOne.set(true); - ps.translate(state.cameraRenderState.entityPos.multiply(-1,-1,-1)); + ps.translate(state.cameraRenderState.pos.multiply(-1,-1,-1)); ps.pushPose(); Gizmos.cuboid( new AABB(0, -60, 0, 10, -50, 10), @@ -72,7 +76,7 @@ public class RenderFrameLayerTest extends BaseTestMod { event.addPass(rl(MODID), def); FramePassManager.PassDefinition def2 = new FramePassManager.PassDefinition() { @Override - public void extracts(LevelTargetBundle bundle, FramePass pass) { + public void extracts(@NotNull LevelTargetBundle bundle, FramePass pass, DeltaTracker dt) { bundle.main = pass.readsAndWrites(bundle.main); } @@ -80,7 +84,7 @@ public class RenderFrameLayerTest extends BaseTestMod { public void executes(LevelRenderState state) { PoseStack ps = new PoseStack(); passTwo.set(true); - ps.translate(state.cameraRenderState.entityPos.multiply(-1,-1,-1)); + ps.translate(state.cameraRenderState.pos.multiply(-1,-1,-1)); ps.pushPose(); Gizmos.cuboid( new AABB(0, -60, 0, 10, -50, 10).contract(1, 1, 1), diff --git a/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java b/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java index f00295bef5..e41c175078 100644 --- a/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java +++ b/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java @@ -7,10 +7,8 @@ package net.minecraftforge.debug.client; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.inventory.InventoryScreen; -import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraftforge.client.event.AddGuiOverlayLayersEvent; import net.minecraftforge.client.event.RenderTooltipEvent; @@ -23,25 +21,35 @@ import net.minecraftforge.test.BaseTestMod; import java.util.Random; +import org.jspecify.annotations.Nullable; + @GameTestNamespace("forge") @Mod(RenderTooltipTest.MODID) public class RenderTooltipTest extends BaseTestMod { public static final String MODID = "render_tooltip_test"; private static boolean testMode = false; private static int shouldOpen = 0; - // Need some randomness so this test isn't asinine. - private static Object[] possibleChoices = BuiltInRegistries.ITEM.listElements().map(Holder::get).map(Item::getDefaultInstance).toArray(); - private static int itemStack = 0; private static ItemStack lastItemstackSeenInEvent = null; + private static @Nullable ItemStack itemStack; + public RenderTooltipTest(FMLJavaModLoadingContext context) { super(context, false, false); AddGuiOverlayLayersEvent.BUS.addListener(event -> { event.getLayeredDraw().addWithCondition(rl("render_tooltip_test"), (gg, dt) -> { - gg.setTooltipForNextFrame(Minecraft.getInstance().font, (ItemStack) possibleChoices[itemStack], 50, 50); + if (itemStack != null) + gg.setTooltipForNextFrame(Minecraft.getInstance().font, itemStack, 50, 50); }, () -> testMode) ; }); } + // Need some randomness so this test isn't asinine. + private static void pickRandomItem() { + var keys = BuiltInRegistries.ITEM.keySet(); + var idx = new Random().nextInt(keys.size()); + var item = BuiltInRegistries.ITEM.listElements().skip(idx).findFirst().get(); + itemStack = item.get().getDefaultInstance(); + } + @SuppressWarnings("all") @GameTest public static void stack_present_in_pre(GameTestHelper helper) { @@ -53,20 +61,22 @@ public class RenderTooltipTest extends BaseTestMod { helper.addRecordListener(TickEvent.RenderTickEvent.Pre.BUS, (event) -> { if (shouldOpen == 1) { - Minecraft.getInstance().setScreen(new InventoryScreen(Minecraft.getInstance().player)); + Minecraft.getInstance().gui.setScreen(new InventoryScreen(Minecraft.getInstance().player)); shouldOpen = 2; } else if (shouldOpen == 2) { - Minecraft.getInstance().setScreen(null); + Minecraft.getInstance().gui.setScreen(null); shouldOpen = 0; } }); - itemStack = new Random().nextInt(possibleChoices.length); + + pickRandomItem(); + helper.runAfterDelay(10, () -> { testMode = false; var copyOfLastSeen = lastItemstackSeenInEvent; - boolean testPassed = lastItemstackSeenInEvent == possibleChoices[itemStack]; + boolean testPassed = lastItemstackSeenInEvent == itemStack; lastItemstackSeenInEvent = null; - helper.assertTrue(testPassed, "Itemstack from last tooltip was not correct. Was " + copyOfLastSeen + " expected " + possibleChoices[itemStack]); + helper.assertTrue(testPassed, "Itemstack from last tooltip was not correct. Was " + copyOfLastSeen + " expected " + itemStack); helper.succeed(); }); } diff --git a/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java b/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java index a3de84b07b..7a02eb32a9 100644 --- a/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java +++ b/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java @@ -5,15 +5,19 @@ package net.minecraftforge.debug.creativetabs; +import java.util.ArrayList; import java.util.List; + +import org.jspecify.annotations.Nullable; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab.TabVisibility; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.ItemLike; @@ -49,7 +53,7 @@ public class CreativeModeTabTest { helper.register(LOGS, CreativeModeTab.builder().icon(() -> new ItemStack(Blocks.ACACIA_LOG)) .title(Component.literal("Logs")) .withLabelColor(0x00FF00) - .displayItems((params, output) -> { + .displayItems((_, output) -> { output.accept(new ItemStack(Blocks.ACACIA_LOG)); output.accept(new ItemStack(Blocks.BIRCH_LOG)); output.accept(new ItemStack(Blocks.DARK_OAK_LOG)); @@ -63,7 +67,7 @@ public class CreativeModeTabTest { .icon(() -> new ItemStack(Blocks.STONE)) .title(Component.literal("Stone")) .withLabelColor(0x0000FF) - .displayItems((params, output) -> { + .displayItems((_, output) -> { output.accept(new ItemStack(Blocks.STONE)); output.accept(new ItemStack(Blocks.GRANITE)); output.accept(new ItemStack(Blocks.DIORITE)); @@ -74,10 +78,7 @@ public class CreativeModeTabTest { helper.register(COLORS, CreativeModeTab.builder() .title(Component.literal("Colors")) - .displayItems((params, output) -> { - for (DyeColor color : DyeColor.values()) - output.accept(DyeItem.byColor(color)); - }) + .displayItems((_, output) -> output.acceptAll(getDyes())) .withTabFactory(CreativeModeColorTab::new) .withTabsBefore(STONE) .build() @@ -86,10 +87,7 @@ public class CreativeModeTabTest { helper.register(SEARCH, CreativeModeTab.builder() .title(Component.literal("Search")) .icon(() -> new ItemStack(Items.BOOKSHELF)) - .displayItems((params, output) -> { - for (DyeColor color : DyeColor.values()) - output.accept(DyeItem.byColor(color)); - }) + .displayItems((_, output) -> output.acceptAll(getDyes())) .withTabsBefore(COLORS) .withSearchBar() .build() @@ -101,7 +99,7 @@ public class CreativeModeTabTest { helper.register(Identifier.fromNamespaceAndPath(MOD_ID, "dummy" + i), CreativeModeTab.builder() .title(Component.literal("Dummy " + i)) .icon(() -> new ItemStack(block)) - .displayItems((params, output) -> output.accept(block)) + .displayItems((_, output) -> output.accept(block)) .build() ); } @@ -110,7 +108,7 @@ public class CreativeModeTabTest { helper.register(Identifier.fromNamespaceAndPath(MOD_ID, "with_tabs_image"), CreativeModeTab.builder() .title(Component.translatable("itemGroup.with_tabs_image")) .icon(() -> new ItemStack(Blocks.BRICKS)) - .displayItems((params, output) -> output.accept(Blocks.BRICKS)) + .displayItems((_, output) -> output.accept(Blocks.BRICKS)) //.withTabsImage(custom_tabs_image) .build()); }); @@ -138,22 +136,30 @@ public class CreativeModeTabTest { } } + private static final List getDyes() { + var ret = new ArrayList(); + for (var itr = BuiltInRegistries.ITEM.listElements().iterator(); itr.hasNext(); ) { + var item = itr.next(); + var color = item.components().get(DataComponents.DYE); + if (color != null) + ret.add(new ItemStack(item)); + } + return ret; + } + private static class CreativeModeColorTab extends CreativeModeTab { - private final ItemStack[] iconItems; + private @Nullable List iconItems; public CreativeModeColorTab(CreativeModeTab.Builder builder) { super(builder); - - DyeColor[] colors = DyeColor.values(); - iconItems = new ItemStack[colors.length]; - for (int i = 0; i < colors.length; i++) - iconItems[i] = new ItemStack(DyeItem.byColor(colors[i])); } @Override public ItemStack getIconItem() { - int idx = (int)(System.currentTimeMillis() / 1200) % iconItems.length; - return iconItems[idx]; + if (iconItems == null) + iconItems = getDyes(); + int idx = (int)(System.currentTimeMillis() / 1200) % iconItems.size(); + return iconItems.get(idx); } } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java b/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java index 72b710caca..dc64ab8251 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java @@ -7,11 +7,11 @@ package net.minecraftforge.debug.gameplay.block; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; +import net.minecraft.data.tags.VanillaBlockTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -38,7 +38,7 @@ public class ChorusBlockPlacementTest extends BaseTestMod { @GameTest public static void custom_placeable_block(GameTestHelper helper) { var custom = helper.setAssertAndGetBlock(BlockPos.ZERO, BLOCK.get()); - helper.assertTrue(custom.is(Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON), () -> "Block %s is not placeable on chorus".formatted(custom.getBlock())); + helper.assertTrue(custom.is(BlockTags.SUPPORTS_CHORUS_PLANT), () -> "Block %s is not placeable on chorus".formatted(custom.getBlock())); helper.setAndAssertBlock(BlockPos.ZERO.above(), Blocks.CHORUS_FLOWER); helper.runAfterDelay(1, () -> { @@ -48,17 +48,17 @@ public class ChorusBlockPlacementTest extends BaseTestMod { } private void gatherData(GatherDataEvent event) { - event.getGenerator().addProvider(event.includeServer(), new BlockTags(event)); + event.getGenerator().addProvider(event.includeServer(), new BlockTagProvider(event)); } - private static final class BlockTags extends BlockTagsProvider { - public BlockTags(GatherDataEvent event) { + private static final class BlockTagProvider extends VanillaBlockTagsProvider { + public BlockTagProvider(GatherDataEvent event) { super(event.getGenerator().getPackOutput(), event.getLookupProvider(), MOD_ID, event.getExistingFileHelper()); } @Override protected void addTags(HolderLookup.Provider provider) { - this.tag(Tags.Blocks.CHORUS_ADDITIONALLY_GROWS_ON).add(BLOCK.get()); + this.tag(BlockTags.SUPPORTS_CHORUS_PLANT).add(BLOCK.getKey()); } } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java b/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java index 2a61645aca..b62099e71f 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java @@ -24,6 +24,7 @@ import net.minecraftforge.test.BaseTestMod; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -31,9 +32,6 @@ import java.util.List; import java.util.Map; import java.util.function.Consumer; import java.util.stream.Collectors; -import java.util.stream.Stream; - -import com.google.common.collect.Streams; import static net.minecraft.world.level.block.Blocks.*; @GameTestNamespace("forge") @@ -42,11 +40,16 @@ public class PlantTypePlacementTest extends BaseTestMod { static final String MOD_ID = "plant_type_placement"; private static final Map, List> TAGS = Util.make(new HashMap<>(), map -> { - map.put(BlockTags.DIRT, List.of(DIRT, GRASS_BLOCK, PODZOL, COARSE_DIRT, MYCELIUM, ROOTED_DIRT, MOSS_BLOCK, PALE_MOSS_BLOCK, MUD, MUDDY_MANGROVE_ROOTS)); + map.put(BlockTags.DIRT, List.of(DIRT, COARSE_DIRT, ROOTED_DIRT)); + map.put(BlockTags.MUD, List.of(MUD, MUDDY_MANGROVE_ROOTS)); + map.put(BlockTags.MOSS_BLOCKS, List.of(MOSS_BLOCK, PALE_MOSS_BLOCK)); + map.put(BlockTags.GRASS_BLOCKS, List.of(GRASS_BLOCK, PODZOL, MYCELIUM)); map.put(BlockTags.SAND, List.of(SAND, RED_SAND, SUSPICIOUS_SAND)); - map.put(BlockTags.TERRACOTTA, List.of(TERRACOTTA, WHITE_TERRACOTTA, ORANGE_TERRACOTTA, MAGENTA_TERRACOTTA, LIGHT_BLUE_TERRACOTTA, YELLOW_TERRACOTTA, LIME_TERRACOTTA, PINK_TERRACOTTA, GRAY_TERRACOTTA, LIGHT_GRAY_TERRACOTTA, CYAN_TERRACOTTA, PURPLE_TERRACOTTA, BLUE_TERRACOTTA, BROWN_TERRACOTTA, GREEN_TERRACOTTA, RED_TERRACOTTA, BLACK_TERRACOTTA)); + var terracotta = new ArrayList(Blocks.DYED_TERRACOTTA.asList()); + terracotta.add(TERRACOTTA); + map.put(BlockTags.TERRACOTTA, terracotta); map.put(BlockTags.NYLIUM, List.of(CRIMSON_NYLIUM, WARPED_NYLIUM)); - map.put(BlockTags.MUSHROOM_GROW_BLOCK, List.of(MYCELIUM, PODZOL, CRIMSON_NYLIUM, WARPED_NYLIUM)); + map.put(BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT, List.of(MYCELIUM, PODZOL, CRIMSON_NYLIUM, WARPED_NYLIUM)); }); private record Info(Consumer handler, List blocks) {} @@ -61,8 +64,8 @@ public class PlantTypePlacementTest extends BaseTestMod { // VegitationBlock has no direct creations map.put(AttachedStemBlock.class, of(this::farmland, ATTACHED_MELON_STEM, ATTACHED_PUMPKIN_STEM)); - map.put(AzaleaBlock.class, of(this::vegitation_and_clay, AZALEA, FLOWERING_AZALEA)); - map.put(BushBlock.class, of(this::vegitation, BUSH)); + map.put(AzaleaBlock.class, of(this::simple, AZALEA, FLOWERING_AZALEA)); + map.put(BushBlock.class, of(this::vegetation, BUSH)); map.put(CactusFlowerBlock.class, of(this::cactus_flower, CACTUS_FLOWER)); map.put(CropBlock.class, of(this::farmland, WHEAT)); @@ -81,29 +84,29 @@ public class PlantTypePlacementTest extends BaseTestMod { map.put(ShortDryGrassBlock.class, of(this::dry_vegitation, SHORT_DRY_GRASS)); map.put(TallDryGrassBlock.class, of(this::dry_vegitation, TALL_DRY_GRASS)); - map.put(FireflyBushBlock.class, of(this::vegitation, FIREFLY_BUSH)); - map.put(FlowerBedBlock.class, of(this::vegitation, PINK_PETALS, WILDFLOWERS)); + map.put(FireflyBushBlock.class, of(this::vegetation, FIREFLY_BUSH)); + map.put(FlowerBedBlock.class, of(this::vegetation, PINK_PETALS, WILDFLOWERS)); - map.put(FlowerBlock.class, of(this::vegitation, ALLIUM, AZURE_BLUET, BLUE_ORCHID, CORNFLOWER, DANDELION, LILY_OF_THE_VALLEY, ORANGE_TULIP, OXEYE_DAISY, PINK_TULIP, POPPY, RED_TULIP, TORCHFLOWER, WHITE_TULIP)); - map.put(EyeblossomBlock.class, of(this::vegitation, CLOSED_EYEBLOSSOM, OPEN_EYEBLOSSOM)); - map.put(WitherRoseBlock.class, of(this::withrose, WITHER_ROSE)); + map.put(FlowerBlock.class, of(this::vegetation, ALLIUM, AZURE_BLUET, BLUE_ORCHID, CORNFLOWER, DANDELION, GOLDEN_DANDELION, LILY_OF_THE_VALLEY, ORANGE_TULIP, OXEYE_DAISY, PINK_TULIP, POPPY, RED_TULIP, TORCHFLOWER, WHITE_TULIP)); + map.put(EyeblossomBlock.class, of(this::vegetation, CLOSED_EYEBLOSSOM, OPEN_EYEBLOSSOM)); + map.put(WitherRoseBlock.class, of(this::simple, WITHER_ROSE)); - map.put(FungusBlock.class, of(this::nether_fungus, CRIMSON_FUNGUS, WARPED_FUNGUS)); + map.put(NetherFungusBlock.class, of(this::simple, CRIMSON_FUNGUS, WARPED_FUNGUS)); map.put(LeafLitterBlock.class, of(this::todo, LEAF_LITTER)); map.put(MushroomBlock.class, of(this::mushroom, BROWN_MUSHROOM, RED_MUSHROOM)); - map.put(NetherSproutsBlock.class, of(this::nether_vegitation, NETHER_SPROUTS)); - map.put(NetherWartBlock.class, of(this::netherwart, NETHER_WART)); - map.put(RootsBlock.class, of(this::nether_vegitation, CRIMSON_ROOTS, WARPED_ROOTS)); + map.put(NetherSproutsBlock.class, of(this::simple, NETHER_SPROUTS)); + map.put(NetherWartBlock.class, of(this::simple, NETHER_WART)); + map.put(NetherRootsBlock.class, of(this::simple, CRIMSON_ROOTS, WARPED_ROOTS)); - map.put(SaplingBlock.class, of(this::vegitation, ACACIA_SAPLING, BIRCH_SAPLING, CHERRY_SAPLING, DARK_OAK_SAPLING, JUNGLE_SAPLING, OAK_SAPLING, PALE_OAK_SAPLING, SPRUCE_SAPLING)); - map.put(MangrovePropaguleBlock.class, of(this::vegitation_and_clay, MANGROVE_PROPAGULE)); + map.put(SaplingBlock.class, of(this::vegetation, ACACIA_SAPLING, BIRCH_SAPLING, CHERRY_SAPLING, DARK_OAK_SAPLING, JUNGLE_SAPLING, OAK_SAPLING, PALE_OAK_SAPLING, SPRUCE_SAPLING)); + map.put(MangrovePropaguleBlock.class, of(this::vegetation, MANGROVE_PROPAGULE)); map.put(SeagrassBlock.class, of(this::todo, SEAGRASS)); map.put(SeaPickleBlock.class, of(this::todo, SEA_PICKLE)); map.put(StemBlock.class, of(this::farmland, MELON_STEM, PUMPKIN_STEM)); - map.put(SweetBerryBushBlock.class, of(this::vegitation, SWEET_BERRY_BUSH)); - map.put(TallGrassBlock.class, of(this::vegitation, FERN, SHORT_GRASS)); - map.put(WaterlilyBlock.class, of(this::todo, LILY_PAD)); + map.put(SweetBerryBushBlock.class, of(this::vegetation, SWEET_BERRY_BUSH)); + map.put(TallGrassBlock.class, of(this::vegetation, FERN, SHORT_GRASS)); + map.put(LilyPadBlock.class, of(this::todo, LILY_PAD)); }); @SafeVarargs @@ -152,15 +155,14 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.succeed(); } - @GameTest(structure = "forge:empty5x4x4") // sand(3) + dirt(10) + extra(4) = 17 + @GameTest(structure = "forge:empty5x4x4") // SUPPORTS_BAMBOO = sand(3) + substrate() + extra(4) = 17 public void bamboo(GameTestHelper helper) { - // BambooStalkBlock = Tag.BAMBOO_PLANTABLE_ON var plants = plants(BambooStalkBlock.class); - var soils = new ArrayList<>(sandAndDirt(helper, BAMBOO, BAMBOO_SAPLING, GRAVEL, SUSPICIOUS_GRAVEL)); + var soils = join(sand(helper), substrate(helper), List.of(BAMBOO, BAMBOO_SAPLING, GRAVEL, SUSPICIOUS_GRAVEL)); // these need special case var special = List.of(BAMBOO, BAMBOO_SAPLING); - testTag(helper, BlockTags.BAMBOO_PLANTABLE_ON, soils); + testTag(helper, BlockTags.SUPPORTS_BAMBOO, soils); soils.removeAll(special); var pos = iterate(helper, plants, soils); @@ -217,7 +219,7 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.makeFloor(SAND, 1); var pos = BlockPos.ZERO.above(); - // CactusFlowerBlock = CACTUS, FARMLAND, SturdyCenter Up + // CactusFlowerBlock = SUPPORT_OVERRIDE_CACTUS_FLOWER(CACTUS, FARMLAND), SturdyCenter Up for (var plant : plants(CactusFlowerBlock.class)) { helper.setAndAssertBlock(pos, FARMLAND); canSurvive(helper, pos.above(), plant); @@ -233,11 +235,11 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.succeed(); } - @GameTest(structure = "forge:empty13x3x9") // (sand(3) + dirt(10)) * (water(2) + FROSTED_ICE) + @GameTest(structure = "forge:empty13x3x9") // SUPPORTS_SUGAR_CANE(substrate() + sand(3)) * (water(2) + FROSTED_ICE) public void sugarcane(GameTestHelper helper) { // SugarCaneBlock = DIRT || SAND && Horizontal (Fluid == WATER || FROSTED_ICE) var plants = plants(SugarCaneBlock.class); - var soils = sandAndDirt(helper); + var soils = join(substrate(helper), sand(helper)); var start = BlockPos.ZERO; for (var plant : plants) { @@ -268,75 +270,35 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.succeed(); } - @GameTest(structure = "forge:empty11x3x30") // (dirt(10) + FARMLAND) * 30 plants - public void vegitation(GameTestHelper helper) { + @GameTest(structure = "forge:empty11x3x33") // vegetation(11) * 32 plants + public void vegetation(GameTestHelper helper) { var plants = plants( BushBlock.class, // 1 FireflyBushBlock.class, // 1 FlowerBedBlock.class, // 2 - FlowerBlock.class, // 13 + FlowerBlock.class, // 14 EyeblossomBlock.class, // 2 SaplingBlock.class, // 8 SweetBerryBushBlock.class, // 1 + MangrovePropaguleBlock.class, // 1 TallGrassBlock.class // 2 ); - var soils = vegitationSoils(helper); + var soils = supportsVegetation(helper); iterate(helper, plants, soils); helper.succeed(); } - @GameTest(structure = "forge:empty12x3x3") // (dirt(10) + FARMLAND + CLAY) * 2 plants - public void vegitation_and_clay(GameTestHelper helper) { - var plants = plants( - MangrovePropaguleBlock.class, // 1 - AzaleaBlock.class // 2 - ); - var soils = vegitationSoils(helper, CLAY); - - iterate(helper, plants, soils); - helper.succeed(); - } - - @GameTest(structure = "forge:empty4x3x4") // (dirt(10) + FARMLAND + 3 extra) * 1 plant = 14 - public void withrose(GameTestHelper helper) { - //WitherRoseBlock = VEGITATION || NETHERRACK, SOUL_SAND, SOUL_SOIL - var plants = plants(WitherRoseBlock.class); - iterate(helper, plants, vegitationSoils(helper, NETHERRACK, SOUL_SAND, SOUL_SOIL)); - helper.succeed(); - } - - @GameTest - public void netherwart(GameTestHelper helper) { - // NetherWartBlock = SOUL_SAND - var plants = plants(NetherWartBlock.class); - iterate(helper, plants, List.of(SOUL_SAND)); - helper.succeed(); - } - - @GameTest(structure = "forge:empty14x3x3") // (dirt(10) + FARMLAND + nylium(2) + SOUL_SOIL) * 3 plants - public void nether_vegitation(GameTestHelper helper) { - // NetherSproutsBlock = VEGITATION || Tags.NYLIUM, SOUL_SOIL - // RootsBlock = VEGITATION || Tags.NYLIUM, SOUL_SOIL - var plants = plants( - NetherSproutsBlock.class, // 1 - RootsBlock.class // 2 - ); - var nylium = testTag(helper, BlockTags.NYLIUM, TAGS.get(BlockTags.NYLIUM)); - var soils = Stream.concat(nylium.stream(), vegitationSoils(helper, SOUL_SOIL).stream()).distinct().toList(); - - iterate(helper, plants, soils); - helper.succeed(); - } - - @GameTest(structure = "forge:empty15x3x2") // (dirt(10) + FARMLAND + nylium(2) + SOUL_SOIL + MYCELIUM) * 2 plants - public void nether_fungus(GameTestHelper helper) { - // FungusBlock = VEGITATION || Tags.NYLIUM, MYCELIUM, SOUL_SOIL - var plants = plants(FungusBlock.class); - var nylium = testTag(helper, BlockTags.NYLIUM, TAGS.get(BlockTags.NYLIUM)); - var soils = Stream.concat(nylium.stream(), vegitationSoils(helper, MYCELIUM, SOUL_SOIL).stream()).distinct().toList(); - - iterate(helper, plants, soils); + @GameTest(structure = "forge:empty16x3x8") + public void simple(GameTestHelper helper) { + var pos = iterate(helper, BlockPos.ZERO, plants(AzaleaBlock.class), supportsAzalea(helper)); // 12 + pos = iterate(helper, pos, plants(WitherRoseBlock.class), supportsWitherRose(helper)); // 14 + pos = iterate(helper, pos, plants(NetherWartBlock.class), supportsNetherWart(helper)); // 1 + pos = iterate(helper, pos, plants(NetherSproutsBlock.class), supportsNetherSprouts(helper)); // 14 + pos = iterate(helper, pos, List.of(Blocks.WARPED_ROOTS), supportsWarpedRoots(helper)); // 14 + pos = iterate(helper, pos, List.of(Blocks.CRIMSON_ROOTS), supportsCrimsonRoots(helper)); // 14 + pos = iterate(helper, pos, List.of(Blocks.WARPED_FUNGUS), supportsWarpedFungus(helper)); // 15 + pos = iterate(helper, pos, List.of(Blocks.CRIMSON_FUNGUS), supportsCrimsonFungus(helper)); // 15 helper.succeed(); } @@ -356,14 +318,10 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.succeed(); } - @GameTest(structure = "forge:empty31x3x3") // 3 plants (sand(3) + dirt(10) + terracotta(17) + FARMLAND) * plants(3) + @GameTest(structure = "forge:empty32x3x3") // 32 * plants(3) public void dry_vegitation(GameTestHelper helper) { - // DryVegetationBlock = Tag.DRY_VEGETATION_MAY_PLACE_ON var plants = plants(DryVegetationBlock.class, ShortDryGrassBlock.class, TallDryGrassBlock.class); - var terracotta = testTag(helper, BlockTags.TERRACOTTA, TAGS.get(BlockTags.TERRACOTTA)); - var soils = Streams.concat(sandAndDirt(helper, FARMLAND).stream(), terracotta.stream()).toList(); - testTag(helper, BlockTags.DRY_VEGETATION_MAY_PLACE_ON, soils); - iterate(helper, plants, soils); + iterate(helper, plants, supportsDryVegetation(helper)); helper.succeed(); } @@ -397,7 +355,7 @@ public class PlantTypePlacementTest extends BaseTestMod { // I would rather make a enclosed box, but lighting doesn't propagate for some reason. - var soil = testTag(helper, BlockTags.MUSHROOM_GROW_BLOCK, TAGS.get(BlockTags.MUSHROOM_GROW_BLOCK)); + var soil = testTag(helper, BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT, TAGS.get(BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT)); iterate(helper, plants, soil); // delay a handful of ticks to propagate lighting @@ -428,11 +386,11 @@ public class PlantTypePlacementTest extends BaseTestMod { //=================================================== // HELPERS //=================================================== - private static BlockPos iterate(GameTestHelper helper, List plants, List soils) { + private static BlockPos iterate(GameTestHelper helper, Collection plants, Collection soils) { return iterate(helper, BlockPos.ZERO.west(), plants, soils); } - private static BlockPos iterate(GameTestHelper helper, BlockPos pos, List plants, List soils) { + private static BlockPos iterate(GameTestHelper helper, BlockPos pos, Collection plants, Collection soils) { for (var plant : plants) { for (var soil : soils) { pos = offset(helper, pos); @@ -447,25 +405,73 @@ public class PlantTypePlacementTest extends BaseTestMod { return pos; } - private static List dirt(GameTestHelper helper) { - return testTag(helper, BlockTags.DIRT, TAGS.get(BlockTags.DIRT)); + private static Collection known(GameTestHelper helper, TagKey tag) { + var expected = TAGS.get(tag); + if (expected == null) + helper.fail("Failed to find known values for: " + tag); + return testTag(helper, tag, expected); } - private static List dirt(GameTestHelper helper, Block... extra) { - return Streams.concat(dirt(helper).stream(), Stream.of(extra)).distinct().toList(); + @SafeVarargs + private static Collection join(GameTestHelper helper, TagKey... tags) { + var ret = new HashSet(); + for (var tag : tags) + ret.addAll(known(helper, tag)); + return ret; } - private static List sand(GameTestHelper helper) { - return testTag(helper, BlockTags.SAND, TAGS.get(BlockTags.SAND)); + @SafeVarargs + private static Collection join(Collection... lists) { + var ret = new HashSet(); + for (var list : lists) + ret.addAll(list); + return ret; } - private static List sandAndDirt(GameTestHelper helper, Block... extra) { - return Streams.concat(sand(helper).stream(), dirt(helper).stream(), Stream.of(extra)).distinct().toList(); + private static Collection dirt(GameTestHelper helper) { // 3 + return known(helper, BlockTags.DIRT); } - - // See VegitationBlock.mayPlaceOn - private static List vegitationSoils(GameTestHelper helper, Block... extra) { - return Streams.concat(dirt(helper, FARMLAND).stream(), Stream.of(extra)).distinct().toList(); + private static Collection sand(GameTestHelper helper) { // 3 + return known(helper, BlockTags.SAND); + } + private static Collection terracotta(GameTestHelper helper) { // 18 + return known(helper, BlockTags.TERRACOTTA); + } + private static Collection nylium(GameTestHelper helper) { // 2 + return known(helper, BlockTags.NYLIUM); + } + private static Collection substrate(GameTestHelper helper) { // 10 = dirt(3), mud(2), moss_blocks(2), grass_blocks(3) + return testTag(helper, BlockTags.SUBSTRATE_OVERWORLD, join(helper, BlockTags.DIRT, BlockTags.MUD, BlockTags.MOSS_BLOCKS, BlockTags.GRASS_BLOCKS)); + } + private static Collection supportsVegetation(GameTestHelper helper) { // 11 = (substrate(10) + FARMLAND) + return testTag(helper, BlockTags.SUPPORTS_VEGETATION, join(substrate(helper), List.of(FARMLAND))); + } + private static Collection supportsAzalea(GameTestHelper helper) { // 12 = (vegetation(11) + CLAY) + return testTag(helper, BlockTags.SUPPORTS_AZALEA, join(supportsVegetation(helper), List.of(CLAY))); + } + private static Collection supportsWitherRose(GameTestHelper helper) { // 14 = (vegetation(11) + NETHERRACK + SOUL_SAND + SOUL_SOIL) + return testTag(helper, BlockTags.SUPPORTS_WITHER_ROSE, join(supportsVegetation(helper), List.of(NETHERRACK, SOUL_SAND, SOUL_SOIL))); + } + private static Collection supportsNetherWart(GameTestHelper helper) { // 1 + return testTag(helper, BlockTags.SUPPORTS_NETHER_WART, List.of(SOUL_SAND)); + } + private static Collection supportsNetherSprouts(GameTestHelper helper) { // 14 = (vegetation(11) + nylium(2) + SOUL_SOIL) + return testTag(helper, BlockTags.SUPPORTS_NETHER_SPROUTS, join(supportsVegetation(helper), nylium(helper), List.of(SOUL_SOIL))); + } + private static Collection supportsWarpedRoots(GameTestHelper helper) { // 14 = (vegetation(11) + nylium(2) + SOUL_SOIL) + return testTag(helper, BlockTags.SUPPORTS_WARPED_ROOTS, join(supportsVegetation(helper), nylium(helper), List.of(SOUL_SOIL))); + } + private static Collection supportsCrimsonRoots(GameTestHelper helper) { // 14 = (warpedRoots(14)) + return testTag(helper, BlockTags.SUPPORTS_CRIMSON_ROOTS, supportsWarpedRoots(helper)); + } + private static Collection supportsWarpedFungus(GameTestHelper helper) { // 15 = (vegetation(11) + nylium(2) + MYCELIUM + SOUL_SOIL) + return testTag(helper, BlockTags.SUPPORTS_WARPED_FUNGUS, join(supportsVegetation(helper), nylium(helper), List.of(MYCELIUM, SOUL_SOIL))); + } + private static Collection supportsCrimsonFungus(GameTestHelper helper) { // 15 = (warpedFungus(15)) + return testTag(helper, BlockTags.SUPPORTS_CRIMSON_FUNGUS, supportsWarpedFungus(helper)); + } + private static Collection supportsDryVegetation(GameTestHelper helper) { // 32 = (sand(3) + terracotta(18) + vegetation(11) + return testTag(helper, BlockTags.SUPPORTS_DRY_VEGETATION, join(sand(helper), terracotta(helper), supportsVegetation(helper))); } private static BlockPos offset(GameTestHelper helper, BlockPos pos) { @@ -477,7 +483,7 @@ public class PlantTypePlacementTest extends BaseTestMod { return pos; } - private static List sort(List blocks) { + private static Collection sort(Collection blocks) { var sorted = new ArrayList<>(blocks); Collections.sort(sorted, (a, b) -> name(a).compareTo(name(b))); return sorted; @@ -498,7 +504,7 @@ public class PlantTypePlacementTest extends BaseTestMod { helper.assertTrue(state.canSurvive(helper.getLevel(), helper.absolutePos(pos)), () -> name(state) + " can not survive on " + name(soil)); } - private static List testTag(GameTestHelper helper, TagKey tag, List expected) { + private static Collection testTag(GameTestHelper helper, TagKey tag, Collection expected) { var lookup = helper.registryLookup(Registries.BLOCK); var values = lookup.getOrThrow(tag).stream() .filter(h -> h.unwrapKey().orElseThrow().identifier().getNamespace().equals("minecraft")) // Only vanilla entries diff --git a/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java b/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java index bc3ae3569e..f6e849c1d7 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java @@ -18,10 +18,11 @@ import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; import net.minecraft.data.recipes.SingleItemRecipeBuilder; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.references.ItemIds; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.CookingBookCategory; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeInput; @@ -32,7 +33,6 @@ import net.minecraftforge.common.Tags; import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.SimpleCraftingContainer; import net.minecraftforge.common.crafting.conditions.IConditionBuilder; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.fml.common.Mod; @@ -54,8 +54,6 @@ public class ConditionalRecipeTest extends BaseTestMod { public void gatherData(GatherDataEvent event) { var gen = event.getGenerator(); gen.addProvider(event.includeServer(), new Recipes.Runner(gen.getPackOutput(), event.getLookupProvider())); - var testBlockTags = new TestBlockTags(gen.getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper()); - gen.addProvider(event.includeServer(), testBlockTags); gen.addProvider(event.includeServer(), new TestItemTags(gen.getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper())); } @@ -170,17 +168,6 @@ public class ConditionalRecipeTest extends BaseTestMod { ); } - public static class TestBlockTags extends BlockTagsProvider { - public TestBlockTags(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, MODID, existingFileHelper); - } - - @Override - protected void addTags(HolderLookup.Provider registries) { - // No block tags needed; just need a block provider content-getter to supply to the item tags generator - } - } - public static class TestItemTags extends VanillaItemTagsProvider { public TestItemTags(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { super(output, lookupProvider, MODID, existingFileHelper); @@ -189,7 +176,7 @@ public class ConditionalRecipeTest extends BaseTestMod { @Override protected void addTags(HolderLookup.Provider registries) { // Empty out the Forge eggs tag for purposes of testing the tag-empty recipe condition - this.tag(Tags.Items.EGGS).remove(Items.EGG); + this.tag(Tags.Items.EGGS).remove(ItemIds.EGG); } } @@ -278,7 +265,7 @@ public class ConditionalRecipeTest extends BaseTestMod { ConditionalRecipe.builder() .condition(FALSE()) .recipe( - SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.DIRT), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK, 0.1F, 200) + SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.DIRT), RecipeCategory.MISC, CookingBookCategory.MISC, Blocks.DIAMOND_BLOCK, 0.1F, 200) .unlockedBy(getHasName(Blocks.DIRT), has(Blocks.DIRT)) ::save ) @@ -287,7 +274,7 @@ public class ConditionalRecipeTest extends BaseTestMod { ConditionalRecipe.builder() .condition(TRUE()) .recipe( - SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BEE_NEST), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK, 0.1F, 200) + SimpleCookingRecipeBuilder.smelting(Ingredient.of(Blocks.BEE_NEST), RecipeCategory.MISC, CookingBookCategory.MISC, Blocks.DIAMOND_BLOCK, 0.1F, 200) .unlockedBy(getHasName(Blocks.BEE_NEST), has(Blocks.BEE_NEST)) ::save ) @@ -296,7 +283,7 @@ public class ConditionalRecipeTest extends BaseTestMod { ConditionalRecipe.builder() .condition(FALSE()) .recipe( - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.DIRT), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK) + SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.DIRT), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK, 1) .unlockedBy(getHasName(Blocks.DIRT), has(Blocks.DIRT)) ::save ) @@ -305,7 +292,7 @@ public class ConditionalRecipeTest extends BaseTestMod { ConditionalRecipe.builder() .condition(TRUE()) .recipe( - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.REDSTONE_ORE), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK) + SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.REDSTONE_ORE), RecipeCategory.MISC, Blocks.DIAMOND_BLOCK, 1) .unlockedBy(getHasName(Blocks.REDSTONE_ORE), has(Blocks.REDSTONE_ORE)) ::save ) diff --git a/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java b/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java index 888b64680a..68bd6ae49a 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java @@ -9,8 +9,6 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.jetbrains.annotations.Nullable; - import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup.Provider; import net.minecraft.core.component.DataComponents; @@ -23,6 +21,7 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.nbt.CompoundTag; +import net.minecraft.references.BlockItemIds; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; @@ -38,7 +37,6 @@ import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.crafting.SimpleCraftingContainer; import net.minecraftforge.common.crafting.conditions.IConditionBuilder; import net.minecraftforge.common.crafting.ingredients.IIngredientBuilder; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.util.INBTBuilder; import net.minecraftforge.data.event.GatherDataEvent; @@ -69,9 +67,7 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { var look = event.getLookupProvider(); var exist = event.getExistingFileHelper(); - var blockTags = new BlockTagsGen(out, look, exist); - gen.addProvider(event.includeServer(), blockTags); - gen.addProvider(event.includeServer(), new ItemTagsGen(out, look, blockTags, exist)); + gen.addProvider(event.includeServer(), new ItemTagsGen(out, look, exist)); gen.addProvider(event.includeServer(), new Recipes.Runner(out, event.getLookupProvider())); } @@ -226,25 +222,15 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { assertRecipeMatch(helper, RecipeType.CRAFTING, container.apply(stack(Items.DIRT)), "difference_ingredient"); assertRecipeMiss(helper, RecipeType.CRAFTING, container.apply(stack(Items.STONE))); } - - private static class BlockTagsGen extends BlockTagsProvider { - public BlockTagsGen(PackOutput out, CompletableFuture look, @Nullable ExistingFileHelper exist) { - super(out, look, MODID, exist); - } - - @Override - public void addTags(HolderLookup.Provider lookup) { } - } - private static class ItemTagsGen extends VanillaItemTagsProvider { - public ItemTagsGen(PackOutput out, CompletableFuture lookup, BlockTagsProvider blocks, ExistingFileHelper existing) { - super(out, lookup, /*blocks.contentsGetter(),*/ MODID, existing); + public ItemTagsGen(PackOutput out, CompletableFuture lookup, ExistingFileHelper existing) { + super(out, lookup, MODID, existing); } @Override public void addTags(HolderLookup.Provider lookup) { - tag(LEFT).add(Items.DIRT, Items.STONE); - tag(RIGHT).add(Items.STONE, Items.GRAVEL); + tag(LEFT).add(BlockItemIds.DIRT.item(), BlockItemIds.STONE.item()); + tag(RIGHT).add(BlockItemIds.STONE.item(), BlockItemIds.GRAVEL.item()); } } @@ -272,7 +258,7 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { .pattern("XXX") .pattern("XXX") .define('X', - partialNbt() + nbtIngredient() .nbt(damaged()) .items(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE) .build() @@ -284,7 +270,7 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { shaped() .pattern("XXX") .define('X', - partialNbt() + nbtIngredient() .nbt(named()) .items(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE) .build() @@ -297,8 +283,16 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { .pattern("XXX") .pattern(" X ") .define('X', compound( - strictNbt(named(Items.DIRT)), - strictNbt(named(Items.OAK_LOG)) + nbtIngredient() + .strict() + .nbt(named()) + .item(Items.DIRT) + .build(), + nbtIngredient() + .strict() + .nbt(named()) + .item(Items.OAK_LOG) + .build() )) .unlockedBy(hasName, has) .save(this.output, rk("compound_ingredient")); @@ -306,7 +300,13 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { // strict NBT match - should match an unnamed pickaxe that lost 3 durability shaped() .pattern("XXX") - .define('X', strictNbt(named(Items.DIAMOND_PICKAXE))) + .define('X', + nbtIngredient() + .strict() + .nbt(named()) + .item(Items.DIAMOND_PICKAXE) + .build() + ) .unlockedBy(hasName, has) .save(this.output, rk("strict_nbt_ingredient")); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/crafting/TagsTest.java b/src/test/java/net/minecraftforge/debug/gameplay/crafting/TagsTest.java index db0ff22ade..0209c54299 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/crafting/TagsTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/crafting/TagsTest.java @@ -6,10 +6,9 @@ package net.minecraftforge.debug.gameplay.crafting; import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.resources.Identifier; -import net.minecraft.tags.ItemTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraftforge.common.Tags; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.gametest.GameTest; @@ -18,7 +17,7 @@ import net.minecraftforge.test.BaseTestMod; @Mod(TagsTest.MODID) @GameTestNamespace("forge") -public class TagsTest extends BaseTestMod { +public final class TagsTest extends BaseTestMod { public static final String MODID = "tags_test"; public TagsTest(FMLJavaModLoadingContext context) { @@ -26,11 +25,11 @@ public class TagsTest extends BaseTestMod { } @GameTest - public static void cobble_in_legacy(GameTestHelper helper) throws ReflectiveOperationException { + public static void cobble_in_common(GameTestHelper helper) throws ReflectiveOperationException { var cobble = new ItemStack(Items.COBBLESTONE); - var forgeCobbleTag = ItemTags.create(Identifier.fromNamespaceAndPath("forge", "cobblestone")); - boolean isCobble = cobble.is(forgeCobbleTag); - helper.assertTrue(isCobble, forgeCobbleTag + " is missing " + Items.COBBLESTONE); + var commonCobbleTag = Tags.Items.COBBLESTONES; + boolean isCobble = cobble.is(commonCobbleTag); + helper.assertTrue(isCobble, commonCobbleTag + " is missing " + Items.COBBLESTONE); helper.succeed(); } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java b/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java index a7d239b1ce..669a39095b 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java @@ -8,11 +8,12 @@ package net.minecraftforge.debug.gameplay.criterion; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import org.jspecify.annotations.NullMarked; -import net.minecraft.advancements.Criterion; -import net.minecraft.advancements.criterion.BlockPredicate; -import net.minecraft.advancements.criterion.ContextAwarePredicate; -import net.minecraft.advancements.criterion.ItemPredicate; -import net.minecraft.advancements.criterion.SimpleCriterionTrigger; + +import net.minecraft.advancements.predicates.BlockPredicate; +import net.minecraft.advancements.predicates.ContextAwarePredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.triggers.Criterion; +import net.minecraft.advancements.triggers.SimpleCriterionTrigger; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; diff --git a/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java b/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java index 3b0e0452c5..e6f38e19cf 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java @@ -9,9 +9,9 @@ import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementType; -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.advancements.criterion.BlockPredicate; -import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.predicates.BlockPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.triggers.CriterionTrigger; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; @@ -19,6 +19,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.network.chat.Component; +import net.minecraft.references.ItemIds; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; @@ -107,12 +108,12 @@ public final class CriterionTest extends BaseTestMod { @Override protected void addTags(HolderLookup.Provider lookup) { this.tag(tag) - .add(Items.COD) - .add(Items.SALMON) - .add(Items.TROPICAL_FISH) - .add(Items.PUFFERFISH) - .add(Items.COOKED_COD) - .add(Items.COOKED_SALMON) + .add(ItemIds.COD) + .add(ItemIds.SALMON) + .add(ItemIds.TROPICAL_FISH) + .add(ItemIds.PUFFERFISH) + .add(ItemIds.COOKED_COD) + .add(ItemIds.COOKED_SALMON) ; } }); @@ -124,7 +125,7 @@ public final class CriterionTest extends BaseTestMod { event.getGenerator().getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper(), - List.of(((registries, saver, existingFileHelper) -> { + List.of(((registries, saver, _) -> { var blocks = registries.lookup(Registries.BLOCK).get(); var items = registries.lookup(Registries.ITEM).get(); saver.accept(new Advancement.Builder() diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java index 4d43654182..5c804f61b2 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java @@ -17,7 +17,7 @@ import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -50,7 +50,7 @@ public class PreventItemDamageTest extends BaseTestMod { public PreventItemDamageTest(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> FAKE_SHIELD.get().getDefaultInstance()); + this.testItem(_ -> FAKE_SHIELD.get().getDefaultInstance()); } @GameTest @@ -90,7 +90,7 @@ public class PreventItemDamageTest extends BaseTestMod { int initialDamage = shield.getDamageValue(); // setup enemy - var enemy = helper.spawnWithNoFreeWill(EntityType.HUSK, new BlockPos(2, 0, 2)); + var enemy = helper.spawnWithNoFreeWill(EntityTypes.HUSK, new BlockPos(2, 0, 2)); player.lookAt(EntityAnchorArgument.Anchor.EYES, enemy.position()); // hit the player @@ -117,7 +117,7 @@ public class PreventItemDamageTest extends BaseTestMod { helper.makeFloor(); // setup player - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // setup shield var shield = FAKE_SHIELD.get().getDefaultInstance(); @@ -144,14 +144,14 @@ public class PreventItemDamageTest extends BaseTestMod { .setId(ITEMS.key("fake_shield")) .durability(10) .equippableUnswappable(EquipmentSlot.OFFHAND) - .component( + .delayedComponent( DataComponents.BLOCKS_ATTACKS, - new BlocksAttacks( + context -> new BlocksAttacks( 0F, 0F, List.of(new BlocksAttacks.DamageReduction(360.0F, Optional.empty(), 0.0F, 1.0F)), new BlocksAttacks.ItemDamageFunction(3.0F, 1.0F, 1.0F), - Optional.of(DamageTypeTags.BYPASSES_SHIELD), + Optional.of(context.getOrThrow(DamageTypeTags.BYPASSES_SHIELD)), Optional.of(SoundEvents.SHIELD_BLOCK), Optional.of(SoundEvents.SHIELD_BREAK) ) diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java index d2317dec95..77ac4ad264 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java @@ -6,17 +6,23 @@ package net.minecraftforge.debug.gameplay.item; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.animal.cow.MushroomCow; import net.minecraft.world.entity.animal.golem.CopperGolem; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.ShearsItem; import net.minecraft.world.level.GameType; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; import net.minecraftforge.fml.common.Mod; @@ -43,8 +49,16 @@ public class ShearsBehaviorTest extends BaseTestMod { public ShearsBehaviorTest(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> CUSTOM_SHEARS_ITEM.get().getDefaultInstance()); - this.testItem(lookup -> CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance()); + this.testItem(_ -> CUSTOM_SHEARS_ITEM.get().getDefaultInstance()); + this.testItem(_ -> CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance()); + } + + private static void shear(GameTestHelper helper, Entity entity) { + var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var shears = CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance(); + player.setItemInHand(InteractionHand.MAIN_HAND, shears); + var result = player.interactOn(entity, InteractionHand.MAIN_HAND, Vec3.ZERO); + helper.assertTrue(result.consumesAction(), "Using entity should result in consume action"); } @GameTest @@ -55,19 +69,14 @@ public class ShearsBehaviorTest extends BaseTestMod { var fencePos = new BlockPos(1, 1, 1); var cowPos = new BlockPos(0, 1, 1); helper.setBlock(fencePos, Blocks.OAK_FENCE); - var cow = helper.spawnWithNoFreeWill(EntityType.COW, cowPos); + var cow = helper.spawnWithNoFreeWill(EntityTypes.COW, cowPos); var knot = LeashFenceKnotEntity.getOrCreateKnot(helper.getLevel(), helper.absolutePos(fencePos)); cow.setLeashedTo(knot, true); helper.assertTrue(cow.isLeashed(), "Cow should start leashed"); - // act: interact with cow using custom shears - var player = helper.makeMockPlayer(GameType.SURVIVAL); - var shears = CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance(); - player.setItemInHand(InteractionHand.MAIN_HAND, shears); - var result = player.interactOn(cow, InteractionHand.MAIN_HAND); + shear(helper, cow); // assert - helper.assertTrue(result.consumesAction(), "Using custom shears on leashed cow should result in consume action"); helper.assertTrue(!cow.isLeashed(), "Cow should be unleashed by custom shears"); helper.assertItemEntityPresent(Items.LEAD); @@ -83,19 +92,14 @@ public class ShearsBehaviorTest extends BaseTestMod { var fencePos = new BlockPos(1, 1, 1); var cowPos = new BlockPos(0, 1, 1); helper.setBlock(fencePos, Blocks.OAK_FENCE); - var cow = helper.spawnWithNoFreeWill(EntityType.COW, cowPos); + var cow = helper.spawnWithNoFreeWill(EntityTypes.COW, cowPos); var knot = LeashFenceKnotEntity.getOrCreateKnot(helper.getLevel(), helper.absolutePos(fencePos)); cow.setLeashedTo(knot, true); helper.assertTrue(cow.isLeashed(), "Cow should start leashed"); - // act: interact with knot using custom shears - var player = helper.makeMockPlayer(GameType.SURVIVAL); - var shears = CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance(); - player.setItemInHand(InteractionHand.MAIN_HAND, shears); - var result = player.interactOn(knot, InteractionHand.MAIN_HAND); + shear(helper, knot); // assert - helper.assertTrue(result.consumesAction(), "Using custom shears on leash knot should result in consume action"); helper.assertTrue(!cow.isLeashed(), "Cow should be unleashed by sheared knot"); helper.assertItemEntityPresent(Items.LEAD); @@ -108,24 +112,114 @@ public class ShearsBehaviorTest extends BaseTestMod { // setup: copper golem with poppy var golemPos = new BlockPos(1, 1, 1); - var golem = helper.spawnWithNoFreeWill(EntityType.COPPER_GOLEM, golemPos); + var golem = helper.spawnWithNoFreeWill(EntityTypes.COPPER_GOLEM, golemPos); golem.setItemSlot(CopperGolem.EQUIPMENT_SLOT_ANTENNA, new ItemStack(Items.POPPY)); helper.assertTrue(golem.readyForShearing(), "Golem should start shearable (has poppy)"); - // act: interact with copper golem using custom shears - var player = helper.makeMockPlayer(GameType.SURVIVAL); - var shears = CUSTOM_SHEARS_ITEM.get().getDefaultInstance(); - player.setItemInHand(InteractionHand.MAIN_HAND, shears); - var result = player.interactOn(golem, InteractionHand.MAIN_HAND); + shear(helper, golem); // assert - helper.assertTrue(result.consumesAction(), "Using custom shears on copper golem should result in consume action"); helper.assertTrue(golem.getItemBySlot(CopperGolem.EQUIPMENT_SLOT_ANTENNA).isEmpty(), "Copper golem poppy should be sheared off with custom shears"); helper.assertItemEntityPresent(Items.POPPY); helper.succeed(); } + @GameTest + public static void custom_shears_shear_sulfur_cube_block(GameTestHelper helper) { + helper.makeFloor(); + + // setup: sulfur cube with block + var pos = new BlockPos(1, 1, 1); + var sulfurCube = helper.spawnWithNoFreeWill(EntityTypes.SULFUR_CUBE, pos); + sulfurCube.setItemSlot(EquipmentSlot.BODY, new ItemStack(Items.DIRT)); + helper.assertTrue(sulfurCube.readyForShearing(), "Sulfur cube should start shearable (has dirt block)"); + + shear(helper, sulfurCube); + + // assert + helper.assertTrue(sulfurCube.getItemBySlot(EquipmentSlot.BODY).isEmpty(), "Sulfur cube block should be sheared off with custom shears"); + helper.assertItemEntityPresent(Items.DIRT); + + helper.succeed(); + } + + @GameTest + public static void custom_shears_shear_bogged(GameTestHelper helper) { + helper.makeFloor(); + + var pos = new BlockPos(1, 1, 1); + var entity = helper.spawnWithNoFreeWill(EntityTypes.BOGGED, pos); + helper.assertTrue(entity.readyForShearing(), "Bogged start shearable"); + + shear(helper, entity); + + // assert + helper.assertTrue(!entity.readyForShearing(), "Bogged should no longer be shearable"); + int found = 0; + for (var item : helper.getEntities(EntityTypes.ITEM, BlockPos.ZERO, 3)) { + if (item.isAlive() && (item.getItem().is(Items.BROWN_MUSHROOM) || item.getItem().is(Items.RED_MUSHROOM))) + found += item.getItem().count(); + } + helper.assertValueEqual(found, 2, "Mushroom loot not found"); + + helper.succeed(); + } + + @GameTest + public static void custom_shears_shear_mooshroom(GameTestHelper helper) { + helper.makeFloor(); + + var pos = new BlockPos(1, 1, 1); + var entity = helper.spawnWithNoFreeWill(EntityTypes.MOOSHROOM, pos); + entity.setComponent(DataComponents.MOOSHROOM_VARIANT, MushroomCow.Variant.RED); + helper.assertTrue(entity.readyForShearing(), "Mooshroom start shearable"); + + shear(helper, entity); + + // assert + helper.assertTrue(!entity.isAlive(), "Mooshroom should no longer be alive"); + helper.assertEntityPresent(EntityTypes.COW); + helper.assertItemEntityPresent(Items.RED_MUSHROOM); + + helper.succeed(); + } + + @GameTest + public static void custom_shears_shear_sheep(GameTestHelper helper) { + helper.makeFloor(); + + var pos = new BlockPos(1, 1, 1); + var entity = helper.spawnWithNoFreeWill(EntityTypes.SHEEP, pos); + entity.setColor(DyeColor.WHITE); + helper.assertTrue(entity.readyForShearing(), "Sheep should start shearable"); + + shear(helper, entity); + + // assert + helper.assertTrue(!entity.readyForShearing(), "Sheep should no longer be shearable"); + helper.assertItemEntityPresent(Items.WOOL.white()); + + helper.succeed(); + } + + @GameTest + public static void custom_shears_shear_snowgolem(GameTestHelper helper) { + helper.makeFloor(); + + var pos = new BlockPos(1, 1, 1); + var entity = helper.spawnWithNoFreeWill(EntityTypes.SNOW_GOLEM, pos); + helper.assertTrue(entity.readyForShearing(), "Snow golem should start shearable"); + + shear(helper, entity); + + // assert + helper.assertTrue(!entity.readyForShearing(), "Snow golem should no longer be shearable"); + helper.assertItemEntityPresent(Items.CARVED_PUMPKIN); + + helper.succeed(); + } + private static final class ShearsHarvestItem extends Item { ShearsHarvestItem(Item.Properties properties) { super(properties); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java index cc9f1c2f8d..6a26db4c71 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java @@ -13,7 +13,7 @@ import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -39,14 +39,14 @@ public final class ShieldDisablingTest extends BaseTestMod { @GameTest public static void player_shield_disabled_by_axe(GameTestHelper helper) { player_shield_disabled_common(helper, h -> Util.make( - h.spawnWithNoFreeWill(EntityType.HUSK, new BlockPos(2, 0, 2)), + h.spawnWithNoFreeWill(EntityTypes.HUSK, new BlockPos(2, 0, 2)), enemy -> enemy.setItemInHand(InteractionHand.MAIN_HAND, new ItemStack(Items.IRON_AXE)) )); } @GameTest public static void player_shield_disabled_by_warden(GameTestHelper helper) { - player_shield_disabled_common(helper, h -> h.spawnWithNoFreeWill(EntityType.WARDEN, new BlockPos(2, 0, 2))); + player_shield_disabled_common(helper, h -> h.spawnWithNoFreeWill(EntityTypes.WARDEN, new BlockPos(2, 0, 2))); } private static void player_shield_disabled_common(GameTestHelper helper, Function enemyGetter) { diff --git a/src/test/java/net/minecraftforge/debug/gameplay/level/ForcedChunkLoadingTest.java b/src/test/java/net/minecraftforge/debug/gameplay/level/ForcedChunkLoadingTest.java index 4c1d2623a5..49c6891eb2 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/level/ForcedChunkLoadingTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/level/ForcedChunkLoadingTest.java @@ -44,7 +44,7 @@ public class ForcedChunkLoadingTest extends BaseTestMod { chunk = level.getChunk(origin.offset(x, 0, z)); // If the chunk is already ticking, we can't force it - chunk = chunkSource.isPositionTicking(chunk.getPos().toLong()) ? null : chunk; + chunk = chunkSource.isPositionTicking(chunk.getPos().pack()) ? null : chunk; } if (chunk == null) { @@ -55,15 +55,15 @@ public class ForcedChunkLoadingTest extends BaseTestMod { } var pos = chunk.getPos(); - var posLong = pos.toLong(); + var posLong = pos.pack(); helper.say("Attempting to force far away chunk: " + pos, ChatFormatting.YELLOW); chunkSource.updateChunkForced(pos, true); helper.runAfterDelay(20, () -> { helper.assertTrue(chunkSource.chunkMap.getDistanceManager().shouldForceTicks(posLong), "Chunk is not ticketed as a force loaded chunk"); - helper.assertTrue(chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(pos.toLong()), "Forced chunk cannot tick entities"); - helper.assertTrue(chunkSource.chunkMap.getDistanceManager().inBlockTickingRange(pos.toLong()), "Forced chunk cannot tick blocks"); - helper.assertTrue(chunkSource.hasChunk(pos.x, pos.z), "Chunk is not loaded despite being ticketed as a force loaded chunk"); + helper.assertTrue(chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(pos.pack()), "Forced chunk cannot tick entities"); + helper.assertTrue(chunkSource.chunkMap.getDistanceManager().inBlockTickingRange(pos.pack()), "Forced chunk cannot tick blocks"); + helper.assertTrue(chunkSource.hasChunk(pos.x(), pos.z()), "Chunk is not loaded despite being ticketed as a force loaded chunk"); helper.succeed(); }); } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java b/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java new file mode 100644 index 0000000000..6010a38474 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.debug.gameplay.level; + +import net.minecraft.core.BlockPos; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.clock.ClockTimeMarker; +import net.minecraft.world.clock.ClockTimeMarkers; +import net.minecraft.world.clock.WorldClocks; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.BedBlock; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.properties.BedPart; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.gametest.GameTest; +import net.minecraftforge.gametest.GameTestNamespace; +import net.minecraftforge.test.BaseTestMod; + +@GameTestNamespace("forge") +@Mod(TrySleepTest.MOD_ID) +public class TrySleepTest extends BaseTestMod { + static final String MOD_ID = "try_sleep"; + + public TrySleepTest(FMLJavaModLoadingContext context) { + super(context, false, false); + } + + @GameTest + public static void sleep_obstructed(GameTestHelper helper) { + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); + + var bed = putBed(helper); + helper.setAndAssertBlock(bed.above(), Blocks.STONE); + setTimeAndTest(helper, ClockTimeMarkers.NIGHT, bed, player, false, "Player was able to sleep in an obstructed bed."); + } + + @GameTest + public static void sleep_daytime(GameTestHelper helper) { + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); + var bed = putBed(helper); + setTimeAndTest(helper, ClockTimeMarkers.DAY, bed, player, false, "Player was able to sleep during daytime."); + } + + @GameTest + public static void sleep_unsafe(GameTestHelper helper) { + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); + var bed = putBed(helper); + helper.spawn(EntityTypes.ZOMBIE, bed.east()); + setTimeAndTest(helper, ClockTimeMarkers.NIGHT, bed, player, false, "Player was able to sleep in an unsafe bed."); + } + + @GameTest + public static void sleep_normally(GameTestHelper helper) { + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); + var bed = putBed(helper); + setTimeAndTest(helper, ClockTimeMarkers.NIGHT, bed, player, true, "Player was not able to sleep. There might be a slime or something causing this to fail."); + } + + private static BlockPos putBed(GameTestHelper helper) { + var mid = new BlockPos(0,0,0); + var south = mid.south(); + helper.setAndAssertBlock(south, Blocks.BED.black().defaultBlockState()); + helper.setAndAssertBlock(mid, Blocks.BED.black().defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD)); + return mid; + } + + private static void setTimeAndTest(GameTestHelper helper, ResourceKey time, BlockPos bed, Player player, boolean shouldBeSleeping, String err) { + var manager = helper.getLevel().clockManager(); + var overworld = helper.getLevel().registryAccess().getOrThrow(WorldClocks.OVERWORLD); + var origTime = manager.getTotalTicks(overworld); + + player.setPos(Vec3.atBottomCenterOf(helper.absolutePos(bed))); + manager.moveToTimeMarker(overworld, time); + helper.getLevel().tick(() -> true); + helper.useBlock(bed, player); + var sleep = player.isSleeping(); + manager.setTotalTicks(overworld, origTime); + helper.assertTrue(sleep == shouldBeSleeping, err); + helper.succeed(); + } +} diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java index 160e3a5529..257ada2f9b 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java @@ -60,7 +60,7 @@ public class ConditionalLootPools extends BaseTestMod { helper.setBlock(center, TEST_BLOCK.get()); helper.assertBlock(center, block -> block == TEST_BLOCK.get(), block -> Component.literal("Failed to set block, was " + block.getDescriptionId())); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); player.gameMode.destroyBlock(helper.absolutePos(center)); helper.assertItemEntityPresent(Items.GOLDEN_APPLE, center, 1.0); 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 326b0f10fc..eedf7503d1 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java @@ -10,10 +10,10 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.advancements.criterion.DataComponentMatchers; -import net.minecraft.advancements.criterion.EnchantmentPredicate; -import net.minecraft.advancements.criterion.ItemPredicate; -import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.advancements.predicates.DataComponentMatchers; +import net.minecraft.advancements.predicates.EnchantmentPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.predicates.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistrySetBuilder; @@ -138,7 +138,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { // Tests the Enchantment condition, as well as the ability to completely override the returned values. @GameTest public static void smellting(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var center = new BlockPos(1, 1, 1); var enchants = helper.getLevel().holderLookup(Registries.ENCHANTMENT); var smelt = getSmelterAxe(enchants, true); @@ -166,7 +166,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { @GameTest public static void condition_table_name(GameTestHelper helper) { var center = new BlockPos(1, 1, 1); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // Should be doubled helper.setBlock(center, TEST_BLOCK.get()); @@ -185,7 +185,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { @GameTest public static void silk_reentrant(GameTestHelper helper) { var center = new BlockPos(1, 1, 1); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bamboo = new ItemStack(Items.BAMBOO); var normal = new ItemStack(Items.IRON_AXE); @@ -308,12 +308,11 @@ public class GlobalLootModifiersTest extends BaseTestMod { private static ItemStack smelt(ItemStack stack, LootContext context) { var mgr = context.getLevel().recipeAccess(); - var reg = context.getLevel().registryAccess(); var inv = new SingleRecipeInput(stack); return mgr .getRecipeFor(RecipeType.SMELTING, inv, context.getLevel()) .map(holder -> holder.value()) - .map(recipe -> recipe.assemble(inv, reg)) + .map(recipe -> recipe.assemble(inv)) .filter(itemStack -> !itemStack.isEmpty()) .map(itemStack -> ItemHandlerHelper.copyStackWithSize(itemStack, stack.getCount() * itemStack.getCount())) .orElse(stack); @@ -347,8 +346,8 @@ public class GlobalLootModifiersTest extends BaseTestMod { //return early if silk-touch is already applied (otherwise we'll get stuck in an infinite loop). var silk = context.getLevel().holderLookup(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH); var silkLevel = EnchantmentHelper.getItemEnchantmentLevel(silk, ctxTool); - if (ctxTool == null || ctxTool.isEmpty() || silkLevel > 0) return generatedLoot; - var fakeTool = ctxTool.copy(); + if (ctxTool == null || ctxTool.count() == 0 || silkLevel > 0) return generatedLoot; + var fakeTool = ((ItemStack)ctxTool).copy(); fakeTool.enchant(silk, 1); var params = new LootParams.Builder(context.getParams()) .withParameter(LootContextParams.TOOL, fakeTool) diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java index a9f5438953..feecc983ff 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java @@ -69,7 +69,7 @@ public class LootEventsTest extends BaseTestMod { helper.setBlock(center, TEST_BLOCK.get()); helper.assertBlock(center, block -> block == TEST_BLOCK.get(), block -> Component.literal("Failed to set block, was " + block.getDescriptionId())); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); player.gameMode.destroyBlock(helper.absolutePos(center)); helper.assertItemEntityPresent(Items.GOLDEN_APPLE, center, 1.0); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java index 8a163dac86..15ccc31886 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java @@ -44,7 +44,7 @@ public class ShearsLootTests extends BaseTestMod { public ShearsLootTests(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> MODDED_SHEARS.get().getDefaultInstance()); + this.testItem(_ -> MODDED_SHEARS.get().getDefaultInstance()); } @GameTest @@ -86,7 +86,7 @@ public class ShearsLootTests extends BaseTestMod { }; helper.makeFloor(); // Seagrass makes water - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); // Plants prevent loot for creative players + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // Plants prevent loot for creative players var center = new BlockPos(1, 1, 1); player.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(MODDED_SHEARS.get())); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java b/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java index 04d06b8a82..6fb46d29b9 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java @@ -44,7 +44,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -58,7 +58,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -72,7 +72,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(4, () -> { var expectedPos = new BlockPos(3, 1, 2); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -86,7 +86,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -103,8 +103,8 @@ public class UpdateOrder extends BaseTestMod { barrel.setItem(0, new ItemStack(Items.DIRT)); helper.runAfterDelay(10, () -> { // There are a lot of things happening, give it a few ticks - helper.assertBlockNotPresent(Blocks.WHITE_WOOL, unexpectedPos); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockNotPresent(Blocks.WOOL.white(), unexpectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/villager/VillagerTypeTestMod.java b/src/test/java/net/minecraftforge/debug/gameplay/villager/VillagerTypeTestMod.java index cad9c3f6f2..2aa89ae664 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/villager/VillagerTypeTestMod.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/villager/VillagerTypeTestMod.java @@ -10,11 +10,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.npc.villager.Villager; -import net.minecraft.world.entity.npc.villager.VillagerTrades; import net.minecraft.world.entity.npc.villager.VillagerType; -import net.minecraft.world.item.Items; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; import net.minecraftforge.fml.common.Mod; @@ -26,8 +22,6 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.test.BaseTestMod; -import java.util.Map; - @GameTestNamespace("forge") @Mod(VillagerTypeTestMod.MOD_ID) public class VillagerTypeTestMod extends BaseTestMod { @@ -59,24 +53,4 @@ public class VillagerTypeTestMod extends BaseTestMod { helper.succeed(); } - - /** Test verifies NPE not thrown when looking up a villager type in the trade that doesn't contain that type.*/ - @GameTest - public static void emeralds_for_villager_type(GameTestHelper helper) { - var trade = new VillagerTrades.EmeraldsForVillagerTypeItem(1, 12, 30, Map.of(TEST_VILLAGER_TYPE.getKey(), Items.DIRT)); - var rnd = helper.getLevel().getRandom(); - - // Should be a successful trade for dirt for our test villager - var test = new Villager(EntityType.VILLAGER, helper.getLevel(), TEST_VILLAGER_TYPE.getKey()); - var test_offer = trade.getOffer(helper.getLevel(), test, rnd); - helper.assertFalse(test_offer == null, "Failed to retreive trade value for test profession"); - helper.assertValueEqual(test_offer.getItemCostA().itemStack().getItem(), Items.DIRT, Component.literal("Offer did not return the expected item")); - - var plains = new Villager(EntityType.VILLAGER, helper.getLevel(), VillagerType.PLAINS); - // This will NPE on unpatched code, we need to test that it returns null correctly - var plains_offer = trade.getOffer(helper.getLevel(), plains, rnd); - helper.assertTrue(plains_offer == null, "Offer should not be available for a plains villager"); - - helper.succeed(); - } } diff --git a/src/test/java/net/minecraftforge/test/BaseTestMod.java b/src/test/java/net/minecraftforge/test/BaseTestMod.java index 06eb401f08..23721ee51d 100644 --- a/src/test/java/net/minecraftforge/test/BaseTestMod.java +++ b/src/test/java/net/minecraftforge/test/BaseTestMod.java @@ -223,7 +223,7 @@ public abstract class BaseTestMod { var rdata = entry.getValue().data(); var env = envs.getOrThrow(ResourceKey.create(Registries.TEST_ENVIRONMENT, rdata.environment())); - var edata = new TestData>( + var edata = new TestData>>( env, rdata.structure(), rdata.maxTicks(), @@ -233,7 +233,8 @@ public abstract class BaseTestMod { rdata.manualOnly(), rdata.maxAttempts(), rdata.requiredSuccesses(), - rdata.skyAccess() + rdata.skyAccess(), + rdata.padding() ); var funcKey = ResourceKey.create(Registries.TEST_FUNCTION, entry.getKey()); diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/blockstates/gas.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/blockstates/gas.json new file mode 100644 index 0000000000..d86665fb61 --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/blockstates/gas.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "fluid_bucket_model:block/gas" + } + } +} \ No newline at end of file diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/bucket.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/bucket.json new file mode 100644 index 0000000000..cec24c2bd1 --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/bucket.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fluid_bucket_model:item/bucket" + } +} \ No newline at end of file diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/gas_bucket.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/gas_bucket.json new file mode 100644 index 0000000000..b29c97b6af --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/items/gas_bucket.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fluid_bucket_model:item/gas_bucket" + } +} \ No newline at end of file diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/block/gas.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/block/gas.json new file mode 100644 index 0000000000..67032282f0 --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/block/gas.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "minecraft:block/water_still" + } +} \ No newline at end of file diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/bucket.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/bucket.json new file mode 100644 index 0000000000..5c42dc3a2d --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/bucket.json @@ -0,0 +1,9 @@ +{ + "parent": "forge:item/bucket", + "flip_gas": true, + "fluid": "minecraft:lava", + "loader": "forge:fluid_container", + "textures": { + "particle": "minecraft:block/lava_still" + } +} \ No newline at end of file diff --git a/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/gas_bucket.json b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/gas_bucket.json new file mode 100644 index 0000000000..bf90e7b06e --- /dev/null +++ b/src/test/resources/fluid_bucket_model/assets/fluid_bucket_model/models/item/gas_bucket.json @@ -0,0 +1,9 @@ +{ + "parent": "forge:item/bucket", + "flip_gas": true, + "fluid": "fluid_bucket_model:gas", + "loader": "forge:fluid_container", + "textures": { + "particle": "minecraft:block/water_still" + } +} \ No newline at end of file diff --git a/src/test_old/java/net/minecraftforge/debug/AddPackFinderEventTest.java b/src/test_old/java/net/minecraftforge/debug/AddPackFinderEventTest.java index 6e09b20280..310e76c958 100644 --- a/src/test_old/java/net/minecraftforge/debug/AddPackFinderEventTest.java +++ b/src/test_old/java/net/minecraftforge/debug/AddPackFinderEventTest.java @@ -31,7 +31,7 @@ public class AddPackFinderEventTest { @SubscribeEvent public void addPackFinders(AddPackFindersEvent event) { if (event.getPackType() == PackType.CLIENT_RESOURCES) { - var resourcePath = ModList.get().getModFileById(MODID).getFile().findResource("test_nested_resource_pack"); + var resourcePath = ModList.getModFileById(MODID).getFile().findResource("test_nested_resource_pack"); var supplier = new PathResourcesSupplier(resourcePath, false); var pack = Pack.readMetaAndCreate("builtin/add_pack_finders_test", Component.literal("display name"), false, supplier, PackType.CLIENT_RESOURCES, Pack.Position.BOTTOM, PackSource.BUILT_IN); event.addRepositorySource((packConsumer) -> packConsumer.accept(pack));