diff --git a/build.gradle b/build.gradle index d37d79d2ce..b2948c6734 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.39,5.2.0)' + classpath 'net.minecraftforge.gradle:ForgeGradle:[6.0.16,6.2)' } } @@ -27,16 +27,17 @@ import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact import net.minecraftforge.gradle.common.tasks.ExtractInheritance import net.minecraftforge.gradle.common.tasks.SignJar +import net.minecraftforge.gradle.patcher.tasks.GeneratePatches import net.minecraftforge.gradle.patcher.tasks.ReobfuscateJar import org.apache.tools.ant.filters.ReplaceTokens import org.gradle.plugins.ide.eclipse.model.SourceFolder plugins { id 'org.cadixdev.licenser' version '0.6.1' - id 'com.github.ben-manes.versions' version '0.36.0' + id 'com.github.ben-manes.versions' version '0.46.0' id 'net.minecraftforge.gradleutils' version '[2.2,2.3)' id 'eclipse' - id 'de.undercouch.download' version '5.1.3' + id 'de.undercouch.download' version '5.4.0' } Util.init() //Init all our extension methods @@ -56,6 +57,7 @@ ext { MAPPING_VERSION = '1.16.5' MC_VERSION = '1.16.5' MCP_VERSION = '20210115.111550' + ASM_VERSION = '9.6' SPI_VERSION = '3.2.0' MIN_TAG_FOR_CHANGELOG = "36.0" GIT_INFO = gradleutils.gitInfo @@ -203,7 +205,6 @@ project(':forge') { // 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. MCP_ARTIFACT = project(':mcp').mcp.config.get() - SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0' SPECIAL_SOURCE_MCP = 'net.md-5:SpecialSource:1.8.5' VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json') BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar' @@ -218,7 +219,7 @@ project(':forge') { parent = project(':clean') patches = file("$rootDir/patches/minecraft") patchedSrc = file('src/main/java') - srgPatches = true + srgPatches = false accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg") sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas") @@ -374,6 +375,33 @@ project(':forge') { } } } + + afterEvaluate { + if (!patcher.srgPatches) { + srg2mcpClean { + dependsOn = [] + input = project(':mcp').setupMCP.output + } + userdevJar { + onlyIf = { t -> true } + } + def patches = project.file('build/genPatchesForUserdev/output/') + patches.mkdirs() + def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){ + base = project(':mcp').setupMCP.output + modified = applyRangeMapBase.output + originalPrefix = genPatches.originalPrefix + modifiedPrefix = genPatches.modifiedPrefix + output = patches + autoHeader true + lineEnding = '\n' + } + bakePatches { + dependsOn = [] + input = genPatchesForUserdev.get().output + } + } + } ext { MANIFESTS = [ @@ -441,11 +469,11 @@ project(':forge') { fmllauncherImplementation.extendsFrom(installer, implementation) } dependencies { - installer 'org.ow2.asm:asm:9.1' - installer 'org.ow2.asm:asm-commons:9.1' - installer 'org.ow2.asm:asm-tree:9.1' - installer 'org.ow2.asm:asm-util:9.1' - installer 'org.ow2.asm:asm-analysis:9.1' + installer 'org.ow2.asm:asm:' + ASM_VERSION + installer 'org.ow2.asm:asm-commons:' + ASM_VERSION + installer 'org.ow2.asm:asm-tree:' + ASM_VERSION + installer 'org.ow2.asm:asm-util:' + ASM_VERSION + installer 'org.ow2.asm:asm-analysis:' + ASM_VERSION installer 'cpw.mods:modlauncher:8.1.3' installer 'cpw.mods:grossjava9hacks:1.3.3' installer 'net.minecraftforge:accesstransformers:3.0.1' @@ -900,7 +928,7 @@ project(':forge') { } task launcherJar(type: Jar) { - classifier 'launcher' + archiveClassifier.set('launcher') from sourceSets.fmllauncher.output doFirst { def classpath = new StringBuilder() @@ -1008,7 +1036,7 @@ project(':forge') { exclude it } filter(ReplaceTokens, tokens: [ - FORGE_VERSION: project.version, + FORGE_VERSION: project.version.substring(MC_VERSION.length() + 1), FORGE_GROUP: project.group, FORGE_NAME: project.name, MC_VERSION: MC_VERSION, @@ -1126,11 +1154,7 @@ project(':forge') { task userdevExtras(type:Jar) { dependsOn classes from sourceSets.userdev.output - classifier 'userdev-temp' - } - - reobfJar { - tool = SPECIAL_SOURCE + ':shaded' + archiveClassifier.set('userdev-temp') } task userdevExtrasReobf(type: ReobfuscateJar) { @@ -1138,7 +1162,6 @@ project(':forge') { input = tasks.userdevExtras.archiveFile classpath.from project.configurations.userdevCompileClasspath srg = tasks.createMcp2Srg.output - tool = SPECIAL_SOURCE + ':shaded' } userdevJar { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 34a3e5ae6c..ea4857869d 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -3,9 +3,9 @@ repositories { mavenCentral() } dependencies { - implementation 'org.ow2.asm:asm:9.1' - implementation 'org.ow2.asm:asm-tree:9.1' + implementation 'org.ow2.asm:asm:9.6' + implementation 'org.ow2.asm:asm-tree:9.6' implementation 'net.minecraftforge:srgutils:0.4.+' - implementation 'commons-io:commons-io:2.8.0' + implementation 'commons-io:commons-io:2.12.0' implementation 'com.google.code.gson:gson:2.10' } \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy index d8555f716b..d217608de8 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy @@ -4,7 +4,7 @@ import groovy.json.JsonBuilder import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import org.objectweb.asm.ClassReader import org.objectweb.asm.Opcodes @@ -17,7 +17,9 @@ import java.util.zip.ZipInputStream abstract class BytecodeFinder extends DefaultTask { @InputFile abstract RegularFileProperty getJar() - @OutputFile abstract RegularFileProperty getOutput() + // It should be fine to mark the output as internal as we want to control when we run it anyways. + // This also shuts Gradle 8 up about implicit task dependencies. + @Internal abstract RegularFileProperty getOutput() BytecodeFinder() { output.convention(project.layout.buildDirectory.dir(name).map { it.file("output.json") }) diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy index 96f557d7e5..55046da0aa 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy @@ -171,7 +171,7 @@ abstract class CheckATs extends CheckTask { } private static List joinBack(TreeMap lines, Map inheritance, IMappingFile mappings) { - final data = [] + final List data = [] final remapComment = { ATParser.Entry entry -> if (!mappings || !entry || !entry.desc) return null final comment = entry.comment?.substring(1)?.trim() diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..fce403e45e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mdk/README.txt b/mdk/README.txt index 344bca7513..939f67b01e 100644 --- a/mdk/README.txt +++ b/mdk/README.txt @@ -16,14 +16,14 @@ Step 1: Open your command-line and browse to the folder where you extracted the Step 2: You're left with a choice. If you prefer to use Eclipse: -1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux) +1. Run the following command: `./gradlew genEclipseRuns` 2. Open Eclipse, Import > Existing Gradle Project > Select Folder or run `gradlew eclipse` to generate the project. If you prefer to use IntelliJ: 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. -3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux) +3. Run the following command: `./gradlew genIntellijRuns` 4. Refresh the Gradle Project in IDEA if required. If at any point you are missing libraries in your IDE, or you've run into problems you can @@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md Additional Resources: ========================= -Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/ -LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0 -Forge Forum: https://forums.minecraftforge.net/ -Forge Discord: https://discord.gg/UvedJ9m \ No newline at end of file +Community Documentation: https://docs.minecraftforge.net/en/1.16.x/gettingstarted/ +LexManos' Install Video: https://youtu.be/8VEdtQLuLO0 +Forge Forums: https://forums.minecraftforge.net/ +Forge Discord: https://discord.minecraftforge.net/ diff --git a/mdk/build.gradle b/mdk/build.gradle index 17e2f9ba27..34f7e77c65 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -1,49 +1,69 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() +plugins { + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.minecraftforge.gradle' version '[6.0,6.2)' } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + +version = mod_version +group = mod_group_id + +base { + archivesName = mod_id } -} -apply plugin: 'net.minecraftforge.gradle' -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'eclipse' -apply plugin: 'maven-publish' -version = '1.0' -group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = 'modid' +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(8) -java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. - -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) +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. + // The mappings can be changed at any time and must be in the following format. // Channel: Version: - // snapshot YYYYMMDD Snapshot are built nightly. - // stable # Stables are built at the discretion of the MCP team. // 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' mappings. + // 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 // - // Use non-default mappings at your own risk. they may not always work. + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // + // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + mappings channel: mapping_channel, version: mapping_version + // 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. + // They will be applied to the Minecraft artifact. + // The access transformer file can be anywhere in the project. + // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. + // This default location is a best practice to automatically put the file in the right place in the final jar. + // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { - client { + // applies to all the run configs below + configureEach { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // 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. @@ -55,57 +75,26 @@ minecraft { property 'forge.logging.console.level', 'debug' mods { - examplemod { + "${mod_id}" { source sourceSets.main } } } + client { + // this block needs to be here for runClient to exist + } + server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be changed as needed. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } + args '--nogui' } data { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be changed as needed. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' + // example of overriding the workingDirectory set in configureEach above + workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - examplemod { - source sourceSets.main - } - } + args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } @@ -113,62 +102,94 @@ minecraft { // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } -dependencies { - // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. - // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' - - // You may put jars on which you depend on in ./libs or you may define them like so.. - // compile "some.group:artifact:version:classifier" - // compile "some.group:artifact:version" - - // Real examples - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // These dependencies get remapped to your current MCP mappings - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // For more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } } -// Example for how to get properties into the manifest for reading by the runtime.. -jar { - manifest { - attributes([ - "Specification-Title": "examplemod", - "Specification-Vendor": "examplemodsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) +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}" + + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + + // 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).configure { + 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 configuration to allow publishing using the maven-publish task +// Example for how to get properties into the manifest for reading at runtime. +tasks.named('jar', Jar).configure { + 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, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) +} + // This is the preferred method to reobfuscate your jar file -jar.finalizedBy('reobfJar') -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing -//publish.dependsOn('reobfJar') + finalizedBy 'reobfJar' +} + +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: +// tasks.named('publish').configure { +// dependsOn 'reobfJar' +// } publishing { publications { - mavenJava(MavenPublication) { + register('mavenJava', MavenPublication) { artifact jar } } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/mcmodsrepo" } } } + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} diff --git a/mdk/gradle.properties b/mdk/gradle.properties index 878bf1f7ec..dc9592085d 100644 --- a/mdk/gradle.properties +++ b/mdk/gradle.properties @@ -1,4 +1,59 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +org.gradle.daemon=false + + +## Environment Properties + +# The Minecraft version must agree with the Forge version to get a valid artifact +minecraft_version=@MC_VERSION@ +# The Minecraft version range can use any release version of Minecraft as bounds. +# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly +# as they do not follow standard versioning conventions. +minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@) +# The Forge version must agree with the Minecraft version to get a valid artifact +forge_version=@FORGE_VERSION@ +# The Forge version range can use any version of Forge as bounds or match the loader version range +forge_version_range=[@FORGE_SPEC_VERSION@,) +# The loader version range can only use the major version of Forge/FML as bounds +loader_version_range=[@FORGE_SPEC_VERSION@,) +# The mapping channel to use for mappings. +# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. +# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. +# +# | Channel | Version | | +# |-----------|----------------------|--------------------------------------------------------------------------------| +# | official | MCVersion | Official field/method names from Mojang mapping files | +# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official | +# +# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. +# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md +# +# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. +# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started +mapping_channel=@MAPPING_CHANNEL@ +# The mapping version to query from the mapping channel. +# This must match the format required by the mapping channel. +mapping_version=@MAPPING_VERSION@ + + +## Mod Properties + +# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} +# Must match the String constant located in the main mod class annotated with @Mod. +mod_id=examplemod +# The human-readable display name for the mod. +mod_name=Example Mod +# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. +mod_license=All Rights Reserved +# The mod version. See https://semver.org/ +mod_version=1.0.0 +# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. +# This should match the base package used for the mod sources. +# See https://maven.apache.org/guides/mini/guide-naming-conventions.html +mod_group_id=com.example.examplemod +# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. +mod_authors=YourNameHere, OtherNameHere +# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. +mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. diff --git a/mdk/settings.gradle b/mdk/settings.gradle new file mode 100644 index 0000000000..b7053dd502 --- /dev/null +++ b/mdk/settings.gradle @@ -0,0 +1,14 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = 'https://maven.minecraftforge.net/' } + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} \ No newline at end of file diff --git a/mdk/src/main/resources/META-INF/mods.toml b/mdk/src/main/resources/META-INF/mods.toml index 472db367d0..fb1a05a17e 100644 --- a/mdk/src/main/resources/META-INF/mods.toml +++ b/mdk/src/main/resources/META-INF/mods.toml @@ -6,57 +6,52 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="All rights reserved" +license="${mod_license}" # A URL to refer people to when problems occur with this mod #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod -modId="examplemod" #mandatory -# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata -# see the associated build.gradle script for how to populate this completely automatically during a build -version="${file.jarVersion}" #mandatory - # A display name for the mod -displayName="Example Mod" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ +modId="${mod_id}" #mandatory +# The version number of the mod +version="${mod_version}" #mandatory +# A display name for the mod +displayName="${mod_name}" #mandatory +# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display -logoFile="examplemod.png" #optional +#logoFile="examplemod.png" #optional # A text field displayed in the mod UI -credits="Thanks for this example mod goes to Java" #optional +#credits="" #optional # A text field displayed in the mod UI -authors="Love, Cheese and small house plants" #optional +authors="${mod_authors}" #optional + # The description text for the mod (multi line!) (#mandatory) -description=''' -This is a long form description of the mod. You can write whatever you want here - -Have some lorem ipsum. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. -''' +description='''${mod_description}''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.examplemod]] #optional - # the modid of the dependency - modId="forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory=true #mandatory - # The version range of the dependency - versionRange="[@FORGE_SPEC_VERSION@,)" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory - ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER - side="BOTH" +[[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 +ordering="NONE" +# Side this dependency is applied on - BOTH, CLIENT, or SERVER +side="BOTH" # Here's another dependency -[[dependencies.examplemod]] - modId="minecraft" - mandatory=true +[[dependencies.${mod_id}]] +modId="minecraft" +mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)" - ordering="NONE" - side="BOTH" +versionRange="${minecraft_version_range}" +ordering="NONE" +side="BOTH" diff --git a/mdk/src/main/resources/pack.mcmeta b/mdk/src/main/resources/pack.mcmeta index c79a3626c9..53d7ec8f2f 100644 --- a/mdk/src/main/resources/pack.mcmeta +++ b/mdk/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "examplemod resources", + "description": "${mod_id} resources", "pack_format": 6, "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." } diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch index 9a19d82d6e..2f4dc2532a 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch @@ -8,7 +8,7 @@ + public static float lastBrightnessX = 0.0f; + public static float lastBrightnessY = 0.0f; @Deprecated - public static void func_227640_a_(int p_227640_0_, float p_227640_1_, float p_227640_2_) { + public static void _glMultiTexCoord2f(int p_227640_0_, float p_227640_1_, float p_227640_2_) { RenderSystem.assertThread(RenderSystem::isOnRenderThread); GL13.glMultiTexCoord2f(p_227640_0_, p_227640_1_, p_227640_2_); + if (p_227640_0_ == GL13.GL_TEXTURE1) { @@ -17,4 +17,4 @@ + } } - public static void func_227706_d_(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) { + public static void glBlendFuncSeparate(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) { diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch index 8fa6655019..1d377eabd4 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/IVertexBuilder.java.patch @@ -6,9 +6,9 @@ @OnlyIn(Dist.CLIENT) -public interface IVertexBuilder { +public interface IVertexBuilder extends net.minecraftforge.client.extensions.IForgeVertexBuilder { - Logger field_227884_f_ = LogManager.getLogger(); + Logger LOGGER = LogManager.getLogger(); - IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_); + IVertexBuilder vertex(double p_225582_1_, double p_225582_3_, double p_225582_5_); @@ -96,11 +_,12 @@ f5 = p_227890_3_[k] * p_227890_6_; } @@ -18,8 +18,8 @@ float f9 = bytebuffer.getFloat(16); float f10 = bytebuffer.getFloat(20); Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F); - vector4f.func_229372_a_(matrix4f); -+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.func_227872_b_()); - this.func_225588_a_(vector4f.func_195910_a(), vector4f.func_195913_b(), vector4f.func_195914_c(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.func_195899_a(), vector3f.func_195900_b(), vector3f.func_195902_c()); + vector4f.transform(matrix4f); ++ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.normal()); + this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.x(), vector3f.y(), vector3f.z()); } } 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 c6b6802f69..98b5ae21f4 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -5,14 +5,14 @@ } + @Override -+ public boolean func_231046_a_(int key, int scanCode, int modifiers) { ++ public boolean keyPressed(int key, int scanCode, int modifiers) { + if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) { -+ field_230706_i_.func_147108_a(this.field_224228_a); ++ minecraft.setScreen(this.nextScreen); + return true; + } -+ return super.func_231046_a_(key, scanCode, modifiers); ++ return super.keyPressed(key, scanCode, modifiers); + } + - public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) { - this.func_230446_a_(p_230430_1_); - func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_224229_b, this.field_230708_k_ / 2, 80, 16777215); + public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) { + this.renderBackground(p_230430_1_); + drawCenteredString(p_230430_1_, this.font, this.line1, this.width / 2, 80, 16777215); diff --git a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch index 7a1060542e..ee014c08ce 100644 --- a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch +++ b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/advancements/Advancement.java +++ b/net/minecraft/advancements/Advancement.java @@ -130,7 +_,7 @@ - return this.field_193125_h; + return this.chatComponent; } - public static class Builder { + public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder { - private ResourceLocation field_192061_a; - private Advancement field_192062_b; - private DisplayInfo field_192063_c; + private ResourceLocation parentId; + private Advancement parent; + private DisplayInfo display; @@ -309,6 +_,7 @@ } - public static Advancement.Builder func_241043_a_(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) { + public static Advancement.Builder fromJson(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) { + if ((p_241043_0_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_241043_0_)) == null) return null; - ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.func_151200_h(p_241043_0_, "parent")) : null; - DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.func_192294_a(JSONUtils.func_152754_s(p_241043_0_, "display")) : null; - AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.func_241096_a_(JSONUtils.func_152754_s(p_241043_0_, "rewards")) : AdvancementRewards.field_192114_a; + ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.getAsString(p_241043_0_, "parent")) : null; + DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.fromJson(JSONUtils.getAsJsonObject(p_241043_0_, "display")) : null; + AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.deserialize(JSONUtils.getAsJsonObject(p_241043_0_, "rewards")) : AdvancementRewards.EMPTY; diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch index 0a7ad01d12..c4e7a5ebb3 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch @@ -4,7 +4,7 @@ } } -+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c); - field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size()); ++ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.roots); + LOGGER.info("Loaded {} advancements", (int)this.advancements.size()); } diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch index c75b745877..880a6c5d60 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementManager.java.patch @@ -2,12 +2,12 @@ +++ b/net/minecraft/advancements/AdvancementManager.java @@ -36,6 +_,10 @@ try { - JsonObject jsonobject = JSONUtils.func_151210_l(p_240923_3_, "advancement"); - Advancement.Builder advancement$builder = Advancement.Builder.func_241043_a_(jsonobject, new ConditionArrayParser(p_240923_2_, this.field_240922_d_)); + JsonObject jsonobject = JSONUtils.convertToJsonObject(p_240923_3_, "advancement"); + Advancement.Builder advancement$builder = Advancement.Builder.fromJson(jsonobject, new ConditionArrayParser(p_240923_2_, this.predicateManager)); + if (advancement$builder == null) { -+ field_192782_a.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_); ++ LOGGER.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_); + return; + } map.put(p_240923_2_, advancement$builder); } catch (IllegalArgumentException | JsonParseException jsonparseexception) { - field_192782_a.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage()); + LOGGER.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage()); diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch index 5fa77a63f6..d1f27f3afa 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/advancements/AdvancementRewards.java @@ -39,7 +_,7 @@ - public void func_192113_a(ServerPlayerEntity p_192113_1_) { - p_192113_1_.func_195068_e(this.field_192115_b); -- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_237457_g_, p_192113_1_.func_213303_ch()).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f); -+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_237457_g_, p_192113_1_.func_213303_ch()).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext + public void grant(ServerPlayerEntity p_192113_1_) { + p_192113_1_.giveExperiencePoints(this.experience); +- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).create(LootParameterSets.ADVANCEMENT_REWARD); ++ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).withLuck(p_192113_1_.getLuck()).create(LootParameterSets.ADVANCEMENT_REWARD); // FORGE: luck to LootContext boolean flag = false; - for(ResourceLocation resourcelocation : this.field_192116_c) { + for(ResourceLocation resourcelocation : this.loot) { diff --git a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch index 5ddaa779b4..fc6d3f67b3 100644 --- a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch @@ -3,28 +3,28 @@ @@ -159,6 +_,10 @@ } - this.func_240920_c_(p_240921_1_); + this.checkForAutomaticTriggers(p_240921_1_); + + if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get()) -+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c); ++ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.visible, this.visibilityChanged, this.advancements, this.progressChanged, this::shouldBeVisible); + else - this.func_192752_d(); - this.func_240919_b_(p_240921_1_); + this.ensureAllVisible(); + this.registerListeners(p_240921_1_); } @@ -192,6 +_,8 @@ } - public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) { + public boolean award(Advancement p_192750_1_, String p_192750_2_) { + // Forge: don't grant advancements for fake players -+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false; ++ if (this.player instanceof net.minecraftforge.common.util.FakePlayer) return false; boolean flag = false; - AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_); - boolean flag1 = advancementprogress.func_192105_a(); + AdvancementProgress advancementprogress = this.getOrStartProgress(p_192750_1_); + boolean flag1 = advancementprogress.isDone(); @@ -204,6 +_,7 @@ - if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) { - this.field_240917_e_.func_232641_a_(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()), ChatType.SYSTEM, Util.field_240973_b_); + if (p_192750_1_.getDisplay() != null && p_192750_1_.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { + this.playerList.broadcastMessage(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.getDisplay().getFrame().getName(), this.player.getDisplayName(), p_192750_1_.getChatComponent()), ChatType.SYSTEM, Util.NIL_UUID); } -+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_); ++ net.minecraftforge.common.ForgeHooks.onAdvancement(this.player, p_192750_1_); } } diff --git a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch index 03996a8e0c..d1bc7c08ec 100644 --- a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch +++ b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch @@ -6,20 +6,20 @@ public class ItemPredicate { + private static final Map> custom_predicates = new java.util.HashMap<>(); + private static final Map> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates); - public static final ItemPredicate field_192495_a = new ItemPredicate(); + public static final ItemPredicate ANY = new ItemPredicate(); @Nullable - private final ITag field_200018_b; + private final ITag tag; @@ -105,6 +_,11 @@ - public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) { + public static ItemPredicate fromJson(@Nullable JsonElement p_192492_0_) { if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) { - JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item"); + JsonObject jsonobject = JSONUtils.convertToJsonObject(p_192492_0_, "item"); + if (jsonobject.has("type")) { -+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type")); ++ final ResourceLocation rl = new ResourceLocation(JSONUtils.getAsString(jsonobject, "type")); + if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject); + else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl); + } - MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count")); - MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability")); + MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.fromJson(jsonobject.get("count")); + MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.fromJson(jsonobject.get("durability")); if (jsonobject.has("data")) { @@ -202,6 +_,14 @@ } else { diff --git a/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch index bec52c5243..fdd4fac11b 100644 --- a/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch @@ -7,33 +7,33 @@ -public abstract class AbstractBlock { +//TODO, Delegates are weird here now, because Block extends this. +public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry { - protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; - protected final Material field_149764_J; - protected final boolean field_235688_at_; + protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; + protected final Material material; + protected final boolean hasCollision; @@ -87,6 +_,8 @@ - this.field_226887_g_ = p_i241196_1_.field_226894_k_; - this.field_208621_p = p_i241196_1_.field_208772_j; - this.field_235684_aB_ = p_i241196_1_; -+ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j; -+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a()); + this.jumpFactor = p_i241196_1_.jumpFactor; + this.dynamicShape = p_i241196_1_.dynamicShape; + this.properties = p_i241196_1_; ++ final ResourceLocation lootTableCache = p_i241196_1_.drops; ++ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().getNamespace(), "blocks/" + this.getRegistryName().getPath()); } @Deprecated @@ -129,7 +_,7 @@ @Deprecated - public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { -- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) { -+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.func_203425_a(p_196243_4_.func_177230_c()) || !p_196243_4_.hasTileEntity())) { - p_196243_2_.func_175713_t(p_196243_3_); + public void onRemove(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { +- if (this.isEntityBlock() && !p_196243_1_.is(p_196243_4_.getBlock())) { ++ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.is(p_196243_4_.getBlock()) || !p_196243_4_.hasTileEntity())) { + p_196243_2_.removeBlockEntity(p_196243_3_); } @@ -191,7 +_,7 @@ @Deprecated - public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) { -- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j()); -+ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j()); + public boolean canBeReplaced(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) { +- return this.material.isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem()); ++ return p_196253_1_.getMaterial().isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem()); } @Deprecated @@ -41,8 +41,8 @@ if (f == -1.0F) { return 0.0F; } else { -- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100; -- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i; +- int i = p_180647_2_.hasCorrectToolForDrops(p_180647_1_) ? 30 : 100; +- return p_180647_2_.getDestroySpeed(p_180647_1_) / f / (float)i; + int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100; + return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i; } @@ -53,24 +53,24 @@ } + @Deprecated //Forge: Use state.hasTileEntity() - public final boolean func_235695_q_() { + public final boolean isEntityBlock() { return this instanceof ITileEntityProvider; } - public final ResourceLocation func_220068_i() { - if (this.field_220085_g == null) { -- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_()); -- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a()); -+ this.field_220085_g = this.lootTableSupplier.get(); + public final ResourceLocation getLootTable() { + if (this.drops == null) { +- ResourceLocation resourcelocation = Registry.BLOCK.getKey(this.asBlock()); +- this.drops = new ResourceLocation(resourcelocation.getNamespace(), "blocks/" + resourcelocation.getPath()); ++ this.drops = this.lootTableSupplier.get(); } - return this.field_220085_g; + return this.drops; @@ -346,6 +_,14 @@ - return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P()); + return this.properties.materialColor.apply(this.asBlock().defaultBlockState()); } + protected boolean isAir(BlockState state) { -+ return ((AbstractBlockState)state).field_235702_f_; ++ return ((AbstractBlockState)state).isAir; + } + + /* ======================================== FORGE START ===================================== */ @@ -78,53 +78,53 @@ + /* ========================================= FORGE END ====================================== */ + public abstract static class AbstractBlockState extends StateHolder { - private final int field_215708_d; - private final boolean field_215709_e; + private final int lightEmission; + private final boolean useShapeForLightOcclusion; @@ -424,18 +_,24 @@ - return this.field_215709_e; + return this.useShapeForLightOcclusion; } + /** @deprecated use {@link BlockState#getLightValue(IBlockReader, BlockPos)} */ + @Deprecated - public int func_185906_d() { - return this.field_215708_d; + public int getLightEmission() { + return this.lightEmission; } + /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos)} until 1.17, at which point this method will be undreprecated. See https://github.com/MinecraftForge/MinecraftForge/issues/7409 for more details */ + @Deprecated - public boolean func_196958_f() { -- return this.field_235702_f_; -+ return this.func_177230_c().isAir((BlockState)this); + public boolean isAir() { +- return this.isAir; ++ return this.getBlock().isAir((BlockState)this); } - public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) { - return this.field_235704_h_; + public MaterialColor getMapColor(IBlockReader p_185909_1_, BlockPos p_185909_2_) { + return this.materialColor; } + /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation)} */ + @Deprecated - public BlockState func_185907_a(Rotation p_185907_1_) { - return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_); + public BlockState rotate(Rotation p_185907_1_) { + return this.getBlock().rotate(this.asState(), p_185907_1_); } @@ -802,8 +_,11 @@ - private ResourceLocation field_222381_j; - private boolean field_226895_m_ = true; - private boolean field_235813_o_; + private ResourceLocation drops; + private boolean canOcclude = true; + private boolean isAir; + private int harvestLevel = -1; + private net.minecraftforge.common.ToolType harvestTool; + private java.util.function.Supplier lootTableSupplier; - private AbstractBlock.IExtendedPositionPredicate> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> { -- return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14; -+ return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14; + private AbstractBlock.IExtendedPositionPredicate> isValidSpawn = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> { +- return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightEmission() < 14; ++ return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14; }; - private AbstractBlock.IPositionPredicate field_235815_q_ = (p_235853_0_, p_235853_1_, p_235853_2_) -> { - return p_235853_0_.func_185904_a().func_76218_k() && p_235853_0_.func_235785_r_(p_235853_1_, p_235853_2_); + private AbstractBlock.IPositionPredicate isRedstoneConductor = (p_235853_0_, p_235853_1_, p_235853_2_) -> { + return p_235853_0_.getMaterial().isSolidBlocking() && p_235853_0_.isCollisionShapeFullBlock(p_235853_1_, p_235853_2_); @@ -863,6 +_,8 @@ - abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_; - abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_; - abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_; -+ abstractblock$properties.harvestLevel = p_200950_0_.field_235684_aB_.harvestLevel; -+ abstractblock$properties.harvestTool = p_200950_0_.field_235684_aB_.harvestTool; + abstractblock$properties.canOcclude = p_200950_0_.properties.canOcclude; + abstractblock$properties.isAir = p_200950_0_.properties.isAir; + abstractblock$properties.requiresCorrectToolForDrops = p_200950_0_.properties.requiresCorrectToolForDrops; ++ abstractblock$properties.harvestLevel = p_200950_0_.properties.harvestLevel; ++ abstractblock$properties.harvestTool = p_200950_0_.properties.harvestTool; return abstractblock$properties; } @@ -150,23 +150,23 @@ + return this.harvestTool; + } + - public AbstractBlock.Properties func_200941_a(float p_200941_1_) { - this.field_200961_i = p_200941_1_; + public AbstractBlock.Properties friction(float p_200941_1_) { + this.friction = p_200941_1_; return this; @@ -932,9 +_,15 @@ return this; } + @Deprecated // FORGE: Use the variant that takes a Supplier below - public AbstractBlock.Properties func_222379_b(Block p_222379_1_) { -- this.field_222381_j = p_222379_1_.func_220068_i(); -+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i(); + public AbstractBlock.Properties dropsLike(Block p_222379_1_) { +- this.drops = p_222379_1_.getLootTable(); ++ this.lootTableSupplier = () -> p_222379_1_.delegate.get().getLootTable(); return this; + } + + public AbstractBlock.Properties lootFrom(java.util.function.Supplier blockIn) { -+ this.lootTableSupplier = () -> blockIn.get().func_220068_i(); ++ this.lootTableSupplier = () -> blockIn.get().getLootTable(); + return this; } - public AbstractBlock.Properties func_235859_g_() { + public AbstractBlock.Properties air() { diff --git a/patches/minecraft/net/minecraft/block/AbstractFireBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractFireBlock.java.patch index 58f57d3d18..dd27f9195c 100644 --- a/patches/minecraft/net/minecraft/block/AbstractFireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractFireBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/block/AbstractFireBlock.java +++ b/net/minecraft/block/AbstractFireBlock.java @@ -124,6 +_,7 @@ - if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) { - if (func_242649_a(p_220082_2_)) { - Optional optional = PortalSize.func_242964_a(p_220082_2_, p_220082_3_, Direction.Axis.X); + if (!p_220082_4_.is(p_220082_1_.getBlock())) { + if (inPortalDimension(p_220082_2_)) { + Optional optional = PortalSize.findEmptyPortalShape(p_220082_2_, p_220082_3_, Direction.Axis.X); + optional = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_220082_2_, p_220082_3_, optional); if (optional.isPresent()) { - optional.get().func_150859_c(); + optional.get().createPortalBlocks(); return; diff --git a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch index c50a167e51..9491a066e0 100644 --- a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch @@ -6,53 +6,53 @@ -public abstract class AbstractRailBlock extends Block { +public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock { - protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D); - protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); - private final boolean field_196277_c; + protected static final VoxelShape FLAT_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D); + protected static final VoxelShape HALF_BLOCK_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); + private final boolean isStraight; @@ -37,6 +_,7 @@ - public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { - RailShape railshape = p_220053_1_.func_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null; -+ RailShape railShape2 = p_220053_1_.func_203425_a(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null; - return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a; + public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { + RailShape railshape = p_220053_1_.is(this) ? p_220053_1_.getValue(this.getShapeProperty()) : null; ++ RailShape railShape2 = p_220053_1_.is(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null; + return railshape != null && railshape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB; } @@ -61,7 +_,7 @@ - public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { - if (!p_220069_2_.field_72995_K && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) { -- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l()); + public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { + if (!p_220069_2_.isClientSide && p_220069_2_.getBlockState(p_220069_3_).is(this)) { +- RailShape railshape = p_220069_1_.getValue(this.getShapeProperty()); + RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null); - if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) { - func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_); - p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_); + if (shouldBeRemoved(p_220069_3_, p_220069_2_, railshape)) { + dropResources(p_220069_1_, p_220069_2_, p_220069_3_); + p_220069_2_.removeBlock(p_220069_3_, p_220069_6_); @@ -110,7 +_,7 @@ - public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { + public void onRemove(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) { if (!p_196243_5_) { - super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_); -- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) { -+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) { - p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this); + super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_); +- if (p_196243_1_.getValue(this.getShapeProperty()).isAscending()) { ++ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).isAscending()) { + p_196243_2_.updateNeighborsAt(p_196243_3_.above(), this); } @@ -129,5 +_,20 @@ - return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH); + return blockstate.setValue(this.getShapeProperty(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH); } + @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability - public abstract Property func_176560_l(); + public abstract Property getShapeProperty(); + + /* ======================================== FORGE START =====================================*/ + + @Override + public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) + { -+ return !this.field_196277_c; ++ return !this.isStraight; + } + + @Override + public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { -+ return state.func_177229_b(func_176560_l()); ++ return state.getValue(getShapeProperty()); + } + /* ========================================= FORGE END ======================================*/ } diff --git a/patches/minecraft/net/minecraft/block/AbstractTopPlantBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractTopPlantBlock.java.patch index 9d27b632c1..314d2ce82b 100644 --- a/patches/minecraft/net/minecraft/block/AbstractTopPlantBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractTopPlantBlock.java.patch @@ -3,13 +3,13 @@ @@ -32,10 +_,11 @@ } - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { -- if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && p_225542_4_.nextDouble() < this.field_235503_e_) { -+ if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.func_177972_a(this.field_235498_a_), p_225542_2_.func_180495_p(p_225542_3_.func_177972_a(this.field_235498_a_)),p_225542_4_.nextDouble() < this.field_235503_e_)) { - BlockPos blockpos = p_225542_3_.func_177972_a(this.field_235498_a_); - if (this.func_230334_h_(p_225542_2_.func_180495_p(blockpos))) { - p_225542_2_.func_175656_a(blockpos, p_225542_1_.func_235896_a_(field_235502_d_)); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.func_180495_p(blockpos)); + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { +- if (p_225542_1_.getValue(AGE) < 25 && p_225542_4_.nextDouble() < this.growPerTickProbability) { ++ if (p_225542_1_.getValue(AGE) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.relative(this.growthDirection), p_225542_2_.getBlockState(p_225542_3_.relative(this.growthDirection)),p_225542_4_.nextDouble() < this.growPerTickProbability)) { + BlockPos blockpos = p_225542_3_.relative(this.growthDirection); + if (this.canGrowInto(p_225542_2_.getBlockState(blockpos))) { + p_225542_2_.setBlockAndUpdate(blockpos, p_225542_1_.cycle(AGE)); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.getBlockState(blockpos)); } } diff --git a/patches/minecraft/net/minecraft/block/BambooBlock.java.patch b/patches/minecraft/net/minecraft/block/BambooBlock.java.patch index b680223a7c..9ead3be8de 100644 --- a/patches/minecraft/net/minecraft/block/BambooBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BambooBlock.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/block/BambooBlock.java @@ -100,10 +_,11 @@ - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - if (p_225542_1_.func_177229_b(field_220266_f) == 0) { -- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) { -+ if (p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) { - int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1; + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (p_225542_1_.getValue(STAGE) == 0) { +- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) { ++ if (p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) { + int i = this.getHeightBelowUpToMax(p_225542_2_, p_225542_3_) + 1; - if (i < 16) { + if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0)) { - this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i); + this.growBamboo(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } diff --git a/patches/minecraft/net/minecraft/block/BeehiveBlock.java.patch b/patches/minecraft/net/minecraft/block/BeehiveBlock.java.patch index 3daa79cf68..e7e5a7a5db 100644 --- a/patches/minecraft/net/minecraft/block/BeehiveBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BeehiveBlock.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/block/BeehiveBlock.java +++ b/net/minecraft/block/BeehiveBlock.java @@ -65,6 +_,9 @@ - public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { - return p_180641_1_.func_177229_b(field_226873_c_); + public int getAnalogOutputSignal(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { + return p_180641_1_.getValue(HONEY_LEVEL); } + // Forge: Fixed MC-227255 Beehives and bee nests do not rotate/mirror correctly in structure blocks -+ @Override public BlockState func_185499_a(BlockState blockState, net.minecraft.util.Rotation rotation) { return (BlockState)blockState.func_206870_a(field_226872_b_, rotation.func_185831_a(blockState.func_177229_b(field_226872_b_))); } -+ @Override public BlockState func_185471_a(BlockState blockState, net.minecraft.util.Mirror mirror) { return blockState.func_185907_a(mirror.func_185800_a(blockState.func_177229_b(field_226872_b_))); } ++ @Override public BlockState rotate(BlockState blockState, net.minecraft.util.Rotation rotation) { return (BlockState)blockState.setValue(FACING, rotation.rotate(blockState.getValue(FACING))); } ++ @Override public BlockState mirror(BlockState blockState, net.minecraft.util.Mirror mirror) { return blockState.rotate(mirror.getRotation(blockState.getValue(FACING))); } - public void func_180657_a(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); + public void playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { + super.playerDestroy(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); @@ -85,6 +_,7 @@ - List list = p_226881_1_.func_217357_a(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D)); + List list = p_226881_1_.getEntitiesOfClass(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D)); if (!list.isEmpty()) { - List list1 = p_226881_1_.func_217357_a(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D)); + List list1 = p_226881_1_.getEntitiesOfClass(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D)); + if (list1.isEmpty()) return; //Forge: Prevent Error when no players are around. int i = list1.size(); diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 638108cd35..458819256d 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -6,92 +6,92 @@ -public class Block extends AbstractBlock implements IItemProvider { +public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock { - protected static final Logger field_196273_d = LogManager.getLogger(); -- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap<>(); + protected static final Logger LOGGER = LogManager.getLogger(); +- public static final ObjectIntIdentityMap BLOCK_STATE_REGISTRY = new ObjectIntIdentityMap<>(); + @Deprecated //Forge: Do not use, use GameRegistry -+ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap(); - private static final LoadingCache field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { ++ public static final ObjectIntIdentityMap BLOCK_STATE_REGISTRY = net.minecraftforge.registries.GameData.getBlockStateIDMap(); + private static final LoadingCache SHAPE_FULL_BLOCK_CACHE = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_load_1_) { - return !VoxelShapes.func_197879_c(VoxelShapes.func_197868_b(), p_load_1_, IBooleanFunction.field_223236_g_); + return !VoxelShapes.joinIsNotEmpty(VoxelShapes.block(), p_load_1_, IBooleanFunction.NOT_SAME); @@ -151,6 +_,8 @@ super(p_i48440_1_); StateContainer.Builder builder = new StateContainer.Builder<>(this); - this.func_206840_a(builder); + this.createBlockStateDefinition(builder); + this.harvestLevel = p_i48440_1_.getHarvestLevel(); + this.harvestTool = p_i48440_1_.getHarvestTool(); - this.field_176227_L = builder.func_235882_a_(Block::func_176223_P, BlockState::new); - this.func_180632_j(this.field_176227_L.func_177621_b()); + this.stateDefinition = builder.create(Block::defaultBlockState, BlockState::new); + this.registerDefaultState(this.stateDefinition.any()); } @@ -261,7 +_,7 @@ } - public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { -- if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f)) { -+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180635_0_.restoringBlockSnapshots) { + public static void popResource(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { +- if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { ++ if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180635_0_.restoringBlockSnapshots) { float f = 0.5F; - double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; - double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; + double d0 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D; + double d1 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D; @@ -273,7 +_,7 @@ } - public void func_180637_b(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) { -- if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f)) { -+ if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) { + public void popExperience(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) { +- if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { ++ if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180637_1_.restoringBlockSnapshots) { while(p_180637_3_ > 0) { - int i = ExperienceOrbEntity.func_70527_a(p_180637_3_); + int i = ExperienceOrbEntity.getExperienceValue(p_180637_3_); p_180637_3_ -= i; @@ -283,6 +_,7 @@ } + @Deprecated //Forge: Use more sensitive version - public float func_149638_a() { - return this.field_235689_au_; + public float getExplosionResistance() { + return this.explosionResistance; } @@ -332,6 +_,7 @@ - p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D)); + p_176216_2_.setDeltaMovement(p_176216_2_.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); } + @Deprecated //Forge: Use more sensitive version - public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { + public ItemStack getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { return new ItemStack(this); } @@ -363,6 +_,7 @@ - public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) { + public void handleRain(World p_176224_1_, BlockPos p_176224_2_) { } + @Deprecated //Forge: Use more sensitive version - public boolean func_149659_a(Explosion p_149659_1_) { + public boolean dropFromExplosion(Explosion p_149659_1_) { return true; } @@ -382,6 +_,7 @@ - return this.field_196275_y; + return this.defaultBlockState; } + @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } - public SoundType func_220072_p(BlockState p_220072_1_) { - return this.field_149762_H; + public SoundType getSoundType(BlockState p_220072_1_) { + return this.soundType; } @@ -391,7 +_,7 @@ - this.field_220086_i = Item.func_150898_a(this); + this.item = Item.byBlock(this); } -- return this.field_220086_i; -+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements. +- return this.item; ++ return this.item.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements. } - public boolean func_208619_r() { + public boolean hasDynamicShape() { @@ -399,7 +_,7 @@ } public String toString() { -- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}"; +- return "Block{" + Registry.BLOCK.getKey(this) + "}"; + return "Block{" + getRegistryName() + "}"; } @OnlyIn(Dist.CLIENT) @@ -409,6 +_,78 @@ - protected Block func_230328_p_() { + protected Block asBlock() { return this; } + @@ -99,7 +99,7 @@ + protected Random RANDOM = new Random(); + private net.minecraftforge.common.ToolType harvestTool; + private int harvestLevel; -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::func_199896_a); ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getAllTags); + + @Nullable + @Override @@ -114,38 +114,38 @@ + + @Override + public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) { -+ BlockState plant = plantable.getPlant(world, pos.func_177972_a(facing)); -+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing)); ++ BlockState plant = plantable.getPlant(world, pos.relative(facing)); ++ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.relative(facing)); + -+ if (plant.func_177230_c() == Blocks.field_150434_aF) -+ return state.func_203425_a(Blocks.field_150434_aF) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F); ++ if (plant.getBlock() == Blocks.CACTUS) ++ return state.is(Blocks.CACTUS) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND); + -+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF) ++ if (plant.getBlock() == Blocks.SUGAR_CANE && this == Blocks.SUGAR_CANE) + return true; + -+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos)) ++ if (plantable instanceof BushBlock && ((BushBlock)plantable).mayPlaceOn(state, world, pos)) + return true; + + if (net.minecraftforge.common.PlantType.DESERT.equals(type)) { -+ return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock; ++ return this.getBlock() == Blocks.SAND || this.getBlock() == Blocks.TERRACOTTA || this.getBlock() instanceof GlazedTerracottaBlock; + } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) { -+ return this.getBlock() == Blocks.field_150425_aM; ++ return this.getBlock() == Blocks.SOUL_SAND; + } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) { -+ return state.func_203425_a(Blocks.field_150458_ak); ++ return state.is(Blocks.FARMLAND); + } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) { -+ return state.func_224755_d(world, pos, Direction.UP); ++ return state.isFaceSturdy(world, pos, Direction.UP); + } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) { -+ return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak; ++ return this.getBlock() == Blocks.GRASS_BLOCK || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || this.getBlock() == Blocks.FARMLAND; + } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) { -+ return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper) ++ return state.getMaterial() == net.minecraft.block.material.Material.WATER; //&& state.getValue(BlockLiquidWrapper) + } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) { -+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F); ++ boolean isBeach = state.is(Blocks.GRASS_BLOCK) || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND); + boolean hasWater = false; + for (Direction face : Direction.Plane.HORIZONTAL) { -+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face)); -+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face)); -+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de); -+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a); ++ BlockState blockState = world.getBlockState(pos.relative(face)); ++ net.minecraft.fluid.FluidState fluidState = world.getFluidState(pos.relative(face)); ++ hasWater |= blockState.is(Blocks.FROSTED_ICE); ++ hasWater |= fluidState.is(net.minecraft.tags.FluidTags.WATER); + if (hasWater) + break; //No point continuing. + } @@ -168,4 +168,4 @@ + /* ========================================= FORGE END ======================================*/ public static final class RenderSideCacheKey { - private final BlockState field_212164_a; + private final BlockState first; diff --git a/patches/minecraft/net/minecraft/block/BlockState.java.patch b/patches/minecraft/net/minecraft/block/BlockState.java.patch index 7a47526268..3d42da90f9 100644 --- a/patches/minecraft/net/minecraft/block/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockState.java.patch @@ -6,6 +6,6 @@ -public class BlockState extends AbstractBlock.AbstractBlockState { +public class BlockState extends AbstractBlock.AbstractBlockState implements net.minecraftforge.common.extensions.IForgeBlockState { - public static final Codec field_235877_b_ = func_235897_a_(Registry.field_212618_g, Block::func_176223_P).stable(); + public static final Codec CODEC = codec(Registry.BLOCK, Block::defaultBlockState).stable(); public BlockState(Block p_i231876_1_, ImmutableMap, Comparable> p_i231876_2_, MapCodec p_i231876_3_) { diff --git a/patches/minecraft/net/minecraft/block/Blocks.java.patch b/patches/minecraft/net/minecraft/block/Blocks.java.patch index fce20cf8b0..c36c5f693b 100644 --- a/patches/minecraft/net/minecraft/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/block/Blocks.java.patch @@ -6,30 +6,30 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class Blocks { - public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_())); - public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F))); + public static final Block AIR = register("air", new AirBlock(AbstractBlock.Properties.of(Material.AIR).noCollission().noDrops().air())); + public static final Block STONE = register("stone", new Block(AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F))); @@ -119,7 +_,7 @@ - public static final Block field_196601_az = func_222382_a("green_bed", func_235422_a_(DyeColor.GREEN)); - public static final Block field_196550_aA = func_222382_a("red_bed", func_235422_a_(DyeColor.RED)); - public static final Block field_196551_aB = func_222382_a("black_bed", func_235422_a_(DyeColor.BLACK)); -- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); -+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true)); - public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); - public static final Block field_150320_F = func_222382_a("sticky_piston", func_235432_a_(true)); - public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(AbstractBlock.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_235861_h_().func_200943_b(4.0F))); + public static final Block GREEN_BED = register("green_bed", bed(DyeColor.GREEN)); + public static final Block RED_BED = register("red_bed", bed(DyeColor.RED)); + public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK)); +- public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL))); ++ public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL), true)); + public static final Block DETECTOR_RAIL = register("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL))); + public static final Block STICKY_PISTON = register("sticky_piston", pistonBase(true)); + public static final Block COBWEB = register("cobweb", new WebBlock(AbstractBlock.Properties.of(Material.WEB).noCollission().requiresCorrectToolForDrops().strength(4.0F))); @@ -936,16 +_,5 @@ - public static void func_235419_a_() { - Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c); + public static void rebuildCache() { + Block.BLOCK_STATE_REGISTRY.forEach(AbstractBlock.AbstractBlockState::initCache); - } - - static { -- for(Block block : Registry.field_212618_g) { -- for(BlockState blockstate : block.func_176194_O().func_177619_a()) { -- Block.field_176229_d.func_195867_b(blockstate); +- for(Block block : Registry.BLOCK) { +- for(BlockState blockstate : block.getStateDefinition().getPossibleStates()) { +- Block.BLOCK_STATE_REGISTRY.add(blockstate); - } - -- block.func_220068_i(); +- block.getLootTable(); - } - } diff --git a/patches/minecraft/net/minecraft/block/BushBlock.java.patch b/patches/minecraft/net/minecraft/block/BushBlock.java.patch index f4d73b295b..5ef08e3422 100644 --- a/patches/minecraft/net/minecraft/block/BushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/BushBlock.java.patch @@ -11,23 +11,23 @@ } @@ -22,6 +_,8 @@ - public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { - BlockPos blockpos = p_196260_3_.func_177977_b(); -+ if (p_196260_1_.func_177230_c() == 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_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this); - return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos); + public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { + BlockPos blockpos = p_196260_3_.below(); ++ if (p_196260_1_.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_196260_2_.getBlockState(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this); + return this.mayPlaceOn(p_196260_2_.getBlockState(blockpos), p_196260_2_, blockpos); } @@ -31,5 +_,12 @@ - public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { - return p_196266_4_ == PathType.AIR && !this.field_235688_at_ ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_); + public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + return p_196266_4_ == PathType.AIR && !this.hasCollision ? true : super.isPathfindable(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_); + } + + @Override + public BlockState getPlant(IBlockReader world, BlockPos pos) { -+ BlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() != this) return func_176223_P(); ++ BlockState state = world.getBlockState(pos); ++ if (state.getBlock() != this) return defaultBlockState(); + return state; } } diff --git a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch index 1c993d30cc..759582d632 100644 --- a/patches/minecraft/net/minecraft/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch @@ -6,28 +6,28 @@ -public class CactusBlock extends Block { +public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable { - public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X; - protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D); - protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); + public static final IntegerProperty AGE = BlockStateProperties.AGE_15; + protected static final VoxelShape COLLISION_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D); + protected static final VoxelShape OUTLINE_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); @@ -30,6 +_,7 @@ } - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { + public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { + if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update - if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) { - p_225534_2_.func_175655_b(p_225534_3_, true); + if (!p_225534_1_.canSurvive(p_225534_2_, p_225534_3_)) { + p_225534_2_.destroyBlock(p_225534_3_, true); } @@ -45,6 +_,7 @@ if (i < 3) { - int j = p_225542_1_.func_177229_b(field_176587_a); + int j = p_225542_1_.getValue(AGE); + if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) { if (j == 15) { - p_225542_2_.func_175656_a(blockpos, this.func_176223_P()); - BlockState blockstate = p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); + p_225542_2_.setBlockAndUpdate(blockpos, this.defaultBlockState()); + BlockState blockstate = p_225542_1_.setValue(AGE, Integer.valueOf(0)); @@ -53,7 +_,8 @@ } else { - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); + p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4); } - + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); @@ -38,15 +38,15 @@ @@ -84,7 +_,7 @@ } - BlockState blockstate1 = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -- return (blockstate1.func_203425_a(Blocks.field_150434_aF) || blockstate1.func_203425_a(Blocks.field_150354_m) || blockstate1.func_203425_a(Blocks.field_196611_F)) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); -+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); + BlockState blockstate1 = p_196260_2_.getBlockState(p_196260_3_.below()); +- return (blockstate1.is(Blocks.CACTUS) || blockstate1.is(Blocks.SAND) || blockstate1.is(Blocks.RED_SAND)) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid(); ++ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid(); } - public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { + public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { @@ -97,5 +_,15 @@ - public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; + } + @@ -57,6 +57,6 @@ + + @Override + public BlockState getPlant(IBlockReader world, BlockPos pos) { -+ return func_176223_P(); ++ return defaultBlockState(); } } diff --git a/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch b/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch index b7bf5c64a7..59fa2d9419 100644 --- a/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CampfireBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/block/CampfireBlock.java +++ b/net/minecraft/block/CampfireBlock.java @@ -181,7 +_,7 @@ - public void func_220066_a(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) { - if (!p_220066_1_.field_72995_K && p_220066_4_.func_70027_ad()) { - Entity entity = p_220066_4_.func_234616_v_(); -- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b); + public void onProjectileHit(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) { + if (!p_220066_1_.isClientSide && p_220066_4_.isOnFire()) { + Entity entity = p_220066_4_.getOwner(); +- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + boolean flag = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity); - if (flag && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) { - BlockPos blockpos = p_220066_3_.func_216350_a(); - p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11); + if (flag && !p_220066_2_.getValue(LIT) && !p_220066_2_.getValue(WATERLOGGED)) { + BlockPos blockpos = p_220066_3_.getBlockPos(); + p_220066_1_.setBlock(blockpos, p_220066_2_.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)), 11); @@ -208,7 +_,7 @@ return true; } -- boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, p_235474_1_, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_); -+ boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, blockpos, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_);//Forge fix: MC-201374 +- boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, p_235474_1_, ISelectionContext.empty()), IBooleanFunction.AND); ++ boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, blockpos, ISelectionContext.empty()), IBooleanFunction.AND);//Forge fix: MC-201374 if (flag) { - BlockState blockstate1 = p_235474_0_.func_180495_p(blockpos.func_177977_b()); - return func_226915_i_(blockstate1); + BlockState blockstate1 = p_235474_0_.getBlockState(blockpos.below()); + return isLitCampfire(blockstate1); diff --git a/patches/minecraft/net/minecraft/block/ChestBlock.java.patch b/patches/minecraft/net/minecraft/block/ChestBlock.java.patch index 8ef73d440f..7a50b42890 100644 --- a/patches/minecraft/net/minecraft/block/ChestBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ChestBlock.java.patch @@ -3,10 +3,10 @@ @@ -325,7 +_,8 @@ } - public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) { -- return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176459_a))); -+ BlockState rotated = p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176459_a))); -+ return p_185471_2_ == Mirror.NONE ? rotated : rotated.func_206870_a(field_196314_b, rotated.func_177229_b(field_196314_b).func_208081_a()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests + public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) { +- return p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING))); ++ BlockState rotated = p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING))); ++ return p_185471_2_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests } - protected void func_206840_a(StateContainer.Builder p_206840_1_) { + protected void createBlockStateDefinition(StateContainer.Builder p_206840_1_) { diff --git a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch index 38f3da3d3f..11dec66697 100644 --- a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/block/ChorusFlowerBlock.java +++ b/net/minecraft/block/ChorusFlowerBlock.java @@ -40,7 +_,7 @@ - BlockPos blockpos = p_225542_3_.func_177984_a(); - if (p_225542_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { - int i = p_225542_1_.func_177229_b(field_185607_a); + BlockPos blockpos = p_225542_3_.above(); + if (p_225542_2_.isEmptyBlock(blockpos) && blockpos.getY() < 256) { + int i = p_225542_1_.getValue(AGE); - if (i < 5) { + if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) { boolean flag = false; boolean flag1 = false; - BlockState blockstate = p_225542_2_.func_180495_p(p_225542_3_.func_177977_b()); + BlockState blockstate = p_225542_2_.getBlockState(p_225542_3_.below()); @@ -65,7 +_,7 @@ if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) { flag = true; } -- } else if (blockstate.func_196958_f()) { -+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) { +- } else if (blockstate.isAir()) { ++ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.below())) { flag = true; } @@ -97,7 +_,7 @@ } else { - this.func_185605_c(p_225542_2_, p_225542_3_); + this.placeDeadFlower(p_225542_2_, p_225542_3_); } - + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); @@ -28,11 +28,11 @@ } } @@ -133,7 +_,7 @@ - public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { - BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); - if (blockstate.func_177230_c() != this.field_196405_b && !blockstate.func_203425_a(Blocks.field_150377_bs)) { -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) { + public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { + BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below()); + if (blockstate.getBlock() != this.plant && !blockstate.is(Blocks.END_STONE)) { +- if (!blockstate.isAir()) { ++ if (!blockstate.isAir(p_196260_2_, p_196260_3_.below())) { return false; } else { boolean flag = false; @@ -40,8 +40,8 @@ } flag = true; -- } else if (!blockstate1.func_196958_f()) { -+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) { +- } else if (!blockstate1.isAir()) { ++ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.relative(direction))) { return false; } } diff --git a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch index a56342d3a1..4421aee570 100644 --- a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch @@ -3,13 +3,13 @@ @@ -35,10 +_,11 @@ } - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { -- if (p_225542_2_.field_73012_v.nextInt(5) == 0) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { +- if (p_225542_2_.random.nextInt(5) == 0) { + if (true) { - int i = p_225542_1_.func_177229_b(field_176501_a); + int i = p_225542_1_.getValue(AGE); - if (i < 2) { -+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.field_73012_v.nextInt(5) == 0)) { - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2); ++ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.random.nextInt(5) == 0)) { + p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } diff --git a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch index 1bb962f419..37c1be8cc8 100644 --- a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/block/ComparatorBlock.java +++ b/net/minecraft/block/ComparatorBlock.java @@ -154,4 +_,16 @@ - protected void func_206840_a(StateContainer.Builder p_206840_1_) { - p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c); + protected void createBlockStateDefinition(StateContainer.Builder p_206840_1_) { + p_206840_1_.add(FACING, MODE, POWERED); } + + @Override + public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return state.func_203425_a(Blocks.field_196762_fd); ++ return state.is(Blocks.COMPARATOR); + } + + @Override + public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) { -+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) { -+ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false); ++ if (pos.getY() == neighbor.getY() && world instanceof World && !((World)world).isClientSide()) { ++ state.neighborChanged((World)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false); + } + } } diff --git a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch index 70aa23d4b0..886d043de9 100644 --- a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch @@ -3,15 +3,15 @@ @@ -61,12 +_,14 @@ } - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) { - int i = this.func_185527_x(p_225542_1_); - if (i < this.func_185526_g()) { - float f = func_180672_a(this, p_225542_2_, p_225542_3_); + if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) { + int i = this.getAge(p_225542_1_); + if (i < this.getMaxAge()) { + float f = getGrowthSpeed(this, p_225542_2_, p_225542_3_); - if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) { + if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_225542_2_.func_180501_a(p_225542_3_, this.func_185528_e(i + 1), 2); + p_225542_2_.setBlock(p_225542_3_, this.getStateForAge(i + 1), 2); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } } @@ -19,21 +19,21 @@ @@ -95,9 +_,9 @@ for(int j = -1; j <= 1; ++j) { float f1 = 0.0F; - BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); -- if (blockstate.func_203425_a(Blocks.field_150458_ak)) { -+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) { + BlockState blockstate = p_180672_1_.getBlockState(blockpos.offset(i, 0, j)); +- if (blockstate.is(Blocks.FARMLAND)) { ++ if (blockstate.canSustainPlant(p_180672_1_, blockpos.offset(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) { f1 = 1.0F; -- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) { -+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.func_177982_a(i, 0, j))) { +- if (blockstate.getValue(FarmlandBlock.MOISTURE) > 0) { ++ if (blockstate.isFertile(p_180672_1_, p_180672_2_.offset(i, 0, j))) { f1 = 3.0F; } } @@ -133,7 +_,7 @@ } - public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { -- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { +- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) { - p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_); + p_196262_2_.destroyBlock(p_196262_3_, true, p_196262_4_); } diff --git a/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch index f253ba929d..3a10503e35 100644 --- a/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch @@ -6,6 +6,6 @@ -public class DeadBushBlock extends BushBlock { +public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IForgeShearable { - protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); public DeadBushBlock(AbstractBlock.Properties p_i48418_1_) { diff --git a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch index 5e38a2d969..9cb95c319f 100644 --- a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch @@ -3,9 +3,9 @@ @@ -131,6 +_,8 @@ } - List list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b); -+ List carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null); + List list1 = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.CONTAINER_ENTITY_SELECTOR); ++ List carts = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null); + if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel(); if (!list1.isEmpty()) { - return Container.func_94526_b((IInventory)list1.get(0)); + return Container.getRedstoneSignalFromContainer((IInventory)list1.get(0)); } diff --git a/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch index 88103c304b..6a1ef7e109 100644 --- a/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/block/DoublePlantBlock.java +++ b/net/minecraft/block/DoublePlantBlock.java @@ -51,6 +_,7 @@ - return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); + return super.canSurvive(p_196260_1_, p_196260_2_, p_196260_3_); } else { - BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //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.func_203425_a(this) && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER; + BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below()); ++ if (p_196260_1_.getBlock() != this) return super.canSurvive(p_196260_1_, p_196260_2_, p_196260_3_); //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; } } diff --git a/patches/minecraft/net/minecraft/block/DropperBlock.java.patch b/patches/minecraft/net/minecraft/block/DropperBlock.java.patch index 7d70f11c19..b7ec6e8a47 100644 --- a/patches/minecraft/net/minecraft/block/DropperBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/DropperBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/DropperBlock.java +++ b/net/minecraft/block/DropperBlock.java @@ -37,7 +_,7 @@ - p_176439_1_.func_217379_c(1001, p_176439_2_, 0); + p_176439_1_.levelEvent(1001, p_176439_2_, 0); } else { - ItemStack itemstack = dispensertileentity.func_70301_a(i); -- if (!itemstack.func_190926_b()) { -+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) { - Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a); - IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction)); + ItemStack itemstack = dispensertileentity.getItem(i); +- if (!itemstack.isEmpty()) { ++ if (!itemstack.isEmpty() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) { + Direction direction = p_176439_1_.getBlockState(p_176439_2_).getValue(FACING); + IInventory iinventory = HopperTileEntity.getContainerAt(p_176439_1_, p_176439_2_.relative(direction)); ItemStack itemstack1; diff --git a/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch index ca4416909c..e8474505e2 100644 --- a/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch @@ -3,9 +3,9 @@ @@ -54,7 +_,7 @@ if (p_180655_4_.nextInt(16) == 0) { for(int k = 0; k <= 1; ++k) { - BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j); -- if (p_180655_2_.func_180495_p(blockpos).func_203425_a(Blocks.field_150342_X)) { -+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) { - if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2))) { + BlockPos blockpos = p_180655_3_.offset(i, k, j); +- if (p_180655_2_.getBlockState(blockpos).is(Blocks.BOOKSHELF)) { ++ if (p_180655_2_.getBlockState(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) { + if (!p_180655_2_.isEmptyBlock(p_180655_3_.offset(i / 2, 0, j / 2))) { break; } diff --git a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch index 858209d852..4f4da3a262 100644 --- a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch @@ -3,18 +3,18 @@ @@ -30,7 +_,7 @@ } - public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { -- if (func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) { -+ if (p_225534_2_.func_175623_d(p_225534_3_.func_177977_b()) || func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) { - FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.func_177958_n() + 0.5D, (double)p_225534_3_.func_177956_o(), (double)p_225534_3_.func_177952_p() + 0.5D, p_225534_2_.func_180495_p(p_225534_3_)); - this.func_149829_a(fallingblockentity); - p_225534_2_.func_217376_c(fallingblockentity); + public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) { +- if (isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) { ++ if (p_225534_2_.isEmptyBlock(p_225534_3_.below()) || isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) { + FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.getX() + 0.5D, (double)p_225534_3_.getY(), (double)p_225534_3_.getZ() + 0.5D, p_225534_2_.getBlockState(p_225534_3_)); + this.falling(fallingblockentity); + p_225534_2_.addFreshEntity(fallingblockentity); @@ -59,7 +_,7 @@ - public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) { + public void animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) { if (p_180655_4_.nextInt(16) == 0) { - BlockPos blockpos = p_180655_3_.func_177977_b(); -- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) { -+ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) { - double d0 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble(); - double d1 = (double)p_180655_3_.func_177956_o() - 0.05D; - double d2 = (double)p_180655_3_.func_177952_p() + p_180655_4_.nextDouble(); + BlockPos blockpos = p_180655_3_.below(); +- if (isFree(p_180655_2_.getBlockState(blockpos))) { ++ if (p_180655_2_.isEmptyBlock(blockpos) || isFree(p_180655_2_.getBlockState(blockpos))) { + double d0 = (double)p_180655_3_.getX() + p_180655_4_.nextDouble(); + double d1 = (double)p_180655_3_.getY() - 0.05D; + double d2 = (double)p_180655_3_.getZ() + p_180655_4_.nextDouble(); diff --git a/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch index cf439f5941..c13b2650a5 100644 --- a/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch @@ -3,26 +3,26 @@ @@ -77,7 +_,7 @@ } - public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) { -- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) { -+ if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample - func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_); + public void fallOn(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) { +- if (!p_180658_1_.isClientSide && p_180658_1_.random.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && p_180658_3_.getBbWidth() * p_180658_3_.getBbWidth() * p_180658_3_.getBbHeight() > 0.512F) { ++ if (!p_180658_1_.isClientSide && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.DIRT.defaultBlockState(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample + turnToDirt(p_180658_1_.getBlockState(p_180658_2_), p_180658_1_, p_180658_2_); } @@ -88,9 +_,10 @@ - p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_)); + p_199610_1_.setBlockAndUpdate(p_199610_2_, pushEntitiesUp(p_199610_0_, Blocks.DIRT.defaultBlockState(), p_199610_1_, p_199610_2_)); } -- private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { -- Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c(); +- private static boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) { +- Block block = p_176529_0_.getBlockState(p_176529_1_.above()).getBlock(); - return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock; -+ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { -+ BlockState plant = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()); -+ BlockState state = p_176529_0_.func_180495_p(p_176529_1_); -+ return plant.func_177230_c() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.func_177230_c()); ++ private boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) { ++ BlockState plant = p_176529_0_.getBlockState(p_176529_1_.above()); ++ BlockState state = p_176529_0_.getBlockState(p_176529_1_); ++ return plant.getBlock() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.getBlock()); } - private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) { + private static boolean isNearWater(IWorldReader p_176530_0_, BlockPos p_176530_1_) { @@ -100,7 +_,7 @@ } } @@ -31,4 +31,4 @@ + return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_); } - protected void func_206840_a(StateContainer.Builder p_206840_1_) { + protected void createBlockStateDefinition(StateContainer.Builder p_206840_1_) { diff --git a/patches/minecraft/net/minecraft/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/block/FireBlock.java.patch index f37807a2a3..ee285f5550 100644 --- a/patches/minecraft/net/minecraft/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FireBlock.java.patch @@ -1,87 +1,87 @@ --- a/net/minecraft/block/FireBlock.java +++ b/net/minecraft/block/FireBlock.java @@ -92,13 +_,13 @@ - protected BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) { - BlockPos blockpos = p_196448_2_.func_177977_b(); - BlockState blockstate = p_196448_1_.func_180495_p(blockpos); -- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) { -+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) { - BlockState blockstate1 = this.func_176223_P(); + protected BlockState getStateForPlacement(IBlockReader p_196448_1_, BlockPos p_196448_2_) { + BlockPos blockpos = p_196448_2_.below(); + BlockState blockstate = p_196448_1_.getBlockState(blockpos); +- if (!this.canBurn(blockstate) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) { ++ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) { + BlockState blockstate1 = this.defaultBlockState(); for(Direction direction : Direction.values()) { - BooleanProperty booleanproperty = field_196449_B.get(direction); + BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction); if (booleanproperty != null) { -- blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(direction))))); -+ blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(direction), direction.func_176734_d()))); +- blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canBurn(p_196448_1_.getBlockState(p_196448_2_.relative(direction))))); ++ blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.relative(direction), direction.getOpposite()))); } } @@ -121,7 +_,7 @@ } - BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()); -- boolean flag = blockstate.func_235714_a_(p_225534_2_.func_230315_m_().func_241515_q_()); + BlockState blockstate = p_225534_2_.getBlockState(p_225534_3_.below()); +- boolean flag = blockstate.is(p_225534_2_.dimensionType().infiniburn()); + boolean flag = blockstate.isFireSource(p_225534_2_, p_225534_3_, Direction.UP); - int i = p_225534_1_.func_177229_b(field_176543_a); - if (!flag && p_225534_2_.func_72896_J() && this.func_176537_d(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) { - p_225534_2_.func_217377_a(p_225534_3_, false); + int i = p_225534_1_.getValue(AGE); + if (!flag && p_225534_2_.isRaining() && this.isNearRain(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) { + p_225534_2_.removeBlock(p_225534_3_, false); @@ -142,7 +_,7 @@ return; } -- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.func_196446_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()))) { -+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP)) { - p_225534_2_.func_217377_a(p_225534_3_, false); +- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canBurn(p_225534_2_.getBlockState(p_225534_3_.below()))) { ++ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.below(), Direction.UP)) { + p_225534_2_.removeBlock(p_225534_3_, false); return; } @@ -150,12 +_,12 @@ - boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_); + boolean flag1 = p_225534_2_.isHumidAt(p_225534_3_); int k = flag1 ? -50 : 0; -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i); -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i); -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i); -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i); -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i); -- this.func_176536_a(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i, Direction.WEST); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i, Direction.EAST); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i, Direction.UP); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i, Direction.DOWN); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i, Direction.SOUTH); -+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i, Direction.NORTH); +- this.checkBurnOut(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i); +- this.checkBurnOut(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i); +- this.checkBurnOut(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i); +- this.checkBurnOut(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i); +- this.checkBurnOut(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i); +- this.checkBurnOut(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i, Direction.WEST); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i, Direction.EAST); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i, Direction.UP); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i, Direction.DOWN); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i, Direction.SOUTH); ++ this.tryCatchFire(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i, Direction.NORTH); BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); for(int l = -1; l <= 1; ++l) { @@ -193,16 +_,18 @@ - return p_176537_1_.func_175727_C(p_176537_2_) || p_176537_1_.func_175727_C(p_176537_2_.func_177976_e()) || p_176537_1_.func_175727_C(p_176537_2_.func_177974_f()) || p_176537_1_.func_175727_C(p_176537_2_.func_177978_c()) || p_176537_1_.func_175727_C(p_176537_2_.func_177968_d()); + return p_176537_1_.isRainingAt(p_176537_2_) || p_176537_1_.isRainingAt(p_176537_2_.west()) || p_176537_1_.isRainingAt(p_176537_2_.east()) || p_176537_1_.isRainingAt(p_176537_2_.north()) || p_176537_1_.isRainingAt(p_176537_2_.south()); } + @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only. - public int func_220274_q(BlockState p_220274_1_) { - return p_220274_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220274_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149848_b.getInt(p_220274_1_.func_177230_c()); + public int getBurnOdd(BlockState p_220274_1_) { + return p_220274_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220274_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.burnOdds.getInt(p_220274_1_.getBlock()); } + @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed - public int func_220275_r(BlockState p_220275_1_) { - return p_220275_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220275_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149849_a.getInt(p_220275_1_.func_177230_c()); + public int getFlameOdds(BlockState p_220275_1_) { + return p_220275_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220275_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(p_220275_1_.getBlock()); } -- private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) { -- int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_)); +- private void checkBurnOut(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) { +- int i = this.getBurnOdd(p_176536_1_.getBlockState(p_176536_2_)); + private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, Direction face) { -+ int i = p_176536_1_.func_180495_p(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face); ++ int i = p_176536_1_.getBlockState(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face); if (p_176536_4_.nextInt(p_176536_3_) < i) { - BlockState blockstate = p_176536_1_.func_180495_p(p_176536_2_); - if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) { + BlockState blockstate = p_176536_1_.getBlockState(p_176536_2_); + if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.isRainingAt(p_176536_2_)) { @@ -212,11 +_,7 @@ - p_176536_1_.func_217377_a(p_176536_2_, false); + p_176536_1_.removeBlock(p_176536_2_, false); } -- Block block = blockstate.func_177230_c(); +- Block block = blockstate.getBlock(); - if (block instanceof TNTBlock) { - TNTBlock tntblock = (TNTBlock)block; -- TNTBlock.func_196534_a(p_176536_1_, p_176536_2_); +- TNTBlock.explode(p_176536_1_, p_176536_2_); - } + blockstate.catchFire(p_176536_1_, p_176536_2_, face, null); } @@ -89,19 +89,19 @@ } @@ -228,7 +_,7 @@ - private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) { + private boolean isValidFireLocation(IBlockReader p_196447_1_, BlockPos p_196447_2_) { for(Direction direction : Direction.values()) { -- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(direction)))) { -+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(direction), direction.func_176734_d())) { +- if (this.canBurn(p_196447_1_.getBlockState(p_196447_2_.relative(direction)))) { ++ if (this.canCatchFire(p_196447_1_, p_196447_2_.relative(direction), direction.getOpposite())) { return true; } } @@ -244,13 +_,14 @@ for(Direction direction : Direction.values()) { - BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction)); -- i = Math.max(this.func_220275_r(blockstate), i); -+ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i); + BlockState blockstate = p_176538_1_.getBlockState(p_176538_2_.relative(direction)); +- i = Math.max(this.getFlameOdds(blockstate), i); ++ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.relative(direction), direction.getOpposite()), i); } return i; @@ -109,16 +109,16 @@ } + @Deprecated //Forge: Use canCatchFire with more context - protected boolean func_196446_i(BlockState p_196446_1_) { - return this.func_220275_r(p_196446_1_) > 0; + protected boolean canBurn(BlockState p_196446_1_) { + return this.getFlameOdds(p_196446_1_) > 0; } @@ -269,8 +_,21 @@ } - private void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { -+ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.field_149849_a.put(p_180686_1_, p_180686_2_); - this.field_149848_b.put(p_180686_1_, p_180686_3_); + private void setFlammable(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { ++ if (p_180686_1_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.flameOdds.put(p_180686_1_, p_180686_2_); + this.burnOdds.put(p_180686_1_, p_180686_3_); + } + + /** @@ -130,7 +130,7 @@ + * @return True if the face can catch fire. + */ + public boolean canCatchFire(IBlockReader world, BlockPos pos, Direction face) { -+ return world.func_180495_p(pos).isFlammable(world, pos, face); ++ return world.getBlockState(pos).isFlammable(world, pos, face); } - public static void func_149843_e() { + public static void bootStrap() { diff --git a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch index e8f6bb5310..3afc8320e1 100644 --- a/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/block/FlowerPotBlock.java +++ b/net/minecraft/block/FlowerPotBlock.java @@ -24,10 +_,33 @@ - protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D); - private final Block field_196452_c; + protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D); + private final Block content; + @Deprecated // Mods should use the constructor below public FlowerPotBlock(Block p_i48395_1_, AbstractBlock.Properties p_i48395_2_) { - super(p_i48395_2_); -- this.field_196452_c = p_i48395_1_; -- field_196451_b.put(p_i48395_1_, this); -+ this(Blocks.field_150457_bL == null ? null : () -> (FlowerPotBlock) Blocks.field_150457_bL.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_); -+ if (Blocks.field_150457_bL != null) { -+ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this); +- this.content = p_i48395_1_; +- POTTED_BY_CONTENT.put(p_i48395_1_, this); ++ this(Blocks.FLOWER_POT == null ? null : () -> (FlowerPotBlock) Blocks.FLOWER_POT.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_); ++ if (Blocks.FLOWER_POT != null) { ++ ((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(p_i48395_1_.getRegistryName(), () -> this); + } + } + @@ -25,7 +25,7 @@ + */ + public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_i48395_1_, AbstractBlock.Properties properties) { + super(properties); -+ this.field_196452_c = null; // Unused, redirected by coremod ++ this.content = null; // Unused, redirected by coremod + this.flowerDelegate = p_i48395_1_; + if (emptyPot == null) { + this.fullPots = Maps.newHashMap(); @@ -36,34 +36,34 @@ + } } - public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { + public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { @@ -41,7 +_,7 @@ - public ActionResultType func_225533_a_(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { - ItemStack itemstack = p_225533_4_.func_184586_b(p_225533_5_); - Item item = itemstack.func_77973_b(); -- Block block = item instanceof BlockItem ? field_196451_b.getOrDefault(((BlockItem)item).func_179223_d(), Blocks.field_150350_a) : Blocks.field_150350_a; -+ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).func_179223_d().getRegistryName(), Blocks.field_150350_a.delegate).get() : Blocks.field_150350_a; - boolean flag = block == Blocks.field_150350_a; - boolean flag1 = this.field_196452_c == Blocks.field_150350_a; + public ActionResultType use(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { + ItemStack itemstack = p_225533_4_.getItemInHand(p_225533_5_); + Item item = itemstack.getItem(); +- Block block = item instanceof BlockItem ? POTTED_BY_CONTENT.getOrDefault(((BlockItem)item).getBlock(), Blocks.AIR) : Blocks.AIR; ++ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).getBlock().getRegistryName(), Blocks.AIR.delegate).get() : Blocks.AIR; + boolean flag = block == Blocks.AIR; + boolean flag1 = this.content == Blocks.AIR; if (flag != flag1) { @@ -59,7 +_,7 @@ - p_225533_4_.func_71019_a(itemstack1, false); + p_225533_4_.drop(itemstack1, false); } -- p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150457_bL.func_176223_P(), 3); -+ p_225533_2_.func_180501_a(p_225533_3_, getEmptyPot().func_176223_P(), 3); +- p_225533_2_.setBlock(p_225533_3_, Blocks.FLOWER_POT.defaultBlockState(), 3); ++ p_225533_2_.setBlock(p_225533_3_, getEmptyPot().defaultBlockState(), 3); } - return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K); + return ActionResultType.sidedSuccess(p_225533_2_.isClientSide); @@ -77,10 +_,31 @@ } - public Block func_220276_d() { -- return this.field_196452_c; + public Block getContent() { +- return this.content; + return flowerDelegate.get(); } - public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; } + diff --git a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch index dac95dab33..63584f2ee9 100644 --- a/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowingFluidBlock.java.patch @@ -3,20 +3,20 @@ @@ -29,10 +_,11 @@ public class FlowingFluidBlock extends Block implements IBucketPickupHandler { - public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag; -- protected final FlowingFluid field_204517_c; -+ private final FlowingFluid field_204517_c; - private final List field_212565_c; - public static final VoxelShape field_235510_c_ = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); + public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL; +- protected final FlowingFluid fluid; ++ private final FlowingFluid fluid; + private final List stateCache; + public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); + @Deprecated // Forge: Use the constructor that takes a supplier public FlowingFluidBlock(FlowingFluid p_i49014_1_, AbstractBlock.Properties p_i49014_2_) { super(p_i49014_2_); - this.field_204517_c = p_i49014_1_; + this.fluid = p_i49014_1_; @@ -45,6 +_,19 @@ - this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true)); - this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0))); + this.stateCache.add(p_i49014_1_.getFlowing(8, true)); + this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); + fluidStateCacheInitialized = true; + supplier = p_i49014_1_.delegate; + } @@ -26,41 +26,41 @@ + */ + public FlowingFluidBlock(java.util.function.Supplier supplier, AbstractBlock.Properties p_i48368_1_) { + super(p_i48368_1_); -+ this.field_204517_c = null; -+ this.field_212565_c = Lists.newArrayList(); -+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0))); ++ this.fluid = null; ++ this.stateCache = Lists.newArrayList(); ++ this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); + this.supplier = supplier; } - public VoxelShape func_220071_b(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) { + public VoxelShape getCollisionShape(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) { @@ -69,6 +_,7 @@ - public FluidState func_204507_t(BlockState p_204507_1_) { - int i = p_204507_1_.func_177229_b(field_176367_b); + public FluidState getFluidState(BlockState p_204507_1_) { + int i = p_204507_1_.getValue(LEVEL); + if (!fluidStateCacheInitialized) initFluidStateCache(); - return this.field_212565_c.get(Math.min(i, 8)); + return this.stateCache.get(Math.min(i, 8)); } @@ -120,13 +_,13 @@ - BlockPos blockpos = p_204515_2_.func_177972_a(direction); - if (p_204515_1_.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) { - Block block = p_204515_1_.func_204610_c(p_204515_2_).func_206889_d() ? Blocks.field_150343_Z : Blocks.field_150347_e; -- p_204515_1_.func_175656_a(p_204515_2_, block.func_176223_P()); -+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.func_176223_P())); - this.func_180688_d(p_204515_1_, p_204515_2_); + BlockPos blockpos = p_204515_2_.relative(direction); + if (p_204515_1_.getFluidState(blockpos).is(FluidTags.WATER)) { + Block block = p_204515_1_.getFluidState(p_204515_2_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; +- p_204515_1_.setBlockAndUpdate(p_204515_2_, block.defaultBlockState()); ++ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.defaultBlockState())); + this.fizz(p_204515_1_, p_204515_2_); return false; } - if (flag && p_204515_1_.func_180495_p(blockpos).func_203425_a(Blocks.field_205164_gk)) { -- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_235337_cO_.func_176223_P()); -+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_235337_cO_.func_176223_P())); - this.func_180688_d(p_204515_1_, p_204515_2_); + if (flag && p_204515_1_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) { +- p_204515_1_.setBlockAndUpdate(p_204515_2_, Blocks.BASALT.defaultBlockState()); ++ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.BASALT.defaultBlockState())); + this.fizz(p_204515_1_, p_204515_2_); return false; } @@ -151,6 +_,25 @@ - return this.field_204517_c; + return this.fluid; } else { - return Fluids.field_204541_a; + return Fluids.EMPTY; + } + } + @@ -73,12 +73,12 @@ + private boolean fluidStateCacheInitialized = false; + protected synchronized void initFluidStateCache() { + if (fluidStateCacheInitialized == false) { -+ this.field_212565_c.add(getFluid().func_207204_a(false)); ++ this.stateCache.add(getFluid().getSource(false)); + + for (int i = 1; i < 8; ++i) -+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false)); ++ this.stateCache.add(getFluid().getFlowing(8 - i, false)); + -+ this.field_212565_c.add(getFluid().func_207207_a(8, true)); ++ this.stateCache.add(getFluid().getFlowing(8, true)); + fluidStateCacheInitialized = true; } } diff --git a/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch b/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch index cecbfff826..2084cd60ec 100644 --- a/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch +++ b/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch @@ -7,4 +7,4 @@ +@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity public interface ITileEntityProvider { @Nullable - TileEntity func_196283_a_(IBlockReader p_196283_1_); + TileEntity newBlockEntity(IBlockReader p_196283_1_); diff --git a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch index b20f63a617..a525f6be42 100644 --- a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch @@ -6,6 +6,6 @@ -public class LeavesBlock extends Block { +public class LeavesBlock extends Block implements net.minecraftforge.common.IForgeShearable { - public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa; - public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s; + public static final IntegerProperty DISTANCE = BlockStateProperties.DISTANCE; + public static final BooleanProperty PERSISTENT = BlockStateProperties.PERSISTENT; diff --git a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch index a01a838815..10b6e54874 100644 --- a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/block/MushroomBlock.java +++ b/net/minecraft/block/MushroomBlock.java @@ -64,7 +_,7 @@ - if (blockstate.func_235714_a_(BlockTags.field_242171_aD)) { + if (blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK)) { return true; } else { -- return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos); -+ return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); +- return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && this.mayPlaceOn(blockstate, p_196260_2_, blockpos); ++ return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); } } diff --git a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch index f07b5ea7b2..2470198b19 100644 --- a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch @@ -2,12 +2,12 @@ +++ b/net/minecraft/block/NetherWartBlock.java @@ -35,9 +_,10 @@ - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - int i = p_225542_1_.func_177229_b(field_176486_a); + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + int i = p_225542_1_.getValue(AGE); - if (i < 3 && p_225542_4_.nextInt(10) == 0) { + if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(10) == 0)) { - p_225542_1_ = p_225542_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2); + p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)); + p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } diff --git a/patches/minecraft/net/minecraft/block/NoteBlock.java.patch b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch index 79ada4da25..a9775ec58a 100644 --- a/patches/minecraft/net/minecraft/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch @@ -3,30 +3,30 @@ @@ -50,7 +_,7 @@ } - private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) { -- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) { -+ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) { - p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0); + private void playNote(World p_196482_1_, BlockPos p_196482_2_) { +- if (p_196482_1_.getBlockState(p_196482_2_.above()).isAir()) { ++ if (p_196482_1_.isEmptyBlock(p_196482_2_.above())) { + p_196482_1_.blockEvent(p_196482_2_, this, 0, 0); } @@ -60,7 +_,9 @@ - if (p_225533_2_.field_72995_K) { + if (p_225533_2_.isClientSide) { return ActionResultType.SUCCESS; } else { -- p_225533_1_ = p_225533_1_.func_235896_a_(field_196485_c); -+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_235896_a_(field_196485_c).func_177229_b(field_196485_c)); +- p_225533_1_ = p_225533_1_.cycle(NOTE); ++ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.getValue(NOTE), p_225533_1_.cycle(NOTE).getValue(NOTE)); + if (_new == -1) return ActionResultType.FAIL; -+ p_225533_1_ = p_225533_1_.func_206870_a(field_196485_c, _new); - p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3); - this.func_196482_a(p_225533_2_, p_225533_3_); - p_225533_4_.func_195066_a(Stats.field_188087_U); ++ p_225533_1_ = p_225533_1_.setValue(NOTE, _new); + p_225533_2_.setBlock(p_225533_3_, p_225533_1_, 3); + this.playNote(p_225533_2_, p_225533_3_); + p_225533_4_.awardStat(Stats.TUNE_NOTEBLOCK); @@ -76,6 +_,9 @@ } - public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a)); + public boolean triggerEvent(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.getValue(NOTE), p_189539_1_.getValue(INSTRUMENT)); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument()); - int i = p_189539_1_.func_177229_b(field_196485_c); ++ p_189539_1_ = p_189539_1_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument()); + int i = p_189539_1_.getValue(NOTE); float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D); - p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f); + p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, p_189539_1_.getValue(INSTRUMENT).getSoundEvent(), SoundCategory.RECORDS, 3.0F, f); diff --git a/patches/minecraft/net/minecraft/block/OreBlock.java.patch b/patches/minecraft/net/minecraft/block/OreBlock.java.patch index 9e831cc6f0..3ce3709dff 100644 --- a/patches/minecraft/net/minecraft/block/OreBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/OreBlock.java.patch @@ -2,18 +2,18 @@ +++ b/net/minecraft/block/OreBlock.java @@ -31,12 +_,10 @@ - public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { - super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); -- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) { -- int i = this.func_220281_a(p_220062_2_.field_73012_v); + public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) { +- int i = this.xpOnDrop(p_220062_2_.random); - if (i > 0) { -- this.func_180637_b(p_220062_2_, p_220062_3_, i); +- this.popExperience(p_220062_2_, p_220062_3_, i); - } - } + } + @Override + public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) { -+ return silktouch == 0 ? this.func_220281_a(RANDOM) : 0; ++ return silktouch == 0 ? this.xpOnDrop(RANDOM) : 0; } } diff --git a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch index 44aa84927e..e7c1eb49d6 100644 --- a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch @@ -5,19 +5,19 @@ if (p_189539_4_ == 0) { + if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false; - if (!this.func_176319_a(p_189539_2_, p_189539_3_, direction, true)) { + if (!this.moveBlocks(p_189539_2_, p_189539_3_, direction, true)) { return false; } @@ -165,6 +_,7 @@ - p_189539_2_.func_180501_a(p_189539_3_, p_189539_1_.func_206870_a(field_176320_b, Boolean.valueOf(true)), 67); - p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187715_dR, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.25F + 0.6F); + p_189539_2_.setBlock(p_189539_3_, p_189539_1_.setValue(EXTENDED, Boolean.valueOf(true)), 67); + p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.25F + 0.6F); } else if (p_189539_4_ == 1 || p_189539_4_ == 2) { + if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false; - TileEntity tileentity1 = p_189539_2_.func_175625_s(p_189539_3_.func_177972_a(direction)); + TileEntity tileentity1 = p_189539_2_.getBlockEntity(p_189539_3_.relative(direction)); if (tileentity1 instanceof PistonTileEntity) { - ((PistonTileEntity)tileentity1).func_145866_f(); + ((PistonTileEntity)tileentity1).finalTick(); @@ -204,6 +_,7 @@ - p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187712_dQ, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.15F + 0.6F); + p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.15F + 0.6F); } + net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_189539_2_, p_189539_3_, direction, (p_189539_4_ == 0)); @@ -28,7 +28,7 @@ return false; } -- return !p_185646_0_.func_177230_c().func_235695_q_(); +- return !p_185646_0_.getBlock().isEntityBlock(); + return !p_185646_0_.hasTileEntity(); } } else { @@ -36,20 +36,20 @@ @@ -273,7 +_,7 @@ for(int k = list2.size() - 1; k >= 0; --k) { BlockPos blockpos2 = list2.get(k); - BlockState blockstate1 = p_176319_1_.func_180495_p(blockpos2); -- TileEntity tileentity = blockstate1.func_177230_c().func_235695_q_() ? p_176319_1_.func_175625_s(blockpos2) : null; -+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null; - func_220059_a(blockstate1, p_176319_1_, blockpos2, tileentity); - p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18); + BlockState blockstate1 = p_176319_1_.getBlockState(blockpos2); +- TileEntity tileentity = blockstate1.getBlock().isEntityBlock() ? p_176319_1_.getBlockEntity(blockpos2) : null; ++ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.getBlockEntity(blockpos2) : null; + dropResources(blockstate1, p_176319_1_, blockpos2, tileentity); + p_176319_1_.setBlock(blockpos2, Blocks.AIR.defaultBlockState(), 18); ablockstate[j++] = blockstate1; @@ -335,6 +_,10 @@ - public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) { - return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N))); + public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) { + return p_185499_1_.setValue(FACING, p_185499_2_.rotate(p_185499_1_.getValue(FACING))); + } + + public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) { -+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction); ++ return state.getValue(EXTENDED) ? state : super.rotate(state, world, pos, direction); } - public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) { + public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) { diff --git a/patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch index 9a5909d46b..f7412f4d12 100644 --- a/patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch +++ b/patches/minecraft/net/minecraft/block/PistonBlockStructureHelper.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/block/PistonBlockStructureHelper.java @@ -48,7 +_,7 @@ } else { - for(int i = 0; i < this.field_177258_e.size(); ++i) { - BlockPos blockpos = this.field_177258_e.get(i); -- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos).func_177230_c()) && !this.func_177250_b(blockpos)) { -+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) { + for(int i = 0; i < this.toPush.size(); ++i) { + BlockPos blockpos = this.toPush.get(i); +- if (isSticky(this.level.getBlockState(blockpos).getBlock()) && !this.addBranchingBlocks(blockpos)) { ++ if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) { return false; } } @@ -13,69 +13,69 @@ } } -- private static boolean func_227029_a_(Block p_227029_0_) { -- return p_227029_0_ == Blocks.field_180399_cE || p_227029_0_ == Blocks.field_226907_mc_; +- private static boolean isSticky(Block p_227029_0_) { +- return p_227029_0_ == Blocks.SLIME_BLOCK || p_227029_0_ == Blocks.HONEY_BLOCK; - } - -- private static boolean func_227030_a_(Block p_227030_0_, Block p_227030_1_) { -- if (p_227030_0_ == Blocks.field_226907_mc_ && p_227030_1_ == Blocks.field_180399_cE) { +- private static boolean canStickToEachOther(Block p_227030_0_, Block p_227030_1_) { +- if (p_227030_0_ == Blocks.HONEY_BLOCK && p_227030_1_ == Blocks.SLIME_BLOCK) { - return false; -- } else if (p_227030_0_ == Blocks.field_180399_cE && p_227030_1_ == Blocks.field_226907_mc_) { +- } else if (p_227030_0_ == Blocks.SLIME_BLOCK && p_227030_1_ == Blocks.HONEY_BLOCK) { - return false; - } else { -- return func_227029_a_(p_227030_0_) || func_227029_a_(p_227030_1_); +- return isSticky(p_227030_0_) || isSticky(p_227030_1_); - } - } - - private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) { - BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_); -- Block block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f()) { -+ if (field_177261_a.func_175623_d(p_177251_1_)) { + private boolean addBlockLine(BlockPos p_177251_1_, Direction p_177251_2_) { + BlockState blockstate = this.level.getBlockState(p_177251_1_); +- Block block = blockstate.getBlock(); +- if (blockstate.isAir()) { ++ if (level.isEmptyBlock(p_177251_1_)) { return true; - } else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) { + } else if (!PistonBlock.isPushable(blockstate, this.level, p_177251_1_, this.pushDirection, false, p_177251_2_)) { return true; @@ -87,12 +_,12 @@ - if (i + this.field_177258_e.size() > 12) { + if (i + this.toPush.size() > 12) { return false; } else { -- while(func_227029_a_(block)) { +- while(isSticky(block)) { + BlockState oldState; + while(blockstate.isStickyBlock()) { - BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); + BlockPos blockpos = p_177251_1_.relative(this.pushDirection.getOpposite(), i); - Block block1 = block; + oldState = blockstate; - blockstate = this.field_177261_a.func_180495_p(blockpos); -- block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f() || !func_227030_a_(block1, block) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { -+ if (blockstate.isAir(this.field_177261_a, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { + blockstate = this.level.getBlockState(blockpos); +- block = blockstate.getBlock(); +- if (blockstate.isAir() || !canStickToEachOther(block1, block) || !PistonBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) { ++ if (blockstate.isAir(this.level, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.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.field_177258_e.get(k); -- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos2).func_177230_c()) && !this.func_177250_b(blockpos2)) { -+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) { + BlockPos blockpos2 = this.toPush.get(k); +- if (isSticky(this.level.getBlockState(blockpos2).getBlock()) && !this.addBranchingBlocks(blockpos2)) { ++ if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) { return false; } } @@ -128,7 +_,7 @@ } - blockstate = this.field_177261_a.func_180495_p(blockpos1); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(field_177261_a, blockpos1)) { + blockstate = this.level.getBlockState(blockpos1); +- if (blockstate.isAir()) { ++ if (blockstate.isAir(level, blockpos1)) { return true; } @@ -173,7 +_,7 @@ - if (direction.func_176740_k() != this.field_177257_d.func_176740_k()) { - BlockPos blockpos = p_177250_1_.func_177972_a(direction); - BlockState blockstate1 = this.field_177261_a.func_180495_p(blockpos); -- if (func_227030_a_(blockstate1.func_177230_c(), blockstate.func_177230_c()) && !this.func_177251_a(blockpos, direction)) { -+ if (blockstate1.canStickTo(blockstate) && !this.func_177251_a(blockpos, direction)) { + if (direction.getAxis() != this.pushDirection.getAxis()) { + BlockPos blockpos = p_177250_1_.relative(direction); + BlockState blockstate1 = this.level.getBlockState(blockpos); +- if (canStickToEachOther(blockstate1.getBlock(), blockstate.getBlock()) && !this.addBlockLine(blockpos, direction)) { ++ if (blockstate1.canStickTo(blockstate) && !this.addBlockLine(blockpos, direction)) { return false; } } diff --git a/patches/minecraft/net/minecraft/block/PortalSize.java.patch b/patches/minecraft/net/minecraft/block/PortalSize.java.patch index 18e35628ec..4859fa4d55 100644 --- a/patches/minecraft/net/minecraft/block/PortalSize.java.patch +++ b/patches/minecraft/net/minecraft/block/PortalSize.java.patch @@ -3,9 +3,9 @@ @@ -16,7 +_,7 @@ public class PortalSize { - private static final AbstractBlock.IPositionPredicate field_242962_a = (p_242966_0_, p_242966_1_, p_242966_2_) -> { -- return p_242966_0_.func_203425_a(Blocks.field_150343_Z); + private static final AbstractBlock.IPositionPredicate FRAME = (p_242966_0_, p_242966_1_, p_242966_2_) -> { +- return p_242966_0_.is(Blocks.OBSIDIAN); + return p_242966_0_.isPortalFrame(p_242966_1_, p_242966_2_); }; - private final IWorld field_150867_a; - private final Direction.Axis field_150865_b; + private final IWorld level; + private final Direction.Axis axis; diff --git a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch index 3e741398d1..338e1c283d 100644 --- a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch @@ -2,8 +2,8 @@ +++ b/net/minecraft/block/PoweredRailBlock.java @@ -14,10 +_,16 @@ public class PoweredRailBlock extends AbstractRailBlock { - public static final EnumProperty field_176568_b = BlockStateProperties.field_208166_S; - public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u; + public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail public PoweredRailBlock(AbstractBlock.Properties p_i48349_1_) { @@ -13,42 +13,42 @@ + + protected PoweredRailBlock(AbstractBlock.Properties builder, boolean isPoweredRail) { + super(true, builder); - this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false))); + this.registerDefaultState(this.stateDefinition.any().setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(POWERED, Boolean.valueOf(false))); + this.isActivator = !isPoweredRail; } - protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) { + protected boolean findPoweredRailSignal(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) { @@ -99,13 +_,13 @@ - protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) { - BlockState blockstate = p_208071_1_.func_180495_p(p_208071_2_); -- if (!blockstate.func_203425_a(this)) { -+ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) { + protected boolean isSameRailWithPower(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) { + BlockState blockstate = p_208071_1_.getBlockState(p_208071_2_); +- if (!blockstate.is(this)) { ++ if (!(blockstate.getBlock() instanceof PoweredRailBlock)) { return false; } else { -- RailShape railshape = blockstate.func_177229_b(field_176568_b); +- RailShape railshape = blockstate.getValue(SHAPE); + RailShape railshape = getRailDirection(blockstate, p_208071_1_, p_208071_2_, null); if (p_208071_5_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) { if (p_208071_5_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) { -- if (blockstate.func_177229_b(field_176569_M)) { -+ if (isActivator == (((PoweredRailBlock) blockstate.func_177230_c()).isActivator)) { - return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1); +- if (blockstate.getValue(POWERED)) { ++ if (isActivator == (((PoweredRailBlock) blockstate.getBlock()).isActivator)) { + return p_208071_1_.hasNeighborSignal(p_208071_2_) ? true : this.findPoweredRailSignal(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1); } else { return false; @@ -156,6 +_,9 @@ - return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_EAST); + return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST); case NORTH_EAST: - return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_WEST); + return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST); + case NORTH_SOUTH: //Forge fix: MC-196102 + case EAST_WEST: + return p_185499_1_; } case COUNTERCLOCKWISE_90: - switch((RailShape)p_185499_1_.func_177229_b(field_176568_b)) { + switch((RailShape)p_185499_1_.getValue(SHAPE)) { @@ -254,5 +_,9 @@ - protected void func_206840_a(StateContainer.Builder p_206840_1_) { - p_206840_1_.func_206894_a(field_176568_b, field_176569_M); + protected void createBlockStateDefinition(StateContainer.Builder p_206840_1_) { + p_206840_1_.add(SHAPE, POWERED); + } + + public boolean isActivatorRail() { diff --git a/patches/minecraft/net/minecraft/block/RailBlock.java.patch b/patches/minecraft/net/minecraft/block/RailBlock.java.patch index 95ce1dc1d6..5166ca3415 100644 --- a/patches/minecraft/net/minecraft/block/RailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RailBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/block/RailBlock.java +++ b/net/minecraft/block/RailBlock.java @@ -49,6 +_,9 @@ - return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_EAST); + return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST); case NORTH_EAST: - return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_WEST); + return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST); + case NORTH_SOUTH: //Forge fix: MC-196102 + case EAST_WEST: + return p_185499_1_; } case COUNTERCLOCKWISE_90: - switch((RailShape)p_185499_1_.func_177229_b(field_176565_b)) { + switch((RailShape)p_185499_1_.getValue(SHAPE)) { diff --git a/patches/minecraft/net/minecraft/block/RailState.java.patch b/patches/minecraft/net/minecraft/block/RailState.java.patch index a5857110ca..306dad12f9 100644 --- a/patches/minecraft/net/minecraft/block/RailState.java.patch +++ b/patches/minecraft/net/minecraft/block/RailState.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/block/RailState.java +++ b/net/minecraft/block/RailState.java @@ -15,14 +_,16 @@ - private BlockState field_196923_d; - private final boolean field_208513_e; - private final List field_196924_e = Lists.newArrayList(); + private BlockState state; + private final boolean isStraight; + private final List connections = Lists.newArrayList(); + private final boolean canMakeSlopes; public RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) { - this.field_196920_a = p_i47755_1_; - this.field_196921_b = p_i47755_2_; - this.field_196923_d = p_i47755_3_; - this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c(); -- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l()); -- this.field_208513_e = this.field_196922_c.func_208490_b(); -+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null); -+ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_); -+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_); - this.func_208509_a(railshape); + this.level = p_i47755_1_; + this.pos = p_i47755_2_; + this.state = p_i47755_3_; + this.block = (AbstractRailBlock)p_i47755_3_.getBlock(); +- RailShape railshape = p_i47755_3_.getValue(this.block.getShapeProperty()); +- this.isStraight = this.block.isStraight(); ++ RailShape railshape = this.block.getRailDirection(state, p_i47755_1_, p_i47755_2_, null); ++ this.isStraight = !this.block.isFlexibleRail(state, p_i47755_1_, p_i47755_2_); ++ this.canMakeSlopes = this.block.canMakeSlopes(state, p_i47755_1_, p_i47755_2_); + this.updateConnections(railshape); } @@ -178,7 +_,7 @@ @@ -25,7 +25,7 @@ - if (railshape == RailShape.NORTH_SOUTH) { + if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + if (AbstractRailBlock.isRail(this.level, blockpos.above())) { railshape = RailShape.ASCENDING_NORTH; } @@ -188,7 +_,7 @@ @@ -34,7 +34,7 @@ - if (railshape == RailShape.EAST_WEST) { + if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + if (AbstractRailBlock.isRail(this.level, blockpos3.above())) { railshape = RailShape.ASCENDING_EAST; } @@ -304,7 +_,7 @@ @@ -43,7 +43,7 @@ - if (railshape == RailShape.NORTH_SOUTH) { + if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + if (AbstractRailBlock.isRail(this.level, blockpos.above())) { railshape = RailShape.ASCENDING_NORTH; } @@ -314,7 +_,7 @@ @@ -52,6 +52,6 @@ - if (railshape == RailShape.EAST_WEST) { + if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + if (AbstractRailBlock.isRail(this.level, blockpos3.above())) { railshape = RailShape.ASCENDING_EAST; } diff --git a/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch index c9546902aa..0fba496609 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/block/RedstoneDiodeBlock.java +++ b/net/minecraft/block/RedstoneDiodeBlock.java @@ -65,7 +_,7 @@ - if (p_220069_1_.func_196955_c(p_220069_2_, p_220069_3_)) { - this.func_176398_g(p_220069_2_, p_220069_3_, p_220069_1_); + if (p_220069_1_.canSurvive(p_220069_2_, p_220069_3_)) { + this.checkTickOnNeighbor(p_220069_2_, p_220069_3_, p_220069_1_); } else { -- TileEntity tileentity = this.func_235695_q_() ? p_220069_2_.func_175625_s(p_220069_3_) : null; -+ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.func_175625_s(p_220069_3_) : null; - func_220059_a(p_220069_1_, p_220069_2_, p_220069_3_, tileentity); - p_220069_2_.func_217377_a(p_220069_3_, false); +- TileEntity tileentity = this.isEntityBlock() ? p_220069_2_.getBlockEntity(p_220069_3_) : null; ++ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.getBlockEntity(p_220069_3_) : null; + dropResources(p_220069_1_, p_220069_2_, p_220069_3_, tileentity); + p_220069_2_.removeBlock(p_220069_3_, false); @@ -163,6 +_,8 @@ - protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) { - Direction direction = p_176400_3_.func_177229_b(field_185512_D); - BlockPos blockpos = p_176400_2_.func_177972_a(direction.func_176734_d()); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(direction.func_176734_d()), false).isCanceled()) + protected void updateNeighborsInFront(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) { + Direction direction = p_176400_3_.getValue(FACING); + BlockPos blockpos = p_176400_2_.relative(direction.getOpposite()); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.getBlockState(p_176400_2_), java.util.EnumSet.of(direction.getOpposite()), false).isCanceled()) + return; - p_176400_1_.func_190524_a(blockpos, this, p_176400_2_); - p_176400_1_.func_175695_a(blockpos, this, direction); + p_176400_1_.neighborChanged(blockpos, this, p_176400_2_); + p_176400_1_.updateNeighborsAtExceptFromFacing(blockpos, this, direction); } diff --git a/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch index 69ab5d8b6a..be0d6a9f94 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch @@ -2,11 +2,11 @@ +++ b/net/minecraft/block/RedstoneOreBlock.java @@ -71,11 +_,11 @@ - public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { - super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); -- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) { -- int i = 1 + p_220062_2_.field_73012_v.nextInt(5); -- this.func_180637_b(p_220062_2_, p_220062_3_, i); + public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) { +- int i = 1 + p_220062_2_.random.nextInt(5); +- this.popExperience(p_220062_2_, p_220062_3_, i); - } + } diff --git a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch index 18b9ede9b8..cd9f593a59 100644 --- a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch @@ -1,41 +1,41 @@ --- a/net/minecraft/block/RedstoneWireBlock.java +++ b/net/minecraft/block/RedstoneWireBlock.java @@ -184,7 +_,7 @@ - BlockState blockstate = p_235545_1_.func_180495_p(blockpos); + BlockState blockstate = p_235545_1_.getBlockState(blockpos); if (p_235545_4_) { - boolean flag = this.func_235552_b_(p_235545_1_, blockpos, blockstate); -- if (flag && func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177984_a()))) { -+ if (flag && canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177984_a()), p_235545_1_, blockpos.func_177984_a(), null) ) { - if (blockstate.func_224755_d(p_235545_1_, blockpos, p_235545_3_.func_176734_d())) { + boolean flag = this.canSurviveOn(p_235545_1_, blockpos, blockstate); +- if (flag && shouldConnectTo(p_235545_1_.getBlockState(blockpos.above()))) { ++ if (flag && canConnectTo(p_235545_1_.getBlockState(blockpos.above()), p_235545_1_, blockpos.above(), null) ) { + if (blockstate.isFaceSturdy(p_235545_1_, blockpos, p_235545_3_.getOpposite())) { return RedstoneSide.UP; } @@ -193,7 +_,7 @@ } } -- return !func_176343_a(blockstate, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE; -+ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177977_b()), p_235545_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; +- return !shouldConnectTo(blockstate, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !shouldConnectTo(p_235545_1_.getBlockState(blockpos.below()))) ? RedstoneSide.NONE : RedstoneSide.SIDE; ++ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.getBlockState(blockpos.below()), p_235545_1_, blockpos.below(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; } - public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { + public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { @@ -335,11 +_,7 @@ } } -- protected static boolean func_176346_d(BlockState p_176346_0_) { -- return func_176343_a(p_176346_0_, (Direction)null); +- protected static boolean shouldConnectTo(BlockState p_176346_0_) { +- return shouldConnectTo(p_176346_0_, (Direction)null); - } - -- protected static boolean func_176343_a(BlockState p_176343_0_, @Nullable Direction p_176343_1_) { +- protected static boolean shouldConnectTo(BlockState p_176343_0_, @Nullable Direction p_176343_1_) { + protected static boolean canConnectTo(BlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable Direction p_176343_1_) { - if (p_176343_0_.func_203425_a(Blocks.field_150488_af)) { + if (p_176343_0_.is(Blocks.REDSTONE_WIRE)) { return true; - } else if (p_176343_0_.func_203425_a(Blocks.field_196633_cV)) { + } else if (p_176343_0_.is(Blocks.REPEATER)) { @@ -348,7 +_,7 @@ - } else if (p_176343_0_.func_203425_a(Blocks.field_190976_dk)) { - return p_176343_1_ == p_176343_0_.func_177229_b(ObserverBlock.field_176387_N); + } else if (p_176343_0_.is(Blocks.OBSERVER)) { + return p_176343_1_ == p_176343_0_.getValue(ObserverBlock.FACING); } else { -- return p_176343_0_.func_185897_m() && p_176343_1_ != null; +- return p_176343_0_.isSignalSource() && p_176343_1_ != null; + return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null; } } diff --git a/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch index b0851a5867..6070ae87d1 100644 --- a/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch @@ -2,17 +2,17 @@ +++ b/net/minecraft/block/SaplingBlock.java @@ -29,6 +_,7 @@ - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9 && p_225542_4_.nextInt(7) == 0) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9 && p_225542_4_.nextInt(7) == 0) { + if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - this.func_226942_a_(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_); + this.advanceTree(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_); } @@ -38,6 +_,7 @@ - if (p_226942_3_.func_177229_b(field_176479_b) == 0) { - p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_235896_a_(field_176479_b), 4); + if (p_226942_3_.getValue(STAGE) == 0) { + p_226942_1_.setBlock(p_226942_2_, p_226942_3_.cycle(STAGE), 4); } else { + if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return; - this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_); + this.treeGrower.growTree(p_226942_1_, p_226942_1_.getChunkSource().getGenerator(), p_226942_2_, p_226942_3_, p_226942_4_); } diff --git a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch index 4db6d7b9d6..b5986de79c 100644 --- a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch @@ -6,6 +6,6 @@ -public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer { +public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IForgeShearable { - protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); public SeaGrassBlock(AbstractBlock.Properties p_i48780_1_) { diff --git a/patches/minecraft/net/minecraft/block/SoundType.java.patch b/patches/minecraft/net/minecraft/block/SoundType.java.patch index 9457ee2e5d..4ff9f05d39 100644 --- a/patches/minecraft/net/minecraft/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/block/SoundType.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/block/SoundType.java +++ b/net/minecraft/block/SoundType.java @@ -59,6 +_,7 @@ - private final SoundEvent field_185865_r; - private final SoundEvent field_185866_s; + private final SoundEvent hitSound; + private final SoundEvent fallSound; + @Deprecated // Forge: Use {@link net.minecraftforge.common.util.ForgeSoundType} instead for suppliers public SoundType(float p_i46679_1_, float p_i46679_2_, SoundEvent p_i46679_3_, SoundEvent p_i46679_4_, SoundEvent p_i46679_5_, SoundEvent p_i46679_6_, SoundEvent p_i46679_7_) { - this.field_185860_m = p_i46679_1_; - this.field_185861_n = p_i46679_2_; + this.volume = p_i46679_1_; + this.pitch = p_i46679_2_; diff --git a/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch index 93f36a70ad..492d721754 100644 --- a/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/block/SpawnerBlock.java @@ -18,8 +_,11 @@ - public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { - super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); -- int i = 15 + p_220062_2_.field_73012_v.nextInt(15) + p_220062_2_.field_73012_v.nextInt(15); -- this.func_180637_b(p_220062_2_, p_220062_3_, i); + public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- int i = 15 + p_220062_2_.random.nextInt(15) + p_220062_2_.random.nextInt(15); +- this.popExperience(p_220062_2_, p_220062_3_, i); + } + + @Override @@ -13,4 +13,4 @@ + return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); } - public BlockRenderType func_149645_b(BlockState p_149645_1_) { + public BlockRenderType getRenderShape(BlockState p_149645_1_) { diff --git a/patches/minecraft/net/minecraft/block/SpongeBlock.java.patch b/patches/minecraft/net/minecraft/block/SpongeBlock.java.patch index 9efbca821e..a690c602da 100644 --- a/patches/minecraft/net/minecraft/block/SpongeBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpongeBlock.java.patch @@ -3,9 +3,9 @@ @@ -64,7 +_,7 @@ queue.add(new Tuple<>(blockpos1, j + 1)); } - } else if (material == Material.field_203243_f || material == Material.field_204868_h) { -- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? p_176312_1_.func_175625_s(blockpos1) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.func_175625_s(blockpos1) : null; - func_220059_a(blockstate, p_176312_1_, blockpos1, tileentity); - p_176312_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3); + } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { +- TileEntity tileentity = blockstate.getBlock().isEntityBlock() ? p_176312_1_.getBlockEntity(blockpos1) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.getBlockEntity(blockpos1) : null; + dropResources(blockstate, p_176312_1_, blockpos1, tileentity); + p_176312_1_.setBlock(blockpos1, Blocks.AIR.defaultBlockState(), 3); ++i; diff --git a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch index a8d5ded1b3..efcc2a75c7 100644 --- a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java @@ -33,6 +_,7 @@ - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - if (!func_220257_b(p_225542_1_, p_225542_2_, p_225542_3_)) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (!canBeGrass(p_225542_1_, p_225542_2_, p_225542_3_)) { + if (!p_225542_2_.isAreaLoaded(p_225542_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - p_225542_2_.func_175656_a(p_225542_3_, Blocks.field_150346_d.func_176223_P()); + p_225542_2_.setBlockAndUpdate(p_225542_3_, Blocks.DIRT.defaultBlockState()); } else { - if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9) { + if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9) { diff --git a/patches/minecraft/net/minecraft/block/StairsBlock.java.patch b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch index fa883a3374..9e9cf5d2d5 100644 --- a/patches/minecraft/net/minecraft/block/StairsBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StairsBlock.java.patch @@ -7,30 +7,30 @@ + @Deprecated // Forge: Use the other constructor that takes a Supplier public StairsBlock(BlockState p_i48321_1_, AbstractBlock.Properties p_i48321_2_) { super(p_i48321_2_); - this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false))); - this.field_150149_b = p_i48321_1_.func_177230_c(); - this.field_150151_M = p_i48321_1_; + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false))); + this.base = p_i48321_1_.getBlock(); + this.baseState = p_i48321_1_; + this.stateSupplier = () -> p_i48321_1_; + } + + public StairsBlock(java.util.function.Supplier state, AbstractBlock.Properties properties) { + super(properties); -+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false))); -+ this.field_150149_b = Blocks.field_150350_a; // These are unused, fields are redirected -+ this.field_150151_M = Blocks.field_150350_a.func_176223_P(); ++ this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false))); ++ this.base = Blocks.AIR; // These are unused, fields are redirected ++ this.baseState = Blocks.AIR.defaultBlockState(); + this.stateSupplier = state; } - public boolean func_220074_n(BlockState p_220074_1_) { + public boolean useShapeForLightOcclusion(BlockState p_220074_1_) { @@ -265,4 +_,14 @@ - public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; } + + // Forge Start + private final java.util.function.Supplier stateSupplier; + private Block getModelBlock() { -+ return getModelState().func_177230_c(); ++ return getModelState().getBlock(); + } + private BlockState getModelState() { + return stateSupplier.get(); diff --git a/patches/minecraft/net/minecraft/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/block/StemBlock.java.patch index ddb17d0aca..59766d40d3 100644 --- a/patches/minecraft/net/minecraft/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/StemBlock.java.patch @@ -3,26 +3,26 @@ @@ -37,22 +_,24 @@ } - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) { - float f = CropsBlock.func_180672_a(this, p_225542_2_, p_225542_3_); + if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) { + float f = CropsBlock.getGrowthSpeed(this, p_225542_2_, p_225542_3_); - if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) { + if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - int i = p_225542_1_.func_177229_b(field_176484_a); + int i = p_225542_1_.getValue(AGE); if (i < 7) { -- p_225542_1_ = p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); -- p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2); -+ p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2); +- p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)); +- p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2); ++ p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2); } else { - Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225542_4_); - BlockPos blockpos = p_225542_3_.func_177972_a(direction); - BlockState blockstate = p_225542_2_.func_180495_p(blockpos.func_177977_b()); -- if (p_225542_2_.func_180495_p(blockpos).func_196958_f() && (blockstate.func_203425_a(Blocks.field_150458_ak) || blockstate.func_203425_a(Blocks.field_150346_d) || blockstate.func_203425_a(Blocks.field_196660_k) || blockstate.func_203425_a(Blocks.field_196661_l) || blockstate.func_203425_a(Blocks.field_196658_i))) { -+ Block block = blockstate.func_177230_c(); -+ if (p_225542_2_.func_175623_d(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.func_177977_b(), Direction.UP, this) || block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { - p_225542_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); - p_225542_2_.func_175656_a(p_225542_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction)); + Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(p_225542_4_); + BlockPos blockpos = p_225542_3_.relative(direction); + BlockState blockstate = p_225542_2_.getBlockState(blockpos.below()); +- if (p_225542_2_.getBlockState(blockpos).isAir() && (blockstate.is(Blocks.FARMLAND) || blockstate.is(Blocks.DIRT) || blockstate.is(Blocks.COARSE_DIRT) || blockstate.is(Blocks.PODZOL) || blockstate.is(Blocks.GRASS_BLOCK))) { ++ Block block = blockstate.getBlock(); ++ if (p_225542_2_.isEmptyBlock(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.below(), Direction.UP, this) || block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) { + p_225542_2_.setBlockAndUpdate(blockpos, this.fruit.defaultBlockState()); + p_225542_2_.setBlockAndUpdate(p_225542_3_, this.fruit.getAttachedStem().defaultBlockState().setValue(HorizontalBlock.FACING, direction)); } } + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); @@ -31,8 +31,8 @@ } @@ -96,5 +_,11 @@ - public StemGrownBlock func_208486_d() { - return this.field_149877_a; + public StemGrownBlock getFruit() { + return this.fruit; + } + + //FORGE START diff --git a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch index da29f8cff5..51fab60df0 100644 --- a/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch @@ -6,19 +6,19 @@ -public class SugarCaneBlock extends Block { +public class SugarCaneBlock extends Block implements net.minecraftforge.common.IPlantable { - public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X; - protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D); + public static final IntegerProperty AGE = BlockStateProperties.AGE_15; + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D); @@ -43,12 +_,14 @@ if (i < 3) { - int j = p_225542_1_.func_177229_b(field_176355_a); + int j = p_225542_1_.getValue(AGE); + if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, true)) { if (j == 15) { - p_225542_2_.func_175656_a(p_225542_3_.func_177984_a(), this.func_176223_P()); - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4); + p_225542_2_.setBlockAndUpdate(p_225542_3_.above(), this.defaultBlockState()); + p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(0)), 4); } else { - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4); + p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4); } + } } @@ -27,16 +27,16 @@ @@ -63,6 +_,8 @@ } - public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { -+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this)) return true; - BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); - if (blockstate.func_177230_c() == this) { + public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { ++ BlockState soil = p_196260_2_.getBlockState(p_196260_3_.below()); ++ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.below(), Direction.UP, this)) return true; + BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below()); + if (blockstate.getBlock() == this) { return true; @@ -85,5 +_,15 @@ - protected void func_206840_a(StateContainer.Builder p_206840_1_) { - p_206840_1_.func_206894_a(field_176355_a); + protected void createBlockStateDefinition(StateContainer.Builder p_206840_1_) { + p_206840_1_.add(AGE); + } + + @Override @@ -46,6 +46,6 @@ + + @Override + public BlockState getPlant(IBlockReader world, BlockPos pos) { -+ return func_176223_P(); ++ return defaultBlockState(); } } diff --git a/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch b/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch index 8d5a46580b..22c3f71727 100644 --- a/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/SweetBerryBushBlock.java.patch @@ -2,11 +2,11 @@ +++ b/net/minecraft/block/SweetBerryBushBlock.java @@ -52,8 +_,9 @@ - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { - int i = p_225542_1_.func_177229_b(field_220125_a); -- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) { -+ if (i < 3 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) { - p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2); + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { + int i = p_225542_1_.getValue(AGE); +- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) { ++ if (i < 3 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) { + p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_); } diff --git a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch index 7ad46a4a45..5389963afb 100644 --- a/patches/minecraft/net/minecraft/block/TNTBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TNTBlock.java.patch @@ -1,67 +1,67 @@ --- a/net/minecraft/block/TNTBlock.java +++ b/net/minecraft/block/TNTBlock.java @@ -29,10 +_,14 @@ - this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false))); + this.registerDefaultState(this.defaultBlockState().setValue(UNSTABLE, Boolean.valueOf(false))); } + public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) { -+ func_196535_a(world, pos, igniter); ++ explode(world, pos, igniter); + } + - public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) { - if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) { - if (p_220082_2_.func_175640_z(p_220082_3_)) { -- func_196534_a(p_220082_2_, p_220082_3_); + public void onPlace(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) { + if (!p_220082_4_.is(p_220082_1_.getBlock())) { + if (p_220082_2_.hasNeighborSignal(p_220082_3_)) { +- explode(p_220082_2_, p_220082_3_); + catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null); - p_220082_2_.func_217377_a(p_220082_3_, false); + p_220082_2_.removeBlock(p_220082_3_, false); } @@ -41,7 +_,7 @@ - public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { - if (p_220069_2_.func_175640_z(p_220069_3_)) { -- func_196534_a(p_220069_2_, p_220069_3_); + public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { + if (p_220069_2_.hasNeighborSignal(p_220069_3_)) { +- explode(p_220069_2_, p_220069_3_); + catchFire(p_220069_1_, p_220069_2_, p_220069_3_, null, null); - p_220069_2_.func_217377_a(p_220069_3_, false); + p_220069_2_.removeBlock(p_220069_3_, false); } @@ -49,7 +_,7 @@ - public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) { - if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) { -- func_196534_a(p_176208_1_, p_176208_2_); + public void playerWillDestroy(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) { + if (!p_176208_1_.isClientSide() && !p_176208_4_.isCreative() && p_176208_3_.getValue(UNSTABLE)) { +- explode(p_176208_1_, p_176208_2_); + catchFire(p_176208_3_, p_176208_1_, p_176208_2_, null, null); } - super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); + super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); @@ -63,10 +_,12 @@ } } + @Deprecated //Forge: Prefer using IForgeBlock#catchFire - public static void func_196534_a(World p_196534_0_, BlockPos p_196534_1_) { - func_196535_a(p_196534_0_, p_196534_1_, (LivingEntity)null); + public static void explode(World p_196534_0_, BlockPos p_196534_1_) { + explode(p_196534_0_, p_196534_1_, (LivingEntity)null); } + @Deprecated //Forge: Prefer using IForgeBlock#catchFire - private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) { - if (!p_196535_0_.field_72995_K) { - TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.func_177958_n() + 0.5D, (double)p_196535_1_.func_177956_o(), (double)p_196535_1_.func_177952_p() + 0.5D, p_196535_2_); + private static void explode(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) { + if (!p_196535_0_.isClientSide) { + TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.getX() + 0.5D, (double)p_196535_1_.getY(), (double)p_196535_1_.getZ() + 0.5D, p_196535_2_); @@ -81,7 +_,7 @@ - if (item != Items.field_151033_d && item != Items.field_151059_bz) { - return super.func_225533_a_(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_); + if (item != Items.FLINT_AND_STEEL && item != Items.FIRE_CHARGE) { + return super.use(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_); } else { -- func_196535_a(p_225533_2_, p_225533_3_, p_225533_4_); -+ catchFire(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_6_.func_216354_b(), p_225533_4_); - p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150350_a.func_176223_P(), 11); - if (!p_225533_4_.func_184812_l_()) { - if (item == Items.field_151033_d) { +- explode(p_225533_2_, p_225533_3_, p_225533_4_); ++ catchFire(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_6_.getDirection(), p_225533_4_); + p_225533_2_.setBlock(p_225533_3_, Blocks.AIR.defaultBlockState(), 11); + if (!p_225533_4_.isCreative()) { + if (item == Items.FLINT_AND_STEEL) { @@ -102,7 +_,7 @@ - Entity entity = p_220066_4_.func_234616_v_(); - if (p_220066_4_.func_70027_ad()) { - BlockPos blockpos = p_220066_3_.func_216350_a(); -- func_196535_a(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null); + Entity entity = p_220066_4_.getOwner(); + if (p_220066_4_.isOnFire()) { + BlockPos blockpos = p_220066_3_.getBlockPos(); +- explode(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null); + catchFire(p_220066_2_, p_220066_1_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null); - p_220066_1_.func_217377_a(blockpos, false); + p_220066_1_.removeBlock(blockpos, false); } } diff --git a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch index cc29e09840..6ec062b4fa 100644 --- a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch @@ -6,6 +6,6 @@ -public class TallGrassBlock extends BushBlock implements IGrowable { +public class TallGrassBlock extends BushBlock implements IGrowable, net.minecraftforge.common.IForgeShearable { - protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); public TallGrassBlock(AbstractBlock.Properties p_i48310_1_) { diff --git a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch index 36d845ff8b..55df9bea38 100644 --- a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch @@ -2,16 +2,16 @@ +++ b/net/minecraft/block/TrapDoorBlock.java @@ -147,4 +_,17 @@ - return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); + return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); } + + //Forge Start + @Override + public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { -+ if (state.func_177229_b(field_176283_b)) { -+ BlockPos downPos = pos.func_177977_b(); -+ BlockState down = world.func_180495_p(downPos); -+ return down.func_177230_c().makesOpenTrapdoorAboveClimbable(down, world, downPos, state); ++ if (state.getValue(OPEN)) { ++ BlockPos downPos = pos.below(); ++ BlockState down = world.getBlockState(downPos); ++ return down.getBlock().makesOpenTrapdoorAboveClimbable(down, world, downPos, state); + } + return false; + } diff --git a/patches/minecraft/net/minecraft/block/TripWireHookBlock.java.patch b/patches/minecraft/net/minecraft/block/TripWireHookBlock.java.patch index 7e07a7ff5e..445e2bb815 100644 --- a/patches/minecraft/net/minecraft/block/TripWireHookBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TripWireHookBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/block/TripWireHookBlock.java +++ b/net/minecraft/block/TripWireHookBlock.java @@ -150,8 +_,8 @@ - BlockPos blockpos2 = p_176260_2_.func_177967_a(direction, k); + BlockPos blockpos2 = p_176260_2_.relative(direction, k); BlockState blockstate2 = ablockstate[k]; if (blockstate2 != null) { -+ if (!p_176260_1_.func_180495_p(blockpos2).func_196958_f()) { // FORGE: fix MC-129055 - p_176260_1_.func_180501_a(blockpos2, blockstate2.func_206870_a(field_176265_M, Boolean.valueOf(flag2)), 3); -- if (!p_176260_1_.func_180495_p(blockpos2).func_196958_f()) { ++ if (!p_176260_1_.getBlockState(blockpos2).isAir()) { // FORGE: fix MC-129055 + p_176260_1_.setBlock(blockpos2, blockstate2.setValue(ATTACHED, Boolean.valueOf(flag2)), 3); +- if (!p_176260_1_.getBlockState(blockpos2).isAir()) { } } } diff --git a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch index d4813c28aa..af18a6f3d3 100644 --- a/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/TurtleEggBlock.java.patch @@ -4,7 +4,7 @@ if (!(p_212570_2_ instanceof LivingEntity)) { return false; } else { -- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.func_82736_K().func_223586_b(GameRules.field_223599_b); +- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + return p_212570_2_ instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_); } } else { diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch index 6306c149c5..6285914413 100644 --- a/patches/minecraft/net/minecraft/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -6,35 +6,35 @@ -public class VineBlock extends Block { +public class VineBlock extends Block implements net.minecraftforge.common.IForgeShearable { - public static final BooleanProperty field_176277_a = SixWayBlock.field_196496_z; - public static final BooleanProperty field_176273_b = SixWayBlock.field_196488_a; - public static final BooleanProperty field_176278_M = SixWayBlock.field_196490_b; + public static final BooleanProperty UP = SixWayBlock.UP; + public static final BooleanProperty NORTH = SixWayBlock.NORTH; + public static final BooleanProperty EAST = SixWayBlock.EAST; @@ -152,14 +_,14 @@ } - public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { -- if (p_225542_2_.field_73012_v.nextInt(4) == 0) { -+ if (p_225542_2_.field_73012_v.nextInt(4) == 0 && p_225542_2_.isAreaLoaded(p_225542_3_, 4)) { // Forge: check area to prevent loading unloaded chunks - Direction direction = Direction.func_239631_a_(p_225542_4_); - BlockPos blockpos = p_225542_3_.func_177984_a(); - if (direction.func_176740_k().func_176722_c() && !p_225542_1_.func_177229_b(func_176267_a(direction))) { - if (this.func_196539_a(p_225542_2_, p_225542_3_)) { - BlockPos blockpos4 = p_225542_3_.func_177972_a(direction); - BlockState blockstate4 = p_225542_2_.func_180495_p(blockpos4); -- if (blockstate4.func_196958_f()) { + public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) { +- if (p_225542_2_.random.nextInt(4) == 0) { ++ if (p_225542_2_.random.nextInt(4) == 0 && p_225542_2_.isAreaLoaded(p_225542_3_, 4)) { // Forge: check area to prevent loading unloaded chunks + Direction direction = Direction.getRandom(p_225542_4_); + BlockPos blockpos = p_225542_3_.above(); + if (direction.getAxis().isHorizontal() && !p_225542_1_.getValue(getPropertyForFace(direction))) { + if (this.canSpread(p_225542_2_, p_225542_3_)) { + BlockPos blockpos4 = p_225542_3_.relative(direction); + BlockState blockstate4 = p_225542_2_.getBlockState(blockpos4); +- if (blockstate4.isAir()) { + if (blockstate4.isAir(p_225542_2_, blockpos4)) { - Direction direction3 = direction.func_176746_e(); - Direction direction4 = direction.func_176735_f(); - boolean flag = p_225542_1_.func_177229_b(func_176267_a(direction3)); + Direction direction3 = direction.getClockWise(); + Direction direction4 = direction.getCounterClockWise(); + boolean flag = p_225542_1_.getValue(getPropertyForFace(direction3)); @@ -216,8 +_,9 @@ - if (p_225542_3_.func_177956_o() > 0) { - BlockPos blockpos1 = p_225542_3_.func_177977_b(); - BlockState blockstate = p_225542_2_.func_180495_p(blockpos1); -- if (blockstate.func_196958_f() || blockstate.func_203425_a(this)) { -- BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate; + if (p_225542_3_.getY() > 0) { + BlockPos blockpos1 = p_225542_3_.below(); + BlockState blockstate = p_225542_2_.getBlockState(blockpos1); +- if (blockstate.isAir() || blockstate.is(this)) { +- BlockState blockstate1 = blockstate.isAir() ? this.defaultBlockState() : blockstate; + boolean isAir = blockstate.isAir(p_225542_2_, blockpos1); -+ if (isAir || blockstate.func_203425_a(this)) { -+ BlockState blockstate1 = isAir ? this.func_176223_P() : blockstate; - BlockState blockstate2 = this.func_196544_a(p_225542_1_, blockstate1, p_225542_4_); - if (blockstate1 != blockstate2 && this.func_196540_x(blockstate2)) { - p_225542_2_.func_180501_a(blockpos1, blockstate2, 2); ++ if (isAir || blockstate.is(this)) { ++ BlockState blockstate1 = isAir ? this.defaultBlockState() : blockstate; + BlockState blockstate2 = this.copyRandomFaces(p_225542_1_, blockstate1, p_225542_4_); + if (blockstate1 != blockstate2 && this.hasHorizontalConnection(blockstate2)) { + p_225542_2_.setBlock(blockpos1, blockstate2, 2); diff --git a/patches/minecraft/net/minecraft/block/WoodType.java.patch b/patches/minecraft/net/minecraft/block/WoodType.java.patch index 9bb3324586..1ef40f992c 100644 --- a/patches/minecraft/net/minecraft/block/WoodType.java.patch +++ b/patches/minecraft/net/minecraft/block/WoodType.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/block/WoodType.java +++ b/net/minecraft/block/WoodType.java @@ -32,4 +_,11 @@ - public String func_227048_b_() { - return this.field_227045_h_; + public String name() { + return this.name; } + + /** diff --git a/patches/minecraft/net/minecraft/client/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/GameSettings.java.patch index 61f8cb0e26..7d217744ee 100644 --- a/patches/minecraft/net/minecraft/client/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/GameSettings.java.patch @@ -1,64 +1,64 @@ --- a/net/minecraft/client/GameSettings.java +++ b/net/minecraft/client/GameSettings.java @@ -170,6 +_,7 @@ - public boolean field_241568_aS_; + public boolean syncWrites; public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { + setForgeKeybindProperties(); - this.field_74317_L = p_i46326_1_; - this.field_74354_ai = new File(p_i46326_2_, "options.txt"); - if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) { + this.minecraft = p_i46326_1_; + this.optionsFile = new File(p_i46326_2_, "options.txt"); + if (p_i46326_1_.is64Bit() && Runtime.getRuntime().maxMemory() >= 1000000000L) { @@ -529,7 +_,11 @@ - for(KeyBinding keybinding : this.field_74324_K) { - if (s.equals("key_" + keybinding.func_151464_g())) { -- keybinding.func_197979_b(InputMappings.func_197955_a(s1)); + for(KeyBinding keybinding : this.keyMappings) { + if (s.equals("key_" + keybinding.getName())) { +- keybinding.setKey(InputMappings.getKey(s1)); + if (s1.indexOf(':') != -1) { + String[] pts = s1.split(":"); -+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0])); ++ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.getKey(pts[0])); + } else -+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s1)); ++ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.getKey(s1)); } } @@ -576,6 +_,7 @@ } - public void func_74303_b() { + public void save() { + if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. - try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { - printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); - printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); + try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) { + printwriter.println("version:" + SharedConstants.getCurrentVersion().getWorldVersion()); + printwriter.println("autoJump:" + AbstractOption.AUTO_JUMP.get(this)); @@ -661,7 +_,7 @@ - printwriter.println("syncChunkWrites:" + this.field_241568_aS_); + printwriter.println("syncChunkWrites:" + this.syncWrites); - for(KeyBinding keybinding : this.field_74324_K) { -- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m()); -+ printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : "")); + for(KeyBinding keybinding : this.keyMappings) { +- printwriter.println("key_" + keybinding.getName() + ":" + keybinding.saveString()); ++ printwriter.println("key_" + keybinding.getName() + ":" + keybinding.saveString() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : "")); } for(SoundCategory soundcategory : SoundCategory.values()) { @@ -758,6 +_,23 @@ } - p_198017_1_.func_198985_a(set); + p_198017_1_.setSelected(set); + } + + private void setForgeKeybindProperties() { + net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; -+ field_74351_w.setKeyConflictContext(inGame); -+ field_74370_x.setKeyConflictContext(inGame); -+ field_74368_y.setKeyConflictContext(inGame); -+ field_74366_z.setKeyConflictContext(inGame); -+ field_74314_A.setKeyConflictContext(inGame); -+ field_228046_af_.setKeyConflictContext(inGame); -+ field_151444_V.setKeyConflictContext(inGame); -+ field_74312_F.setKeyConflictContext(inGame); -+ field_74310_D.setKeyConflictContext(inGame); -+ field_74321_H.setKeyConflictContext(inGame); -+ field_74323_J.setKeyConflictContext(inGame); -+ field_151457_aa.setKeyConflictContext(inGame); -+ field_151458_ab.setKeyConflictContext(inGame); ++ keyUp.setKeyConflictContext(inGame); ++ keyLeft.setKeyConflictContext(inGame); ++ keyDown.setKeyConflictContext(inGame); ++ keyRight.setKeyConflictContext(inGame); ++ keyJump.setKeyConflictContext(inGame); ++ keyShift.setKeyConflictContext(inGame); ++ keySprint.setKeyConflictContext(inGame); ++ keyAttack.setKeyConflictContext(inGame); ++ keyChat.setKeyConflictContext(inGame); ++ keyPlayerList.setKeyConflictContext(inGame); ++ keyCommand.setKeyConflictContext(inGame); ++ keyTogglePerspective.setKeyConflictContext(inGame); ++ keySmoothCamera.setKeyConflictContext(inGame); } - public PointOfView func_243230_g() { + public PointOfView getCameraType() { diff --git a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch index ff24bc5b5c..df29ea895b 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch @@ -3,37 +3,37 @@ @@ -255,7 +_,9 @@ } - INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r; -- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { + INestedGuiEventHandler inestedguieventhandler = this.minecraft.screen; +- if (p_197961_5_ == 1 && (!(this.minecraft.screen instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).lastKeySelection <= Util.getMillis() - 20L)) { + -+ if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { ++ if ((!(this.minecraft.screen instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).lastKeySelection <= Util.getMillis() - 20L)) { + if (p_197961_5_ == 1) { - if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) { - this.field_197972_a.func_228018_at_().func_198077_g(); - this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.func_228018_at_().func_198113_j(); + if (this.minecraft.options.keyFullscreen.matches(p_197961_3_, p_197961_4_)) { + this.minecraft.getWindow().toggleFullScreen(); + this.minecraft.options.fullscreen = this.minecraft.getWindow().isFullscreen(); @@ -274,6 +_,8 @@ }); return; } -+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof ControlsScreen) -+ ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers. ++ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof ControlsScreen) ++ ((ControlsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers. } - boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.func_241217_q_() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.func_241217_q_()).func_212955_f(); + boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).canConsumeInput(); @@ -289,10 +_,14 @@ - Screen.func_231153_a_(() -> { - if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) { + Screen.wrapScreenError(() -> { + if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.sendRepeatsToGui)) { if (p_197961_5_ == 0) { -- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); +- aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_); } } else { -- aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); +- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_); } }, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName()); @@ -47,21 +47,21 @@ } @@ -355,12 +_,16 @@ - if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) { + if (iguieventlistener != null && this.minecraft.getOverlay() == null) { if (Character.charCount(p_197963_3_) == 1) { - Screen.func_231153_a_(() -> { -- iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return; -+ if (iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_); + Screen.wrapScreenError(() -> { +- iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.minecraft.screen, (char)p_197963_3_, p_197963_4_)) return; ++ if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.minecraft.screen, (char)p_197963_3_, p_197963_4_); }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); } else { for(char c0 : Character.toChars(p_197963_3_)) { - Screen.func_231153_a_(() -> { -- iguieventlistener.func_231042_a_(c0, p_197963_4_); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return; -+ if (iguieventlistener.func_231042_a_(c0, p_197963_4_)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_); + Screen.wrapScreenError(() -> { +- iguieventlistener.charTyped(c0, p_197963_4_); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.minecraft.screen, c0, p_197963_4_)) return; ++ if (iguieventlistener.charTyped(c0, p_197963_4_)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.minecraft.screen, c0, p_197963_4_); }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); } } diff --git a/patches/minecraft/net/minecraft/client/MainWindow.java.patch b/patches/minecraft/net/minecraft/client/MainWindow.java.patch index 1b51fd9636..d0d7fe2f78 100644 --- a/patches/minecraft/net/minecraft/client/MainWindow.java.patch +++ b/patches/minecraft/net/minecraft/client/MainWindow.java.patch @@ -4,24 +4,24 @@ GLFW.glfwWindowHint(139266, 2); GLFW.glfwWindowHint(139267, 0); GLFW.glfwWindowHint(139272, 0); -- this.field_198119_f = GLFW.glfwCreateWindow(this.field_198129_p, this.field_198130_q, p_i51170_5_, this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L, 0L); -+ this.field_198119_f = net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.handOffWindow(()->this.field_198129_p, ()->this.field_198130_q, ()->p_i51170_5_, ()->this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L); +- this.window = GLFW.glfwCreateWindow(this.width, this.height, p_i51170_5_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L); ++ this.window = net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.handOffWindow(()->this.width, ()->this.height, ()->p_i51170_5_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L); if (monitor != null) { - VideoMode videomode = monitor.func_197992_a(this.field_198125_l ? this.field_198124_k : Optional.empty()); - this.field_198120_g = this.field_198127_n = monitor.func_197989_c() + videomode.func_198064_a() / 2 - this.field_198129_p / 2; + VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty()); + this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2; @@ -136,6 +_,7 @@ - public void func_216529_a(InputStream p_216529_1_, InputStream p_216529_2_) { + public void setIcon(InputStream p_216529_1_, InputStream p_216529_2_) { RenderSystem.assertThread(RenderSystem::isInInitPhase); -+ if (net.minecraft.client.Minecraft.field_142025_a) return; ++ if (net.minecraft.client.Minecraft.ON_OSX) return; try (MemoryStack memorystack = MemoryStack.stackPush()) { if (p_216529_1_ == null) { @@ -271,6 +_,7 @@ - GLFW.glfwGetFramebufferSize(this.field_198119_f, aint, aint1); - this.field_198131_r = aint[0]; - this.field_198132_s = aint1[0]; -+ if (this.field_198132_s == 0 || this.field_198131_r==0) net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.updateFBSize(w->this.field_198131_r=w, h->this.field_198132_s=h); + GLFW.glfwGetFramebufferSize(this.window, aint, aint1); + this.framebufferWidth = aint[0]; + this.framebufferHeight = aint1[0]; ++ if (this.framebufferHeight == 0 || this.framebufferWidth==0) net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.updateFBSize(w->this.framebufferWidth=w, h->this.framebufferHeight=h); } - private void func_198089_c(long p_198089_1_, int p_198089_3_, int p_198089_4_) { + private void onResize(long p_198089_1_, int p_198089_3_, int p_198089_4_) { diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 83ec7983f9..ac0f1c4cf5 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -6,82 +6,82 @@ @OnlyIn(Dist.CLIENT) -public class Minecraft extends RecursiveEventLoop implements ISnooperInfo, IWindowEventListener { +public class Minecraft extends RecursiveEventLoop implements ISnooperInfo, IWindowEventListener, net.minecraftforge.client.extensions.IForgeMinecraft { - private static Minecraft field_71432_P; - private static final Logger field_147123_G = LogManager.getLogger(); - public static final boolean field_142025_a = Util.func_110647_a() == Util.OS.OSX; + private static Minecraft instance; + private static final Logger LOGGER = LogManager.getLogger(); + public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX; @@ -368,6 +_,7 @@ public Minecraft(GameConfiguration p_i45547_1_) { super("Client"); - field_71432_P = this; + instance = this; + net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache(); - this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; - File file1 = p_i45547_1_.field_178744_c.field_178759_c; - this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; + this.gameDirectory = p_i45547_1_.location.gameDirectory; + File file1 = p_i45547_1_.location.assetDirectory; + this.resourcePackDirectory = p_i45547_1_.location.resourcePackDirectory; @@ -382,7 +_,6 @@ - this.field_244734_au = this.func_244735_a(yggdrasilauthenticationservice, p_i45547_1_); - this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; - field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a()); -- field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b()); - this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; - this.field_238175_ae_ = !p_i45547_1_.field_178741_d.field_239099_d_; - this.field_238176_af_ = !p_i45547_1_.field_178741_d.field_239100_e_; + this.socialInteractionsService = this.createSocialInteractions(yggdrasilauthenticationservice, p_i45547_1_); + this.user = p_i45547_1_.user.user; + LOGGER.info("Setting user: {}", (Object)this.user.getName()); +- LOGGER.debug("(Session ID is {})", (Object)this.user.getSessionId()); + this.demo = p_i45547_1_.game.demo; + this.allowsMultiplayer = !p_i45547_1_.game.disableMultiplayer; + this.allowsChat = !p_i45547_1_.game.disableChat; @@ -428,13 +_,13 @@ - this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i); - this.field_71417_B = new MouseHelper(this); -- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); - this.field_195559_v = new KeyboardListener(this); - this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i()); - RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false); - this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a); - this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); - this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES); -+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax); - this.field_110448_aq.func_198983_a(); - this.field_71474_y.func_198017_a(this.field_110448_aq); - this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); + this.window.setFramerateLimit(this.options.framerateLimit); + this.mouseHandler = new MouseHelper(this); +- this.mouseHandler.setup(this.window.getWindow()); + this.keyboardHandler = new KeyboardListener(this); + this.keyboardHandler.setup(this.window.getWindow()); + RenderSystem.initRenderer(this.options.glDebugVerbosity, false); + this.mainRenderTarget = new Framebuffer(this.window.getWidth(), this.window.getHeight(), true, ON_OSX); + this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); + this.resourceManager = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES); ++ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager, this.clientPackSource); + this.resourcePackRepository.reload(); + this.options.loadSelectedResourcePacks(this.resourcePackRepository); + this.languageManager = new LanguageManager(this.options.languageCode); @@ -476,6 +_,7 @@ - this.func_193986_ar(); - this.field_110451_am.func_219534_a(this.field_193995_ae); - this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); + this.createSearchTrees(); + this.resourceManager.registerReloadListener(this.searchRegistry); + this.particleEngine = new ParticleManager(this.level, this.textureManager); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent()); - this.field_110451_am.func_219534_a(this.field_71452_i); - this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o); - this.field_110451_am.func_219534_a(this.field_213272_aL); + this.resourceManager.registerReloadListener(this.particleEngine); + this.paintingTextures = new PaintingSpriteUploader(this.textureManager); + this.resourceManager.registerReloadListener(this.paintingTextures); @@ -483,7 +_,8 @@ - this.field_110451_am.func_219534_a(this.field_213273_aM); - this.field_241557_ar_ = new GPUWarning(); - this.field_110451_am.func_219534_a(this.field_241557_ar_); -- this.field_71456_v = new IngameGui(this); -+ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this); -+ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. - this.field_184132_p = new DebugRenderer(this); - RenderSystem.setErrorCallback(this::func_195545_a); - if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { + this.resourceManager.registerReloadListener(this.mobEffectTextures); + this.gpuWarnlistManager = new GPUWarning(); + this.resourceManager.registerReloadListener(this.gpuWarnlistManager); +- this.gui = new IngameGui(this); ++ this.gui = new net.minecraftforge.client.gui.ForgeIngameGui(this); ++ this.mouseHandler.setup(this.window.getWindow()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. + this.debugRenderer = new DebugRenderer(this); + RenderSystem.setErrorCallback(this::onFullscreenError); + if (this.options.fullscreen && !this.window.isFullscreen()) { @@ -495,11 +_,6 @@ - this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); - this.field_195558_d.func_227801_c_(); - this.func_213226_a(); + this.window.updateRawMouseInput(this.options.rawMouseInput); + this.window.setDefaultErrorCallback(); + this.resizeDisplay(); - if (s != null) { -- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i)); +- this.setScreen(new ConnectingScreen(new MainMenuScreen(), this, s, i)); - } else { -- this.func_147108_a(new MainMenuScreen(true)); +- this.setScreen(new MainMenuScreen(true)); - } - ResourceLoadProgressGui.func_212970_a(this); - List list = this.field_110448_aq.func_232623_f_(); + ResourceLoadProgressGui.registerTextures(this); + List list = this.resourcePackRepository.openAllSelected(); @@ -508,7 +_,14 @@ - if (SharedConstants.field_206244_b) { - this.func_213256_aB(); + if (SharedConstants.IS_RUNNING_IN_IDE) { + this.selfTest(); } - + if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen + // FORGE: Move opening initial screen to after startup and events are enabled. + // Also Fixes MC-145102 + if (s != null) { -+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i)); ++ this.setScreen(new ConnectingScreen(new MainMenuScreen(), this, s, i)); + } else { -+ this.func_147108_a(new MainMenuScreen(true)); ++ this.setScreen(new MainMenuScreen(true)); + } }); }, false)); @@ -89,120 +89,120 @@ @@ -556,7 +_,7 @@ } - private void func_229988_a_(Throwable p_229988_1_) { -- if (this.field_110448_aq.func_232621_d_().size() > 1) { -+ if (this.field_110448_aq.func_198980_d().stream().anyMatch(e -> !e.func_195797_g())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. + private void rollbackResourcePacks(Throwable p_229988_1_) { +- 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. ITextComponent itextcomponent; if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) { - itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_241203_a().func_195762_a()); + itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).getPack().getName()); @@ -644,7 +_,7 @@ - return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b())); + return Stream.of(Registry.ITEM.getKey(p_213251_0_.getItem())); }); SearchTreeReloadable searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> { -- return ItemTags.func_199903_a().func_199913_a(p_213235_0_.func_77973_b()).stream(); -+ return p_213235_0_.func_77973_b().getTags().stream(); +- return ItemTags.getAllTags().getMatchingTags(p_213235_0_.getItem()).stream(); ++ return p_213235_0_.getItem().getTags().stream(); }); - NonNullList nonnulllist = NonNullList.func_191196_a(); + NonNullList nonnulllist = NonNullList.create(); @@ -714,13 +_,13 @@ - Bootstrap.func_179870_a(p_71377_0_.func_71502_e()); - if (p_71377_0_.func_71497_f() != null) { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f()); + Bootstrap.realStdoutPrintln(p_71377_0_.getFriendlyReport()); + if (p_71377_0_.getSaveFile() != null) { + Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.getSaveFile()); - System.exit(-1); + net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1); - } else if (p_71377_0_.func_147149_a(file2)) { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); + } else if (p_71377_0_.saveToFile(file2)) { + Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); - System.exit(-1); + net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1); } else { - Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + Bootstrap.realStdoutPrintln("#@?@# Game crashed! Crash report could not be saved. #@?@#"); - System.exit(-2); + net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-2); } } @@ -729,6 +_,7 @@ - return this.field_71474_y.field_211842_aO; + return this.options.forceUnicodeFont; } + @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler - public CompletableFuture func_213237_g() { - if (this.field_213276_aV != null) { - return this.field_213276_aV; + public CompletableFuture reloadResourcePacks() { + if (this.pendingReload != null) { + return this.pendingReload; @@ -817,10 +_,6 @@ } - public void func_147108_a(@Nullable Screen p_147108_1_) { -- if (this.field_71462_r != null) { -- this.field_71462_r.func_231164_f_(); + public void setScreen(@Nullable Screen p_147108_1_) { +- if (this.screen != null) { +- this.screen.removed(); - } - - if (p_147108_1_ == null && this.field_71441_e == null) { + if (p_147108_1_ == null && this.level == null) { p_147108_1_ = new MainMenuScreen(); - } else if (p_147108_1_ == null && this.field_71439_g.func_233643_dh_()) { + } else if (p_147108_1_ == null && this.player.isDeadOrDying()) { @@ -831,6 +_,15 @@ } } + net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this); -+ Screen old = this.field_71462_r; ++ Screen old = this.screen; + net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_147108_1_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + + p_147108_1_ = event.getGui(); + if (old != null && p_147108_1_ != old) -+ old.func_231164_f_(); ++ old.removed(); + if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) { - this.field_71474_y.field_74330_P = false; - this.field_71456_v.func_146158_b().func_146231_a(true); + this.options.renderDebug = false; + this.gui.getChat().clearMessages(true); @@ -962,11 +_,13 @@ RenderSystem.enableCull(); - this.field_71424_I.func_76319_b(); - if (!this.field_71454_w) { -+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b); - this.field_71424_I.func_219895_b("gameRenderer"); - this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_); - this.field_71424_I.func_219895_b("toasts"); - this.field_193034_aS.func_238541_a_(new MatrixStack()); - this.field_71424_I.func_76319_b(); -+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b); + this.profiler.pop(); + if (!this.noRender) { ++ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.pause ? this.pausePartialTick : this.timer.partialTick); + this.profiler.popPush("gameRenderer"); + this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_195542_1_); + this.profiler.popPush("toasts"); + this.toast.render(new MatrixStack()); + this.profiler.pop(); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.pause ? this.pausePartialTick : this.timer.partialTick); } - if (this.field_238174_aV_ != null) { + if (this.fpsPieResults != null) { @@ -1061,10 +_,12 @@ - this.field_195558_d.func_216525_a((double)i); - if (this.field_71462_r != null) { - this.field_71462_r.func_231152_a_(this, this.field_195558_d.func_198107_o(), this.field_195558_d.func_198087_p()); -+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.field_195558_d.func_198107_o(), this.field_195558_d.func_198087_p()); + this.window.setGuiScale((double)i); + if (this.screen != null) { + this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); ++ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); } - Framebuffer framebuffer = this.func_147110_a(); - framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a); -+ if (this.field_71460_t != null) - this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l()); - this.field_71417_B.func_198021_g(); + Framebuffer framebuffer = this.getMainRenderTarget(); + framebuffer.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX); ++ if (this.gameRenderer != null) + this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight()); + this.mouseHandler.setIgnoreFirstMove(); } @@ -1253,11 +_,21 @@ - if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) { - BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; - BlockPos blockpos = blockraytraceresult.func_216350_a(); -- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { -+ if (!this.field_71441_e.func_175623_d(blockpos)) { -+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND); + if (p_147115_1_ && this.hitResult != null && this.hitResult.getType() == RayTraceResult.Type.BLOCK) { + BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.hitResult; + BlockPos blockpos = blockraytraceresult.getBlockPos(); +- if (!this.level.getBlockState(blockpos).isAir()) { ++ if (!this.level.isEmptyBlock(blockpos)) { ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, Hand.MAIN_HAND); + if (inputEvent.isCanceled()) { + if (inputEvent.shouldSwingHand()) { -+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); -+ this.field_71439_g.func_184609_a(Hand.MAIN_HAND); ++ this.particleEngine.addBlockHitEffects(blockpos, blockraytraceresult); ++ this.player.swing(Hand.MAIN_HAND); + } + return; + } - Direction direction = blockraytraceresult.func_216354_b(); - if (this.field_71442_b.func_180512_c(blockpos, direction)) { -- this.field_71452_i.func_180532_a(blockpos, direction); + Direction direction = blockraytraceresult.getDirection(); + if (this.gameMode.continueDestroyBlock(blockpos, direction)) { +- this.particleEngine.crack(blockpos, direction); + if (inputEvent.shouldSwingHand()) { -+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); - this.field_71439_g.func_184609_a(Hand.MAIN_HAND); ++ this.particleEngine.addBlockHitEffects(blockpos, blockraytraceresult); + this.player.swing(Hand.MAIN_HAND); + } } } @@ -210,168 +210,168 @@ @@ -1276,6 +_,8 @@ } - } else if (!this.field_71439_g.func_184838_M()) { -+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND); + } else if (!this.player.isHandsBusy()) { ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, Hand.MAIN_HAND); + if (!inputEvent.isCanceled()) - switch(this.field_71476_x.func_216346_c()) { + switch(this.hitResult.getType()) { case ENTITY: - this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a()); + this.gameMode.attack(this.player, ((EntityRayTraceResult)this.hitResult).getEntity()); @@ -1283,7 +_,7 @@ case BLOCK: - BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; - BlockPos blockpos = blockraytraceresult.func_216350_a(); -- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { -+ if (!this.field_71441_e.func_175623_d(blockpos)) { - this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); + BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.hitResult; + BlockPos blockpos = blockraytraceresult.getBlockPos(); +- if (!this.level.getBlockState(blockpos).isAir()) { ++ if (!this.level.isEmptyBlock(blockpos)) { + this.gameMode.startDestroyBlock(blockpos, blockraytraceresult.getDirection()); break; } @@ -1293,8 +_,10 @@ } - this.field_71439_g.func_184821_cY(); -+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g); + this.player.resetAttackStrengthTicker(); ++ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.player); } + if (inputEvent.shouldSwingHand()) - this.field_71439_g.func_184609_a(Hand.MAIN_HAND); + this.player.swing(Hand.MAIN_HAND); } } @@ -1309,6 +_,11 @@ } for(Hand hand : Hand.values()) { -+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.field_71474_y.field_74313_G, hand); ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.options.keyUse, hand); + if (inputEvent.isCanceled()) { -+ if (inputEvent.shouldSwingHand()) this.field_71439_g.func_184609_a(hand); ++ if (inputEvent.shouldSwingHand()) this.player.swing(hand); + return; + } - ItemStack itemstack = this.field_71439_g.func_184586_b(hand); - if (this.field_71476_x != null) { - switch(this.field_71476_x.func_216346_c()) { + ItemStack itemstack = this.player.getItemInHand(hand); + if (this.hitResult != null) { + switch(this.hitResult.getType()) { @@ -1322,6 +_,7 @@ - if (actionresulttype.func_226246_a_()) { - if (actionresulttype.func_226247_b_()) { + if (actionresulttype.consumesAction()) { + if (actionresulttype.shouldSwing()) { + if (inputEvent.shouldSwingHand()) - this.field_71439_g.func_184609_a(hand); + this.player.swing(hand); } @@ -1334,6 +_,7 @@ - ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult); - if (actionresulttype1.func_226246_a_()) { - if (actionresulttype1.func_226247_b_()) { + ActionResultType actionresulttype1 = this.gameMode.useItemOn(this.player, this.level, hand, blockraytraceresult); + if (actionresulttype1.consumesAction()) { + if (actionresulttype1.shouldSwing()) { + if (inputEvent.shouldSwingHand()) - this.field_71439_g.func_184609_a(hand); - if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) { - this.field_71460_t.field_78516_c.func_187460_a(hand); + this.player.swing(hand); + if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) { + this.gameRenderer.itemInHandRenderer.itemUsed(hand); @@ -1349,6 +_,9 @@ } } -+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS)) -+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand); ++ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == RayTraceResult.Type.MISS)) ++ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.player, hand); + - if (!itemstack.func_190926_b()) { - ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand); - if (actionresulttype2.func_226246_a_()) { + if (!itemstack.isEmpty()) { + ActionResultType actionresulttype2 = this.gameMode.useItem(this.player, this.level, hand); + if (actionresulttype2.consumesAction()) { @@ -1375,6 +_,8 @@ - --this.field_71467_ac; + --this.rightClickDelay; } + net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(); + - this.field_71424_I.func_76320_a("gui"); - if (!this.field_71445_n) { - this.field_71456_v.func_73831_a(); + this.profiler.push("gui"); + if (!this.pause) { + this.gui.tick(); @@ -1500,6 +_,8 @@ - this.field_71424_I.func_219895_b("keyboard"); - this.field_195559_v.func_204870_b(); - this.field_71424_I.func_76319_b(); + this.profiler.popPush("keyboard"); + this.keyboardHandler.tick(); + this.profiler.pop(); + + net.minecraftforge.fml.hooks.BasicEventHooks.onPostClientTick(); } - private boolean func_244600_aM() { + private boolean isMultiplayerServer() { @@ -1638,11 +_,11 @@ } - public void func_238191_a_(String p_238191_1_) { -- this.func_238195_a_(p_238191_1_, DynamicRegistries.func_239770_b_(), Minecraft::func_238180_a_, Minecraft::func_238181_a_, false, Minecraft.WorldSelectionType.BACKUP); -+ this.loadWorld(p_238191_1_, DynamicRegistries.func_239770_b_(), Minecraft::func_238180_a_, Minecraft::func_238181_a_, false, Minecraft.WorldSelectionType.BACKUP, false); + public void loadLevel(String p_238191_1_) { +- this.doLoadLevel(p_238191_1_, DynamicRegistries.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.WorldSelectionType.BACKUP); ++ this.loadWorld(p_238191_1_, DynamicRegistries.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.WorldSelectionType.BACKUP, false); } - public void func_238192_a_(String p_238192_1_, WorldSettings p_238192_2_, DynamicRegistries.Impl p_238192_3_, DimensionGeneratorSettings p_238192_4_) { -- this.func_238195_a_(p_238192_1_, p_238192_3_, (p_238179_1_) -> { + public void createLevel(String p_238192_1_, WorldSettings p_238192_2_, DynamicRegistries.Impl p_238192_3_, DimensionGeneratorSettings p_238192_4_) { +- this.doLoadLevel(p_238192_1_, p_238192_3_, (p_238179_1_) -> { + this.loadWorld(p_238192_1_, p_238192_3_, (p_238179_1_) -> { - return p_238192_2_.func_234958_g_(); + return p_238192_2_.getDataPackConfig(); }, (p_238187_3_, p_238187_4_, p_238187_5_, p_238187_6_) -> { - WorldGenSettingsExport worldgensettingsexport = WorldGenSettingsExport.func_240896_a_(JsonOps.INSTANCE, p_238192_3_); + WorldGenSettingsExport worldgensettingsexport = WorldGenSettingsExport.create(JsonOps.INSTANCE, p_238192_3_); @@ -1652,10 +_,10 @@ }); - DimensionGeneratorSettings dimensiongeneratorsettings = dataresult.resultOrPartial(Util.func_240982_a_("Error reading worldgen settings after loading data packs: ", field_147123_G::error)).orElse(p_238192_4_); + DimensionGeneratorSettings dimensiongeneratorsettings = dataresult.resultOrPartial(Util.prefix("Error reading worldgen settings after loading data packs: ", LOGGER::error)).orElse(p_238192_4_); return new ServerWorldInfo(p_238192_2_, dimensiongeneratorsettings, dataresult.lifecycle()); - }, false, Minecraft.WorldSelectionType.CREATE); + }, false, Minecraft.WorldSelectionType.CREATE, true); } -- private void func_238195_a_(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function p_238195_3_, Function4 p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_) { +- private void doLoadLevel(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function p_238195_3_, Function4 p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_) { + private void loadWorld(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function p_238195_3_, Function4 p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_, boolean creating) { SaveFormat.LevelSave saveformat$levelsave; try { - saveformat$levelsave = this.field_71469_aa.func_237274_c_(p_238195_1_); + saveformat$levelsave = this.levelSource.createAccess(p_238195_1_); @@ -1667,12 +_,17 @@ } Minecraft.PackManager minecraft$packmanager; + final DynamicRegistries.Impl dyn_f; try { -- minecraft$packmanager = this.func_238189_a_(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); -+ Minecraft.PackManager mgr = this.func_238189_a_(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); +- minecraft$packmanager = this.makeServerStem(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); ++ Minecraft.PackManager mgr = this.makeServerStem(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); + // We need to rebuild this if we're loading world, so that it gets all the information from AFTER we inject our mappings from the save. -+ dyn_f = creating ? p_238195_2_ : DynamicRegistries.func_239770_b_(); -+ minecraft$packmanager = creating ? mgr : this.func_238189_a_(dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in. ++ dyn_f = creating ? p_238195_2_ : DynamicRegistries.builtin(); ++ minecraft$packmanager = creating ? mgr : this.makeServerStem(dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in. + } catch (Exception exception) { - field_147123_G.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception); - this.func_147108_a(new DatapackFailureScreen(() -> { -- this.func_238195_a_(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_); + LOGGER.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception); + this.setScreen(new DatapackFailureScreen(() -> { +- this.doLoadLevel(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_); + this.loadWorld(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_, creating); })); try { @@ -1692,7 +_,7 @@ - this.field_213277_ad.set((TrackingChunkStatusListener)null); + this.progressListener.set((TrackingChunkStatusListener)null); try { -- saveformat$levelsave.func_237287_a_(p_238195_2_, iserverconfiguration); -+ saveformat$levelsave.func_237287_a_(dyn_f, iserverconfiguration); - minecraft$packmanager.func_238225_b_().func_240971_i_(); - YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.field_110453_aa); +- saveformat$levelsave.saveDataTag(p_238195_2_, iserverconfiguration); ++ saveformat$levelsave.saveDataTag(dyn_f, iserverconfiguration); + minecraft$packmanager.serverResources().updateGlobals(); + YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.proxy); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); @@ -1702,7 +_,7 @@ - SkullTileEntity.func_184294_a(minecraftsessionservice); - PlayerProfileCache.func_187320_a(false); - this.field_71437_Z = MinecraftServer.func_240784_a_((p_238188_8_) -> { -- return new IntegratedServer(p_238188_8_, this, p_238195_2_, saveformat$levelsave, minecraft$packmanager.func_238224_a_(), minecraft$packmanager.func_238225_b_(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> { -+ return new IntegratedServer(p_238188_8_, this, dyn_f, saveformat$levelsave, minecraft$packmanager.func_238224_a_(), minecraft$packmanager.func_238225_b_(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> { + SkullTileEntity.setSessionService(minecraftsessionservice); + PlayerProfileCache.setUsesAuthentication(false); + this.singleplayerServer = MinecraftServer.spin((p_238188_8_) -> { +- return new IntegratedServer(p_238188_8_, this, p_238195_2_, saveformat$levelsave, minecraft$packmanager.packRepository(), minecraft$packmanager.serverResources(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> { ++ return new IntegratedServer(p_238188_8_, this, dyn_f, saveformat$levelsave, minecraft$packmanager.packRepository(), minecraft$packmanager.serverResources(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> { TrackingChunkStatusListener trackingchunkstatuslistener = new TrackingChunkStatusListener(p_238211_1_ + 0); - trackingchunkstatuslistener.func_219521_a(); - this.field_213277_ad.set(trackingchunkstatuslistener); + trackingchunkstatuslistener.start(); + this.progressListener.set(trackingchunkstatuslistener); @@ -1747,11 +_,16 @@ - networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { + networkmanager.setListener(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { })); - networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); -- networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e())); -+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); -+ if (!this.func_110432_I().hasCachedProperties()) { -+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.func_110432_I().setProperties(gameProfile.getProperties()); + networkmanager.send(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); +- networkmanager.send(new CLoginStartPacket(this.getUser().getGameProfile())); ++ com.mojang.authlib.GameProfile gameProfile = this.getUser().getGameProfile(); ++ if (!this.getUser().hasCachedProperties()) { ++ gameProfile = minecraftSessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getUser().setProperties(gameProfile.getProperties()); + } -+ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile)); - this.field_71453_ak = networkmanager; ++ networkmanager.send(new CLoginStartPacket(gameProfile)); + this.pendingConnection = networkmanager; } else { - this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> { -- this.func_238195_a_(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE); + this.displayExperimentalConfirmationDialog(p_238195_6_, p_238195_1_, flag, () -> { +- this.doLoadLevel(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE); + this.loadWorld(p_238195_1_, dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE, creating); }); minecraft$packmanager.close(); @@ -379,114 +379,114 @@ @@ -1821,6 +_,7 @@ } - public void func_71403_a(ClientWorld p_71403_1_) { -+ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + public void setLevel(ClientWorld p_71403_1_) { ++ if (level != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(level)); WorkingScreen workingscreen = new WorkingScreen(); - workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); - this.func_213241_c(workingscreen); + workingscreen.progressStartNoAbort(new TranslationTextComponent("connect.joining")); + this.updateScreenAndTick(workingscreen); @@ -1852,10 +_,12 @@ - IntegratedServer integratedserver = this.field_71437_Z; - this.field_71437_Z = null; - this.field_71460_t.func_190564_k(); -+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.field_71442_b, this.field_71439_g); - this.field_71442_b = null; - NarratorChatListener.field_193643_a.func_193642_b(); - this.func_213241_c(p_213231_1_); - if (this.field_71441_e != null) { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + IntegratedServer integratedserver = this.singleplayerServer; + this.singleplayerServer = null; + this.gameRenderer.resetData(); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.gameMode, this.player); + this.gameMode = null; + NarratorChatListener.INSTANCE.clear(); + this.updateScreenAndTick(p_213231_1_); + if (this.level != null) { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(level)); if (integratedserver != null) { - this.field_71424_I.func_76320_a("waitForServer"); + this.profiler.push("waitForServer"); @@ -1870,6 +_,7 @@ - this.field_71456_v.func_181029_i(); - this.field_71422_O = null; - this.field_71455_al = false; -+ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(field_71441_e); - this.field_213274_aO.func_216815_b(); + this.gui.onDisconnected(); + this.currentServer = null; + this.isLocalServer = false; ++ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(level); + this.game.onLeaveGameSession(); } @@ -1900,6 +_,7 @@ - this.field_71452_i.func_78870_a(p_213257_1_); - TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); - this.func_230150_b_(); + this.particleEngine.setLevel(p_213257_1_); + TileEntityRendererDispatcher.instance.setLevel(p_213257_1_); + this.updateTitle(); + net.minecraftforge.client.MinecraftForgeClient.clearRenderCache(); } - public boolean func_238216_r_() { + public boolean allowsMultiplayer() { @@ -1945,112 +_,9 @@ - private void func_147112_ai() { - if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { -- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; + private void pickBlock() { + if (this.hitResult != null && this.hitResult.getType() != RayTraceResult.Type.MISS) { +- boolean flag = this.player.abilities.instabuild; - TileEntity tileentity = null; -- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c(); +- RayTraceResult.Type raytraceresult$type = this.hitResult.getType(); - ItemStack itemstack; - if (raytraceresult$type == RayTraceResult.Type.BLOCK) { -- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a(); -- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos); -- Block block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f()) { +- BlockPos blockpos = ((BlockRayTraceResult)this.hitResult).getBlockPos(); +- BlockState blockstate = this.level.getBlockState(blockpos); +- Block block = blockstate.getBlock(); +- if (blockstate.isAir()) { - return; - } - -- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate); -- if (itemstack.func_190926_b()) { +- itemstack = block.getCloneItemStack(this.level, blockpos, blockstate); +- if (itemstack.isEmpty()) { - return; - } - -- if (flag && Screen.func_231172_r_() && block.func_235695_q_()) { -- tileentity = this.field_71441_e.func_175625_s(blockpos); +- if (flag && Screen.hasControlDown() && block.isEntityBlock()) { +- tileentity = this.level.getBlockEntity(blockpos); - } - } else { - if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) { - return; - } - -- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a(); +- Entity entity = ((EntityRayTraceResult)this.hitResult).getEntity(); - if (entity instanceof PaintingEntity) { -- itemstack = new ItemStack(Items.field_151159_an); +- itemstack = new ItemStack(Items.PAINTING); - } else if (entity instanceof LeashKnotEntity) { -- itemstack = new ItemStack(Items.field_151058_ca); +- itemstack = new ItemStack(Items.LEAD); - } else if (entity instanceof ItemFrameEntity) { - ItemFrameEntity itemframeentity = (ItemFrameEntity)entity; -- ItemStack itemstack1 = itemframeentity.func_82335_i(); -- if (itemstack1.func_190926_b()) { -- itemstack = new ItemStack(Items.field_151160_bD); +- ItemStack itemstack1 = itemframeentity.getItem(); +- if (itemstack1.isEmpty()) { +- itemstack = new ItemStack(Items.ITEM_FRAME); - } else { -- itemstack = itemstack1.func_77946_l(); +- itemstack = itemstack1.copy(); - } - } else if (entity instanceof AbstractMinecartEntity) { - AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity; - Item item; -- switch(abstractminecartentity.func_184264_v()) { +- switch(abstractminecartentity.getMinecartType()) { - case FURNACE: -- item = Items.field_151109_aJ; +- item = Items.FURNACE_MINECART; - break; - case CHEST: -- item = Items.field_151108_aI; +- item = Items.CHEST_MINECART; - break; - case TNT: -- item = Items.field_151142_bV; +- item = Items.TNT_MINECART; - break; - case HOPPER: -- item = Items.field_151140_bW; +- item = Items.HOPPER_MINECART; - break; - case COMMAND_BLOCK: -- item = Items.field_151095_cc; +- item = Items.COMMAND_BLOCK_MINECART; - break; - default: -- item = Items.field_151143_au; +- item = Items.MINECART; - } - - itemstack = new ItemStack(item); - } else if (entity instanceof BoatEntity) { -- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j()); +- itemstack = new ItemStack(((BoatEntity)entity).getDropItem()); - } else if (entity instanceof ArmorStandEntity) { -- itemstack = new ItemStack(Items.field_179565_cj); +- itemstack = new ItemStack(Items.ARMOR_STAND); - } else if (entity instanceof EnderCrystalEntity) { -- itemstack = new ItemStack(Items.field_185158_cP); +- itemstack = new ItemStack(Items.END_CRYSTAL); - } else { -- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R()); +- SpawnEggItem spawneggitem = SpawnEggItem.byId(entity.getType()); - if (spawneggitem == null) { - return; - } @@ -495,69 +495,69 @@ - } - } - -- if (itemstack.func_190926_b()) { +- if (itemstack.isEmpty()) { - String s = ""; - if (raytraceresult$type == RayTraceResult.Type.BLOCK) { -- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString(); +- s = Registry.BLOCK.getKey(this.level.getBlockState(((BlockRayTraceResult)this.hitResult).getBlockPos()).getBlock()).toString(); - } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) { -- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString(); +- s = Registry.ENTITY_TYPE.getKey(((EntityRayTraceResult)this.hitResult).getEntity().getType()).toString(); - } - -- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s); +- LOGGER.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s); - } else { -- PlayerInventory playerinventory = this.field_71439_g.field_71071_by; +- PlayerInventory playerinventory = this.player.inventory; - if (tileentity != null) { -- this.func_184119_a(itemstack, tileentity); +- this.addCustomNbtData(itemstack, tileentity); - } - -- int i = playerinventory.func_184429_b(itemstack); +- int i = playerinventory.findSlotMatchingItem(itemstack); - if (flag) { -- playerinventory.func_184434_a(itemstack); -- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c); +- playerinventory.setPickedItem(itemstack); +- this.gameMode.handleCreativeModeItemAdd(this.player.getItemInHand(Hand.MAIN_HAND), 36 + playerinventory.selected); - } else if (i != -1) { -- if (PlayerInventory.func_184435_e(i)) { -- playerinventory.field_70461_c = i; +- if (PlayerInventory.isHotbarSlot(i)) { +- playerinventory.selected = i; - } else { -- this.field_71442_b.func_187100_a(i); +- this.gameMode.handlePickItem(i); - } - } - - } -+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled()) -+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e); ++ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.options.keyPickItem, Hand.MAIN_HAND).isCanceled()) ++ net.minecraftforge.common.ForgeHooks.onPickBlock(this.hitResult, this.player, this.level); + // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions } } @@ -2140,6 +_,7 @@ - return field_71432_P; + return instance; } + @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler - public CompletableFuture func_213245_w() { - return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { + public CompletableFuture delayTextureReload() { + return this.submit(this::reloadResourcePacks).thenCompose((p_229993_0_) -> { return p_229993_0_; @@ -2451,7 +_,7 @@ - supplier = func_228022_c_(supplier); + supplier = adaptV4(supplier); } - return new ResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_); + return new ResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_, p_228011_3_.isHidden()); } - private static Supplier func_228021_b_(Supplier p_228021_0_) { + private static Supplier adaptV3(Supplier p_228021_0_) { @@ -2468,6 +_,14 @@ - public void func_228020_b_(int p_228020_1_) { - this.field_175617_aL.func_229355_a_(p_228020_1_); + public void updateMaxMipLevel(int p_228020_1_) { + this.modelManager.updateMaxMipLevel(p_228020_1_); + } + + public ItemColors getItemColors() { -+ return this.field_184128_aI; ++ return this.itemColors; + } + + public SearchTreeManager getSearchTreeManager() { -+ return this.field_193995_ae; ++ return this.searchRegistry; } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch index 6306bba5d6..3141326cae 100644 --- a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/client/MouseHelper.java +++ b/net/minecraft/client/MouseHelper.java @@ -71,6 +_,7 @@ - this.field_198042_g = -1; + this.activeButton = -1; } + if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return; boolean[] aboolean = new boolean[]{false}; - if (this.field_198036_a.field_213279_p == null) { - if (this.field_198036_a.field_71462_r == null) { + if (this.minecraft.overlay == null) { + if (this.minecraft.screen == null) { @@ -82,11 +_,15 @@ - double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); + double d1 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight(); if (flag) { - Screen.func_231153_a_(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i); - }, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + Screen.wrapScreenError(() -> { +- aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.minecraft.screen, d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.minecraft.screen, d0, d1, i); + }, "mouseClicked event handler", this.minecraft.screen.getClass().getCanonicalName()); } else { - Screen.func_231153_a_(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i); - }, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + Screen.wrapScreenError(() -> { +- aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.minecraft.screen, d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.minecraft.screen, d0, d1, i); + }, "mouseReleased event handler", this.minecraft.screen.getClass().getCanonicalName()); } } @@ -110,18 +_,26 @@ @@ -35,68 +35,68 @@ } } - private void func_198020_a(long p_198020_1_, double p_198020_3_, double p_198020_5_) { - if (p_198020_1_ == Minecraft.func_71410_x().func_228018_at_().func_198092_i()) { -- double d0 = (this.field_198036_a.field_71474_y.field_216843_O ? Math.signum(p_198020_5_) : p_198020_5_) * this.field_198036_a.field_71474_y.field_208033_V; + private void onScroll(long p_198020_1_, double p_198020_3_, double p_198020_5_) { + if (p_198020_1_ == Minecraft.getInstance().getWindow().getWindow()) { +- double d0 = (this.minecraft.options.discreteMouseScroll ? Math.signum(p_198020_5_) : p_198020_5_) * this.minecraft.options.mouseWheelSensitivity; + // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772 + double offset = p_198020_5_; -+ if (Minecraft.field_142025_a && p_198020_5_ == 0) { ++ if (Minecraft.ON_OSX && p_198020_5_ == 0) { + offset = p_198020_3_; + } + -+ double d0 = (this.field_198036_a.field_71474_y.field_216843_O ? Math.signum(offset) : offset) * this.field_198036_a.field_71474_y.field_208033_V; - if (this.field_198036_a.field_213279_p == null) { - if (this.field_198036_a.field_71462_r != null) { - double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); - double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); -- this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return; -+ if (this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0); - } else if (this.field_198036_a.field_71439_g != null) { - if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) { - this.field_200542_o = 0.0D; ++ double d0 = (this.minecraft.options.discreteMouseScroll ? Math.signum(offset) : offset) * this.minecraft.options.mouseWheelSensitivity; + if (this.minecraft.overlay == null) { + if (this.minecraft.screen != null) { + double d1 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); + double d2 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight(); +- this.minecraft.screen.mouseScrolled(d1, d2, d0); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.minecraft.screen, d0)) return; ++ if (this.minecraft.screen.mouseScrolled(d1, d2, d0)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.minecraft.screen, d0); + } else if (this.minecraft.player != null) { + if (this.accumulatedScroll != 0.0D && Math.signum(d0) != Math.signum(this.accumulatedScroll)) { + this.accumulatedScroll = 0.0D; @@ -134,6 +_,7 @@ } - this.field_200542_o -= (double)f1; + this.accumulatedScroll -= (double)f1; + if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return; - if (this.field_198036_a.field_71439_g.func_175149_v()) { - if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) { - this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1)); + if (this.minecraft.player.isSpectator()) { + if (this.minecraft.gui.getSpectatorGui().isMenuActive()) { + this.minecraft.gui.getSpectatorGui().onMouseScrolled((double)(-f1)); @@ -202,7 +_,9 @@ - double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); - double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); - Screen.func_231153_a_(() -> { -- iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return; -+ if (iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3); + double d2 = (p_198022_3_ - this.xpos) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); + double d3 = (p_198022_5_ - this.ypos) * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight(); + Screen.wrapScreenError(() -> { +- iguieventlistener.mouseDragged(d0, d1, this.activeButton, d2, d3); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.minecraft.screen, d0, d1, this.activeButton, d2, d3)) return; ++ if (iguieventlistener.mouseDragged(d0, d1, this.activeButton, d2, d3)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.minecraft.screen, d0, d1, this.activeButton, d2, d3); }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); } } @@ -267,12 +_,24 @@ - return this.field_198039_d; + return this.isRightPressed; } + public boolean isMiddleDown() { -+ return this.field_198038_c; ++ return this.isMiddlePressed; + } + - public double func_198024_e() { - return this.field_198040_e; + public double xpos() { + return this.xpos; } - public double func_198026_f() { - return this.field_198041_f; + public double ypos() { + return this.ypos; + } + + public double getXVelocity() { -+ return this.field_198048_m; ++ return this.accumulatedDX; + } + + public double getYVelocity() { -+ return this.field_198049_n; ++ return this.accumulatedDY; } - public void func_198021_g() { + public void setIgnoreFirstMove() { diff --git a/patches/minecraft/net/minecraft/client/audio/ISound.java.patch b/patches/minecraft/net/minecraft/client/audio/ISound.java.patch index 6a63c84d54..b68d2b91b1 100644 --- a/patches/minecraft/net/minecraft/client/audio/ISound.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/ISound.java.patch @@ -8,6 +8,6 @@ + /*================================ FORGE START ================================================*/ + + default java.util.concurrent.CompletableFuture getStream(net.minecraft.client.audio.AudioStreamManager soundBuffers, Sound sound, boolean looping) { -+ return soundBuffers.func_217917_b(sound.func_188721_b(), looping); ++ return soundBuffers.getStream(sound.getPath(), looping); + } } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch index 43c1555c26..86935a187d 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch @@ -1,50 +1,50 @@ --- a/net/minecraft/client/audio/SoundEngine.java +++ b/net/minecraft/client/audio/SoundEngine.java @@ -56,6 +_,7 @@ - this.field_148622_c = p_i50892_1_; - this.field_148619_d = p_i50892_2_; - this.field_217939_i = new AudioStreamManager(p_i50892_3_); + this.soundManager = p_i50892_1_; + this.options = p_i50892_2_; + this.soundBuffers = new AudioStreamManager(p_i50892_3_); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } - public void func_148596_a() { + public void reload() { @@ -71,6 +_,7 @@ - this.func_148613_b(); - this.func_148608_i(); + this.destroy(); + this.loadLibrary(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } - private synchronized void func_148608_i() { + private synchronized void loadLibrary() { @@ -266,7 +_,8 @@ - public void func_148611_c(ISound p_148611_1_) { - if (this.field_148617_f) { -- if (p_148611_1_.func_230510_t_()) { + public void play(ISound p_148611_1_) { + if (this.loaded) { +- if (p_148611_1_.canPlaySound()) { + p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); -+ if (p_148611_1_ != null && p_148611_1_.func_230510_t_()) { - SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); - ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); ++ if (p_148611_1_ != null && p_148611_1_.canPlaySound()) { + SoundEventAccessor soundeventaccessor = p_148611_1_.resolve(this.soundManager); + ResourceLocation resourcelocation = p_148611_1_.getLocation(); if (soundeventaccessor == null) { @@ -331,18 +_,21 @@ - p_239543_8_.func_216420_a(vector3d); - p_239543_8_.func_216432_b(flag); + p_239543_8_.setSelfPosition(vector3d); + p_239543_8_.setRelative(flag); }); + final ISound isound = p_148611_1_; if (!flag3) { - this.field_217939_i.func_217909_a(sound.func_188721_b()).thenAccept((p_217934_1_) -> { - channelmanager$entry.func_217888_a((p_217925_1_) -> { - p_217925_1_.func_216429_a(p_217934_1_); - p_217925_1_.func_216438_c(); + this.soundBuffers.getCompleteBuffer(sound.getPath()).thenAccept((p_217934_1_) -> { + channelmanager$entry.execute((p_217925_1_) -> { + p_217925_1_.attachStaticBuffer(p_217934_1_); + p_217925_1_.play(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, isound, p_217925_1_)); }); }); } else { -- this.field_217939_i.func_217917_b(sound.func_188721_b(), flag2).thenAccept((p_217928_1_) -> { -+ isound.getStream(this.field_217939_i, sound, flag2).thenAccept((p_217928_1_) -> { - channelmanager$entry.func_217888_a((p_217935_1_) -> { - p_217935_1_.func_216433_a(p_217928_1_); - p_217935_1_.func_216438_c(); +- this.soundBuffers.getStream(sound.getPath(), flag2).thenAccept((p_217928_1_) -> { ++ isound.getStream(this.soundBuffers, sound, flag2).thenAccept((p_217928_1_) -> { + channelmanager$entry.execute((p_217935_1_) -> { + p_217935_1_.attachBufferStream(p_217928_1_); + p_217935_1_.play(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, isound, p_217935_1_)); }); }); diff --git a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch index be49f5e646..20a1f877a3 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/audio/SoundHandler.java +++ b/net/minecraft/client/audio/SoundHandler.java @@ -192,6 +_,11 @@ - this.field_147694_f.func_195855_a(p_195478_1_, p_195478_2_); + this.soundEngine.stop(p_195478_1_, p_195478_2_); } + //@Override //TODO: Filtered reload @@ -9,6 +9,6 @@ + return net.minecraftforge.resource.VanillaResourceType.SOUNDS; + } + - public String func_215293_f() { - return this.field_147694_f.func_217932_f(); + public String getDebugString() { + return this.soundEngine.getDebugString(); } diff --git a/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch index 529419b3eb..5006916e21 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch @@ -4,7 +4,7 @@ f *= 1.0F - f1 * 0.15F; } -- return MathHelper.func_219799_g(Minecraft.func_71410_x().field_71474_y.field_243227_aN, 1.0F, f); +- return MathHelper.lerp(Minecraft.getInstance().options.fovEffectScale, 1.0F, f); + return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); } } diff --git a/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch index 69dd1d3181..19a5a0df5d 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch @@ -3,7 +3,7 @@ @@ -134,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { + net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_); return false; } @@ -11,55 +11,55 @@ @@ -457,6 +_,11 @@ } - public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); + public void playSound(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.getSoundSource(), p_184185_2_, p_184185_3_); + if (event.isCanceled() || event.getSound() == null) return; + p_184185_1_ = event.getSound(); + p_184185_2_ = event.getVolume(); + p_184185_3_ = event.getPitch(); - this.field_70170_p.func_184134_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); + this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), p_184185_1_, this.getSoundSource(), p_184185_2_, p_184185_3_, false); } @@ -595,6 +_,7 @@ - boolean flag2 = this.func_223110_ee(); - this.field_239203_ch_ = !this.field_71075_bZ.field_75100_b && !this.func_203007_ba() && this.func_213298_c(Pose.CROUCHING) && (this.func_225608_bj_() || !this.func_70608_bn() && !this.func_213298_c(Pose.STANDING)); - this.field_71158_b.func_225607_a_(this.func_228354_I_()); -+ net.minecraftforge.client.ForgeHooksClient.onInputUpdate(this, this.field_71158_b); - this.field_71159_c.func_193032_ao().func_193293_a(this.field_71158_b); - if (this.func_184587_cr() && !this.func_184218_aH()) { - this.field_71158_b.field_78902_a *= 0.2F; + boolean flag2 = this.hasEnoughImpulseToStartSprinting(); + this.crouching = !this.abilities.flying && !this.isSwimming() && this.canEnterPose(Pose.CROUCHING) && (this.isShiftKeyDown() || !this.isSleeping() && !this.canEnterPose(Pose.STANDING)); + this.input.tick(this.isMovingSlowly()); ++ net.minecraftforge.client.ForgeHooksClient.onInputUpdate(this, this.input); + this.minecraft.getTutorial().onInput(this.input); + if (this.isUsingItem() && !this.isPassenger()) { + this.input.leftImpulse *= 0.2F; @@ -667,7 +_,7 @@ - if (this.field_71158_b.field_78901_c && !flag7 && !flag && !this.field_71075_bZ.field_75100_b && !this.func_184218_aH() && !this.func_70617_f_()) { - ItemStack itemstack = this.func_184582_a(EquipmentSlotType.CHEST); -- if (itemstack.func_77973_b() == Items.field_185160_cR && ElytraItem.func_185069_d(itemstack) && this.func_226566_ei_()) { -+ if (itemstack.canElytraFly(this) && this.func_226566_ei_()) { - this.field_71174_a.func_147297_a(new CEntityActionPacket(this, CEntityActionPacket.Action.START_FALL_FLYING)); + if (this.input.jumping && !flag7 && !flag && !this.abilities.flying && !this.isPassenger() && !this.onClimbable()) { + ItemStack itemstack = this.getItemBySlot(EquipmentSlotType.CHEST); +- if (itemstack.getItem() == Items.ELYTRA && ElytraItem.isFlyEnabled(itemstack) && this.tryToStartFallFlying()) { ++ if (itemstack.canElytraFly(this) && this.tryToStartFallFlying()) { + this.connection.send(new CEntityActionPacket(this, CEntityActionPacket.Action.START_FALL_FLYING)); } } @@ -777,6 +_,7 @@ - public void func_70098_U() { - super.func_70098_U(); -+ if (this.func_226564_dU_() && this.func_184218_aH()) this.field_71158_b.field_228350_h_ = false; - this.field_184844_co = false; - if (this.func_184187_bx() instanceof BoatEntity) { - BoatEntity boatentity = (BoatEntity)this.func_184187_bx(); + public void rideTick() { + super.rideTick(); ++ if (this.wantsToStopRiding() && this.isPassenger()) this.input.shiftKeyDown = false; + this.handsBusy = false; + if (this.getVehicle() instanceof BoatEntity) { + BoatEntity boatentity = (BoatEntity)this.getVehicle(); @@ -974,5 +_,17 @@ } else { - return super.func_241843_o(p_241843_1_); + return super.getRopeHoldPosition(p_241843_1_); } + } + + public void updateSyncFields(ClientPlayerEntity old) { -+ this.field_175172_bI = old.field_175172_bI; -+ this.field_175166_bJ = old.field_175166_bJ; -+ this.field_175167_bK = old.field_175167_bK; -+ this.field_175164_bL = old.field_175164_bL; -+ this.field_175165_bM = old.field_175165_bM; -+ this.field_184841_cd = old.field_184841_cd; -+ this.field_228351_cj_ = old.field_228351_cj_; -+ this.field_175171_bO = old.field_175171_bO; -+ this.field_175168_bP = old.field_175168_bP; ++ this.xLast = old.xLast; ++ this.yLast1 = old.yLast1; ++ this.zLast = old.zLast; ++ this.yRotLast = old.yRotLast; ++ this.xRotLast = old.xRotLast; ++ this.lastOnGround = old.lastOnGround; ++ this.wasShiftKeyDown = old.wasShiftKeyDown; ++ this.wasSprinting = old.wasSprinting; ++ this.positionReminder = old.positionReminder; } } diff --git a/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch index 61d827d647..5137374d3a 100644 --- a/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch @@ -3,7 +3,7 @@ @@ -29,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { + net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_); return true; } diff --git a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch index cf4058a84f..00571f04ea 100644 --- a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/gui/DisplayEffectsScreen.java +++ b/net/minecraft/client/gui/DisplayEffectsScreen.java @@ -35,6 +_,9 @@ - this.field_147003_i = (this.field_230708_k_ - this.field_146999_f) / 2; - this.field_147045_u = false; + this.leftPos = (this.width - this.imageWidth) / 2; + this.doRenderEffects = false; } else { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) -+ this.field_147003_i = (this.field_230708_k_ - this.field_146999_f) / 2; ++ this.leftPos = (this.width - this.imageWidth) / 2; + else - this.field_147003_i = 160 + (this.field_230708_k_ - this.field_146999_f - 200) / 2; - this.field_147045_u = true; + this.leftPos = 160 + (this.width - this.imageWidth - 200) / 2; + this.doRenderEffects = true; } @@ -59,7 +_,7 @@ j = 132 / (collection.size() - 1); @@ -16,18 +16,18 @@ - Iterable iterable = Ordering.natural().sortedCopy(collection); + Iterable iterable = collection.stream().filter(effectInstance -> effectInstance.shouldRender()).sorted().collect(java.util.stream.Collectors.toList()); - this.func_238810_a_(p_238811_1_, i, j, iterable); - this.func_238812_b_(p_238811_1_, i, j, iterable); - this.func_238813_c_(p_238811_1_, i, j, iterable); + this.renderBackgrounds(p_238811_1_, i, j, iterable); + this.renderIcons(p_238811_1_, i, j, iterable); + this.renderLabels(p_238811_1_, i, j, iterable); @@ -96,6 +_,11 @@ - int i = this.field_147009_r; + int i = this.topPos; for(EffectInstance effectinstance : p_238813_4_) { -+ effectinstance.renderInventoryEffect(this, p_238813_1_, p_238813_2_, i, this.func_230927_p_()); ++ effectinstance.renderInventoryEffect(this, p_238813_1_, p_238813_2_, i, this.getBlitOffset()); + if (!effectinstance.shouldRenderInvText()) { + i += p_238813_3_; + continue; + } - String s = I18n.func_135052_a(effectinstance.func_188419_a().func_76393_a()); - if (effectinstance.func_76458_c() >= 1 && effectinstance.func_76458_c() <= 9) { - s = s + ' ' + I18n.func_135052_a("enchantment.level." + (effectinstance.func_76458_c() + 1)); + String s = I18n.get(effectinstance.getEffect().getDescriptionId()); + if (effectinstance.getAmplifier() >= 1 && effectinstance.getAmplifier() <= 9) { + s = s + ' ' + I18n.get("enchantment.level." + (effectinstance.getAmplifier() + 1)); diff --git a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch index 8ce90013b5..e0e15acd1c 100644 --- a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch @@ -1,63 +1,63 @@ --- a/net/minecraft/client/gui/IngameGui.java +++ b/net/minecraft/client/gui/IngameGui.java @@ -79,7 +_,7 @@ - protected static final ResourceLocation field_110329_b = new ResourceLocation("textures/misc/vignette.png"); - protected static final ResourceLocation field_110330_c = new ResourceLocation("textures/gui/widgets.png"); - protected static final ResourceLocation field_110328_d = new ResourceLocation("textures/misc/pumpkinblur.png"); -- protected static final ITextComponent field_243249_e = new TranslationTextComponent("demo.demoExpired"); -+ private static final ITextComponent field_243249_e = new TranslationTextComponent("demo.demoExpired"); - protected final Random field_73842_c = new Random(); - protected final Minecraft field_73839_d; - protected final ItemRenderer field_73841_b; + protected static final ResourceLocation VIGNETTE_LOCATION = new ResourceLocation("textures/misc/vignette.png"); + protected static final ResourceLocation WIDGETS_LOCATION = new ResourceLocation("textures/gui/widgets.png"); + protected static final ResourceLocation PUMPKIN_BLUR_LOCATION = new ResourceLocation("textures/misc/pumpkinblur.png"); +- protected static final ITextComponent DEMO_EXPIRED_TEXT = new TranslationTextComponent("demo.demoExpired"); ++ private static final ITextComponent DEMO_EXPIRED_TEXT = new TranslationTextComponent("demo.demoExpired"); + protected final Random random = new Random(); + protected final Minecraft minecraft; + protected final ItemRenderer itemRenderer; @@ -415,6 +_,9 @@ for(EffectInstance effectinstance : Ordering.natural().reverse().sortedCopy(collection)) { - Effect effect = effectinstance.func_188419_a(); + Effect effect = effectinstance.getEffect(); + if (!effectinstance.shouldRenderHUD()) continue; + // Rebind in case previous renderHUDEffect changed texture -+ this.field_73839_d.func_110434_K().func_110577_a(ContainerScreen.field_147001_a); - if (effectinstance.func_205348_f()) { - int k = this.field_194811_H; ++ this.minecraft.getTextureManager().bind(ContainerScreen.INVENTORY_LOCATION); + if (effectinstance.showIcon()) { + int k = this.screenWidth; int l = 1; @@ -452,6 +_,7 @@ RenderSystem.color4f(1.0F, 1.0F, 1.0F, f1); - func_238470_a_(p_238444_1_, j1 + 3, k1 + 3, this.func_230927_p_(), 18, 18, textureatlassprite); + blit(p_238444_1_, j1 + 3, k1 + 3, this.getBlitOffset(), 18, 18, textureatlassprite); }); -+ effectinstance.renderHUDEffect(this, p_238444_1_, k, l, this.func_230927_p_(), f); ++ effectinstance.renderHUDEffect(this, p_238444_1_, k, l, this.getBlitOffset(), f); } } @@ -576,7 +_,8 @@ - iformattabletextcomponent.func_240699_a_(TextFormatting.ITALIC); + iformattabletextcomponent.withStyle(TextFormatting.ITALIC); } -- int i = this.func_175179_f().func_238414_a_(iformattabletextcomponent); -+ ITextComponent highlightTip = this.field_92016_l.getHighlightTip(iformattabletextcomponent); -+ int i = this.func_175179_f().func_238414_a_(highlightTip); - int j = (this.field_194811_H - i) / 2; - int k = this.field_194812_I - 59; - if (!this.field_73839_d.field_71442_b.func_78755_b()) { +- int i = this.getFont().width(iformattabletextcomponent); ++ ITextComponent highlightTip = this.lastToolHighlight.getHighlightTip(iformattabletextcomponent); ++ int i = this.getFont().width(highlightTip); + int j = (this.screenWidth - i) / 2; + int k = this.screenHeight - 59; + if (!this.minecraft.gameMode.canHurtPlayer()) { @@ -593,7 +_,13 @@ RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - func_238467_a_(p_238453_1_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.field_73839_d.field_71474_y.func_216839_a(0)); -- this.func_175179_f().func_243246_a(p_238453_1_, iformattabletextcomponent, (float)j, (float)k, 16777215 + (l << 24)); -+ FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l); + fill(p_238453_1_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0)); +- this.getFont().drawShadow(p_238453_1_, iformattabletextcomponent, (float)j, (float)k, 16777215 + (l << 24)); ++ FontRenderer font = lastToolHighlight.getItem().getFontRenderer(lastToolHighlight); + if (font == null) { -+ this.func_175179_f().func_243246_a(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24)); ++ this.getFont().drawShadow(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24)); + } else { -+ j = (this.field_194811_H - font.func_238414_a_(highlightTip)) / 2; -+ font.func_243246_a(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24)); ++ j = (this.screenWidth - font.width(highlightTip)) / 2; ++ font.drawShadow(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24)); + } RenderSystem.disableBlend(); RenderSystem.popMatrix(); } @@ -1056,7 +_,7 @@ - ItemStack itemstack = this.field_73839_d.field_71439_g.field_71071_by.func_70448_g(); - if (itemstack.func_190926_b()) { - this.field_92017_k = 0; -- } else if (!this.field_92016_l.func_190926_b() && itemstack.func_77973_b() == this.field_92016_l.func_77973_b() && itemstack.func_200301_q().equals(this.field_92016_l.func_200301_q())) { -+ } else if (!this.field_92016_l.func_190926_b() && itemstack.func_77973_b() == this.field_92016_l.func_77973_b() && (itemstack.func_200301_q().equals(this.field_92016_l.func_200301_q()) && itemstack.getHighlightTip(itemstack.func_200301_q()).equals(field_92016_l.getHighlightTip(field_92016_l.func_200301_q())))) { - if (this.field_92017_k > 0) { - --this.field_92017_k; + ItemStack itemstack = this.minecraft.player.inventory.getSelected(); + if (itemstack.isEmpty()) { + this.toolHighlightTimer = 0; +- } else if (!this.lastToolHighlight.isEmpty() && itemstack.getItem() == this.lastToolHighlight.getItem() && itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) { ++ } else if (!this.lastToolHighlight.isEmpty() && itemstack.getItem() == this.lastToolHighlight.getItem() && (itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) && itemstack.getHighlightTip(itemstack.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName())))) { + if (this.toolHighlightTimer > 0) { + --this.toolHighlightTimer; } diff --git a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch index 7f32a92348..114269fea2 100644 --- a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/client/gui/MapItemRenderer.java @@ -115,6 +_,7 @@ - for(MapDecoration mapdecoration : this.field_148242_b.field_76203_h.values()) { - if (!p_228089_3_ || mapdecoration.func_191180_f()) { + for(MapDecoration mapdecoration : this.data.decorations.values()) { + if (!p_228089_3_ || mapdecoration.renderOnFrame()) { + if (mapdecoration.render(k)) { k++; continue; } - p_228089_1_.func_227860_a_(); - p_228089_1_.func_227861_a_((double)(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F), (double)(0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F), (double)-0.02F); - p_228089_1_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_((float)(mapdecoration.func_176111_d() * 360) / 16.0F)); + p_228089_1_.pushPose(); + p_228089_1_.translate((double)(0.0F + (float)mapdecoration.getX() / 2.0F + 64.0F), (double)(0.0F + (float)mapdecoration.getY() / 2.0F + 64.0F), (double)-0.02F); + p_228089_1_.mulPose(Vector3f.ZP.rotationDegrees((float)(mapdecoration.getRot() * 360) / 16.0F)); diff --git a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch index d9dbfeb036..796b1e500a 100644 --- a/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ResourceLoadProgressGui.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/client/gui/ResourceLoadProgressGui.java +++ b/net/minecraft/client/gui/ResourceLoadProgressGui.java @@ -97,6 +_,7 @@ - int l1 = (int)((double)this.field_212974_b.func_228018_at_().func_198087_p() * 0.8325D); - float f3 = this.field_212975_c.func_219555_b(); - this.field_212978_f = MathHelper.func_76131_a(this.field_212978_f * 0.95F + f3 * 0.050000012F, 0.0F, 1.0F); + int l1 = (int)((double)this.minecraft.getWindow().getGuiScaledHeight() * 0.8325D); + float f3 = this.reload.getActualProgress(); + this.currentProgress = MathHelper.clamp(this.currentProgress * 0.95F + f3 * 0.050000012F, 0.0F, 1.0F); + net.minecraftforge.fml.client.ClientModLoader.renderProgressText(); if (f < 1.0F) { - this.func_238629_a_(p_230430_1_, i / 2 - k1, l1 - 5, i / 2 + k1, l1 + 5, 1.0F - MathHelper.func_76131_a(f, 0.0F, 1.0F)); + this.drawProgressBar(p_230430_1_, i / 2 - k1, l1 - 5, i / 2 + k1, l1 + 5, 1.0F - MathHelper.clamp(f, 0.0F, 1.0F)); } @@ -106,6 +_,7 @@ } - if (this.field_212979_g == -1L && this.field_212975_c.func_219554_d() && (!this.field_212977_e || f1 >= 2.0F)) { -+ this.field_212979_g = Util.func_211177_b(); // Moved up to guard against inf loops caused by callback + if (this.fadeOutStart == -1L && this.reload.isDone() && (!this.fadeIn || f1 >= 2.0F)) { ++ this.fadeOutStart = Util.getMillis(); // Moved up to guard against inf loops caused by callback try { - this.field_212975_c.func_219556_e(); - this.field_212976_d.accept(Optional.empty()); + this.reload.checkExceptions(); + this.onFinish.accept(Optional.empty()); @@ -113,7 +_,6 @@ - this.field_212976_d.accept(Optional.of(throwable)); + this.onFinish.accept(Optional.of(throwable)); } -- this.field_212979_g = Util.func_211177_b(); - if (this.field_212974_b.field_71462_r != null) { - this.field_212974_b.field_71462_r.func_231158_b_(this.field_212974_b, this.field_212974_b.func_228018_at_().func_198107_o(), this.field_212974_b.func_228018_at_().func_198087_p()); +- this.fadeOutStart = Util.getMillis(); + if (this.minecraft.screen != null) { + this.minecraft.screen.init(this.minecraft, this.minecraft.getWindow().getGuiScaledWidth(), this.minecraft.getWindow().getGuiScaledHeight()); } diff --git a/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch b/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch index 3d4f94b975..ced841ba6a 100644 --- a/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ScreenManager.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/gui/ScreenManager.java +++ b/net/minecraft/client/gui/ScreenManager.java @@ -40,6 +_,10 @@ - private static final Map, ScreenManager.IScreenFactory> field_216914_b = Maps.newHashMap(); + private static final Map, ScreenManager.IScreenFactory> SCREENS = Maps.newHashMap(); - public static void func_216909_a(@Nullable ContainerType p_216909_0_, Minecraft p_216909_1_, int p_216909_2_, ITextComponent p_216909_3_) { -+ getScreenFactory(p_216909_0_, p_216909_1_, p_216909_2_, p_216909_3_).ifPresent(f -> f.func_216908_a(p_216909_3_, p_216909_0_, p_216909_1_, p_216909_2_)); + public static void create(@Nullable ContainerType p_216909_0_, Minecraft p_216909_1_, int p_216909_2_, ITextComponent p_216909_3_) { ++ getScreenFactory(p_216909_0_, p_216909_1_, p_216909_2_, p_216909_3_).ifPresent(f -> f.fromPacket(p_216909_3_, p_216909_0_, p_216909_1_, p_216909_2_)); + } + + public static java.util.Optional> getScreenFactory(@Nullable ContainerType p_216909_0_, Minecraft p_216909_1_, int p_216909_2_, ITextComponent p_216909_3_) { if (p_216909_0_ == null) { - field_216913_a.warn("Trying to open invalid screen with name: {}", (Object)p_216909_3_.getString()); + LOGGER.warn("Trying to open invalid screen with name: {}", (Object)p_216909_3_.getString()); } else { @@ -47,9 +_,10 @@ if (iscreenfactory == null) { - field_216913_a.warn("Failed to create screen for menu type: {}", (Object)Registry.field_218366_G.func_177774_c(p_216909_0_)); + LOGGER.warn("Failed to create screen for menu type: {}", (Object)Registry.MENU.getKey(p_216909_0_)); } else { -- iscreenfactory.func_216908_a(p_216909_3_, p_216909_0_, p_216909_1_, p_216909_2_); +- iscreenfactory.fromPacket(p_216909_3_, p_216909_0_, p_216909_1_, p_216909_2_); + return java.util.Optional.of(iscreenfactory); } } diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch index e266b3741b..b81c8f44c0 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/advancements/AdvancementTabGui.java +++ b/net/minecraft/client/gui/advancements/AdvancementTabGui.java @@ -38,6 +_,7 @@ - private int field_191814_q = Integer.MIN_VALUE; - private float field_191815_r; - private boolean field_192992_s; + private int maxY = Integer.MIN_VALUE; + private float fade; + private boolean centered; + private int page; public AdvancementTabGui(Minecraft p_i47589_1_, AdvancementsScreen p_i47589_2_, AdvancementTabType p_i47589_3_, int p_i47589_4_, Advancement p_i47589_5_, DisplayInfo p_i47589_6_) { - this.field_191802_a = p_i47589_1_; + this.minecraft = p_i47589_1_; @@ -52,6 +_,15 @@ - this.func_193937_a(this.field_191809_l, p_i47589_5_); + this.addWidget(this.root, p_i47589_5_); } + public AdvancementTabGui(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, Advancement adv, DisplayInfo info) { @@ -21,17 +21,17 @@ + return page; + } + - public Advancement func_193935_c() { - return this.field_191805_h; + public Advancement getAdvancement() { + return this.advancement; } @@ -152,8 +_,8 @@ return null; } else { for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { -- if (p_193936_2_ < advancementtabtype.func_192650_a()) { -- return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_, p_193936_3_, p_193936_3_.func_192068_c()); -+ if ((p_193936_2_ % AdvancementTabType.MAX_TABS) < advancementtabtype.func_192650_a()) { -+ return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_ % AdvancementTabType.MAX_TABS, p_193936_2_ / AdvancementTabType.MAX_TABS, p_193936_3_, p_193936_3_.func_192068_c()); +- if (p_193936_2_ < advancementtabtype.getMax()) { +- return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_, p_193936_3_, p_193936_3_.getDisplay()); ++ if ((p_193936_2_ % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) { ++ return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_ % AdvancementTabType.MAX_TABS, p_193936_2_ / AdvancementTabType.MAX_TABS, p_193936_3_, p_193936_3_.getDisplay()); } - p_193936_2_ -= advancementtabtype.func_192650_a(); + p_193936_2_ -= advancementtabtype.getMax(); diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabType.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabType.java.patch index 20042ac1de..7326df1150 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabType.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabType.java.patch @@ -4,7 +4,7 @@ LEFT(0, 64, 32, 28, 5), RIGHT(96, 64, 32, 28, 5); -+ public static final int MAX_TABS = java.util.Arrays.stream(values()).mapToInt(e -> e.field_192664_j).sum(); - private final int field_192660_f; - private final int field_192661_g; - private final int field_192662_h; ++ public static final int MAX_TABS = java.util.Arrays.stream(values()).mapToInt(e -> e.max).sum(); + private final int textureX; + private final int textureY; + private final int width; diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch index 90c5b02ec4..de413d659a 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch @@ -1,72 +1,72 @@ --- a/net/minecraft/client/gui/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/advancements/AdvancementsScreen.java @@ -29,6 +_,7 @@ - private final Map field_191947_i = Maps.newLinkedHashMap(); - private AdvancementTabGui field_191940_s; - private boolean field_191944_v; + private final Map tabs = Maps.newLinkedHashMap(); + private AdvancementTabGui selectedTab; + private boolean isScrolling; + private static int tabPage, maxPages; public AdvancementsScreen(ClientAdvancementManager p_i47383_1_) { - super(NarratorChatListener.field_216868_a); + super(NarratorChatListener.NO_TITLE); @@ -44,7 +_,13 @@ } else { - this.field_191946_h.func_194230_a(this.field_191940_s == null ? null : this.field_191940_s.func_193935_c(), true); + this.advancements.setSelectedTab(this.selectedTab == null ? null : this.selectedTab.getAdvancement(), true); } - -+ if (this.field_191947_i.size() > AdvancementTabType.MAX_TABS) { -+ int guiLeft = (this.field_230708_k_ - 252) / 2; -+ int guiTop = (this.field_230709_l_ - 140) / 2; -+ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(guiLeft, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); -+ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); -+ maxPages = this.field_191947_i.size() / AdvancementTabType.MAX_TABS; ++ if (this.tabs.size() > AdvancementTabType.MAX_TABS) { ++ int guiLeft = (this.width - 252) / 2; ++ int guiTop = (this.height - 140) / 2; ++ addButton(new net.minecraft.client.gui.widget.button.Button(guiLeft, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ addButton(new net.minecraft.client.gui.widget.button.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, new net.minecraft.util.text.StringTextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS; + } } - public void func_231164_f_() { + public void removed() { @@ -62,7 +_,7 @@ - int j = (this.field_230709_l_ - 140) / 2; + int j = (this.height - 140) / 2; - for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { -- if (advancementtabgui.func_195627_a(i, j, p_231044_1_, p_231044_3_)) { -+ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(i, j, p_231044_1_, p_231044_3_)) { - this.field_191946_h.func_194230_a(advancementtabgui.func_193935_c(), true); + for(AdvancementTabGui advancementtabgui : this.tabs.values()) { +- if (advancementtabgui.isMouseOver(i, j, p_231044_1_, p_231044_3_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.isMouseOver(i, j, p_231044_1_, p_231044_3_)) { + this.advancements.setSelectedTab(advancementtabgui.getAdvancement(), true); break; } @@ -86,6 +_,12 @@ - int i = (this.field_230708_k_ - 252) / 2; - int j = (this.field_230709_l_ - 140) / 2; - this.func_230446_a_(p_230430_1_); + int i = (this.width - 252) / 2; + int j = (this.height - 140) / 2; + this.renderBackground(p_230430_1_); + if (maxPages != 0) { + net.minecraft.util.text.ITextComponent page = new net.minecraft.util.text.StringTextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); -+ int width = this.field_230712_o_.func_238414_a_(page); ++ int width = this.font.width(page); + RenderSystem.disableLighting(); -+ this.field_230712_o_.func_238407_a_(p_230430_1_, page.func_241878_f(), i + (252 / 2) - (width / 2), j - 44, -1); ++ this.font.drawShadow(p_230430_1_, page.getVisualOrderText(), i + (252 / 2) - (width / 2), j - 44, -1); + } - this.func_238696_c_(p_230430_1_, p_230430_2_, p_230430_3_, i, j); - this.func_238695_a_(p_230430_1_, i, j); - this.func_238697_d_(p_230430_1_, p_230430_2_, p_230430_3_, i, j); + this.renderInside(p_230430_1_, p_230430_2_, p_230430_3_, i, j); + this.renderWindow(p_230430_1_, i, j); + this.renderTooltips(p_230430_1_, p_230430_2_, p_230430_3_, i, j); @@ -132,6 +_,7 @@ - this.field_230706_i_.func_110434_K().func_110577_a(field_191945_g); + this.minecraft.getTextureManager().bind(TABS_LOCATION); - for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { + for(AdvancementTabGui advancementtabgui : this.tabs.values()) { + if (advancementtabgui.getPage() == tabPage) - advancementtabgui.func_238683_a_(p_238695_1_, p_238695_2_, p_238695_3_, advancementtabgui == this.field_191940_s); + advancementtabgui.drawTab(p_238695_1_, p_238695_2_, p_238695_3_, advancementtabgui == this.selectedTab); } @@ -139,6 +_,7 @@ RenderSystem.defaultBlendFunc(); - for(AdvancementTabGui advancementtabgui1 : this.field_191947_i.values()) { + for(AdvancementTabGui advancementtabgui1 : this.tabs.values()) { + if (advancementtabgui1.getPage() == tabPage) - advancementtabgui1.func_191796_a(p_238695_2_, p_238695_3_, this.field_230707_j_); + advancementtabgui1.drawIcon(p_238695_2_, p_238695_3_, this.itemRenderer); } @@ -161,7 +_,7 @@ - if (this.field_191947_i.size() > 1) { - for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { -- if (advancementtabgui.func_195627_a(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { -+ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { - this.func_238652_a_(p_238697_1_, advancementtabgui.func_238685_d_(), p_238697_2_, p_238697_3_); + if (this.tabs.size() > 1) { + for(AdvancementTabGui advancementtabgui : this.tabs.values()) { +- if (advancementtabgui.isMouseOver(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.isMouseOver(p_238697_4_, p_238697_5_, (double)p_238697_2_, (double)p_238697_3_)) { + this.renderTooltip(p_238697_1_, advancementtabgui.getTitle(), p_238697_2_, p_238697_3_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch index 55de676224..4b8c1ed32e 100644 --- a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch @@ -2,22 +2,22 @@ +++ b/net/minecraft/client/gui/overlay/BossOverlayGui.java @@ -32,6 +_,9 @@ - for(ClientBossInfo clientbossinfo : this.field_184060_g.values()) { + for(ClientBossInfo clientbossinfo : this.events.values()) { int k = i / 2 - 91; + net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(p_238484_1_, this.field_184059_f.func_228018_at_(), clientbossinfo, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(p_238484_1_, this.minecraft.getWindow(), clientbossinfo, k, j, 10 + this.minecraft.font.lineHeight); + if (!event.isCanceled()) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_184059_f.func_110434_K().func_110577_a(field_184058_a); - this.func_238485_a_(p_238484_1_, k, j, clientbossinfo); + this.minecraft.getTextureManager().bind(GUI_BARS_LOCATION); + this.drawBar(p_238484_1_, k, j, clientbossinfo); @@ -40,7 +_,9 @@ int i1 = i / 2 - l / 2; int j1 = j - 9; - this.field_184059_f.field_71466_p.func_243246_a(p_238484_1_, itextcomponent, (float)i1, (float)j1, 16777215); + this.minecraft.font.drawShadow(p_238484_1_, itextcomponent, (float)i1, (float)j1, 16777215); - j += 10 + 9; + } + j += event.getIncrement(); -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(p_238484_1_, this.field_184059_f.func_228018_at_()); - if (j >= this.field_184059_f.func_228018_at_().func_198087_p() / 3) { ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(p_238484_1_, this.minecraft.getWindow()); + if (j >= this.minecraft.getWindow().getGuiScaledHeight() / 3) { break; } diff --git a/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch b/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch index 7168c2c606..8f82d90ced 100644 --- a/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/overlay/DebugOverlayGui.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/client/gui/overlay/DebugOverlayGui.java +++ b/net/minecraft/client/gui/overlay/DebugOverlayGui.java @@ -362,7 +_,7 @@ - list.add(this.func_211534_a(entry)); + list.add(this.getPropertyValueString(entry)); } -- for(ResourceLocation resourcelocation : this.field_175242_a.func_147114_u().func_199724_l().func_241835_a().func_199913_a(blockstate.func_177230_c())) { -+ for(ResourceLocation resourcelocation : blockstate.func_177230_c().getTags()) { +- for(ResourceLocation resourcelocation : this.minecraft.getConnection().getTags().getBlocks().getMatchingTags(blockstate.getBlock())) { ++ for(ResourceLocation resourcelocation : blockstate.getBlock().getTags()) { list.add("#" + resourcelocation); } } @@ -378,7 +_,7 @@ - list.add(this.func_211534_a(entry1)); + list.add(this.getPropertyValueString(entry1)); } -- for(ResourceLocation resourcelocation1 : this.field_175242_a.func_147114_u().func_199724_l().func_241837_c().func_199913_a(fluidstate.func_206886_c())) { -+ for(ResourceLocation resourcelocation1 : fluidstate.func_206886_c().getTags()) { +- for(ResourceLocation resourcelocation1 : this.minecraft.getConnection().getTags().getFluids().getMatchingTags(fluidstate.getType())) { ++ for(ResourceLocation resourcelocation1 : fluidstate.getType().getTags()) { list.add("#" + resourcelocation1); } } @@ -388,6 +_,7 @@ list.add(""); list.add(TextFormatting.UNDERLINE + "Targeted Entity"); - list.add(String.valueOf((Object)Registry.field_212629_r.func_177774_c(entity.func_200600_R()))); -+ entity.func_200600_R().getTags().forEach(t -> list.add("#" + t)); + list.add(String.valueOf((Object)Registry.ENTITY_TYPE.getKey(entity.getType()))); ++ entity.getType().getTags().forEach(t -> list.add("#" + t)); } return list; diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch index d038ea7134..ae69196c56 100644 --- a/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/gui/recipebook/RecipeBookGui.java +++ b/net/minecraft/client/gui/recipebook/RecipeBookGui.java @@ -95,7 +_,7 @@ - this.func_205702_a(); - this.field_193018_j.clear(); + this.initFilterButtonTextures(); + this.tabButtons.clear(); -- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.func_243236_a(this.field_201522_g.func_241850_m())) { -+ for(RecipeBookCategories recipebookcategories : this.field_201522_g.getRecipeBookCategories()) { - this.field_193018_j.add(new RecipeTabToggleWidget(recipebookcategories)); +- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { ++ for(RecipeBookCategories recipebookcategories : this.menu.getRecipeBookCategories()) { + this.tabButtons.add(new RecipeTabToggleWidget(recipebookcategories)); } @@ -434,7 +_,7 @@ - languagemanager.func_135045_a(language); - this.field_191888_F.field_71474_y.field_74363_ab = language.getCode(); -- this.field_191888_F.func_213237_g(); -+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); - this.field_191888_F.field_71474_y.func_74303_b(); + languagemanager.setSelected(language); + this.minecraft.options.languageCode = language.getCode(); +- this.minecraft.reloadResourcePacks(); ++ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.minecraft, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); + this.minecraft.options.save(); } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/BiomeGeneratorTypeScreens.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/BiomeGeneratorTypeScreens.java.patch index 0eb3814ec7..20406306d6 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/BiomeGeneratorTypeScreens.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/BiomeGeneratorTypeScreens.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/client/gui/screen/BiomeGeneratorTypeScreens.java @@ -113,6 +_,9 @@ private BiomeGeneratorTypeScreens(String p_i232324_1_) { - this.field_239076_k_ = new TranslationTextComponent("generator." + p_i232324_1_); + this.description = new TranslationTextComponent("generator." + p_i232324_1_); } + public BiomeGeneratorTypeScreens(ITextComponent displayName) { -+ this.field_239076_k_ = displayName; ++ this.description = displayName; + } - private static DimensionGeneratorSettings func_243452_a(DynamicRegistries p_243452_0_, DimensionGeneratorSettings p_243452_1_, BiomeGeneratorTypeScreens p_243452_2_, Biome p_243452_3_) { + private static DimensionGeneratorSettings fromBuffetSettings(DynamicRegistries p_243452_0_, DimensionGeneratorSettings p_243452_1_, BiomeGeneratorTypeScreens p_243452_2_, Biome p_243452_3_) { BiomeProvider biomeprovider = new SingleBiomeProvider(p_243452_3_); @@ -166,4 +_,8 @@ public interface IFactory { @@ -17,5 +17,5 @@ + + // Forge start + // For internal use only, automatically called for all ForgeWorldTypes. Register your ForgeWorldType in the forge registry! -+ public static void registerGenerator(BiomeGeneratorTypeScreens gen) { field_239068_c_.add(gen); } ++ public static void registerGenerator(BiomeGeneratorTypeScreens gen) { PRESETS.add(gen); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch index 70336c181a..53fd1fbe21 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/client/gui/screen/ControlsScreen.java +++ b/net/minecraft/client/gui/screen/ControlsScreen.java @@ -33,7 +_,7 @@ - this.field_230705_e_.add(this.field_146494_r); - this.field_146493_s = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 155, this.field_230709_l_ - 29, 150, 20, new TranslationTextComponent("controls.resetAll"), (p_213125_1_) -> { - for(KeyBinding keybinding : this.field_228183_b_.field_74324_K) { -- keybinding.func_197979_b(keybinding.func_197977_i()); + this.children.add(this.controlList); + this.resetButton = this.addButton(new Button(this.width / 2 - 155, this.height - 29, 150, 20, new TranslationTextComponent("controls.resetAll"), (p_213125_1_) -> { + for(KeyBinding keybinding : this.options.keyMappings) { +- keybinding.setKey(keybinding.getDefaultKey()); + keybinding.setToDefault(); } - KeyBinding.func_74508_b(); + KeyBinding.resetMapping(); @@ -57,11 +_,14 @@ - public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_3_) { - if (this.field_146491_f != null) { + public boolean keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_) { + if (this.selectedKey != null) { if (p_231046_1_ == 256) { -+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.field_197958_a); - this.field_228183_b_.func_198014_a(this.field_146491_f, InputMappings.field_197958_a); ++ this.selectedKey.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.UNKNOWN); + this.options.setKey(this.selectedKey, InputMappings.UNKNOWN); } else { -+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.func_197954_a(p_231046_1_, p_231046_2_)); - this.field_228183_b_.func_198014_a(this.field_146491_f, InputMappings.func_197954_a(p_231046_1_, p_231046_2_)); ++ this.selectedKey.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.getKey(p_231046_1_, p_231046_2_)); + this.options.setKey(this.selectedKey, InputMappings.getKey(p_231046_1_, p_231046_2_)); } -+ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.field_146491_f.getKey())) - this.field_146491_f = null; - this.field_152177_g = Util.func_211177_b(); - KeyBinding.func_74508_b(); ++ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey())) + this.selectedKey = null; + this.lastKeySelection = Util.getMillis(); + KeyBinding.resetMapping(); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch index 2fe57a3798..586cbfce30 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch @@ -2,18 +2,18 @@ +++ b/net/minecraft/client/gui/screen/CreateWorldScreen.java @@ -110,7 +_,7 @@ - public static CreateWorldScreen func_243425_a(@Nullable Screen p_243425_0_) { - DynamicRegistries.Impl dynamicregistries$impl = DynamicRegistries.func_239770_b_(); -- return new CreateWorldScreen(p_243425_0_, DatapackCodec.field_234880_a_, new WorldOptionsScreen(dynamicregistries$impl, DimensionGeneratorSettings.func_242751_a(dynamicregistries$impl.func_243612_b(Registry.field_239698_ad_), dynamicregistries$impl.func_243612_b(Registry.field_239720_u_), dynamicregistries$impl.func_243612_b(Registry.field_243549_ar)), Optional.of(BiomeGeneratorTypeScreens.field_239066_a_), OptionalLong.empty())); -+ return new CreateWorldScreen(p_243425_0_, DatapackCodec.field_234880_a_, new WorldOptionsScreen(dynamicregistries$impl, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType().map(type -> type.func_241220_a_(dynamicregistries$impl, new java.util.Random().nextLong(), true, false)).orElseGet(() -> DimensionGeneratorSettings.func_242751_a(dynamicregistries$impl.func_243612_b(Registry.field_239698_ad_), dynamicregistries$impl.func_243612_b(Registry.field_239720_u_), dynamicregistries$impl.func_243612_b(Registry.field_243549_ar))), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType(), OptionalLong.empty())); + public static CreateWorldScreen create(@Nullable Screen p_243425_0_) { + DynamicRegistries.Impl dynamicregistries$impl = DynamicRegistries.builtin(); +- return new CreateWorldScreen(p_243425_0_, DatapackCodec.DEFAULT, new WorldOptionsScreen(dynamicregistries$impl, DimensionGeneratorSettings.makeDefault(dynamicregistries$impl.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY), dynamicregistries$impl.registryOrThrow(Registry.BIOME_REGISTRY), dynamicregistries$impl.registryOrThrow(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY)), Optional.of(BiomeGeneratorTypeScreens.NORMAL), OptionalLong.empty())); ++ return new CreateWorldScreen(p_243425_0_, DatapackCodec.DEFAULT, new WorldOptionsScreen(dynamicregistries$impl, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType().map(type -> type.create(dynamicregistries$impl, new java.util.Random().nextLong(), true, false)).orElseGet(() -> DimensionGeneratorSettings.makeDefault(dynamicregistries$impl.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY), dynamicregistries$impl.registryOrThrow(Registry.BIOME_REGISTRY), dynamicregistries$impl.registryOrThrow(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY))), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType(), OptionalLong.empty())); } private CreateWorldScreen(@Nullable Screen p_i242063_1_, DatapackCodec p_i242063_2_, WorldOptionsScreen p_i242063_3_) { @@ -542,6 +_,7 @@ File file1 = path.toFile(); - if (this.field_243416_G == null) { - this.field_243416_G = new ResourcePackList(new ServerPackFinder(), new FolderPackFinder(file1, IPackNameDecorator.field_232625_a_)); -+ net.minecraftforge.fml.packs.ResourcePackLoader.loadResourcePacks(this.field_243416_G, net.minecraftforge.fml.server.ServerLifecycleHooks::buildPackFinder); - this.field_243416_G.func_198983_a(); + if (this.tempDataPackRepository == null) { + this.tempDataPackRepository = new ResourcePackList(new ServerPackFinder(), new FolderPackFinder(file1, IPackNameDecorator.DEFAULT)); ++ net.minecraftforge.fml.packs.ResourcePackLoader.loadResourcePacks(this.tempDataPackRepository, net.minecraftforge.fml.server.ServerLifecycleHooks::buildPackFinder); + this.tempDataPackRepository.reload(); } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch index e646008074..9e1b20bde8 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/DeathScreen.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/client/gui/screen/DeathScreen.java @@ -35,6 +_,7 @@ })); - Button button = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, this.field_230709_l_ / 4 + 96, 200, 20, new TranslationTextComponent("deathScreen.titleScreen"), (p_213020_1_) -> { - if (this.field_213023_c) { -+ func_213022_a(true); - this.func_228177_a_(); + Button button = this.addButton(new Button(this.width / 2 - 100, this.height / 4 + 96, 200, 20, new TranslationTextComponent("deathScreen.titleScreen"), (p_213020_1_) -> { + if (this.hardcore) { ++ confirmResult(true); + this.exitToTitleScreen(); } else { - ConfirmScreen confirmscreen = new ConfirmScreen(this::func_213022_a, new TranslationTextComponent("deathScreen.quit.confirm"), StringTextComponent.field_240750_d_, new TranslationTextComponent("deathScreen.titleScreen"), new TranslationTextComponent("deathScreen.respawn")); + ConfirmScreen confirmscreen = new ConfirmScreen(this::confirmResult, new TranslationTextComponent("deathScreen.quit.confirm"), StringTextComponent.EMPTY, new TranslationTextComponent("deathScreen.titleScreen"), new TranslationTextComponent("deathScreen.respawn")); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch index 48a04998a0..e99dd0bdc8 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/client/gui/screen/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screen/EnchantmentScreen.java @@ -149,7 +_,7 @@ - int i2 = 86 - this.field_230712_o_.func_78256_a(s); - ITextProperties itextproperties = EnchantmentNameParts.func_178176_a().func_238816_a_(this.field_230712_o_, i2); + int i2 = 86 - this.font.width(s); + ITextProperties itextproperties = EnchantmentNameParts.getInstance().getRandomName(this.font, i2); int j2 = 6839882; -- if ((l < i1 + 1 || this.field_230706_i_.field_71439_g.field_71068_ca < l1) && !this.field_230706_i_.field_71439_g.field_71075_bZ.field_75098_d) { -+ if (((l < i1 + 1 || this.field_230706_i_.field_71439_g.field_71068_ca < l1) && !this.field_230706_i_.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147002_h.field_185001_h[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels - this.func_238474_b_(p_230450_1_, j1, j + 14 + 19 * i1, 0, 185, 108, 19); - this.func_238474_b_(p_230450_1_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); - this.field_230712_o_.func_238418_a_(itextproperties, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); +- if ((l < i1 + 1 || this.minecraft.player.experienceLevel < l1) && !this.minecraft.player.abilities.instabuild) { ++ if (((l < i1 + 1 || this.minecraft.player.experienceLevel < l1) && !this.minecraft.player.abilities.instabuild) || this.menu.enchantClue[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels + this.blit(p_230450_1_, j1, j + 14 + 19 * i1, 0, 185, 108, 19); + this.blit(p_230450_1_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); + this.font.drawWordWrap(itextproperties, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); @@ -188,10 +_,13 @@ - Enchantment enchantment = Enchantment.func_185262_c((this.field_147002_h).field_185001_h[j]); - int l = (this.field_147002_h).field_185002_i[j]; + Enchantment enchantment = Enchantment.byId((this.menu).enchantClue[j]); + int l = (this.menu).levelClue[j]; int i1 = j + 1; -- if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0 && l >= 0 && enchantment != null) { -+ if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0) { +- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0 && l >= 0 && enchantment != null) { ++ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_230430_2_, (double)p_230430_3_) && k > 0) { List list = Lists.newArrayList(); -- list.add((new TranslationTextComponent("container.enchant.clue", enchantment.func_200305_d(l))).func_240699_a_(TextFormatting.WHITE)); +- list.add((new TranslationTextComponent("container.enchant.clue", enchantment.getFullname(l))).withStyle(TextFormatting.WHITE)); - if (!flag) { -+ list.add((new TranslationTextComponent("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l))).func_240699_a_(TextFormatting.WHITE)); ++ list.add((new TranslationTextComponent("container.enchant.clue", enchantment == null ? "" : enchantment.getFullname(l))).withStyle(TextFormatting.WHITE)); + if(enchantment == null) { + list.add(new StringTextComponent("")); -+ list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").func_240699_a_(TextFormatting.RED)); ++ list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").withStyle(TextFormatting.RED)); + } else if (!flag) { - list.add(StringTextComponent.field_240750_d_); - if (this.field_230706_i_.field_71439_g.field_71068_ca < k) { - list.add((new TranslationTextComponent("container.enchant.level.requirement", (this.field_147002_h).field_75167_g[j])).func_240699_a_(TextFormatting.RED)); + list.add(StringTextComponent.EMPTY); + if (this.minecraft.player.experienceLevel < k) { + list.add((new TranslationTextComponent("container.enchant.level.requirement", (this.menu).costs[j])).withStyle(TextFormatting.RED)); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch index e9aed17848..5993a672b9 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screen/LanguageScreen.java +++ b/net/minecraft/client/gui/screen/LanguageScreen.java @@ -46,7 +_,7 @@ - if (languagescreen$list$languageentry != null && !languagescreen$list$languageentry.field_214398_b.getCode().equals(this.field_146454_h.func_135041_c().getCode())) { - this.field_146454_h.func_135045_a(languagescreen$list$languageentry.field_214398_b); - this.field_228183_b_.field_74363_ab = languagescreen$list$languageentry.field_214398_b.getCode(); -- this.field_230706_i_.func_213237_g(); -+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_230706_i_, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); - this.field_146452_r.func_238482_a_(DialogTexts.field_240632_c_); - this.field_211832_i.func_238482_a_(AbstractOption.field_216684_H.func_238152_c_(this.field_228183_b_)); - this.field_228183_b_.func_74303_b(); + if (languagescreen$list$languageentry != null && !languagescreen$list$languageentry.language.getCode().equals(this.languageManager.getSelected().getCode())) { + this.languageManager.setSelected(languagescreen$list$languageentry.language); + this.options.languageCode = languagescreen$list$languageentry.language.getCode(); +- this.minecraft.reloadResourcePacks(); ++ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.minecraft, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); + this.doneButton.setMessage(DialogTexts.GUI_DONE); + this.forceUnicodeButton.setMessage(AbstractOption.FORCE_UNICODE_FONT.getMessage(this.options)); + this.options.save(); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch index b199962bec..0208bba0eb 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch @@ -1,68 +1,68 @@ --- a/net/minecraft/client/gui/screen/MainMenuScreen.java +++ b/net/minecraft/client/gui/screen/MainMenuScreen.java @@ -54,6 +_,7 @@ - private final RenderSkybox field_209101_K = new RenderSkybox(field_213098_a); - private final boolean field_213102_y; - private long field_213103_z; + private final RenderSkybox panorama = new RenderSkybox(CUBE_MAP); + private final boolean fading; + private long fadeInStart; + private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; public MainMenuScreen() { this(false); @@ -97,11 +_,16 @@ - this.field_193979_N = this.field_230708_k_ - this.field_193978_M - 2; + this.copyrightX = this.width - this.copyrightWidth - 2; int i = 24; - int j = this.field_230709_l_ / 4 + 48; + int j = this.height / 4 + 48; + Button modButton = null; - if (this.field_230706_i_.func_71355_q()) { - this.func_73972_b(j, 24); + if (this.minecraft.isDemo()) { + this.createDemoMenuOptions(j, 24); } else { - this.func_73969_a(j, 24); -+ modButton = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, j + 24 * 2, 98, 20, new TranslationTextComponent("fml.menu.mods"), button -> { -+ this.field_230706_i_.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this)); + this.createNormalMenuOptions(j, 24); ++ modButton = this.addButton(new Button(this.width / 2 - 100, j + 24 * 2, 98, 20, new TranslationTextComponent("fml.menu.mods"), button -> { ++ this.minecraft.setScreen(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this)); + })); } + modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton); - this.func_230480_a_(new ImageButton(this.field_230708_k_ / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.field_230687_i_, 256, 256, (p_213090_1_) -> { - this.field_230706_i_.func_147108_a(new LanguageScreen(this, this.field_230706_i_.field_71474_y, this.field_230706_i_.func_135016_M())); + this.addButton(new ImageButton(this.width / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.WIDGETS_LOCATION, 256, 256, (p_213090_1_) -> { + this.minecraft.setScreen(new LanguageScreen(this, this.minecraft.options, this.minecraft.getLanguageManager())); @@ -143,7 +_,7 @@ - Screen screen = (Screen)(this.field_230706_i_.field_71474_y.field_230152_Z_ ? new MultiplayerScreen(this) : new MultiplayerWarningScreen(this)); - this.field_230706_i_.func_147108_a(screen); - }, button$itooltip))).field_230693_o_ = flag; -- (this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { -+ (this.func_230480_a_(new Button(this.field_230708_k_ / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { - this.func_140005_i(); - }, button$itooltip))).field_230693_o_ = flag; + Screen screen = (Screen)(this.minecraft.options.skipMultiplayerWarning ? new MultiplayerScreen(this) : new MultiplayerWarningScreen(this)); + this.minecraft.setScreen(screen); + }, button$itooltip))).active = flag; +- (this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { ++ (this.addButton(new Button(this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, new TranslationTextComponent("menu.online"), (p_238661_1_) -> { + this.realmsButtonClicked(); + }, button$itooltip))).active = flag; } @@ -229,6 +_,7 @@ - this.field_230706_i_.func_110434_K().func_110577_a(field_194400_H); - func_238463_a_(p_230430_1_, j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_230430_1_, this.field_230712_o_, this.field_230708_k_, this.field_230709_l_, l); - if (this.field_73975_c != null) { + this.minecraft.getTextureManager().bind(MINECRAFT_EDITION); + blit(p_230430_1_, j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_230430_1_, this.font, this.width, this.height, l); + if (this.splash != null) { RenderSystem.pushMatrix(); - RenderSystem.translatef((float)(this.field_230708_k_ / 2 + 90), 70.0F, 0.0F); + RenderSystem.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); @@ -251,7 +_,14 @@ - s = s + I18n.func_135052_a("menu.modded"); + s = s + I18n.get("menu.modded"); } -- func_238476_c_(p_230430_1_, this.field_230712_o_, s, 2, this.field_230709_l_ - 10, 16777215 | l); +- drawString(p_230430_1_, this.font, s, 2, this.height - 10, 16777215 | l); + net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) -> -+ func_238476_c_(p_230430_1_, this.field_230712_o_, brd, 2, this.field_230709_l_ - ( 10 + brdline * (this.field_230712_o_.field_78288_b + 1)), 16777215 | l) ++ drawString(p_230430_1_, this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | l) + ); + + net.minecraftforge.fml.BrandingControl.forEachAboveCopyrightLine((brdline, brd) -> -+ func_238476_c_(p_230430_1_, this.field_230712_o_, brd, this.field_230708_k_ - field_230712_o_.func_78256_a(brd), this.field_230709_l_ - (10 + (brdline + 1) * ( this.field_230712_o_.field_78288_b + 1)), 16777215 | l) ++ drawString(p_230430_1_, this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | l) + ); + - func_238476_c_(p_230430_1_, this.field_230712_o_, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_230709_l_ - 10, 16777215 | l); - if (p_230430_2_ > this.field_193979_N && p_230430_2_ < this.field_193979_N + this.field_193978_M && p_230430_3_ > this.field_230709_l_ - 10 && p_230430_3_ < this.field_230709_l_) { - func_238467_a_(p_230430_1_, this.field_193979_N, this.field_230709_l_ - 1, this.field_193979_N + this.field_193978_M, this.field_230709_l_, 16777215 | l); + drawString(p_230430_1_, this.font, "Copyright Mojang AB. Do not distribute!", this.copyrightX, this.height - 10, 16777215 | l); + if (p_230430_2_ > this.copyrightX && p_230430_2_ < this.copyrightX + this.copyrightWidth && p_230430_3_ > this.height - 10 && p_230430_3_ < this.height) { + fill(p_230430_1_, this.copyrightX, this.height - 1, this.copyrightX + this.copyrightWidth, this.height, 16777215 | l); @@ -265,6 +_,7 @@ - if (this.func_183501_a() && f1 >= 1.0F) { - this.field_183503_M.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); + if (this.realmsNotificationsEnabled() && f1 >= 1.0F) { + this.realmsNotificationsScreen.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } -+ modUpdateNotification.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); ++ modUpdateNotification.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch index 7e6457c584..19410c3fc4 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/MultiplayerScreen.java.patch @@ -5,10 +5,10 @@ } + @Override -+ public void func_231175_as__() { -+ this.field_230706_i_.func_147108_a(this.field_146798_g); ++ public void onClose() { ++ this.minecraft.setScreen(this.lastScreen); + } + - public ServerPinger func_146789_i() { - return this.field_146797_f; + public ServerPinger getPinger() { + return this.pinger; } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch index 0fbbbd237c..80dbf2ae44 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/OptionsScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screen/OptionsScreen.java +++ b/net/minecraft/client/gui/screen/OptionsScreen.java @@ -146,4 +_,12 @@ - func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_230704_d_, this.field_230708_k_ / 2, 15, 16777215); - super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); + drawCenteredString(p_230430_1_, this.font, this.title, this.width / 2, 15, 16777215); + super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); } + + @Override -+ public void func_231175_as__() { ++ public void onClose() { + // We need to consider 2 potential parent screens here: + // 1. From the main menu, in which case display the main menu + // 2. From the pause menu, in which case exit back to game -+ this.field_230706_i_.func_147108_a(this.field_146441_g instanceof IngameMenuScreen ? null : this.field_146441_g); ++ this.minecraft.setScreen(this.lastScreen instanceof IngameMenuScreen ? null : this.lastScreen); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/PackLoadingManager.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/PackLoadingManager.java.patch index e2f684e9cb..4a9e580571 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/PackLoadingManager.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/PackLoadingManager.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/gui/screen/PackLoadingManager.java +++ b/net/minecraft/client/gui/screen/PackLoadingManager.java @@ -134,6 +_,11 @@ - public void func_230468_k_() { - this.func_238879_a_(1); + public void moveDown() { + this.move(1); } + + @Override + public boolean notHidden() { -+ return !field_238878_b_.isHidden(); ++ return !pack.isHidden(); + } } @OnlyIn(Dist.CLIENT) @@ -229,5 +_,7 @@ - boolean func_230469_o_(); + boolean canMoveUp(); - boolean func_230470_p_(); + boolean canMoveDown(); + + default boolean notHidden() { return true; } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/PackScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/PackScreen.java.patch index bf3b64ea9c..b25eb7cf86 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/PackScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/PackScreen.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/client/gui/screen/PackScreen.java @@ -129,7 +_,7 @@ - private void func_238899_a_(net.minecraft.client.gui.widget.list.ResourcePackList p_238899_1_, Stream p_238899_2_) { - p_238899_1_.func_231039_at__().clear(); + private void updateList(net.minecraft.client.gui.widget.list.ResourcePackList p_238899_1_, Stream p_238899_2_) { + p_238899_1_.children().clear(); - p_238899_2_.forEach((p_238898_2_) -> { + p_238899_2_.filter(PackLoadingManager.IPack::notHidden).forEach((p_238898_2_) -> { - p_238899_1_.func_231039_at__().add(new net.minecraft.client.gui.widget.list.ResourcePackList.ResourcePackEntry(this.field_230706_i_, p_238899_1_, this, p_238898_2_)); + p_238899_1_.children().add(new net.minecraft.client.gui.widget.list.ResourcePackList.ResourcePackEntry(this.minecraft, p_238899_1_, this, p_238898_2_)); }); } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch index a45d4274e0..aef688cf6c 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch @@ -3,42 +3,42 @@ @@ -99,7 +_,7 @@ } - public void func_231175_as__() { -- this.field_230706_i_.func_147108_a((Screen)null); -+ this.field_230706_i_.popGuiLayer(); + public void onClose() { +- this.minecraft.setScreen((Screen)null); ++ this.minecraft.popGuiLayer(); } - protected T func_230480_a_(T p_230480_1_) { + protected T addButton(T p_230480_1_) { @@ -113,7 +_,10 @@ } - protected void func_230457_a_(MatrixStack p_230457_1_, ItemStack p_230457_2_, int p_230457_3_, int p_230457_4_) { -- this.func_243308_b(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_); -+ FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_); + protected void renderTooltip(MatrixStack p_230457_1_, ItemStack p_230457_2_, int p_230457_3_, int p_230457_4_) { +- this.renderComponentTooltip(p_230457_1_, this.getTooltipFromItem(p_230457_2_), p_230457_3_, p_230457_4_); ++ FontRenderer font = p_230457_2_.getItem().getFontRenderer(p_230457_2_); + net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_); -+ this.renderWrappedToolTip(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font)); ++ this.renderWrappedToolTip(p_230457_1_, this.getTooltipFromItem(p_230457_2_), p_230457_3_, p_230457_4_, (font == null ? this.font : font)); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } - public List func_231151_a_(ItemStack p_231151_1_) { + public List getTooltipFromItem(ItemStack p_231151_1_) { @@ -121,14 +_,20 @@ } - public void func_238652_a_(MatrixStack p_238652_1_, ITextComponent p_238652_2_, int p_238652_3_, int p_238652_4_) { -- this.func_238654_b_(p_238652_1_, Arrays.asList(p_238652_2_.func_241878_f()), p_238652_3_, p_238652_4_); -+ this.func_243308_b(p_238652_1_, Arrays.asList(p_238652_2_), p_238652_3_, p_238652_4_); + public void renderTooltip(MatrixStack p_238652_1_, ITextComponent p_238652_2_, int p_238652_3_, int p_238652_4_) { +- this.renderTooltip(p_238652_1_, Arrays.asList(p_238652_2_.getVisualOrderText()), p_238652_3_, p_238652_4_); ++ this.renderComponentTooltip(p_238652_1_, Arrays.asList(p_238652_2_), p_238652_3_, p_238652_4_); } - public void func_243308_b(MatrixStack p_243308_1_, List p_243308_2_, int p_243308_3_, int p_243308_4_) { -- this.func_238654_b_(p_243308_1_, Lists.transform(p_243308_2_, ITextComponent::func_241878_f), p_243308_3_, p_243308_4_); -+ this.renderWrappedToolTip(p_243308_1_, p_243308_2_, p_243308_3_, p_243308_4_, field_230712_o_); + public void renderComponentTooltip(MatrixStack p_243308_1_, List p_243308_2_, int p_243308_3_, int p_243308_4_) { +- this.renderTooltip(p_243308_1_, Lists.transform(p_243308_2_, ITextComponent::getVisualOrderText), p_243308_3_, p_243308_4_); ++ this.renderWrappedToolTip(p_243308_1_, p_243308_2_, p_243308_3_, p_243308_4_, font); + } + public void renderWrappedToolTip(MatrixStack matrixStack, List tooltips, int mouseX, int mouseY, FontRenderer font) { -+ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(matrixStack, tooltips, mouseX, mouseY, field_230708_k_, field_230709_l_, -1, font); ++ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(matrixStack, tooltips, mouseX, mouseY, width, height, -1, font); } - public void func_238654_b_(MatrixStack p_238654_1_, List p_238654_2_, int p_238654_3_, int p_238654_4_) { -+ this.renderToolTip(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, field_230712_o_); + public void renderTooltip(MatrixStack p_238654_1_, List p_238654_2_, int p_238654_3_, int p_238654_4_) { ++ this.renderToolTip(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, font); + } + public void renderToolTip(MatrixStack p_238654_1_, List p_238654_2_, int p_238654_3_, int p_238654_4_, FontRenderer font) { if (!p_238654_2_.isEmpty()) { @@ -47,57 +47,57 @@ @@ -289,9 +_,12 @@ } - public void func_231159_b_(String p_231159_1_, boolean p_231159_2_) { + public void sendMessage(String p_231159_1_, boolean p_231159_2_) { + p_231159_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_231159_1_); + if (p_231159_1_.isEmpty()) return; if (p_231159_2_) { - this.field_230706_i_.field_71456_v.func_146158_b().func_146239_a(p_231159_1_); + this.minecraft.gui.getChat().addRecentChat(p_231159_1_); } + //if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.player, msg) != 0) return; //Forge: TODO Client command re-write - this.field_230706_i_.field_71439_g.func_71165_d(p_231159_1_); + this.minecraft.player.chat(p_231159_1_); } @@ -302,10 +_,17 @@ - this.field_230712_o_ = p_231158_1_.field_71466_p; - this.field_230708_k_ = p_231158_2_; - this.field_230709_l_ = p_231158_3_; + this.font = p_231158_1_.font; + this.width = p_231158_2_; + this.height = p_231158_3_; + java.util.function.Consumer remove = (b) -> { -+ field_230710_m_.remove(b); -+ field_230705_e_.remove(b); ++ buttons.remove(b); ++ children.remove(b); + }; -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_230710_m_, this::func_230480_a_, remove))) { - this.field_230710_m_.clear(); - this.field_230705_e_.clear(); - this.func_231035_a_((IGuiEventListener)null); - this.func_231160_c_(); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttons, this::addButton, remove))) { + this.buttons.clear(); + this.children.clear(); + this.setFocused((IGuiEventListener)null); + this.init(); + } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_230710_m_, this::func_230480_a_, remove)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttons, this::addButton, remove)); } - public List func_231039_at__() { + public List children() { @@ -328,6 +_,7 @@ - public void func_238651_a_(MatrixStack p_238651_1_, int p_238651_2_) { - if (this.field_230706_i_.field_71441_e != null) { - this.func_238468_a_(p_238651_1_, 0, 0, this.field_230708_k_, this.field_230709_l_, -1072689136, -804253680); + public void renderBackground(MatrixStack p_238651_1_, int p_238651_2_) { + if (this.minecraft.level != null) { + this.fillGradient(p_238651_1_, 0, 0, this.width, this.height, -1072689136, -804253680); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, p_238651_1_)); } else { - this.func_231165_f_(p_238651_2_); + this.renderDirtBackground(p_238651_2_); } @@ -346,6 +_,7 @@ - bufferbuilder.func_225582_a_((double)this.field_230708_k_, 0.0D, 0.0D).func_225583_a_((float)this.field_230708_k_ / 32.0F, (float)p_231165_1_).func_225586_a_(64, 64, 64, 255).func_181675_d(); - bufferbuilder.func_225582_a_(0.0D, 0.0D, 0.0D).func_225583_a_(0.0F, (float)p_231165_1_).func_225586_a_(64, 64, 64, 255).func_181675_d(); - tessellator.func_78381_a(); + bufferbuilder.vertex((double)this.width, 0.0D, 0.0D).uv((float)this.width / 32.0F, (float)p_231165_1_).color(64, 64, 64, 255).endVertex(); + bufferbuilder.vertex(0.0D, 0.0D, 0.0D).uv(0.0F, (float)p_231165_1_).color(64, 64, 64, 255).endVertex(); + tessellator.end(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, new MatrixStack())); } - public boolean func_231177_au__() { + public boolean isPauseScreen() { @@ -431,5 +_,9 @@ } - public void func_230476_a_(List p_230476_1_) { + public void onFilesDrop(List p_230476_1_) { + } + + public Minecraft getMinecraft() { -+ return this.field_230706_i_; ++ return this.minecraft; } } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch index 73e4bc6809..48a64e5b54 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screen/ServerSelectionList.java +++ b/net/minecraft/client/gui/screen/ServerSelectionList.java @@ -307,6 +_,8 @@ - this.field_148303_c.func_238854_b_(list1); + this.screen.setToolTip(list1); } -+ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, p_230432_1_, p_230432_4_, p_230432_3_, p_230432_5_, i1, j1); ++ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.screen, serverData, p_230432_1_, p_230432_4_, p_230432_3_, p_230432_5_, i1, j1); + - if (this.field_148300_d.field_71474_y.field_85185_A || p_230432_9_) { - this.field_148300_d.func_110434_K().func_110577_a(ServerSelectionList.field_214360_d); - AbstractGui.func_238467_a_(p_230432_1_, p_230432_4_, p_230432_3_, p_230432_4_ + 32, p_230432_3_ + 32, -1601138544); + if (this.minecraft.options.touchscreen || p_230432_9_) { + this.minecraft.getTextureManager().bind(ServerSelectionList.ICON_OVERLAY_LOCATION); + AbstractGui.fill(p_230432_1_, p_230432_4_, p_230432_3_, p_230432_4_ + 32, p_230432_3_ + 32, -1601138544); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/WorldOptionsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/WorldOptionsScreen.java.patch index 81ad181038..ed7c95bd05 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/WorldOptionsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/WorldOptionsScreen.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/gui/screen/WorldOptionsScreen.java +++ b/net/minecraft/client/gui/screen/WorldOptionsScreen.java @@ -134,6 +_,7 @@ - this.field_239035_i_.field_230693_o_ = this.field_239040_n_.isPresent(); - this.field_239036_j_ = p_239048_1_.func_230480_a_(new Button(j, 120, 150, 20, new TranslationTextComponent("selectWorld.customizeType"), (p_239044_3_) -> { - BiomeGeneratorTypeScreens.IFactory biomegeneratortypescreens$ifactory = BiomeGeneratorTypeScreens.field_239069_d_.get(this.field_239040_n_); -+ biomegeneratortypescreens$ifactory = net.minecraftforge.client.ForgeHooksClient.getBiomeGeneratorTypeScreenFactory(this.field_239040_n_, biomegeneratortypescreens$ifactory); + this.typeButton.active = this.preset.isPresent(); + this.customizeTypeButton = p_239048_1_.addButton(new Button(j, 120, 150, 20, new TranslationTextComponent("selectWorld.customizeType"), (p_239044_3_) -> { + BiomeGeneratorTypeScreens.IFactory biomegeneratortypescreens$ifactory = BiomeGeneratorTypeScreens.EDITORS.get(this.preset); ++ biomegeneratortypescreens$ifactory = net.minecraftforge.client.ForgeHooksClient.getBiomeGeneratorTypeScreenFactory(this.preset, biomegeneratortypescreens$ifactory); if (biomegeneratortypescreens$ifactory != null) { - p_239048_2_.func_147108_a(biomegeneratortypescreens$ifactory.createEditScreen(p_239048_1_, this.field_239039_m_)); + p_239048_2_.setScreen(biomegeneratortypescreens$ifactory.createEditScreen(p_239048_1_, this.settings)); } @@ -292,7 +_,7 @@ } else { - this.field_239034_h_.field_230694_p_ = p_239059_1_; - this.field_239027_a_.field_230694_p_ = p_239059_1_; -- this.field_239036_j_.field_230694_p_ = p_239059_1_ && BiomeGeneratorTypeScreens.field_239069_d_.containsKey(this.field_239040_n_); -+ this.field_239036_j_.field_230694_p_ = p_239059_1_ && (BiomeGeneratorTypeScreens.field_239069_d_.containsKey(this.field_239040_n_) || net.minecraftforge.client.ForgeHooksClient.hasBiomeGeneratorSettingsOptionsScreen(this.field_239040_n_)); - this.field_239037_k_.field_230694_p_ = p_239059_1_; + this.featuresButton.visible = p_239059_1_; + this.bonusItemsButton.visible = p_239059_1_; +- this.customizeTypeButton.visible = p_239059_1_ && BiomeGeneratorTypeScreens.EDITORS.containsKey(this.preset); ++ this.customizeTypeButton.visible = p_239059_1_ && (BiomeGeneratorTypeScreens.EDITORS.containsKey(this.preset) || net.minecraftforge.client.ForgeHooksClient.hasBiomeGeneratorSettingsOptionsScreen(this.preset)); + this.importSettingsButton.visible = p_239059_1_; } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch index 82de7a733d..53e6bef021 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch @@ -1,135 +1,135 @@ --- a/net/minecraft/client/gui/screen/inventory/ContainerScreen.java +++ b/net/minecraft/client/gui/screen/inventory/ContainerScreen.java @@ -86,6 +_,7 @@ - int i = this.field_147003_i; - int j = this.field_147009_r; - this.func_230450_a_(p_230430_1_, p_230430_4_, p_230430_2_, p_230430_3_); + int i = this.leftPos; + int j = this.topPos; + this.renderBg(p_230430_1_, p_230430_4_, p_230430_2_, p_230430_3_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawBackground(this, p_230430_1_, p_230430_2_, p_230430_3_)); RenderSystem.disableRescaleNormal(); RenderSystem.disableDepthTest(); - super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); + super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); @@ -111,13 +_,15 @@ - int j1 = slot.field_75223_e; - int k1 = slot.field_75221_f; + int j1 = slot.x; + int k1 = slot.y; RenderSystem.colorMask(true, true, true, false); -- this.func_238468_a_(p_230430_1_, j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); +- this.fillGradient(p_230430_1_, j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + int slotColor = this.getSlotColor(i1); -+ this.func_238468_a_(p_230430_1_, j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); ++ this.fillGradient(p_230430_1_, j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); RenderSystem.colorMask(true, true, true, true); RenderSystem.enableDepthTest(); } } - this.func_230451_b_(p_230430_1_, p_230430_2_, p_230430_3_); + this.renderLabels(p_230430_1_, p_230430_2_, p_230430_3_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_230430_1_, p_230430_2_, p_230430_3_)); - PlayerInventory playerinventory = this.field_230706_i_.field_71439_g.field_71071_by; - ItemStack itemstack = this.field_147012_x.func_190926_b() ? playerinventory.func_70445_o() : this.field_147012_x; - if (!itemstack.func_190926_b()) { + PlayerInventory playerinventory = this.minecraft.player.inventory; + ItemStack itemstack = this.draggingItem.isEmpty() ? playerinventory.getCarried() : this.draggingItem; + if (!itemstack.isEmpty()) { @@ -167,8 +_,10 @@ RenderSystem.translatef(0.0F, 0.0F, 32.0F); - this.func_230926_e_(200); - this.field_230707_j_.field_77023_b = 200.0F; -+ net.minecraft.client.gui.FontRenderer font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); -+ if (font == null) font = this.field_230712_o_; - this.field_230707_j_.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); -- this.field_230707_j_.func_180453_a(this.field_230712_o_, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); -+ this.field_230707_j_.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); - this.func_230926_e_(0); - this.field_230707_j_.field_77023_b = 0.0F; + this.setBlitOffset(200); + this.itemRenderer.blitOffset = 200.0F; ++ net.minecraft.client.gui.FontRenderer font = p_146982_1_.getItem().getFontRenderer(p_146982_1_); ++ if (font == null) font = this.font; + this.itemRenderer.renderAndDecorateItem(p_146982_1_, p_146982_2_, p_146982_3_); +- this.itemRenderer.renderGuiItemDecorations(this.font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.draggingItem.isEmpty() ? 0 : 8), p_146982_4_); ++ this.itemRenderer.renderGuiItemDecorations(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.draggingItem.isEmpty() ? 0 : 8), p_146982_4_); + this.setBlitOffset(0); + this.itemRenderer.blitOffset = 0.0F; } @@ -278,7 +_,8 @@ - if (super.func_231044_a_(p_231044_1_, p_231044_3_, p_231044_5_)) { + if (super.mouseClicked(p_231044_1_, p_231044_3_, p_231044_5_)) { return true; } else { -- boolean flag = this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_); -+ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_231044_5_); -+ boolean flag = this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey); - Slot slot = this.func_195360_a(p_231044_1_, p_231044_3_); - long i = Util.func_211177_b(); - this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_231044_5_; +- boolean flag = this.minecraft.options.keyPickItem.matchesMouse(p_231044_5_); ++ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.getOrCreate(p_231044_5_); ++ boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey); + Slot slot = this.findSlot(p_231044_1_, p_231044_3_); + long i = Util.getMillis(); + this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == p_231044_5_; @@ -289,6 +_,7 @@ - int j = this.field_147003_i; - int k = this.field_147009_r; - boolean flag1 = this.func_195361_a(p_231044_1_, p_231044_3_, j, k, p_231044_5_); + int j = this.leftPos; + int k = this.topPos; + boolean flag1 = this.hasClickedOutside(p_231044_1_, p_231044_3_, j, k, p_231044_5_); + if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries int l = -1; if (slot != null) { - l = slot.field_75222_d; + l = slot.index; @@ -314,7 +_,7 @@ } - } else if (!this.field_147007_t) { - if (this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { -- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_)) { -+ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { - this.func_184098_a(slot, l, p_231044_5_, ClickType.CLONE); + } else if (!this.isQuickCrafting) { + if (this.minecraft.player.inventory.getCarried().isEmpty()) { +- if (this.minecraft.options.keyPickItem.matchesMouse(p_231044_5_)) { ++ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.slotClicked(slot, l, p_231044_5_, ClickType.CLONE); } else { - boolean flag2 = l != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 344)); + boolean flag2 = l != -999 && (InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344)); @@ -338,7 +_,7 @@ - this.field_146987_F = 0; + this.quickCraftingType = 0; } else if (p_231044_5_ == 1) { - this.field_146987_F = 1; -- } else if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231044_5_)) { -+ } else if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { - this.field_146987_F = 2; + this.quickCraftingType = 1; +- } else if (this.minecraft.options.keyPickItem.matchesMouse(p_231044_5_)) { ++ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.quickCraftingType = 2; } } @@ -407,10 +_,13 @@ } - public boolean func_231048_c_(double p_231048_1_, double p_231048_3_, int p_231048_5_) { -+ super.func_231048_c_(p_231048_1_, p_231048_3_, p_231048_5_); //Forge, Call parent to release buttons - Slot slot = this.func_195360_a(p_231048_1_, p_231048_3_); - int i = this.field_147003_i; - int j = this.field_147009_r; - boolean flag = this.func_195361_a(p_231048_1_, p_231048_3_, i, j, p_231048_5_); + public boolean mouseReleased(double p_231048_1_, double p_231048_3_, int p_231048_5_) { ++ super.mouseReleased(p_231048_1_, p_231048_3_, p_231048_5_); //Forge, Call parent to release buttons + Slot slot = this.findSlot(p_231048_1_, p_231048_3_); + int i = this.leftPos; + int j = this.topPos; + boolean flag = this.hasClickedOutside(p_231048_1_, p_231048_3_, i, j, p_231048_5_); + if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries -+ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_231048_5_); ++ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.getOrCreate(p_231048_5_); int k = -1; if (slot != null) { - k = slot.field_75222_d; + k = slot.index; @@ -424,7 +_,7 @@ - if (func_231173_s_()) { - if (!this.field_146994_N.func_190926_b()) { - for(Slot slot2 : this.field_147002_h.field_75151_b) { -- if (slot2 != null && slot2.func_82869_a(this.field_230706_i_.field_71439_g) && slot2.func_75216_d() && slot2.field_75224_c == slot.field_75224_c && Container.func_94527_a(slot2, this.field_146994_N, true)) { -+ if (slot2 != null && slot2.func_82869_a(this.field_230706_i_.field_71439_g) && slot2.func_75216_d() && slot2.isSameInventory(slot) && Container.func_94527_a(slot2, this.field_146994_N, true)) { - this.func_184098_a(slot2, slot2.field_75222_d, p_231048_5_, ClickType.QUICK_MOVE); + if (hasShiftDown()) { + if (!this.lastQuickMoved.isEmpty()) { + for(Slot slot2 : this.menu.slots) { +- if (slot2 != null && slot2.mayPickup(this.minecraft.player) && slot2.hasItem() && slot2.container == slot.container && Container.canItemQuickReplace(slot2, this.lastQuickMoved, true)) { ++ if (slot2 != null && slot2.mayPickup(this.minecraft.player) && slot2.hasItem() && slot2.isSameInventory(slot) && Container.canItemQuickReplace(slot2, this.lastQuickMoved, true)) { + this.slotClicked(slot2, slot2.index, p_231048_5_, ClickType.QUICK_MOVE); } } @@ -488,7 +_,7 @@ - this.func_184098_a((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), ClickType.QUICK_CRAFT); - } else if (!this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { -- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197984_a(p_231048_5_)) { -+ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { - this.func_184098_a(slot, k, p_231048_5_, ClickType.CLONE); + this.slotClicked((Slot)null, -999, Container.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT); + } else if (!this.minecraft.player.inventory.getCarried().isEmpty()) { +- if (this.minecraft.options.keyPickItem.matchesMouse(p_231048_5_)) { ++ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.slotClicked(slot, k, p_231048_5_, ClickType.CLONE); } else { - boolean flag1 = k != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().func_228018_at_().func_198092_i(), 344)); + boolean flag1 = k != -999 && (InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344)); @@ -530,34 +_,39 @@ } - public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_3_) { -+ InputMappings.Input mouseKey = InputMappings.func_197954_a(p_231046_1_, p_231046_2_); - if (super.func_231046_a_(p_231046_1_, p_231046_2_, p_231046_3_)) { + public boolean keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_) { ++ InputMappings.Input mouseKey = InputMappings.getKey(p_231046_1_, p_231046_2_); + if (super.keyPressed(p_231046_1_, p_231046_2_, p_231046_3_)) { return true; -- } else if (this.field_230706_i_.field_71474_y.field_151445_Q.func_197976_a(p_231046_1_, p_231046_2_)) { -+ } else if (this.field_230706_i_.field_71474_y.field_151445_Q.isActiveAndMatches(mouseKey)) { - this.func_231175_as__(); +- } else if (this.minecraft.options.keyInventory.matches(p_231046_1_, p_231046_2_)) { ++ } else if (this.minecraft.options.keyInventory.isActiveAndMatches(mouseKey)) { + this.onClose(); return true; } else { -- this.func_195363_d(p_231046_1_, p_231046_2_); -+ boolean handled = this.func_195363_d(p_231046_1_, p_231046_2_);// Forge MC-146650: Needs to return true when the key is handled - if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) { -- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197976_a(p_231046_1_, p_231046_2_)) { -+ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { - this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE); -- } else if (this.field_230706_i_.field_71474_y.field_74316_C.func_197976_a(p_231046_1_, p_231046_2_)) { +- this.checkHotbarKeyPressed(p_231046_1_, p_231046_2_); ++ boolean handled = this.checkHotbarKeyPressed(p_231046_1_, p_231046_2_);// Forge MC-146650: Needs to return true when the key is handled + if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) { +- if (this.minecraft.options.keyPickItem.matches(p_231046_1_, p_231046_2_)) { ++ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) { + this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 0, ClickType.CLONE); +- } else if (this.minecraft.options.keyDrop.matches(p_231046_1_, p_231046_2_)) { + handled = true; -+ } else if (this.field_230706_i_.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { - this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_231172_r_() ? 1 : 0, ClickType.THROW); ++ } else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) { + this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, hasControlDown() ? 1 : 0, ClickType.THROW); + handled = true; } -+ } else if (this.field_230706_i_.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { ++ } else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) { + handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item. } @@ -138,36 +138,36 @@ } } - protected boolean func_195363_d(int p_195363_1_, int p_195363_2_) { - if (this.field_230706_i_.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) { -- if (this.field_230706_i_.field_71474_y.field_186718_X.func_197976_a(p_195363_1_, p_195363_2_)) { -+ if (this.field_230706_i_.field_71474_y.field_186718_X.isActiveAndMatches(InputMappings.func_197954_a(p_195363_1_, p_195363_2_))) { - this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 40, ClickType.SWAP); + protected boolean checkHotbarKeyPressed(int p_195363_1_, int p_195363_2_) { + if (this.minecraft.player.inventory.getCarried().isEmpty() && this.hoveredSlot != null) { +- if (this.minecraft.options.keySwapOffhand.matches(p_195363_1_, p_195363_2_)) { ++ if (this.minecraft.options.keySwapOffhand.isActiveAndMatches(InputMappings.getKey(p_195363_1_, p_195363_2_))) { + this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 40, ClickType.SWAP); return true; } for(int i = 0; i < 9; ++i) { -- if (this.field_230706_i_.field_71474_y.field_151456_ac[i].func_197976_a(p_195363_1_, p_195363_2_)) { -+ if (this.field_230706_i_.field_71474_y.field_151456_ac[i].isActiveAndMatches(InputMappings.func_197954_a(p_195363_1_, p_195363_2_))) { - this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP); +- if (this.minecraft.options.keyHotbarSlots[i].matches(p_195363_1_, p_195363_2_)) { ++ if (this.minecraft.options.keyHotbarSlots[i].isActiveAndMatches(InputMappings.getKey(p_195363_1_, p_195363_2_))) { + this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP); return true; } @@ -587,6 +_,18 @@ - public T func_212873_a_() { - return this.field_147002_h; + public T getMenu() { + return this.menu; + } + + @javax.annotation.Nullable -+ public Slot getSlotUnderMouse() { return this.field_147006_u; } -+ public int getGuiLeft() { return field_147003_i; } -+ public int getGuiTop() { return field_147009_r; } -+ public int getXSize() { return field_146999_f; } -+ public int getYSize() { return field_147000_g; } ++ public Slot getSlotUnderMouse() { return this.hoveredSlot; } ++ public int getGuiLeft() { return leftPos; } ++ public int getGuiTop() { return topPos; } ++ public int getXSize() { return imageWidth; } ++ public int getYSize() { return imageHeight; } + + protected int slotColor = -2130706433; + public int getSlotColor(int index) { + return slotColor; } - public void func_231175_as__() { + public void onClose() { diff --git a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch index 530dd198f0..48c05fa2aa 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch @@ -1,62 +1,62 @@ --- a/net/minecraft/client/gui/screen/inventory/CreativeScreen.java +++ b/net/minecraft/client/gui/screen/inventory/CreativeScreen.java @@ -65,6 +_,8 @@ - private Slot field_147064_C; - private CreativeCraftingListener field_147059_E; - private boolean field_195377_F; + private Slot destroyItemSlot; + private CreativeCraftingListener listener; + private boolean ignoreTextInput; + private static int tabPage = 0; + private int maxPages = 0; - private boolean field_199506_G; - private final Map> field_214085_w = Maps.newTreeMap(); + private boolean hasClickedOutside; + private final Map> visibleTags = Maps.newTreeMap(); @@ -234,6 +_,12 @@ - protected void func_231160_c_() { - if (this.field_230706_i_.field_71442_b.func_78758_h()) { - super.func_231160_c_(); -+ int tabCount = ItemGroup.field_78032_a.length; + protected void init() { + if (this.minecraft.gameMode.hasInfiniteItems()) { + super.init(); ++ int tabCount = ItemGroup.TABS.length; + if (tabCount > 12) { -+ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(field_147003_i, field_147009_r - 50, 20, 20, new StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); -+ func_230480_a_(new net.minecraft.client.gui.widget.button.Button(field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, new StringTextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ addButton(new net.minecraft.client.gui.widget.button.Button(leftPos, topPos - 50, 20, 20, new StringTextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ addButton(new net.minecraft.client.gui.widget.button.Button(leftPos + imageWidth - 20, topPos - 50, 20, 20, new StringTextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); + maxPages = (int) Math.ceil((tabCount - 12) / 10D); + } - this.field_230706_i_.field_195559_v.func_197967_a(true); - this.field_147062_A = new TextFieldWidget(this.field_230712_o_, this.field_147003_i + 82, this.field_147009_r + 6, 80, 9, new TranslationTextComponent("itemGroup.search")); - this.field_147062_A.func_146203_f(50); + this.minecraft.keyboardHandler.setSendRepeatsToGui(true); + this.searchBox = new TextFieldWidget(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, new TranslationTextComponent("itemGroup.search")); + this.searchBox.setMaxLength(50); @@ -275,7 +_,7 @@ - public boolean func_231042_a_(char p_231042_1_, int p_231042_2_) { - if (this.field_195377_F) { + public boolean charTyped(char p_231042_1_, int p_231042_2_) { + if (this.ignoreTextInput) { return false; -- } else if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { -+ } else if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { +- } else if (selectedTab != ItemGroup.TAB_SEARCH.getId()) { ++ } else if (!ItemGroup.TABS[selectedTab].hasSearchBar()) { return false; } else { - String s = this.field_147062_A.func_146179_b(); + String s = this.searchBox.getValue(); @@ -293,7 +_,7 @@ - public boolean func_231046_a_(int p_231046_1_, int p_231046_2_, int p_231046_3_) { - this.field_195377_F = false; -- if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { -+ if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { - if (this.field_230706_i_.field_71474_y.field_74310_D.func_197976_a(p_231046_1_, p_231046_2_)) { - this.field_195377_F = true; - this.func_147050_b(ItemGroup.field_78027_g); + public boolean keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_) { + this.ignoreTextInput = false; +- if (selectedTab != ItemGroup.TAB_SEARCH.getId()) { ++ if (!ItemGroup.TABS[selectedTab].hasSearchBar()) { + if (this.minecraft.options.keyChat.matches(p_231046_1_, p_231046_2_)) { + this.ignoreTextInput = true; + this.selectTab(ItemGroup.TAB_SEARCH); @@ -330,6 +_,32 @@ - private void func_147053_i() { - (this.field_147002_h).field_148330_a.clear(); - this.field_214085_w.clear(); + private void refreshSearchResults() { + (this.menu).items.clear(); + this.visibleTags.clear(); + -+ ItemGroup tab = ItemGroup.field_78032_a[field_147058_w]; -+ if (tab.hasSearchBar() && tab != ItemGroup.field_78027_g) { -+ tab.func_78018_a(field_147002_h.field_148330_a); -+ if (!this.field_147062_A.func_146179_b().isEmpty()) { ++ ItemGroup tab = ItemGroup.TABS[selectedTab]; ++ if (tab.hasSearchBar() && tab != ItemGroup.TAB_SEARCH) { ++ tab.fillItemList(menu.items); ++ if (!this.searchBox.getValue().isEmpty()) { + //TODO: Make this a SearchTree not a manual search -+ String search = this.field_147062_A.func_146179_b().toLowerCase(Locale.ROOT); -+ java.util.Iterator itr = field_147002_h.field_148330_a.iterator(); ++ String search = this.searchBox.getValue().toLowerCase(Locale.ROOT); ++ java.util.Iterator itr = menu.items.iterator(); + while (itr.hasNext()) { + ItemStack stack = itr.next(); + boolean matches = false; -+ for (ITextComponent line : stack.func_82840_a(this.field_230706_i_.field_71439_g, this.field_230706_i_.field_71474_y.field_82882_x ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL)) { -+ if (TextFormatting.func_110646_a(line.getString()).toLowerCase(Locale.ROOT).contains(search)) { ++ for (ITextComponent line : stack.getTooltipLines(this.minecraft.player, this.minecraft.options.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL)) { ++ if (TextFormatting.stripFormatting(line.getString()).toLowerCase(Locale.ROOT).contains(search)) { + matches = true; + break; + } @@ -65,213 +65,213 @@ + itr.remove(); + } + } -+ this.field_147067_x = 0.0F; -+ field_147002_h.func_148329_a(0.0F); ++ this.scrollOffs = 0.0F; ++ menu.scrollTo(0.0F); + return; + } + - String s = this.field_147062_A.func_146179_b(); + String s = this.searchBox.getValue(); if (s.isEmpty()) { - for(Item item : Registry.field_212630_s) { + for(Item item : Registry.ITEM) { @@ -375,9 +_,9 @@ - protected void func_230451_b_(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { - ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; -- if (itemgroup.func_78019_g()) { -+ if (itemgroup != null && itemgroup.func_78019_g()) { + protected void renderLabels(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { + ItemGroup itemgroup = ItemGroup.TABS[selectedTab]; +- if (itemgroup.showTitle()) { ++ if (itemgroup != null && itemgroup.showTitle()) { RenderSystem.disableBlend(); -- this.field_230712_o_.func_243248_b(p_230451_1_, itemgroup.func_242392_c(), 8.0F, 6.0F, 4210752); -+ this.field_230712_o_.func_243248_b(p_230451_1_, itemgroup.func_242392_c(), 8.0F, 6.0F, itemgroup.getLabelColor()); +- this.font.draw(p_230451_1_, itemgroup.getDisplayName(), 8.0F, 6.0F, 4210752); ++ this.font.draw(p_230451_1_, itemgroup.getDisplayName(), 8.0F, 6.0F, itemgroup.getLabelColor()); } } @@ -388,7 +_,7 @@ - double d1 = p_231044_3_ - (double)this.field_147009_r; + double d1 = p_231044_3_ - (double)this.topPos; - for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -- if (this.func_195375_a(itemgroup, d0, d1)) { -+ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) { + for(ItemGroup itemgroup : ItemGroup.TABS) { +- if (this.checkTabClicked(itemgroup, d0, d1)) { ++ if (itemgroup != null && this.checkTabClicked(itemgroup, d0, d1)) { return true; } } @@ -409,7 +_,7 @@ - this.field_147066_y = false; + this.scrolling = false; - for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -- if (this.func_195375_a(itemgroup, d0, d1)) { -+ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) { - this.func_147050_b(itemgroup); + for(ItemGroup itemgroup : ItemGroup.TABS) { +- if (this.checkTabClicked(itemgroup, d0, d1)) { ++ if (itemgroup != null && this.checkTabClicked(itemgroup, d0, d1)) { + this.selectTab(itemgroup); return true; } @@ -420,12 +_,15 @@ } - private boolean func_147055_p() { -+ if (ItemGroup.field_78032_a[field_147058_w] == null) return false; - return field_147058_w != ItemGroup.field_78036_m.func_78021_a() && ItemGroup.field_78032_a[field_147058_w].func_78017_i() && this.field_147002_h.func_148328_e(); + private boolean canScroll() { ++ if (ItemGroup.TABS[selectedTab] == null) return false; + return selectedTab != ItemGroup.TAB_INVENTORY.getId() && ItemGroup.TABS[selectedTab].canScroll() && this.menu.canScroll(); } - private void func_147050_b(ItemGroup p_147050_1_) { + private void selectTab(ItemGroup p_147050_1_) { + if (p_147050_1_ == null) return; - int i = field_147058_w; - field_147058_w = p_147050_1_.func_78021_a(); + int i = selectedTab; + selectedTab = p_147050_1_.getId(); + slotColor = p_147050_1_.getSlotColor(); - this.field_147008_s.clear(); - (this.field_147002_h).field_148330_a.clear(); - if (p_147050_1_ == ItemGroup.field_192395_m) { + this.quickCraftSlots.clear(); + (this.menu).items.clear(); + if (p_147050_1_ == ItemGroup.TAB_HOTBAR) { @@ -502,13 +_,15 @@ } - if (this.field_147062_A != null) { -- if (p_147050_1_ == ItemGroup.field_78027_g) { + if (this.searchBox != null) { +- if (p_147050_1_ == ItemGroup.TAB_SEARCH) { + if (p_147050_1_.hasSearchBar()) { - this.field_147062_A.func_146189_e(true); - this.field_147062_A.func_146205_d(false); - this.field_147062_A.func_146195_b(true); - if (i != p_147050_1_.func_78021_a()) { - this.field_147062_A.func_146180_a(""); + this.searchBox.setVisible(true); + this.searchBox.setCanLoseFocus(false); + this.searchBox.setFocus(true); + if (i != p_147050_1_.getId()) { + this.searchBox.setValue(""); } -+ this.field_147062_A.func_230991_b_(p_147050_1_.getSearchbarWidth()); -+ this.field_147062_A.field_230690_l_ = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.func_230998_h_(); ++ this.searchBox.setWidth(p_147050_1_.getSearchbarWidth()); ++ this.searchBox.x = this.leftPos + (82 /*default left*/ + 89 /*default width*/) - this.searchBox.getWidth(); - this.func_147053_i(); + this.refreshSearchResults(); } else { @@ -568,16 +_,35 @@ - this.func_230446_a_(p_230430_1_); - super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); + this.renderBackground(p_230430_1_); + super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); -- for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -- if (this.func_238809_a_(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { +- for(ItemGroup itemgroup : ItemGroup.TABS) { +- if (this.checkTabHovering(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { + int start = tabPage * 10; -+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10) + 2); ++ int end = Math.min(ItemGroup.TABS.length, ((tabPage + 1) * 10) + 2); + if (tabPage != 0) start += 2; + boolean rendered = false; + + for (int x = start; x < end; x++) { -+ ItemGroup itemgroup = ItemGroup.field_78032_a[x]; -+ if (itemgroup != null && this.func_238809_a_(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { ++ ItemGroup itemgroup = ItemGroup.TABS[x]; ++ if (itemgroup != null && this.checkTabHovering(p_230430_1_, itemgroup, p_230430_2_, p_230430_3_)) { + rendered = true; break; } } -+ if (!rendered && !this.func_238809_a_(p_230430_1_, ItemGroup.field_78027_g, p_230430_2_, p_230430_3_)) -+ this.func_238809_a_(p_230430_1_, ItemGroup.field_78036_m, p_230430_2_, p_230430_3_); ++ if (!rendered && !this.checkTabHovering(p_230430_1_, ItemGroup.TAB_SEARCH, p_230430_2_, p_230430_3_)) ++ this.checkTabHovering(p_230430_1_, ItemGroup.TAB_INVENTORY, p_230430_2_, p_230430_3_); - if (this.field_147064_C != null && field_147058_w == ItemGroup.field_78036_m.func_78021_a() && this.func_195359_a(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, (double)p_230430_2_, (double)p_230430_3_)) { - this.func_238652_a_(p_230430_1_, field_243345_D, p_230430_2_, p_230430_3_); + if (this.destroyItemSlot != null && selectedTab == ItemGroup.TAB_INVENTORY.getId() && this.isHovering(this.destroyItemSlot.x, this.destroyItemSlot.y, 16, 16, (double)p_230430_2_, (double)p_230430_3_)) { + this.renderTooltip(p_230430_1_, TRASH_SLOT_TOOLTIP, p_230430_2_, p_230430_3_); } + if (maxPages != 0) { + ITextComponent page = new StringTextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); + RenderSystem.disableLighting(); -+ this.func_230926_e_(300); -+ this.field_230707_j_.field_77023_b = 300.0F; -+ field_230712_o_.func_238407_a_(p_230430_1_, page.func_241878_f(), field_147003_i + (field_146999_f / 2) - (field_230712_o_.func_238414_a_(page) / 2), field_147009_r - 44, -1); -+ this.func_230926_e_(0); -+ this.field_230707_j_.field_77023_b = 0.0F; ++ this.setBlitOffset(300); ++ this.itemRenderer.blitOffset = 300.0F; ++ font.drawShadow(p_230430_1_, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1); ++ this.setBlitOffset(0); ++ this.itemRenderer.blitOffset = 0.0F; + } + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.func_230459_a_(p_230430_1_, p_230430_2_, p_230430_3_); + this.renderTooltip(p_230430_1_, p_230430_2_, p_230430_3_); } @@ -612,7 +_,10 @@ - list1.add(1, itemgroup.func_242392_c().func_230532_e_().func_240699_a_(TextFormatting.BLUE)); + list1.add(1, itemgroup.getDisplayName().copy().withStyle(TextFormatting.BLUE)); } -- this.func_243308_b(p_230457_1_, list1, p_230457_3_, p_230457_4_); -+ net.minecraft.client.gui.FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_); +- this.renderComponentTooltip(p_230457_1_, list1, p_230457_3_, p_230457_4_); ++ net.minecraft.client.gui.FontRenderer font = p_230457_2_.getItem().getFontRenderer(p_230457_2_); + net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_); -+ this.renderWrappedToolTip(p_230457_1_, list1, p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font)); ++ this.renderWrappedToolTip(p_230457_1_, list1, p_230457_3_, p_230457_4_, (font == null ? this.font : font)); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } else { - super.func_230457_a_(p_230457_1_, p_230457_2_, p_230457_3_, p_230457_4_); + super.renderTooltip(p_230457_1_, p_230457_2_, p_230457_3_, p_230457_4_); } @@ -623,25 +_,44 @@ RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; + ItemGroup itemgroup = ItemGroup.TABS[selectedTab]; -- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) { -- this.field_230706_i_.func_110434_K().func_110577_a(field_147061_u); -- if (itemgroup1.func_78021_a() != field_147058_w) { +- for(ItemGroup itemgroup1 : ItemGroup.TABS) { +- this.minecraft.getTextureManager().bind(CREATIVE_TABS_LOCATION); +- if (itemgroup1.getId() != selectedTab) { + int start = tabPage * 10; -+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2)); ++ int end = Math.min(ItemGroup.TABS.length, ((tabPage + 1) * 10 + 2)); + if (tabPage != 0) start += 2; + + for (int idx = start; idx < end; idx++) { -+ ItemGroup itemgroup1 = ItemGroup.field_78032_a[idx]; -+ if (itemgroup1 != null && itemgroup1.func_78021_a() != field_147058_w) { -+ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup1.getTabsImage()); - this.func_238808_a_(p_230450_1_, itemgroup1); ++ ItemGroup itemgroup1 = ItemGroup.TABS[idx]; ++ if (itemgroup1 != null && itemgroup1.getId() != selectedTab) { ++ this.minecraft.getTextureManager().bind(itemgroup1.getTabsImage()); + this.renderTabButton(p_230450_1_, itemgroup1); } } -- this.field_230706_i_.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f())); +- this.minecraft.getTextureManager().bind(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.getBackgroundSuffix())); + if (tabPage != 0) { -+ if (itemgroup != ItemGroup.field_78027_g) { -+ this.field_230706_i_.func_110434_K().func_110577_a(ItemGroup.field_78027_g.getTabsImage()); -+ func_238808_a_(p_230450_1_, ItemGroup.field_78027_g); ++ if (itemgroup != ItemGroup.TAB_SEARCH) { ++ this.minecraft.getTextureManager().bind(ItemGroup.TAB_SEARCH.getTabsImage()); ++ renderTabButton(p_230450_1_, ItemGroup.TAB_SEARCH); + } -+ if (itemgroup != ItemGroup.field_78036_m) { -+ this.field_230706_i_.func_110434_K().func_110577_a(ItemGroup.field_78036_m.getTabsImage()); -+ func_238808_a_(p_230450_1_, ItemGroup.field_78036_m); ++ if (itemgroup != ItemGroup.TAB_INVENTORY) { ++ this.minecraft.getTextureManager().bind(ItemGroup.TAB_INVENTORY.getTabsImage()); ++ renderTabButton(p_230450_1_, ItemGroup.TAB_INVENTORY); + } + } + -+ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup.getBackgroundImage()); - this.func_238474_b_(p_230450_1_, this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); - this.field_147062_A.func_230430_a_(p_230450_1_, p_230450_3_, p_230450_4_, p_230450_2_); ++ this.minecraft.getTextureManager().bind(itemgroup.getBackgroundImage()); + this.blit(p_230450_1_, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight); + this.searchBox.render(p_230450_1_, p_230450_3_, p_230450_4_, p_230450_2_); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - int i = this.field_147003_i + 175; - int j = this.field_147009_r + 18; + int i = this.leftPos + 175; + int j = this.topPos + 18; int k = j + 112; -- this.field_230706_i_.func_110434_K().func_110577_a(field_147061_u); -+ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup.getTabsImage()); - if (itemgroup.func_78017_i()) { - this.func_238474_b_(p_230450_1_, i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); +- this.minecraft.getTextureManager().bind(CREATIVE_TABS_LOCATION); ++ this.minecraft.getTextureManager().bind(itemgroup.getTabsImage()); + if (itemgroup.canScroll()) { + this.blit(p_230450_1_, i, j + (int)((float)(k - j - 17) * this.scrollOffs), 232 + (this.canScroll() ? 0 : 12), 0, 12, 15); } -+ if ((itemgroup == null || itemgroup.getTabPage() != tabPage) && (itemgroup != ItemGroup.field_78027_g && itemgroup != ItemGroup.field_78036_m)) ++ if ((itemgroup == null || itemgroup.getTabPage() != tabPage) && (itemgroup != ItemGroup.TAB_SEARCH && itemgroup != ItemGroup.TAB_INVENTORY)) + return; + - this.func_238808_a_(p_230450_1_, itemgroup); - if (itemgroup == ItemGroup.field_78036_m) { - InventoryScreen.func_228187_a_(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_230450_3_), (float)(this.field_147009_r + 45 - 30 - p_230450_4_), this.field_230706_i_.field_71439_g); + this.renderTabButton(p_230450_1_, itemgroup); + if (itemgroup == ItemGroup.TAB_INVENTORY) { + InventoryScreen.renderEntityInInventory(this.leftPos + 88, this.topPos + 45, 20, (float)(this.leftPos + 88 - p_230450_3_), (float)(this.topPos + 45 - 30 - p_230450_4_), this.minecraft.player); @@ -650,6 +_,7 @@ } - protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { -+ if (p_195375_1_.getTabPage() != tabPage && p_195375_1_ != ItemGroup.field_78027_g && p_195375_1_ != ItemGroup.field_78036_m) return false; - int i = p_195375_1_.func_78020_k(); + protected boolean checkTabClicked(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { ++ if (p_195375_1_.getTabPage() != tabPage && p_195375_1_ != ItemGroup.TAB_SEARCH && p_195375_1_ != ItemGroup.TAB_INVENTORY) return false; + int i = p_195375_1_.getColumn(); int j = 28 * i; int k = 0; @@ -718,6 +_,8 @@ - i1 = i1 + (this.field_147000_g - 4); + i1 = i1 + (this.imageHeight - 4); } + RenderSystem.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. + RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.func_238474_b_(p_238808_1_, l, i1, j, k, 28, 32); - this.field_230707_j_.field_77023_b = 100.0F; + this.blit(p_238808_1_, l, i1, j, k, 28, 32); + this.itemRenderer.blitOffset = 100.0F; l = l + 6; @@ -883,6 +_,22 @@ - public boolean func_82869_a(PlayerEntity p_82869_1_) { - return this.field_148332_b.func_82869_a(p_82869_1_); + public boolean mayPickup(PlayerEntity p_82869_1_) { + return this.target.mayPickup(p_82869_1_); + } + + @Override + public int getSlotIndex() { -+ return this.field_148332_b.getSlotIndex(); ++ return this.target.getSlotIndex(); + } + + @Override + public boolean isSameInventory(Slot other) { -+ return this.field_148332_b.isSameInventory(other); ++ return this.target.isSameInventory(other); + } + + @Override + public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) { -+ this.field_148332_b.setBackground(atlas, sprite); ++ this.target.setBackground(atlas, sprite); + return this; } } diff --git a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch index a2b29fd509..e0228502c6 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch @@ -1,36 +1,36 @@ --- a/net/minecraft/client/gui/widget/Widget.java +++ b/net/minecraft/client/gui/widget/Widget.java @@ -111,7 +_,7 @@ - this.func_238474_b_(p_230431_1_, this.field_230690_l_, this.field_230691_m_, 0, 46 + i * 20, this.field_230688_j_ / 2, this.field_230689_k_); - this.func_238474_b_(p_230431_1_, this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_, 200 - this.field_230688_j_ / 2, 46 + i * 20, this.field_230688_j_ / 2, this.field_230689_k_); - this.func_230441_a_(p_230431_1_, minecraft, p_230431_2_, p_230431_3_); -- int j = this.field_230693_o_ ? 16777215 : 10526880; + this.blit(p_230431_1_, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height); + this.blit(p_230431_1_, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); + this.renderBg(p_230431_1_, minecraft, p_230431_2_, p_230431_3_); +- int j = this.active ? 16777215 : 10526880; + int j = getFGColor(); - func_238472_a_(p_230431_1_, fontrenderer, this.func_230458_i_(), this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, j | MathHelper.func_76123_f(this.field_230695_q_ * 255.0F) << 24); + drawCenteredString(p_230431_1_, fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); } @@ -206,6 +_,10 @@ - this.field_230688_j_ = p_230991_1_; + this.width = p_230991_1_; } + public void setHeight(int value) { -+ this.field_230689_k_ = value; ++ this.height = value; + } + - public void func_230986_a_(float p_230986_1_) { - this.field_230695_q_ = p_230986_1_; + public void setAlpha(float p_230986_1_) { + this.alpha = p_230986_1_; } @@ -232,5 +_,18 @@ - protected void func_230996_d_(boolean p_230996_1_) { - this.field_230686_c_ = p_230996_1_; + protected void setFocused(boolean p_230996_1_) { + this.focused = p_230996_1_; + } + + public static final int UNSET_FG_COLOR = -1; + protected int packedFGColor = UNSET_FG_COLOR; + public int getFGColor() { + if (packedFGColor != UNSET_FG_COLOR) return packedFGColor; -+ return this.field_230693_o_ ? 16777215 : 10526880; // White : Light Grey ++ return this.active ? 16777215 : 10526880; // White : Light Grey + } + public void setFGColor(int color) { + this.packedFGColor = color; diff --git a/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch index 50fa8c0ede..00f619eb5a 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/widget/list/AbstractList.java +++ b/net/minecraft/client/gui/widget/list/AbstractList.java @@ -492,6 +_,13 @@ - p_238480_1_.field_230666_a_ = this; + p_238480_1_.list = this; } -+ public int getWidth() { return this.field_230670_d_; } -+ public int getHeight() { return this.field_230671_e_; } -+ public int getTop() { return this.field_230672_i_; } -+ public int getBottom() { return this.field_230673_j_; } -+ public int getLeft() { return this.field_230675_l_; } -+ public int getRight() { return this.field_230674_k_; } ++ public int getWidth() { return this.width; } ++ public int getHeight() { return this.height; } ++ public int getTop() { return this.y0; } ++ public int getBottom() { return this.y1; } ++ public int getLeft() { return this.x0; } ++ public int getRight() { return this.x1; } + @OnlyIn(Dist.CLIENT) public abstract static class AbstractListEntry> implements IGuiEventListener { diff --git a/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch index 64db1e2b6b..bf48bc99d9 100644 --- a/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch @@ -3,58 +3,58 @@ @@ -50,7 +_,7 @@ } - protected int func_230952_d_() { -- return super.func_230952_d_() + 15; -+ return super.func_230952_d_() + 15 + 20; + protected int getScrollbarPosition() { +- return super.getScrollbarPosition() + 15; ++ return super.getScrollbarPosition() + 15 + 20; } - public int func_230949_c_() { + public int getRowWidth() { @@ -94,7 +_,7 @@ private KeyEntry(final KeyBinding p_i232281_2_, final ITextComponent p_i232281_3_) { - this.field_148282_b = p_i232281_2_; - this.field_148283_c = p_i232281_3_; -- this.field_148280_d = new Button(0, 0, 75, 20, p_i232281_3_, (p_214386_2_) -> { -+ this.field_148280_d = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, p_i232281_3_, (p_214386_2_) -> { - KeyBindingList.this.field_148191_k.field_146491_f = p_i232281_2_; + this.key = p_i232281_2_; + this.name = p_i232281_3_; +- this.changeButton = new Button(0, 0, 75, 20, p_i232281_3_, (p_214386_2_) -> { ++ this.changeButton = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, p_i232281_3_, (p_214386_2_) -> { + KeyBindingList.this.controlsScreen.selectedKey = p_i232281_2_; }) { - protected IFormattableTextComponent func_230442_c_() { + protected IFormattableTextComponent createNarrationMessage() { @@ -102,6 +_,7 @@ } }; - this.field_148281_e = new Button(0, 0, 50, 20, new TranslationTextComponent("controls.reset"), (p_214387_2_) -> { -+ field_148282_b.setToDefault(); - KeyBindingList.this.field_230668_b_.field_71474_y.func_198014_a(p_i232281_2_, p_i232281_2_.func_197977_i()); - KeyBinding.func_74508_b(); + this.resetButton = new Button(0, 0, 50, 20, new TranslationTextComponent("controls.reset"), (p_214387_2_) -> { ++ key.setToDefault(); + KeyBindingList.this.minecraft.options.setKey(p_i232281_2_, p_i232281_2_.getDefaultKey()); + KeyBinding.resetMapping(); }) { @@ -114,7 +_,7 @@ - public void func_230432_a_(MatrixStack p_230432_1_, int p_230432_2_, int p_230432_3_, int p_230432_4_, int p_230432_5_, int p_230432_6_, int p_230432_7_, int p_230432_8_, boolean p_230432_9_, float p_230432_10_) { - boolean flag = KeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; - KeyBindingList.this.field_230668_b_.field_71466_p.func_243248_b(p_230432_1_, this.field_148283_c, (float)(p_230432_4_ + 90 - KeyBindingList.this.field_148188_n), (float)(p_230432_3_ + p_230432_6_ / 2 - 9 / 2), 16777215); -- this.field_148281_e.field_230690_l_ = p_230432_4_ + 190; -+ this.field_148281_e.field_230690_l_ = p_230432_4_ + 190 + 20; - this.field_148281_e.field_230691_m_ = p_230432_3_; - this.field_148281_e.field_230693_o_ = !this.field_148282_b.func_197985_l(); - this.field_148281_e.func_230430_a_(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); + public void render(MatrixStack p_230432_1_, int p_230432_2_, int p_230432_3_, int p_230432_4_, int p_230432_5_, int p_230432_6_, int p_230432_7_, int p_230432_8_, boolean p_230432_9_, float p_230432_10_) { + boolean flag = KeyBindingList.this.controlsScreen.selectedKey == this.key; + KeyBindingList.this.minecraft.font.draw(p_230432_1_, this.name, (float)(p_230432_4_ + 90 - KeyBindingList.this.maxNameWidth), (float)(p_230432_3_ + p_230432_6_ / 2 - 9 / 2), 16777215); +- this.resetButton.x = p_230432_4_ + 190; ++ this.resetButton.x = p_230432_4_ + 190 + 20; + this.resetButton.y = p_230432_3_; + this.resetButton.active = !this.key.isDefault(); + this.resetButton.render(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); @@ -122,11 +_,12 @@ - this.field_148280_d.field_230691_m_ = p_230432_3_; - this.field_148280_d.func_238482_a_(this.field_148282_b.func_238171_j_()); + this.changeButton.y = p_230432_3_; + this.changeButton.setMessage(this.key.getTranslatedKeyMessage()); boolean flag1 = false; + boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G - if (!this.field_148282_b.func_197986_j()) { - for(KeyBinding keybinding : KeyBindingList.this.field_230668_b_.field_71474_y.field_74324_K) { - if (keybinding != this.field_148282_b && this.field_148282_b.func_197983_b(keybinding)) { + if (!this.key.isUnbound()) { + for(KeyBinding keybinding : KeyBindingList.this.minecraft.options.keyMappings) { + if (keybinding != this.key && this.key.same(keybinding)) { flag1 = true; - break; -+ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b); ++ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.key); } } } @@ -134,7 +_,7 @@ if (flag) { - this.field_148280_d.func_238482_a_((new StringTextComponent("> ")).func_230529_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(TextFormatting.YELLOW)).func_240702_b_(" <").func_240699_a_(TextFormatting.YELLOW)); + this.changeButton.setMessage((new StringTextComponent("> ")).append(this.changeButton.getMessage().copy().withStyle(TextFormatting.YELLOW)).append(" <").withStyle(TextFormatting.YELLOW)); } else if (flag1) { -- this.field_148280_d.func_238482_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(TextFormatting.RED)); -+ this.field_148280_d.func_238482_a_(this.field_148280_d.func_230458_i_().func_230532_e_().func_240699_a_(keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED)); +- this.changeButton.setMessage(this.changeButton.getMessage().copy().withStyle(TextFormatting.RED)); ++ this.changeButton.setMessage(this.changeButton.getMessage().copy().withStyle(keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED)); } - this.field_148280_d.func_230430_a_(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); + this.changeButton.render(p_230432_1_, p_230432_7_, p_230432_8_, p_230432_10_); diff --git a/patches/minecraft/net/minecraft/client/main/Main.java.patch b/patches/minecraft/net/minecraft/client/main/Main.java.patch index eb2dff2fa9..54f4621f42 100644 --- a/patches/minecraft/net/minecraft/client/main/Main.java.patch +++ b/patches/minecraft/net/minecraft/client/main/Main.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/main/Main.java +++ b/net/minecraft/client/main/Main.java @@ -120,7 +_,7 @@ - String s7 = func_206236_a(optionset, optionspec); - Integer integer = func_206236_a(optionset, optionspec1); - CrashReport.func_230188_h_(); -- Bootstrap.func_151354_b(); -+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.func_151354_b(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); - Bootstrap.func_218821_c(); - Util.func_240994_l_(); + String s7 = parseArgument(optionset, optionspec); + Integer integer = parseArgument(optionset, optionspec1); + CrashReport.preload(); +- Bootstrap.bootStrap(); ++ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.bootStrap(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); + Bootstrap.validate(); + Util.startTimerHackThread(); Session session = new Session(optionspec10.value(optionset), s5, optionspec12.value(optionset), optionspec21.value(optionset)); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch index 3d80367a67..d4b8851ab0 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/client/multiplayer/ClientChunkProvider.java +++ b/net/minecraft/client/multiplayer/ClientChunkProvider.java @@ -59,6 +_,7 @@ - int i = this.field_217256_d.func_217191_a(p_73234_1_, p_73234_2_); - Chunk chunk = this.field_217256_d.func_217192_a(i); - if (func_217249_a(chunk, p_73234_1_, p_73234_2_)) { + int i = this.storage.getIndex(p_73234_1_, p_73234_2_); + Chunk chunk = this.storage.getChunk(i); + if (isValidChunk(chunk, p_73234_1_, p_73234_2_)) { + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(chunk)); - this.field_217256_d.func_217190_a(i, chunk, (Chunk)null); + this.storage.replace(i, chunk, (Chunk)null); } @@ -112,6 +_,7 @@ } - this.field_73235_d.func_228323_e_(p_228313_1_, p_228313_2_); + this.level.onChunkLoaded(p_228313_1_, p_228313_2_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); return chunk; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch index 2d6a0cd5d5..05bc171698 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch @@ -3,172 +3,172 @@ @@ -93,6 +_,7 @@ } - public boolean func_187103_a(BlockPos p_187103_1_) { -+ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; - if (this.field_78776_a.field_71439_g.func_223729_a(this.field_78776_a.field_71441_e, p_187103_1_, this.field_78779_k)) { + public boolean destroyBlock(BlockPos p_187103_1_) { ++ if (minecraft.player.getMainHandItem().onBlockStartBreak(p_187103_1_, minecraft.player)) return false; + if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_187103_1_, this.localPlayerMode)) { return false; } else { @@ -104,12 +_,11 @@ - Block block = blockstate.func_177230_c(); - if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_78776_a.field_71439_g.func_195070_dx()) { + Block block = blockstate.getBlock(); + if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.minecraft.player.canUseGameMasterBlocks()) { return false; -- } else if (blockstate.func_196958_f()) { +- } else if (blockstate.isAir()) { + } else if (blockstate.isAir(world, p_187103_1_)) { return false; } else { -- block.func_176208_a(world, p_187103_1_, blockstate, this.field_78776_a.field_71439_g); - FluidState fluidstate = world.func_204610_c(p_187103_1_); -- boolean flag = world.func_180501_a(p_187103_1_, fluidstate.func_206883_i(), 11); -+ boolean flag = blockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, fluidstate); +- block.playerWillDestroy(world, p_187103_1_, blockstate, this.minecraft.player); + FluidState fluidstate = world.getFluidState(p_187103_1_); +- boolean flag = world.setBlock(p_187103_1_, fluidstate.createLegacyBlock(), 11); ++ boolean flag = blockstate.removedByPlayer(world, p_187103_1_, minecraft.player, false, fluidstate); if (flag) { - block.func_176206_d(world, p_187103_1_, blockstate); + block.destroy(world, p_187103_1_, blockstate); } @@ -130,21 +_,25 @@ - BlockState blockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, blockstate, 1.0F); - this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_).isCanceled()) - this.func_187103_a(p_180511_1_); - this.field_78781_i = 5; - } else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) { - if (this.field_78778_j) { - this.func_225324_a(CPlayerDiggingPacket.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_); + BlockState blockstate = this.minecraft.level.getBlockState(p_180511_1_); + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_180511_1_, blockstate, 1.0F); + this.sendBlockAction(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_); ++ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_180511_1_, p_180511_2_).isCanceled()) + this.destroyBlock(p_180511_1_); + this.destroyDelay = 5; + } else if (!this.isDestroying || !this.sameDestroyTarget(p_180511_1_)) { + if (this.isDestroying) { + this.sendBlockAction(CPlayerDiggingPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_180511_2_); } -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_180511_1_, p_180511_2_); - BlockState blockstate1 = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, blockstate1, 0.0F); - this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_); -- boolean flag = !blockstate1.func_196958_f(); -+ boolean flag = !blockstate1.isAir(this.field_78776_a.field_71441_e, p_180511_1_); - if (flag && this.field_78770_f == 0.0F) { + BlockState blockstate1 = this.minecraft.level.getBlockState(p_180511_1_); + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_180511_1_, blockstate1, 0.0F); + this.sendBlockAction(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_); +- boolean flag = !blockstate1.isAir(); ++ boolean flag = !blockstate1.isAir(this.minecraft.level, p_180511_1_); + if (flag && this.destroyProgress == 0.0F) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - blockstate1.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); + blockstate1.attack(this.minecraft.level, p_180511_1_, this.minecraft.player); } + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - if (flag && blockstate1.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) { - this.func_187103_a(p_180511_1_); + if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level, p_180511_1_) >= 1.0F) { + this.destroyBlock(p_180511_1_); } else { @@ -184,22 +_,24 @@ - BlockState blockstate1 = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_); - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180512_1_, blockstate1, 1.0F); - this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180512_1_, p_180512_2_); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180512_1_, p_180512_2_).isCanceled()) - this.func_187103_a(p_180512_1_); + BlockState blockstate1 = this.minecraft.level.getBlockState(p_180512_1_); + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_180512_1_, blockstate1, 1.0F); + this.sendBlockAction(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180512_1_, p_180512_2_); ++ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_180512_1_, p_180512_2_).isCanceled()) + this.destroyBlock(p_180512_1_); return true; - } else if (this.func_178893_a(p_180512_1_)) { - BlockState blockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(this.field_78776_a.field_71441_e, p_180512_1_)) { - this.field_78778_j = false; + } else if (this.sameDestroyTarget(p_180512_1_)) { + BlockState blockstate = this.minecraft.level.getBlockState(p_180512_1_); +- if (blockstate.isAir()) { ++ if (blockstate.isAir(this.minecraft.level, p_180512_1_)) { + this.isDestroying = false; return false; } else { - this.field_78770_f += blockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180512_1_); - if (this.field_78780_h % 4.0F == 0.0F) { -- SoundType soundtype = blockstate.func_215695_r(); -+ SoundType soundtype = blockstate.getSoundType(this.field_78776_a.field_71441_e, p_180512_1_, this.field_78776_a.field_71439_g); - this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); + this.destroyProgress += blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level, p_180512_1_); + if (this.destroyTicks % 4.0F == 0.0F) { +- SoundType soundtype = blockstate.getSoundType(); ++ SoundType soundtype = blockstate.getSoundType(this.minecraft.level, p_180512_1_, this.minecraft.player); + this.minecraft.getSoundManager().play(new SimpleSound(soundtype.getHitSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 8.0F, soundtype.getPitch() * 0.5F, p_180512_1_)); } - ++this.field_78780_h; - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180512_1_, blockstate, MathHelper.func_76131_a(this.field_78770_f, 0.0F, 1.0F)); -+ if (net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180512_1_, p_180512_2_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - if (this.field_78770_f >= 1.0F) { - this.field_78778_j = false; - this.func_225324_a(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, p_180512_1_, p_180512_2_); + ++this.destroyTicks; + this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_180512_1_, blockstate, MathHelper.clamp(this.destroyProgress, 0.0F, 1.0F)); ++ if (net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_180512_1_, p_180512_2_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; + if (this.destroyProgress >= 1.0F) { + this.isDestroying = false; + this.sendBlockAction(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, p_180512_1_, p_180512_2_); @@ -218,7 +_,8 @@ } - public float func_78757_d() { -- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F; -+ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e(); -+ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F; + public float getPickRange() { +- return this.localPlayerMode.isCreative() ? 5.0F : 4.5F; ++ float attrib = (float)minecraft.player.getAttribute(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).getValue(); ++ return this.localPlayerMode.isCreative() ? attrib : attrib - 0.5F; } - public void func_78765_e() { + public void tick() { @@ -235,7 +_,7 @@ - ItemStack itemstack = this.field_78776_a.field_71439_g.func_184614_ca(); - boolean flag = this.field_85183_f.func_190926_b() && itemstack.func_190926_b(); - if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) { -- flag = itemstack.func_77973_b() == this.field_85183_f.func_77973_b() && ItemStack.func_77970_a(itemstack, this.field_85183_f) && (itemstack.func_77984_f() || itemstack.func_77952_i() == this.field_85183_f.func_77952_i()); -+ flag = !this.field_85183_f.shouldCauseBlockBreakReset(itemstack); + ItemStack itemstack = this.minecraft.player.getMainHandItem(); + boolean flag = this.destroyingItem.isEmpty() && itemstack.isEmpty(); + if (!this.destroyingItem.isEmpty() && !itemstack.isEmpty()) { +- flag = itemstack.getItem() == this.destroyingItem.getItem() && ItemStack.tagMatches(itemstack, this.destroyingItem) && (itemstack.isDamageableItem() || itemstack.getDamageValue() == this.destroyingItem.getDamageValue()); ++ flag = !this.destroyingItem.shouldCauseBlockBreakReset(itemstack); } - return p_178893_1_.equals(this.field_178895_c) && flag; + return p_178893_1_.equals(this.destroyBlockPos) && flag; @@ -257,13 +_,27 @@ return ActionResultType.FAIL; } else { - ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_); + ItemStack itemstack = p_217292_1_.getItemInHand(p_217292_3_); + net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks + .onRightClickBlock(p_217292_1_, p_217292_3_, blockpos, p_217292_4_); + if (event.isCanceled()) { -+ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); ++ this.connection.send(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); + return event.getCancellationResult(); + } - if (this.field_78779_k == GameType.SPECTATOR) { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); + if (this.localPlayerMode == GameType.SPECTATOR) { + this.connection.send(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); return ActionResultType.SUCCESS; } else { -- boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b(); +- boolean flag = !p_217292_1_.getMainHandItem().isEmpty() || !p_217292_1_.getOffhandItem().isEmpty(); + ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_); + if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { + ActionResultType result = itemstack.onItemUseFirst(itemusecontext); + if (result != ActionResultType.PASS) { -+ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); ++ this.connection.send(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); + return result; + } + } -+ boolean flag = !p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) || !p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_); - boolean flag1 = p_217292_1_.func_226563_dT_() && flag; ++ boolean flag = !p_217292_1_.getMainHandItem().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) || !p_217292_1_.getOffhandItem().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_); + boolean flag1 = p_217292_1_.isSecondaryUseActive() && flag; - if (!flag1) { + if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { - ActionResultType actionresulttype = p_217292_2_.func_180495_p(blockpos).func_227031_a_(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_); - if (actionresulttype.func_226246_a_()) { - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); + ActionResultType actionresulttype = p_217292_2_.getBlockState(blockpos).use(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_); + if (actionresulttype.consumesAction()) { + this.connection.send(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); @@ -272,8 +_,8 @@ } - this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); -- if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { + this.connection.send(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_)); +- if (!itemstack.isEmpty() && !p_217292_1_.getCooldowns().isOnCooldown(itemstack.getItem())) { - ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_); + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b()))) { ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_217292_1_.getCooldowns().isOnCooldown(itemstack.getItem()))) { ActionResultType actionresulttype1; - if (this.field_78779_k.func_77145_d()) { - int i = itemstack.func_190916_E(); + if (this.localPlayerMode.isCreative()) { + int i = itemstack.getCount(); @@ -301,11 +_,14 @@ - if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { + if (p_187101_1_.getCooldowns().isOnCooldown(itemstack.getItem())) { return ActionResultType.PASS; } else { + ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_); + if (cancelResult != null) return cancelResult; - int i = itemstack.func_190916_E(); - ActionResult actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_); - ItemStack itemstack1 = actionresult.func_188398_b(); + int i = itemstack.getCount(); + ActionResult actionresult = itemstack.use(p_187101_2_, p_187101_1_, p_187101_3_); + ItemStack itemstack1 = actionresult.getObject(); if (itemstack1 != itemstack) { - p_187101_1_.func_184611_a(p_187101_3_, itemstack1); -+ if (itemstack1.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_); + p_187101_1_.setItemInHand(p_187101_3_, itemstack1); ++ if (itemstack1.isEmpty()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_); } - return actionresult.func_188397_a(); + return actionresult.getResult(); @@ -334,6 +_,9 @@ - public ActionResultType func_187097_a(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) { - this.func_78750_j(); - this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_, p_187097_1_.func_225608_bj_())); -+ if (this.field_78779_k == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract + public ActionResultType interact(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) { + this.ensureHasSentCarriedItem(); + this.connection.send(new CUseEntityPacket(p_187097_2_, p_187097_3_, p_187097_1_.isShiftKeyDown())); ++ if (this.localPlayerMode == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract + ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(p_187097_1_, p_187097_2_, p_187097_3_); + if(cancelResult != null) return cancelResult; - return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_); + return this.localPlayerMode == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.interactOn(p_187097_2_, p_187097_3_); } @@ -341,6 +_,9 @@ - this.func_78750_j(); - Vector3d vector3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.func_226277_ct_(), p_187102_2_.func_226278_cu_(), p_187102_2_.func_226281_cx_()); - this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vector3d, p_187102_1_.func_225608_bj_())); -+ if (this.field_78779_k == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract + this.ensureHasSentCarriedItem(); + Vector3d vector3d = p_187102_3_.getLocation().subtract(p_187102_2_.getX(), p_187102_2_.getY(), p_187102_2_.getZ()); + this.connection.send(new CUseEntityPacket(p_187102_2_, p_187102_4_, vector3d, p_187102_1_.isShiftKeyDown())); ++ if (this.localPlayerMode == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract + ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_); + if(cancelResult != null) return cancelResult; - return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187102_2_.func_184199_a(p_187102_1_, vector3d, p_187102_4_); + return this.localPlayerMode == GameType.SPECTATOR ? ActionResultType.PASS : p_187102_2_.interactAt(p_187102_1_, vector3d, p_187102_4_); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch index c52ae4f822..521d2a7232 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/client/multiplayer/ServerData.java @@ -26,6 +_,7 @@ @Nullable - private String field_147411_m; - private boolean field_181042_l; + private String iconB64; + private boolean lan; + public net.minecraftforge.fml.client.ExtendedServerListData forgeData = null; public ServerData(String p_i46420_1_, String p_i46420_2_, boolean p_i46420_3_) { - this.field_78847_a = p_i46420_1_; + this.name = p_i46420_1_; diff --git a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch index 0caf1289a8..4c8d343ef0 100644 --- a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -5,6 +5,6 @@ } + net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_); - this.field_175092_e = Util.func_211177_b(); - networkmanager.func_179290_a(new CPingPacket(this.field_175092_e)); - this.field_147403_d = true; + this.pingStart = Util.getMillis(); + networkmanager.send(new CPingPacket(this.pingStart)); + this.success = true; diff --git a/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch index 56b0c71470..66e7cff34d 100644 --- a/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch @@ -3,8 +3,8 @@ @@ -20,6 +_,7 @@ } - public void func_147383_a(CHandshakePacket p_147383_1_) { -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147384_b)) return; - this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c()); - this.field_147384_b.func_150719_a(new ServerLoginNetHandler(this.field_147385_a, this.field_147384_b)); + public void handleIntention(CHandshakePacket p_147383_1_) { ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.connection)) return; + this.connection.setProtocol(p_147383_1_.getIntention()); + this.connection.setListener(new ServerLoginNetHandler(this.server, this.connection)); } diff --git a/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch index ec577514ac..024529bd31 100644 --- a/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/network/login/ClientLoginNetHandler.java +++ b/net/minecraft/client/network/login/ClientLoginNetHandler.java @@ -115,6 +_,7 @@ - this.field_209525_d.accept(new TranslationTextComponent("connect.joining")); - this.field_175091_e = p_147390_1_.func_179730_a(); - this.field_147393_d.func_150723_a(ProtocolType.PLAY); -+ net.minecraftforge.fml.network.NetworkHooks.handleClientLoginSuccess(this.field_147393_d); - this.field_147393_d.func_150719_a(new ClientPlayNetHandler(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e)); + this.updateStatus.accept(new TranslationTextComponent("connect.joining")); + this.localGameProfile = p_147390_1_.getGameProfile(); + this.connection.setProtocol(ProtocolType.PLAY); ++ net.minecraftforge.fml.network.NetworkHooks.handleClientLoginSuccess(this.connection); + this.connection.setListener(new ClientPlayNetHandler(this.minecraft, this.parent, this.connection, this.localGameProfile)); } @@ -143,6 +_,7 @@ } - public void func_209521_a(SCustomPayloadLoginPacket p_209521_1_) { -+ if (net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.field_147393_d)) return; - this.field_209525_d.accept(new TranslationTextComponent("connect.negotiating")); - this.field_147393_d.func_179290_a(new CCustomPayloadLoginPacket(p_209521_1_.func_209918_a(), (PacketBuffer)null)); + public void handleCustomQuery(SCustomPayloadLoginPacket p_209521_1_) { ++ if (net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.connection)) return; + this.updateStatus.accept(new TranslationTextComponent("connect.negotiating")); + this.connection.send(new CCustomPayloadLoginPacket(p_209521_1_.getTransactionId(), (PacketBuffer)null)); } diff --git a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch index 8a540a3464..30ad43aa53 100644 --- a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch @@ -2,112 +2,112 @@ +++ b/net/minecraft/client/network/play/ClientPlayNetHandler.java @@ -384,6 +_,7 @@ - this.field_147299_f.field_184132_p.func_217737_a(); - this.field_147299_f.field_71439_g.func_70065_x(); -+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogin(this.field_147299_f.field_71442_b, this.field_147299_f.field_71439_g, this.field_147299_f.func_147114_u().func_147298_b()); - int i = p_147282_1_.func_149197_c(); - this.field_147300_g.func_217408_a(i, this.field_147299_f.field_71439_g); - this.field_147299_f.field_71439_g.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); + this.minecraft.debugRenderer.clear(); + this.minecraft.player.resetPos(); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerLogin(this.minecraft.gameMode, this.minecraft.player, this.minecraft.getConnection().getConnection()); + int i = p_147282_1_.getPlayerId(); + this.level.addPlayer(i, this.minecraft.player); + this.minecraft.player.input = new MovementInputFromOptions(this.minecraft.options); @@ -395,6 +_,7 @@ - this.field_147299_f.field_71439_g.func_228355_a_(p_147282_1_.func_229743_k_()); - this.field_147299_f.field_71442_b.func_78746_a(p_147282_1_.func_149198_e()); - this.field_147299_f.field_71442_b.func_241675_a_(p_147282_1_.func_241786_f_()); -+ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(field_147302_e, "PLAY_TO_SERVER"); - this.field_147299_f.field_71474_y.func_82879_c(); - this.field_147302_e.func_179290_a(new CCustomPayloadPacket(CCustomPayloadPacket.field_210344_a, (new PacketBuffer(Unpooled.buffer())).func_180714_a(ClientBrandRetriever.getClientModName()))); - this.field_147299_f.func_213229_ar().func_216814_a(); + this.minecraft.player.setShowDeathScreen(p_147282_1_.shouldShowDeathScreen()); + this.minecraft.gameMode.setLocalMode(p_147282_1_.getGameType()); + this.minecraft.gameMode.setPreviousLocalMode(p_147282_1_.getPreviousGameType()); ++ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(connection, "PLAY_TO_SERVER"); + this.minecraft.options.broadcastOptions(); + this.connection.send(new CCustomPayloadPacket(CCustomPayloadPacket.BRAND, (new PacketBuffer(Unpooled.buffer())).writeUtf(ClientBrandRetriever.getClientModName()))); + this.minecraft.getGame().onStartGameSession(); @@ -734,7 +_,7 @@ - BlockPos blockpos = new BlockPos(compoundnbt.func_74762_e("x"), compoundnbt.func_74762_e("y"), compoundnbt.func_74762_e("z")); - TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos); + BlockPos blockpos = new BlockPos(compoundnbt.getInt("x"), compoundnbt.getInt("y"), compoundnbt.getInt("z")); + TileEntity tileentity = this.level.getBlockEntity(blockpos); if (tileentity != null) { -- tileentity.func_230337_a_(this.field_147300_g.func_180495_p(blockpos), compoundnbt); -+ tileentity.handleUpdateTag(this.field_147300_g.func_180495_p(blockpos), compoundnbt); +- tileentity.load(this.level.getBlockState(blockpos), compoundnbt); ++ tileentity.handleUpdateTag(this.level.getBlockState(blockpos), compoundnbt); } } @@ -815,7 +_,9 @@ - public void func_147251_a(SChatPacket p_147251_1_) { - PacketThreadUtil.func_218797_a(p_147251_1_, this, this.field_147299_f); -- this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c(), p_147251_1_.func_240810_e_()); -+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c(), p_147251_1_.func_240810_e_()); + public void handleChat(SChatPacket p_147251_1_) { + PacketThreadUtil.ensureRunningOnSameThread(p_147251_1_, this, this.minecraft); +- this.minecraft.gui.handleChat(p_147251_1_.getType(), p_147251_1_.getMessage(), p_147251_1_.getSender()); ++ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.getType(), p_147251_1_.getMessage(), p_147251_1_.getSender()); + if (message == null) return; -+ this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), message, p_147251_1_.func_240810_e_()); ++ this.minecraft.gui.handleChat(p_147251_1_.getType(), message, p_147251_1_.getSender()); } - public void func_147279_a(SAnimateHandPacket p_147279_1_) { + public void handleAnimate(SAnimateHandPacket p_147279_1_) { @@ -854,6 +_,7 @@ - livingentity.func_213312_b(d0, d1, d2); - livingentity.field_70761_aq = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F; - livingentity.field_70759_as = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F; + livingentity.setPacketCoordinates(d0, d1, d2); + livingentity.yBodyRot = (float)(p_147281_1_.getyHeadRot() * 360) / 256.0F; + livingentity.yHeadRot = (float)(p_147281_1_.getyHeadRot() * 360) / 256.0F; + if (false) // Forge: Fix MC-158205: Moved into setId() if (livingentity instanceof EnderDragonEntity) { - EnderDragonPartEntity[] aenderdragonpartentity = ((EnderDragonEntity)livingentity).func_213404_dT(); + EnderDragonPartEntity[] aenderdragonpartentity = ((EnderDragonEntity)livingentity).getSubEntities(); @@ -1004,8 +_,10 @@ - clientplayerentity1.func_233645_dx_().func_233784_a_(clientplayerentity.func_233645_dx_()); + clientplayerentity1.getAttributes().assignValues(clientplayerentity.getAttributes()); } + clientplayerentity1.updateSyncFields(clientplayerentity); // Forge: fix MC-10657 - clientplayerentity1.func_70065_x(); - clientplayerentity1.func_175158_f(s); -+ net.minecraftforge.fml.client.ClientHooks.firePlayerRespawn(this.field_147299_f.field_71442_b, clientplayerentity, clientplayerentity1, clientplayerentity1.field_71174_a.func_147298_b()); - this.field_147300_g.func_217408_a(i, clientplayerentity1); - clientplayerentity1.field_70177_z = -180.0F; - clientplayerentity1.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y); + clientplayerentity1.resetPos(); + clientplayerentity1.setServerBrand(s); ++ net.minecraftforge.fml.client.ClientHooks.firePlayerRespawn(this.minecraft.gameMode, clientplayerentity, clientplayerentity1, clientplayerentity1.connection.getConnection()); + this.level.addPlayer(i, clientplayerentity1); + clientplayerentity1.yRot = -180.0F; + clientplayerentity1.input = new MovementInputFromOptions(this.minecraft.options); @@ -1131,6 +_,12 @@ - if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) { - ((CommandBlockScreen)this.field_147299_f.field_71462_r).func_184075_a(); + if (flag && this.minecraft.screen instanceof CommandBlockScreen) { + ((CommandBlockScreen)this.minecraft.screen).updateGui(); + } else { + if(tileentity == null) { -+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g()); ++ LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.getPos(), p_147273_1_.getTag()); + return; + } -+ tileentity.onDataPacket(field_147302_e, p_147273_1_); ++ tileentity.onDataPacket(connection, p_147273_1_); } } @@ -1299,6 +_,7 @@ - clientrecipebook.func_243196_a(this.field_199528_o.func_199510_b()); - clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a); - imutablesearchtree.func_194040_a(); -+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.field_199528_o); + clientrecipebook.setupCollections(this.recipeManager.getRecipes()); + clientrecipebook.getCollections().forEach(imutablesearchtree::add); + imutablesearchtree.refresh(); ++ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager); } - public void func_200232_a(SPlayerLookPacket p_200232_1_) { + public void handleLookAt(SPlayerLookPacket p_200232_1_) { @@ -1376,7 +_,7 @@ - PacketThreadUtil.func_218797_a(p_147260_1_, this, this.field_147299_f); - Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d()); + PacketThreadUtil.ensureRunningOnSameThread(p_147260_1_, this, this.minecraft); + Entity entity = this.level.getEntity(p_147260_1_.getEntityId()); if (entity instanceof LivingEntity) { -- Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e()); -+ Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e() & 0xFF); +- Effect effect = Effect.byId(p_147260_1_.getEffectId()); ++ Effect effect = Effect.byId(p_147260_1_.getEffectId() & 0xFF); if (effect != null) { - EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h()); - effectinstance.func_100012_b(p_147260_1_.func_149429_c()); + EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.getEffectDurationTicks(), p_147260_1_.getEffectAmplifier(), p_147260_1_.isEffectAmbient(), p_147260_1_.isEffectVisible(), p_147260_1_.effectShowsIcon()); + effectinstance.setNoCounter(p_147260_1_.isSuperLongDuration()); @@ -1388,11 +_,14 @@ - public void func_199723_a(STagsListPacket p_199723_1_) { - PacketThreadUtil.func_218797_a(p_199723_1_, this, this.field_147299_f); - ITagCollectionSupplier itagcollectionsupplier = p_199723_1_.func_199858_a(); -- Multimap multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier); -+ boolean vanillaConnection = net.minecraftforge.fml.network.NetworkHooks.isVanillaConnection(field_147302_e); -+ Multimap multimap = vanillaConnection ? TagRegistryManager.func_242198_b(net.minecraftforge.common.ForgeTagHandler.withNoCustom(itagcollectionsupplier)) : TagRegistryManager.validateVanillaTags(itagcollectionsupplier);//Forge: If we are connecting to vanilla validate all tags to properly validate custom tags the client may "require", and if we are connecting to forge only validate the vanilla tag types as the custom tag types get synced in a separate packet so may still arrive + public void handleUpdateTags(STagsListPacket p_199723_1_) { + PacketThreadUtil.ensureRunningOnSameThread(p_199723_1_, this, this.minecraft); + ITagCollectionSupplier itagcollectionsupplier = p_199723_1_.getTags(); +- Multimap multimap = TagRegistryManager.getAllMissingTags(itagcollectionsupplier); ++ boolean vanillaConnection = net.minecraftforge.fml.network.NetworkHooks.isVanillaConnection(connection); ++ Multimap multimap = vanillaConnection ? TagRegistryManager.getAllMissingTags(net.minecraftforge.common.ForgeTagHandler.withNoCustom(itagcollectionsupplier)) : TagRegistryManager.validateVanillaTags(itagcollectionsupplier);//Forge: If we are connecting to vanilla validate all tags to properly validate custom tags the client may "require", and if we are connecting to forge only validate the vanilla tag types as the custom tag types get synced in a separate packet so may still arrive if (!multimap.isEmpty()) { - field_147301_d.warn("Incomplete server tags, disconnecting. Missing: {}", (Object)multimap); - this.field_147302_e.func_150718_a(new TranslationTextComponent("multiplayer.disconnect.missing_tags")); + LOGGER.warn("Incomplete server tags, disconnecting. Missing: {}", (Object)multimap); + this.connection.disconnect(new TranslationTextComponent("multiplayer.disconnect.missing_tags")); } else { + net.minecraftforge.common.ForgeTagHandler.resetCachedTagCollections(true, vanillaConnection); + itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier); - this.field_199725_m = itagcollectionsupplier; - if (!this.field_147302_e.func_150731_c()) { - itagcollectionsupplier.func_242212_e(); + this.tags = itagcollectionsupplier; + if (!this.connection.isMemoryConnection()) { + itagcollectionsupplier.bindToGlobal(); @@ -1885,10 +_,12 @@ int l5 = packetbuffer.readInt(); - this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos8, l3, s10, l5); + this.minecraft.debugRenderer.gameTestDebugRenderer.addMarker(blockpos8, l3, s10, l5); } else { -- field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); -+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e)) -+ field_147301_d.warn("Unknown custom packet identifier: {}", (Object)resourcelocation); +- LOGGER.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.connection)) ++ LOGGER.warn("Unknown custom packet identifier: {}", (Object)resourcelocation); } } finally { if (packetbuffer != null) { diff --git a/patches/minecraft/net/minecraft/client/network/play/NetworkPlayerInfo.java.patch b/patches/minecraft/net/minecraft/client/network/play/NetworkPlayerInfo.java.patch index e0ee3cdbda..1bab03a7ec 100644 --- a/patches/minecraft/net/minecraft/client/network/play/NetworkPlayerInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/network/play/NetworkPlayerInfo.java.patch @@ -3,8 +3,8 @@ @@ -50,6 +_,7 @@ } - protected void func_178839_a(GameType p_178839_1_) { -+ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameMode(this, this.field_178866_b, p_178839_1_); - this.field_178866_b = p_178839_1_; + protected void setGameMode(GameType p_178839_1_) { ++ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameMode(this, this.gameMode, p_178839_1_); + this.gameMode = p_178839_1_; } diff --git a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch index d5ab7fb64d..88b778950d 100644 --- a/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/DiggingParticle.java.patch @@ -3,23 +3,23 @@ @@ -36,6 +_,7 @@ } - public DiggingParticle func_174846_a(BlockPos p_174846_1_) { + public DiggingParticle init(BlockPos p_174846_1_) { + updateSprite(p_174846_1_); - this.field_181019_az = p_174846_1_; - if (this.field_174847_a.func_203425_a(Blocks.field_196658_i)) { + this.pos = p_174846_1_; + if (this.blockState.is(Blocks.GRASS_BLOCK)) { return this; @@ -92,7 +_,13 @@ public static class Factory implements IParticleFactory { - public Particle func_199234_a(BlockParticleData p_199234_1_, ClientWorld p_199234_2_, double p_199234_3_, double p_199234_5_, double p_199234_7_, double p_199234_9_, double p_199234_11_, double p_199234_13_) { - BlockState blockstate = p_199234_1_.func_197584_c(); -- return !blockstate.func_196958_f() && !blockstate.func_203425_a(Blocks.field_196603_bb) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l() : null; -+ return !blockstate.func_196958_f() && !blockstate.func_203425_a(Blocks.field_196603_bb) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).func_174845_l().updateSprite(p_199234_1_.getPos()) : null; + public Particle createParticle(BlockParticleData p_199234_1_, ClientWorld p_199234_2_, double p_199234_3_, double p_199234_5_, double p_199234_7_, double p_199234_9_, double p_199234_11_, double p_199234_13_) { + BlockState blockstate = p_199234_1_.getState(); +- return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).init() : null; ++ return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) ? (new DiggingParticle(p_199234_2_, p_199234_3_, p_199234_5_, p_199234_7_, p_199234_9_, p_199234_11_, p_199234_13_, blockstate)).init().updateSprite(p_199234_1_.getPos()) : null; } + } + + private Particle updateSprite(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.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(field_174847_a, field_187122_b, pos)); ++ this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getTexture(blockState, level, pos)); + return this; } } diff --git a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch index 3d1feb2ede..036bb4cf22 100644 --- a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java @@ -208,4 +_,12 @@ - public void func_187108_a(AxisAlignedBB p_187108_1_) { - this.field_187120_G = p_187108_1_; + public void setBoundingBox(AxisAlignedBB p_187108_1_) { + this.bb = p_187108_1_; } + + /** diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch index cc3538b3c5..03de41a5c1 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/client/particle/ParticleManager.java +++ b/net/minecraft/client/particle/ParticleManager.java @@ -65,7 +_,7 @@ - private final Queue field_178933_d = Queues.newArrayDeque(); - private final TextureManager field_78877_c; - private final Random field_78875_d = new Random(); -- private final Int2ObjectMap> field_178932_g = new Int2ObjectOpenHashMap<>(); -+ private final Map> field_178932_g = new java.util.HashMap<>(); - private final Queue field_187241_h = Queues.newArrayDeque(); - private final Map field_215242_i = Maps.newHashMap(); - private final AtlasTexture field_215243_j = new AtlasTexture(AtlasTexture.field_215262_g); + private final Queue trackingEmitters = Queues.newArrayDeque(); + private final TextureManager textureManager; + private final Random random = new Random(); +- private final Int2ObjectMap> providers = new Int2ObjectOpenHashMap<>(); ++ private final Map> providers = new java.util.HashMap<>(); + private final Queue particlesToAdd = Queues.newArrayDeque(); + private final Map spriteSets = Maps.newHashMap(); + private final AtlasTexture textureAtlas = new AtlasTexture(AtlasTexture.LOCATION_PARTICLES); @@ -153,13 +_,13 @@ } - public void func_199283_a(ParticleType p_199283_1_, IParticleFactory p_199283_2_) { -- this.field_178932_g.put(Registry.field_212632_u.func_148757_b(p_199283_1_), p_199283_2_); -+ this.field_178932_g.put(Registry.field_212632_u.func_177774_c(p_199283_1_), p_199283_2_); + public void register(ParticleType p_199283_1_, IParticleFactory p_199283_2_) { +- this.providers.put(Registry.PARTICLE_TYPE.getId(p_199283_1_), p_199283_2_); ++ this.providers.put(Registry.PARTICLE_TYPE.getKey(p_199283_1_), p_199283_2_); } - public void func_215234_a(ParticleType p_215234_1_, ParticleManager.IParticleMetaFactory p_215234_2_) { + public void register(ParticleType p_215234_1_, ParticleManager.IParticleMetaFactory p_215234_2_) { ParticleManager.AnimatedSpriteImpl particlemanager$animatedspriteimpl = new ParticleManager.AnimatedSpriteImpl(); - this.field_215242_i.put(Registry.field_212632_u.func_177774_c(p_215234_1_), particlemanager$animatedspriteimpl); -- this.field_178932_g.put(Registry.field_212632_u.func_148757_b(p_215234_1_), p_215234_2_.create(particlemanager$animatedspriteimpl)); -+ this.field_178932_g.put(Registry.field_212632_u.func_177774_c(p_215234_1_), p_215234_2_.create(particlemanager$animatedspriteimpl)); + this.spriteSets.put(Registry.PARTICLE_TYPE.getKey(p_215234_1_), particlemanager$animatedspriteimpl); +- this.providers.put(Registry.PARTICLE_TYPE.getId(p_215234_1_), p_215234_2_.create(particlemanager$animatedspriteimpl)); ++ this.providers.put(Registry.PARTICLE_TYPE.getKey(p_215234_1_), p_215234_2_.create(particlemanager$animatedspriteimpl)); } - public CompletableFuture func_215226_a(IFutureReloadListener.IStage p_215226_1_, IResourceManager p_215226_2_, IProfiler p_215226_3_, IProfiler p_215226_4_, Executor p_215226_5_, Executor p_215226_6_) { + public CompletableFuture reload(IFutureReloadListener.IStage p_215226_1_, IResourceManager p_215226_2_, IProfiler p_215226_3_, IProfiler p_215226_4_, Executor p_215226_5_, Executor p_215226_6_) { @@ -248,7 +_,7 @@ @Nullable - private Particle func_199927_b(T p_199927_1_, double p_199927_2_, double p_199927_4_, double p_199927_6_, double p_199927_8_, double p_199927_10_, double p_199927_12_) { -- IParticleFactory iparticlefactory = (IParticleFactory)this.field_178932_g.get(Registry.field_212632_u.func_148757_b(p_199927_1_.func_197554_b())); -+ IParticleFactory iparticlefactory = (IParticleFactory)this.field_178932_g.get(Registry.field_212632_u.func_177774_c(p_199927_1_.func_197554_b())); - return iparticlefactory == null ? null : iparticlefactory.func_199234_a(p_199927_1_, this.field_78878_a, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_); + private Particle makeParticle(T p_199927_1_, double p_199927_2_, double p_199927_4_, double p_199927_6_, double p_199927_8_, double p_199927_10_, double p_199927_12_) { +- IParticleFactory iparticlefactory = (IParticleFactory)this.providers.get(Registry.PARTICLE_TYPE.getId(p_199927_1_.getType())); ++ IParticleFactory iparticlefactory = (IParticleFactory)this.providers.get(Registry.PARTICLE_TYPE.getKey(p_199927_1_.getType())); + return iparticlefactory == null ? null : iparticlefactory.createParticle(p_199927_1_, this.level, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_); } @@ -313,16 +_,29 @@ @@ -40,12 +40,12 @@ + /**@deprecated Forge: use {@link #renderParticles(MatrixStack, IRenderTypeBuffer.Impl, LightTexture, ActiveRenderInfo, float, net.minecraft.client.renderer.culling.ClippingHelper)} with ClippingHelper as additional parameter*/ + @Deprecated - public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) { + public void render(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) { + renderParticles(p_228345_1_, p_228345_2_, p_228345_3_, p_228345_4_, p_228345_5_, null); + } + + public void renderParticles(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_, @Nullable net.minecraft.client.renderer.culling.ClippingHelper clippingHelper) { - p_228345_3_.func_205109_c(); + p_228345_3_.turnOnLightLayer(); + Runnable enable = () -> { RenderSystem.enableAlphaTest(); RenderSystem.defaultAlphaFunc(); @@ -56,42 +56,42 @@ + RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE0); + }; RenderSystem.pushMatrix(); - RenderSystem.multMatrix(p_228345_1_.func_227866_c_().func_227870_a_()); + RenderSystem.multMatrix(p_228345_1_.last().pose()); -- for(IParticleRenderType iparticlerendertype : field_215241_b) { -+ for(IParticleRenderType iparticlerendertype : this.field_78876_b.keySet()) { // Forge: allow custom IParticleRenderType's -+ if (iparticlerendertype == IParticleRenderType.field_217606_f) continue; +- for(IParticleRenderType iparticlerendertype : RENDER_ORDER) { ++ for(IParticleRenderType iparticlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's ++ if (iparticlerendertype == IParticleRenderType.NO_RENDER) continue; + enable.run(); //Forge: MC-168672 Make sure all render types have the correct GL state. - Iterable iterable = this.field_78876_b.get(iparticlerendertype); + Iterable iterable = this.particles.get(iparticlerendertype); if (iterable != null) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -331,6 +_,7 @@ - iparticlerendertype.func_217600_a(bufferbuilder, this.field_78877_c); + iparticlerendertype.begin(bufferbuilder, this.textureManager); for(Particle particle : iterable) { -+ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.func_228957_a_(particle.func_187116_l())) continue; ++ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.isVisible(particle.getBoundingBox())) continue; try { - particle.func_225606_a_(bufferbuilder, p_228345_4_, p_228345_5_); + particle.render(bufferbuilder, p_228345_4_, p_228345_5_); } catch (Throwable throwable) { @@ -362,7 +_,7 @@ } - public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) { -- if (!p_180533_2_.func_196958_f()) { -+ if (!p_180533_2_.isAir(this.field_78878_a, p_180533_1_) && !p_180533_2_.addDestroyEffects(this.field_78878_a, p_180533_1_, this)) { - VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_); + public void destroy(BlockPos p_180533_1_, BlockState p_180533_2_) { +- if (!p_180533_2_.isAir()) { ++ if (!p_180533_2_.isAir(this.level, p_180533_1_) && !p_180533_2_.addDestroyEffects(this.level, p_180533_1_, this)) { + VoxelShape voxelshape = p_180533_2_.getShape(this.level, p_180533_1_); double d0 = 0.25D; - voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> { + voxelshape.forAllBoxes((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> { @@ -432,6 +_,12 @@ - public String func_78869_b() { - return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum()); + public String countParticles() { + return String.valueOf(this.particles.values().stream().mapToInt(Collection::size).sum()); + } + + public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.BlockRayTraceResult target) { -+ BlockState state = field_78878_a.func_180495_p(pos); -+ if (!state.addHitEffects(field_78878_a, target, this)) -+ func_180532_a(pos, target.func_216354_b()); ++ BlockState state = level.getBlockState(pos); ++ if (!state.addHitEffects(level, target, this)) ++ crack(pos, target.getDirection()); } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch index c8dbf6dc05..cfbaa1d5c0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/renderer/ActiveRenderInfo.java +++ b/net/minecraft/client/renderer/ActiveRenderInfo.java @@ -170,4 +_,16 @@ - this.field_216791_c = null; - this.field_216789_a = false; + this.entity = null; + this.initialized = false; } + + public void setAnglesInternal(float yaw, float pitch) { -+ this.field_216798_j = yaw; -+ this.field_216797_i = pitch; ++ this.yRot = yaw; ++ this.xRot = pitch; + } + + public net.minecraft.block.BlockState getBlockAtCamera() { -+ if (!this.field_216789_a) -+ return net.minecraft.block.Blocks.field_150350_a.func_176223_P(); ++ if (!this.initialized) ++ return net.minecraft.block.Blocks.AIR.defaultBlockState(); + else -+ return this.field_216790_b.func_180495_p(this.field_216793_e).getStateAtViewpoint(this.field_216790_b, this.field_216793_e, this.field_216792_d); ++ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/Atlases.java.patch b/patches/minecraft/net/minecraft/client/renderer/Atlases.java.patch index 27380db9cc..6f56acce1d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Atlases.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Atlases.java.patch @@ -3,13 +3,13 @@ @@ -129,7 +_,8 @@ } - public static RenderMaterial func_228773_a_(WoodType p_228773_0_) { -- return new RenderMaterial(field_228746_e_, new ResourceLocation("entity/signs/" + p_228773_0_.func_227048_b_())); -+ ResourceLocation location = new ResourceLocation(p_228773_0_.func_227048_b_()); -+ return new RenderMaterial(field_228746_e_, new ResourceLocation(location.func_110624_b(), "entity/signs/" + location.func_110623_a())); + public static RenderMaterial signTexture(WoodType p_228773_0_) { +- return new RenderMaterial(SIGN_SHEET, new ResourceLocation("entity/signs/" + p_228773_0_.name())); ++ ResourceLocation location = new ResourceLocation(p_228773_0_.name()); ++ return new RenderMaterial(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/" + location.getPath())); } - private static RenderMaterial func_228774_a_(String p_228774_0_) { + private static RenderMaterial chestMaterial(String p_228774_0_) { @@ -156,5 +_,12 @@ default: return p_228772_1_; @@ -20,6 +20,6 @@ + * Not threadsafe. Enqueue it in client setup. + */ + public static void addWoodType(WoodType woodType) { -+ field_228750_i_.put(woodType, func_228773_a_(woodType)); ++ SIGN_MATERIALS.put(woodType, signTexture(woodType)); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index 0f5fb29524..c326784465 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/client/renderer/BlockModelRenderer.java +++ b/net/minecraft/client/renderer/BlockModelRenderer.java @@ -37,65 +_,78 @@ - this.field_187499_a = p_i46575_1_; + this.blockColors = p_i46575_1_; } + @Deprecated //Forge: Model data argument - public boolean func_228802_a_(IBlockDisplayReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) { -- boolean flag = Minecraft.func_71379_u() && p_228802_3_.func_185906_d() == 0 && p_228802_2_.func_177555_b(); -- Vector3d vector3d = p_228802_3_.func_191059_e(p_228802_1_, p_228802_4_); -- p_228802_5_.func_227861_a_(vector3d.field_72450_a, vector3d.field_72448_b, vector3d.field_72449_c); + public boolean tesselateBlock(IBlockDisplayReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) { +- boolean flag = Minecraft.useAmbientOcclusion() && p_228802_3_.getLightEmission() == 0 && p_228802_2_.useAmbientOcclusion(); +- Vector3d vector3d = p_228802_3_.getOffset(p_228802_1_, p_228802_4_); +- p_228802_5_.translate(vector3d.x, vector3d.y, vector3d.z); + return renderModel(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public boolean renderModel(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { -+ boolean flag = Minecraft.func_71379_u() && stateIn.getLightValue(worldIn, posIn) == 0 && modelIn.func_177555_b(); -+ Vector3d vector3d = stateIn.func_191059_e(worldIn, posIn); -+ matrixIn.func_227861_a_(vector3d.field_72450_a, vector3d.field_72448_b, vector3d.field_72449_c); ++ boolean flag = Minecraft.useAmbientOcclusion() && stateIn.getLightValue(worldIn, posIn) == 0 && modelIn.useAmbientOcclusion(); ++ Vector3d vector3d = stateIn.getOffset(worldIn, posIn); ++ matrixIn.translate(vector3d.x, vector3d.y, vector3d.z); + modelData = modelIn.getModelData(worldIn, posIn, stateIn, modelData); try { -- return flag ? this.func_228805_b_(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_) : this.func_228806_c_(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_); +- return flag ? this.tesselateWithAO(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_) : this.tesselateWithoutAO(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_); + return flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, matrixIn, buffer, checkSides, randomIn, rand, combinedOverlayIn, modelData) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, matrixIn, buffer, checkSides, randomIn, rand, combinedOverlayIn, modelData); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block model"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block model being tesselated"); -- CrashReportCategory.func_175750_a(crashreportcategory, p_228802_4_, p_228802_3_); -+ CrashReportCategory.func_175750_a(crashreportcategory, posIn, stateIn); - crashreportcategory.func_71507_a("Using AO", flag); + CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block model"); + CrashReportCategory crashreportcategory = crashreport.addCategory("Block model being tesselated"); +- CrashReportCategory.populateBlockDetails(crashreportcategory, p_228802_4_, p_228802_3_); ++ CrashReportCategory.populateBlockDetails(crashreportcategory, posIn, stateIn); + crashreportcategory.setDetail("Using AO", flag); throw new ReportedException(crashreport); } } + @Deprecated //Forge: Model data argument - public boolean func_228805_b_(IBlockDisplayReader p_228805_1_, IBakedModel p_228805_2_, BlockState p_228805_3_, BlockPos p_228805_4_, MatrixStack p_228805_5_, IVertexBuilder p_228805_6_, boolean p_228805_7_, Random p_228805_8_, long p_228805_9_, int p_228805_11_) { + public boolean tesselateWithAO(IBlockDisplayReader p_228805_1_, IBakedModel p_228805_2_, BlockState p_228805_3_, BlockPos p_228805_4_, MatrixStack p_228805_5_, IVertexBuilder p_228805_6_, boolean p_228805_7_, Random p_228805_8_, long p_228805_9_, int p_228805_11_) { + return renderModelSmooth(p_228805_1_, p_228805_2_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, p_228805_7_, p_228805_8_, p_228805_9_, p_228805_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public boolean renderModelSmooth(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixStackIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { @@ -42,24 +42,24 @@ for(Direction direction : Direction.values()) { - p_228805_8_.setSeed(p_228805_9_); -- List list = p_228805_2_.func_200117_a(p_228805_3_, direction, p_228805_8_); -- if (!list.isEmpty() && (!p_228805_7_ || Block.func_176225_a(p_228805_3_, p_228805_1_, p_228805_4_, direction))) { -- this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); +- List list = p_228805_2_.getQuads(p_228805_3_, direction, p_228805_8_); +- if (!list.isEmpty() && (!p_228805_7_ || Block.shouldRenderFace(p_228805_3_, p_228805_1_, p_228805_4_, direction))) { +- this.renderModelFaceAO(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); + randomIn.setSeed(rand); + List list = modelIn.getQuads(stateIn, direction, randomIn, modelData); -+ if (!list.isEmpty() && (!checkSides || Block.func_176225_a(stateIn, worldIn, posIn, direction))) { -+ this.func_228799_a_(worldIn, stateIn, posIn, matrixStackIn, buffer, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); ++ if (!list.isEmpty() && (!checkSides || Block.shouldRenderFace(stateIn, worldIn, posIn, direction))) { ++ this.renderModelFaceAO(worldIn, stateIn, posIn, matrixStackIn, buffer, list, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); flag = true; } } - p_228805_8_.setSeed(p_228805_9_); -- List list1 = p_228805_2_.func_200117_a(p_228805_3_, (Direction)null, p_228805_8_); +- List list1 = p_228805_2_.getQuads(p_228805_3_, (Direction)null, p_228805_8_); + randomIn.setSeed(rand); + List list1 = modelIn.getQuads(stateIn, (Direction)null, randomIn, modelData); if (!list1.isEmpty()) { -- this.func_228799_a_(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); -+ this.func_228799_a_(worldIn, stateIn, posIn, matrixStackIn, buffer, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); +- this.renderModelFaceAO(p_228805_1_, p_228805_3_, p_228805_4_, p_228805_5_, p_228805_6_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, p_228805_11_); ++ this.renderModelFaceAO(worldIn, stateIn, posIn, matrixStackIn, buffer, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface, combinedOverlayIn); flag = true; } @@ -67,7 +67,7 @@ } + @Deprecated //Forge: Model data argument - public boolean func_228806_c_(IBlockDisplayReader p_228806_1_, IBakedModel p_228806_2_, BlockState p_228806_3_, BlockPos p_228806_4_, MatrixStack p_228806_5_, IVertexBuilder p_228806_6_, boolean p_228806_7_, Random p_228806_8_, long p_228806_9_, int p_228806_11_) { + public boolean tesselateWithoutAO(IBlockDisplayReader p_228806_1_, IBakedModel p_228806_2_, BlockState p_228806_3_, BlockPos p_228806_4_, MatrixStack p_228806_5_, IVertexBuilder p_228806_6_, boolean p_228806_7_, Random p_228806_8_, long p_228806_9_, int p_228806_11_) { + return renderModelFlat(p_228806_1_, p_228806_2_, p_228806_3_, p_228806_4_, p_228806_5_, p_228806_6_, p_228806_7_, p_228806_8_, p_228806_9_, p_228806_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public boolean renderModelFlat(IBlockDisplayReader worldIn, IBakedModel modelIn, BlockState stateIn, BlockPos posIn, MatrixStack matrixStackIn, IVertexBuilder buffer, boolean checkSides, Random randomIn, long rand, int combinedOverlayIn, net.minecraftforge.client.model.data.IModelData modelData) { @@ -76,26 +76,26 @@ for(Direction direction : Direction.values()) { - p_228806_8_.setSeed(p_228806_9_); -- List list = p_228806_2_.func_200117_a(p_228806_3_, direction, p_228806_8_); -- if (!list.isEmpty() && (!p_228806_7_ || Block.func_176225_a(p_228806_3_, p_228806_1_, p_228806_4_, direction))) { -- int i = WorldRenderer.func_228420_a_(p_228806_1_, p_228806_3_, p_228806_4_.func_177972_a(direction)); -- this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, i, p_228806_11_, false, p_228806_5_, p_228806_6_, list, bitset); +- List list = p_228806_2_.getQuads(p_228806_3_, direction, p_228806_8_); +- if (!list.isEmpty() && (!p_228806_7_ || Block.shouldRenderFace(p_228806_3_, p_228806_1_, p_228806_4_, direction))) { +- int i = WorldRenderer.getLightColor(p_228806_1_, p_228806_3_, p_228806_4_.relative(direction)); +- this.renderModelFaceFlat(p_228806_1_, p_228806_3_, p_228806_4_, i, p_228806_11_, false, p_228806_5_, p_228806_6_, list, bitset); + randomIn.setSeed(rand); + List list = modelIn.getQuads(stateIn, direction, randomIn, modelData); -+ if (!list.isEmpty() && (!checkSides || Block.func_176225_a(stateIn, worldIn, posIn, direction))) { -+ int i = WorldRenderer.func_228420_a_(worldIn, stateIn, posIn.func_177972_a(direction)); -+ this.func_228798_a_(worldIn, stateIn, posIn, i, combinedOverlayIn, false, matrixStackIn, buffer, list, bitset); ++ if (!list.isEmpty() && (!checkSides || Block.shouldRenderFace(stateIn, worldIn, posIn, direction))) { ++ int i = WorldRenderer.getLightColor(worldIn, stateIn, posIn.relative(direction)); ++ this.renderModelFaceFlat(worldIn, stateIn, posIn, i, combinedOverlayIn, false, matrixStackIn, buffer, list, bitset); flag = true; } } - p_228806_8_.setSeed(p_228806_9_); -- List list1 = p_228806_2_.func_200117_a(p_228806_3_, (Direction)null, p_228806_8_); +- List list1 = p_228806_2_.getQuads(p_228806_3_, (Direction)null, p_228806_8_); + randomIn.setSeed(rand); + List list1 = modelIn.getQuads(stateIn, (Direction)null, randomIn, modelData); if (!list1.isEmpty()) { -- this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); -+ this.func_228798_a_(worldIn, stateIn, posIn, -1, combinedOverlayIn, true, matrixStackIn, buffer, list1, bitset); +- this.renderModelFaceFlat(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); ++ this.renderModelFaceFlat(worldIn, stateIn, posIn, -1, combinedOverlayIn, true, matrixStackIn, buffer, list1, bitset); flag = true; } @@ -104,7 +104,7 @@ } + @Deprecated //Forge: Model data argument - public void func_228804_a_(MatrixStack.Entry p_228804_1_, IVertexBuilder p_228804_2_, @Nullable BlockState p_228804_3_, IBakedModel p_228804_4_, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_) { + public void renderModel(MatrixStack.Entry p_228804_1_, IVertexBuilder p_228804_2_, @Nullable BlockState p_228804_3_, IBakedModel p_228804_4_, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_) { + renderModel(p_228804_1_, p_228804_2_, p_228804_3_, p_228804_4_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_8_, p_228804_9_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public void renderModel(MatrixStack.Entry p_228804_1_, IVertexBuilder p_228804_2_, @Nullable BlockState p_228804_3_, IBakedModel p_228804_4_, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_, net.minecraftforge.client.model.data.IModelData modelData) { @@ -113,13 +113,13 @@ for(Direction direction : Direction.values()) { random.setSeed(42L); -- func_228803_a_(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.func_200117_a(p_228804_3_, direction, random), p_228804_8_, p_228804_9_); -+ func_228803_a_(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, direction, random, modelData), p_228804_8_, p_228804_9_); +- renderQuadList(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, direction, random), p_228804_8_, p_228804_9_); ++ renderQuadList(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, direction, random, modelData), p_228804_8_, p_228804_9_); } random.setSeed(42L); -- func_228803_a_(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.func_200117_a(p_228804_3_, (Direction)null, random), p_228804_8_, p_228804_9_); -+ func_228803_a_(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, (Direction)null, random, modelData), p_228804_8_, p_228804_9_); +- renderQuadList(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, (Direction)null, random), p_228804_8_, p_228804_9_); ++ renderQuadList(p_228804_1_, p_228804_2_, p_228804_5_, p_228804_6_, p_228804_7_, p_228804_4_.getQuads(p_228804_3_, (Direction)null, random, modelData), p_228804_8_, p_228804_9_); } - private static void func_228803_a_(MatrixStack.Entry p_228803_0_, IVertexBuilder p_228803_1_, float p_228803_2_, float p_228803_3_, float p_228803_4_, List p_228803_5_, int p_228803_6_, int p_228803_7_) { + private static void renderQuadList(MatrixStack.Entry p_228803_0_, IVertexBuilder p_228803_1_, float p_228803_2_, float p_228803_3_, float p_228803_4_, List p_228803_5_, int p_228803_6_, int p_228803_7_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index ccea25fbcb..21925e26b4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/renderer/BlockModelShapes.java +++ b/net/minecraft/client/renderer/BlockModelShapes.java @@ -24,8 +_,15 @@ - this.field_178128_c = p_i46245_1_; + this.modelManager = p_i46245_1_; } + @Deprecated - public TextureAtlasSprite func_178122_a(BlockState p_178122_1_) { -- return this.func_178125_b(p_178122_1_).func_177554_e(); -+ return this.func_178125_b(p_178122_1_).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public TextureAtlasSprite getParticleIcon(BlockState p_178122_1_) { +- return this.getBlockModel(p_178122_1_).getParticleIcon(); ++ return this.getBlockModel(p_178122_1_).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + + public TextureAtlasSprite getTexture(BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) { + net.minecraftforge.client.model.data.IModelData data = net.minecraftforge.client.model.ModelDataManager.getModelData(world, pos); -+ IBakedModel model = this.func_178125_b(state); ++ IBakedModel model = this.getBlockModel(state); + return model.getParticleTexture(model.getModelData(world, pos, state, data == null ? net.minecraftforge.client.model.data.EmptyModelData.INSTANCE : data)); } - public IBakedModel func_178125_b(BlockState p_178125_1_) { + public IBakedModel getBlockModel(BlockState p_178125_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index 393fcbee5d..cef9cbc6eb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -2,81 +2,81 @@ +++ b/net/minecraft/client/renderer/BlockRendererDispatcher.java @@ -33,7 +_,7 @@ public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_) { - this.field_175028_a = p_i46577_1_; - this.field_228790_e_ = p_i46577_2_; -- this.field_175027_c = new BlockModelRenderer(this.field_228790_e_); -+ this.field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(this.field_228790_e_); - this.field_175025_e = new FluidBlockRenderer(); + this.blockModelShaper = p_i46577_1_; + this.blockColors = p_i46577_2_; +- this.modelRenderer = new BlockModelRenderer(this.blockColors); ++ this.modelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(this.blockColors); + this.liquidBlockRenderer = new FluidBlockRenderer(); } @@ -41,22 +_,30 @@ - return this.field_175028_a; + return this.blockModelShaper; } + @Deprecated //Forge: Model parameter - public void func_228792_a_(BlockState p_228792_1_, BlockPos p_228792_2_, IBlockDisplayReader p_228792_3_, MatrixStack p_228792_4_, IVertexBuilder p_228792_5_) { -- if (p_228792_1_.func_185901_i() == BlockRenderType.MODEL) { -- IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_228792_1_); -- long i = p_228792_1_.func_209533_a(p_228792_2_); -- this.field_175027_c.func_228802_a_(p_228792_3_, ibakedmodel, p_228792_1_, p_228792_2_, p_228792_4_, p_228792_5_, true, this.field_195476_e, i, OverlayTexture.field_229196_a_); + public void renderBreakingTexture(BlockState p_228792_1_, BlockPos p_228792_2_, IBlockDisplayReader p_228792_3_, MatrixStack p_228792_4_, IVertexBuilder p_228792_5_) { +- if (p_228792_1_.getRenderShape() == BlockRenderType.MODEL) { +- IBakedModel ibakedmodel = this.blockModelShaper.getBlockModel(p_228792_1_); +- long i = p_228792_1_.getSeed(p_228792_2_); +- this.modelRenderer.tesselateBlock(p_228792_3_, ibakedmodel, p_228792_1_, p_228792_2_, p_228792_4_, p_228792_5_, true, this.random, i, OverlayTexture.NO_OVERLAY); + renderBlockDamage(p_228792_1_,p_228792_2_, p_228792_3_, p_228792_4_, p_228792_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public void renderBlockDamage(BlockState blockStateIn, BlockPos posIn, IBlockDisplayReader lightReaderIn, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, net.minecraftforge.client.model.data.IModelData modelData) { -+ if (blockStateIn.func_185901_i() == BlockRenderType.MODEL) { -+ IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(blockStateIn); -+ long i = blockStateIn.func_209533_a(posIn); -+ this.field_175027_c.renderModel(lightReaderIn, ibakedmodel, blockStateIn, posIn, matrixStackIn, vertexBuilderIn, true, this.field_195476_e, i, OverlayTexture.field_229196_a_, modelData); ++ if (blockStateIn.getRenderShape() == BlockRenderType.MODEL) { ++ IBakedModel ibakedmodel = this.blockModelShaper.getBlockModel(blockStateIn); ++ long i = blockStateIn.getSeed(posIn); ++ this.modelRenderer.renderModel(lightReaderIn, ibakedmodel, blockStateIn, posIn, matrixStackIn, vertexBuilderIn, true, this.random, i, OverlayTexture.NO_OVERLAY, modelData); } } + @Deprecated //Forge: Model parameter - public boolean func_228793_a_(BlockState p_228793_1_, BlockPos p_228793_2_, IBlockDisplayReader p_228793_3_, MatrixStack p_228793_4_, IVertexBuilder p_228793_5_, boolean p_228793_6_, Random p_228793_7_) { + public boolean renderBatched(BlockState p_228793_1_, BlockPos p_228793_2_, IBlockDisplayReader p_228793_3_, MatrixStack p_228793_4_, IVertexBuilder p_228793_5_, boolean p_228793_6_, Random p_228793_7_) { + return renderModel(p_228793_1_, p_228793_2_, p_228793_3_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public boolean renderModel(BlockState blockStateIn, BlockPos posIn, IBlockDisplayReader lightReaderIn, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, boolean checkSides, Random rand, net.minecraftforge.client.model.data.IModelData modelData) { try { -- BlockRenderType blockrendertype = p_228793_1_.func_185901_i(); -- return blockrendertype != BlockRenderType.MODEL ? false : this.field_175027_c.func_228802_a_(p_228793_3_, this.func_184389_a(p_228793_1_), p_228793_1_, p_228793_2_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, p_228793_1_.func_209533_a(p_228793_2_), OverlayTexture.field_229196_a_); -+ BlockRenderType blockrendertype = blockStateIn.func_185901_i(); -+ return blockrendertype != BlockRenderType.MODEL ? false : this.field_175027_c.renderModel(lightReaderIn, this.func_184389_a(blockStateIn), blockStateIn, posIn, matrixStackIn, vertexBuilderIn, checkSides, rand, blockStateIn.func_209533_a(posIn), OverlayTexture.field_229196_a_, modelData); +- BlockRenderType blockrendertype = p_228793_1_.getRenderShape(); +- return blockrendertype != BlockRenderType.MODEL ? false : this.modelRenderer.tesselateBlock(p_228793_3_, this.getBlockModel(p_228793_1_), p_228793_1_, p_228793_2_, p_228793_4_, p_228793_5_, p_228793_6_, p_228793_7_, p_228793_1_.getSeed(p_228793_2_), OverlayTexture.NO_OVERLAY); ++ BlockRenderType blockrendertype = blockStateIn.getRenderShape(); ++ return blockrendertype != BlockRenderType.MODEL ? false : this.modelRenderer.renderModel(lightReaderIn, this.getBlockModel(blockStateIn), blockStateIn, posIn, matrixStackIn, vertexBuilderIn, checkSides, rand, blockStateIn.getSeed(posIn), OverlayTexture.NO_OVERLAY, modelData); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block in world"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being tesselated"); -- CrashReportCategory.func_175750_a(crashreportcategory, p_228793_2_, p_228793_1_); -+ CrashReportCategory.func_175750_a(crashreportcategory, posIn, blockStateIn); + CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block in world"); + CrashReportCategory crashreportcategory = crashreport.addCategory("Block being tesselated"); +- CrashReportCategory.populateBlockDetails(crashreportcategory, p_228793_2_, p_228793_1_); ++ CrashReportCategory.populateBlockDetails(crashreportcategory, posIn, blockStateIn); throw new ReportedException(crashreport); } } @@ -80,7 +_,11 @@ - return this.field_175028_a.func_178125_b(p_184389_1_); + return this.blockModelShaper.getBlockModel(p_184389_1_); } + @Deprecated //Forge: Model parameter - public void func_228791_a_(BlockState p_228791_1_, MatrixStack p_228791_2_, IRenderTypeBuffer p_228791_3_, int p_228791_4_, int p_228791_5_) { + public void renderSingleBlock(BlockState p_228791_1_, MatrixStack p_228791_2_, IRenderTypeBuffer p_228791_3_, int p_228791_4_, int p_228791_5_) { + renderBlock(p_228791_1_, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public void renderBlock(BlockState p_228791_1_, MatrixStack p_228791_2_, IRenderTypeBuffer p_228791_3_, int p_228791_4_, int p_228791_5_, net.minecraftforge.client.model.data.IModelData modelData) { - BlockRenderType blockrendertype = p_228791_1_.func_185901_i(); + BlockRenderType blockrendertype = p_228791_1_.getRenderShape(); if (blockrendertype != BlockRenderType.INVISIBLE) { switch(blockrendertype) { @@ -90,10 +_,11 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -- this.field_175027_c.func_228804_a_(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_239220_a_(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_); -+ this.field_175027_c.renderModel(p_228791_2_.func_227866_c_(), p_228791_3_.getBuffer(RenderTypeLookup.func_239220_a_(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_, modelData); +- this.modelRenderer.renderModel(p_228791_2_.last(), p_228791_3_.getBuffer(RenderTypeLookup.getRenderType(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_); ++ this.modelRenderer.renderModel(p_228791_2_.last(), p_228791_3_.getBuffer(RenderTypeLookup.getRenderType(p_228791_1_, false)), p_228791_1_, ibakedmodel, f, f1, f2, p_228791_4_, p_228791_5_, modelData); break; case ENTITYBLOCK_ANIMATED: -- ItemStackTileEntityRenderer.field_147719_a.func_239207_a_(new ItemStack(p_228791_1_.func_177230_c()), ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); -+ ItemStack stack = new ItemStack(p_228791_1_.func_177230_c()); -+ stack.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(stack, ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); +- ItemStackTileEntityRenderer.instance.renderByItem(new ItemStack(p_228791_1_.getBlock()), ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); ++ ItemStack stack = new ItemStack(p_228791_1_.getBlock()); ++ stack.getItem().getItemStackTileEntityRenderer().renderByItem(stack, ItemCameraTransforms.TransformType.NONE, p_228791_2_, p_228791_3_, p_228791_4_, p_228791_5_); } } @@ -101,5 +_,10 @@ - public void func_195410_a(IResourceManager p_195410_1_) { - this.field_175025_e.func_178268_a(); + public void onResourceManagerReload(IResourceManager p_195410_1_) { + this.liquidBlockRenderer.setupSprites(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch b/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch index 0f73f6e90c..3fe8f0e1ed 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch @@ -3,24 +3,24 @@ @@ -297,6 +_,7 @@ } - ByteBuffer bytebuffer = this.field_179001_a.slice(); -+ bytebuffer.order(this.field_179001_a.order()); // FORGE: Fix incorrect byte order - ((Buffer)this.field_179001_a).clear(); + ByteBuffer bytebuffer = this.buffer.slice(); ++ bytebuffer.order(this.buffer.order()); // FORGE: Fix incorrect byte order + ((Buffer)this.buffer).clear(); return Pair.of(bufferbuilder$drawstate, bytebuffer); } @@ -364,4 +_,15 @@ - this.field_179018_e = p_i225907_2_; + this.format = p_i225907_2_; } } + + // Forge start + public void putBulkData(ByteBuffer buffer) { -+ func_181670_b(buffer.limit() + this.field_179011_q.func_177338_f()); -+ ((Buffer)this.field_179001_a).position(this.field_178997_d * this.field_179011_q.func_177338_f()); -+ this.field_179001_a.put(buffer); -+ this.field_178997_d += buffer.limit() / this.field_179011_q.func_177338_f(); -+ this.field_227824_l_ += buffer.limit(); ++ ensureCapacity(buffer.limit() + this.format.getVertexSize()); ++ ((Buffer)this.buffer).position(this.vertices * this.format.getVertexSize()); ++ this.buffer.put(buffer); ++ this.vertices += buffer.limit() / this.format.getVertexSize(); ++ this.nextElementByte += buffer.limit(); + } + -+ public VertexFormat getVertexFormat() { return this.field_179011_q; } ++ public VertexFormat getVertexFormat() { return this.format; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch index 80bb271fe5..785b29070d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch @@ -2,44 +2,44 @@ +++ b/net/minecraft/client/renderer/FirstPersonRenderer.java @@ -208,7 +_,7 @@ boolean flag1 = true; - if (p_228396_4_.func_184587_cr()) { - ItemStack itemstack = p_228396_4_.func_184607_cu(); -- if (itemstack.func_77973_b() == Items.field_151031_f || itemstack.func_77973_b() == Items.field_222114_py) { -+ if (itemstack.func_77973_b() instanceof net.minecraft.item.ShootableItem) { - flag = p_228396_4_.func_184600_cs() == Hand.MAIN_HAND; + if (p_228396_4_.isUsingItem()) { + ItemStack itemstack = p_228396_4_.getUseItem(); +- if (itemstack.getItem() == Items.BOW || itemstack.getItem() == Items.CROSSBOW) { ++ if (itemstack.getItem() instanceof net.minecraft.item.ShootableItem) { + flag = p_228396_4_.getUsedItemHand() == Hand.MAIN_HAND; flag1 = !flag; } @@ -240,12 +_,14 @@ if (flag) { float f5 = hand == Hand.MAIN_HAND ? f : 0.0F; - float f2 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187470_g, this.field_187469_f); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f5, f2, this.field_187467_d)) - this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.MAIN_HAND, f5, this.field_187467_d, f2, p_228396_2_, p_228396_3_, p_228396_5_); + float f2 = 1.0F - MathHelper.lerp(p_228396_1_, this.oMainHandHeight, this.mainHandHeight); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f5, f2, this.mainHandItem)) + this.renderArmWithItem(p_228396_4_, p_228396_1_, f1, Hand.MAIN_HAND, f5, this.mainHandItem, f2, p_228396_2_, p_228396_3_, p_228396_5_); } if (flag1) { float f6 = hand == Hand.OFF_HAND ? f : 0.0F; - float f7 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187472_i, this.field_187471_h); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f6, f7, this.field_187468_e)) - this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.OFF_HAND, f6, this.field_187468_e, f7, p_228396_2_, p_228396_3_, p_228396_5_); + float f7 = 1.0F - MathHelper.lerp(p_228396_1_, this.oOffHandHeight, this.offHandHeight); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f6, f7, this.offHandItem)) + this.renderArmWithItem(p_228396_4_, p_228396_1_, f1, Hand.OFF_HAND, f6, this.offHandItem, f7, p_228396_2_, p_228396_3_, p_228396_5_); } @@ -410,8 +_,16 @@ - this.field_187471_h = MathHelper.func_76131_a(this.field_187471_h - 0.4F, 0.0F, 1.0F); + this.offHandHeight = MathHelper.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F); } else { - float f = clientplayerentity.func_184825_o(1.0F); -- this.field_187469_f += MathHelper.func_76131_a((this.field_187467_d == itemstack ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -- this.field_187471_h += MathHelper.func_76131_a((float)(this.field_187468_e == itemstack1 ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); -+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c); -+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1); + float f = clientplayerentity.getAttackStrengthScale(1.0F); +- this.mainHandHeight += MathHelper.clamp((this.mainHandItem == itemstack ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); +- this.offHandHeight += MathHelper.clamp((float)(this.offHandItem == itemstack1 ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); ++ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.mainHandItem, itemstack, clientplayerentity.inventory.selected); ++ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.offHandItem, itemstack1, -1); + -+ if (!requipM && this.field_187467_d != itemstack) -+ this.field_187467_d = itemstack; -+ if (!requipO && this.field_187468_e != itemstack1) -+ this.field_187468_e = itemstack1; ++ if (!requipM && this.mainHandItem != itemstack) ++ this.mainHandItem = itemstack; ++ if (!requipO && this.offHandItem != itemstack1) ++ this.offHandItem = itemstack1; + -+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F); -+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F); ++ this.mainHandHeight += MathHelper.clamp((!requipM ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); ++ this.offHandHeight += MathHelper.clamp((float)(!requipO ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); } - if (this.field_187469_f < 0.1F) { + if (this.mainHandHeight < 0.1F) { diff --git a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch index 8a2a105b1a..bf5dd8f83c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/client/renderer/FluidBlockRenderer.java @@ -70,9 +_,10 @@ - public boolean func_228796_a_(IBlockDisplayReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, FluidState p_228796_4_) { - boolean flag = p_228796_4_.func_206884_a(FluidTags.field_206960_b); -- TextureAtlasSprite[] atextureatlassprite = flag ? this.field_178272_a : this.field_178271_b; + public boolean tesselate(IBlockDisplayReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, FluidState p_228796_4_) { + boolean flag = p_228796_4_.is(FluidTags.LAVA); +- TextureAtlasSprite[] atextureatlassprite = flag ? this.lavaIcons : this.waterIcons; + TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_228796_1_, p_228796_2_, p_228796_4_); - BlockState blockstate = p_228796_1_.func_180495_p(p_228796_2_); -- int i = flag ? 16777215 : BiomeColors.func_228363_c_(p_228796_1_, p_228796_2_); -+ int i = p_228796_4_.func_206886_c().getAttributes().getColor(p_228796_1_, p_228796_2_); + BlockState blockstate = p_228796_1_.getBlockState(p_228796_2_); +- int i = flag ? 16777215 : BiomeColors.getAverageWaterColor(p_228796_1_, p_228796_2_); ++ int i = p_228796_4_.getType().getAttributes().getColor(p_228796_1_, p_228796_2_); + float alpha = (float)(i >> 24 & 255) / 255.0F; float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; @@ -17,19 +17,19 @@ float f25 = f4 * f; float f26 = f4 * f1; float f27 = f4 * f2; -- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); -- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); +- this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); +- this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); + this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); + this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j); + this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); + this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); - if (p_228796_4_.func_205586_a(p_228796_1_, p_228796_2_.func_177984_a())) { -- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); -- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); + if (p_228796_4_.shouldRenderBackwardUpFace(p_228796_1_, p_228796_2_.above())) { +- this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); +- this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); + this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); + this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); + this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); @@ -41,10 +41,10 @@ float f40 = f3 * f; float f41 = f3 * f1; float f42 = f3 * f2; -- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f34, f39, i1); -- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, f34, f37, i1); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, f35, f37, i1); -- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f35, f39, i1); +- this.vertex(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f34, f39, i1); +- this.vertex(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, f34, f37, i1); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, f35, f37, i1); +- this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f35, f39, i1); + this.vertexVanilla(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f34, f39, i1); + this.vertexVanilla(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, alpha, f34, f37, i1); + this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, alpha, f35, f37, i1); @@ -54,14 +54,14 @@ @@ -236,10 +_,9 @@ flag7 = true; - BlockPos blockpos = p_228796_2_.func_177972_a(direction); + BlockPos blockpos = p_228796_2_.relative(direction); TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { -- Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c(); +- Block block = p_228796_1_.getBlockState(blockpos).getBlock(); - if (block instanceof BreakableBlock || block instanceof LeavesBlock) { -- textureatlassprite2 = this.field_187501_d; +- textureatlassprite2 = this.waterOverlay; + if (atextureatlassprite[2] != null) { -+ if (p_228796_1_.func_180495_p(blockpos).shouldDisplayFluidOverlay(p_228796_1_, blockpos, p_228796_4_)) { ++ if (p_228796_1_.getBlockState(blockpos).shouldDisplayFluidOverlay(p_228796_1_, blockpos, p_228796_4_)) { + textureatlassprite2 = atextureatlassprite[2]; } } @@ -70,15 +70,15 @@ float f31 = f4 * f30 * f; float f32 = f4 * f30 * f1; float f33 = f4 * f30 * f2; -- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); -- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); -- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); -- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); -- if (textureatlassprite2 != this.field_187501_d) { -- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); -- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); -- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); -- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); +- this.vertex(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); +- this.vertex(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); +- this.vertex(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); +- this.vertex(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); +- if (textureatlassprite2 != this.waterOverlay) { +- this.vertex(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k); +- this.vertex(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k); +- this.vertex(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k); +- this.vertex(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k); + this.vertexVanilla(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k); + this.vertexVanilla(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k); + this.vertexVanilla(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k); @@ -96,12 +96,12 @@ } + @Deprecated - private void func_228797_a_(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float p_228797_11_, float p_228797_12_, int p_228797_13_) { -- p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, 1.0F).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d(); + private void vertex(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float p_228797_11_, float p_228797_12_, int p_228797_13_) { +- p_228797_1_.vertex(p_228797_2_, p_228797_4_, p_228797_6_).color(p_228797_8_, p_228797_9_, p_228797_10_, 1.0F).uv(p_228797_11_, p_228797_12_).uv2(p_228797_13_).normal(0.0F, 1.0F, 0.0F).endVertex(); + vertexVanilla(p_228797_1_, p_228797_2_, p_228797_4_, p_228797_6_, p_228797_8_, p_228797_9_, p_228797_10_, 1.0F, p_228797_11_, p_228797_12_, p_228797_13_); + } + private void vertexVanilla(IVertexBuilder vertexBuilderIn, double x, double y, double z, float red, float green, float blue, float alpha, float u, float v, int packedLight) { -+ vertexBuilderIn.func_225582_a_(x, y, z).func_227885_a_(red, green, blue, alpha).func_225583_a_(u, v).func_227886_a_(packedLight).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d(); ++ vertexBuilderIn.vertex(x, y, z).color(red, green, blue, alpha).uv(u, v).uv2(packedLight).normal(0.0F, 1.0F, 0.0F).endVertex(); } - private int func_228795_a_(IBlockDisplayReader p_228795_1_, BlockPos p_228795_2_) { + private int getLightColor(IBlockDisplayReader p_228795_1_, BlockPos p_228795_2_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index 452fa3c3be..7323ab81b8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -3,30 +3,30 @@ @@ -156,17 +_,28 @@ } - float f9 = Math.min(1.0F / field_205093_c, Math.min(1.0F / field_205094_d, 1.0F / field_205095_e)); + float f9 = Math.min(1.0F / fogRed, Math.min(1.0F / fogGreen, 1.0F / fogBlue)); + // Forge: fix MC-4647 and MC-10480 + if (Float.isInfinite(f9)) f9 = Math.nextAfter(f9, 0.0); - field_205093_c = field_205093_c * (1.0F - f6) + field_205093_c * f9 * f6; - field_205094_d = field_205094_d * (1.0F - f6) + field_205094_d * f9 * f6; - field_205095_e = field_205095_e * (1.0F - f6) + field_205095_e * f9 * f6; - } else if (p_228371_0_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228371_0_.func_216773_g()).func_70644_a(Effects.field_76439_r)) { - float f7 = GameRenderer.func_180438_a((LivingEntity)p_228371_0_.func_216773_g(), p_228371_1_); - float f10 = Math.min(1.0F / field_205093_c, Math.min(1.0F / field_205094_d, 1.0F / field_205095_e)); + fogRed = fogRed * (1.0F - f6) + fogRed * f9 * f6; + fogGreen = fogGreen * (1.0F - f6) + fogGreen * f9 * f6; + fogBlue = fogBlue * (1.0F - f6) + fogBlue * f9 * f6; + } else if (p_228371_0_.getEntity() instanceof LivingEntity && ((LivingEntity)p_228371_0_.getEntity()).hasEffect(Effects.NIGHT_VISION)) { + float f7 = GameRenderer.getNightVisionScale((LivingEntity)p_228371_0_.getEntity(), p_228371_1_); + float f10 = Math.min(1.0F / fogRed, Math.min(1.0F / fogGreen, 1.0F / fogBlue)); + // Forge: fix MC-4647 and MC-10480 + if (Float.isInfinite(f10)) f10 = Math.nextAfter(f10, 0.0); - field_205093_c = field_205093_c * (1.0F - f7) + field_205093_c * f10 * f7; - field_205094_d = field_205094_d * (1.0F - f7) + field_205094_d * f10 * f7; - field_205095_e = field_205095_e * (1.0F - f7) + field_205095_e * f10 * f7; + fogRed = fogRed * (1.0F - f7) + fogRed * f10 * f7; + fogGreen = fogGreen * (1.0F - f7) + fogGreen * f10 * f7; + fogBlue = fogBlue * (1.0F - f7) + fogBlue * f10 * f7; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(p_228371_0_, p_228371_1_, field_205093_c, field_205094_d, field_205095_e); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(p_228371_0_, p_228371_1_, fogRed, fogGreen, fogBlue); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + -+ field_205093_c = event.getRed(); -+ field_205094_d = event.getGreen(); -+ field_205095_e = event.getBlue(); ++ fogRed = event.getRed(); ++ fogGreen = event.getGreen(); ++ fogBlue = event.getBlue(); + - RenderSystem.clearColor(field_205093_c, field_205094_d, field_205095_e, 0.0F); + RenderSystem.clearColor(fogRed, fogGreen, fogBlue, 0.0F); } @@ -174,10 +_,17 @@ @@ -35,17 +35,17 @@ } - + @Deprecated // FORGE: Pass in partialTicks - public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) { + public static void setupFog(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) { + setupFog(p_228372_0_, p_228372_1_, p_228372_2_, p_228372_3_, 0); + } + + public static void setupFog(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_, float partialTicks) { - FluidState fluidstate = p_228372_0_.func_216771_k(); - Entity entity = p_228372_0_.func_216773_g(); + FluidState fluidstate = p_228372_0_.getFluidInCamera(); + Entity entity = p_228372_0_.getEntity(); + float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(p_228372_1_, p_228372_0_, partialTicks, 0.1F); + if (hook >= 0) RenderSystem.fogDensity(hook); + else - if (fluidstate.func_206884_a(FluidTags.field_206959_a)) { + if (fluidstate.is(FluidTags.WATER)) { float f = 1.0F; f = 0.05F; @@ -228,6 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 95de1e4f9c..f777e96b0a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java @@ -135,6 +_,8 @@ - this.func_175069_a(new ResourceLocation("shaders/post/spider.json")); + this.loadEffect(new ResourceLocation("shaders/post/spider.json")); } else if (p_175066_1_ instanceof EndermanEntity) { - this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); + this.loadEffect(new ResourceLocation("shaders/post/invert.json")); + } else { + net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this); } @@ -20,55 +20,55 @@ @@ -439,6 +_,7 @@ RenderSystem.loadIdentity(); - this.field_147707_d.func_148018_a(p_195458_1_); + this.postEffect.process(p_195458_1_); RenderSystem.popMatrix(); + RenderSystem.enableTexture(); //FORGE: Fix MC-194675 } - this.field_78531_r.func_147110_a().func_147610_a(true); + this.minecraft.getMainRenderTarget().bindWrite(true); @@ -448,10 +_,10 @@ - RenderSystem.clear(256, Minecraft.field_142025_a); + RenderSystem.clear(256, Minecraft.ON_OSX); RenderSystem.matrixMode(5889); RenderSystem.loadIdentity(); -- RenderSystem.ortho(0.0D, (double)mainwindow.func_198109_k() / mainwindow.func_198100_s(), (double)mainwindow.func_198091_l() / mainwindow.func_198100_s(), 0.0D, 1000.0D, 3000.0D); -+ RenderSystem.ortho(0.0D, (double)mainwindow.func_198109_k() / mainwindow.func_198100_s(), (double)mainwindow.func_198091_l() / mainwindow.func_198100_s(), 0.0D, 1000.0D, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()); +- RenderSystem.ortho(0.0D, (double)mainwindow.getWidth() / mainwindow.getGuiScale(), (double)mainwindow.getHeight() / mainwindow.getGuiScale(), 0.0D, 1000.0D, 3000.0D); ++ RenderSystem.ortho(0.0D, (double)mainwindow.getWidth() / mainwindow.getGuiScale(), (double)mainwindow.getHeight() / mainwindow.getGuiScale(), 0.0D, 1000.0D, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()); RenderSystem.matrixMode(5888); RenderSystem.loadIdentity(); - RenderSystem.translatef(0.0F, 0.0F, -2000.0F); + RenderSystem.translatef(0.0F, 0.0F, 1000.0F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()); - RenderHelper.func_227784_d_(); + RenderHelper.setupFor3DItems(); MatrixStack matrixstack = new MatrixStack(); - if (p_195458_4_ && this.field_78531_r.field_71441_e != null) { + if (p_195458_4_ && this.minecraft.level != null) { @@ -486,7 +_,7 @@ } - } else if (this.field_78531_r.field_71462_r != null) { + } else if (this.minecraft.screen != null) { try { -- this.field_78531_r.field_71462_r.func_230430_a_(matrixstack, i, j, this.field_78531_r.func_193989_ak()); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, matrixstack, i, j, this.field_78531_r.func_193989_ak()); +- this.minecraft.screen.render(matrixstack, i, j, this.minecraft.getDeltaFrameTime()); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, matrixstack, i, j, this.minecraft.getDeltaFrameTime()); } catch (Throwable throwable) { - CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen"); - CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details"); + CrashReport crashreport1 = CrashReport.forThrowable(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details"); @@ -595,9 +_,16 @@ - Matrix4f matrix4f = matrixstack.func_227866_c_().func_227870_a_(); - this.func_228379_a_(matrix4f); - activerenderinfo.func_216772_a(this.field_78531_r.field_71441_e, (Entity)(this.field_78531_r.func_175606_aa() == null ? this.field_78531_r.field_71439_g : this.field_78531_r.func_175606_aa()), !this.field_78531_r.field_71474_y.func_243230_g().func_243192_a(), this.field_78531_r.field_71474_y.func_243230_g().func_243193_b(), p_228378_1_); + Matrix4f matrix4f = matrixstack.last().pose(); + this.resetProjectionMatrix(matrix4f); + activerenderinfo.setup(this.minecraft.level, (Entity)(this.minecraft.getCameraEntity() == null ? this.minecraft.player : this.minecraft.getCameraEntity()), !this.minecraft.options.getCameraType().isFirstPerson(), this.minecraft.options.getCameraType().isMirrored(), p_228378_1_); + + net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(this, activerenderinfo, p_228378_1_); + activerenderinfo.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch()); -+ p_228378_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(cameraSetup.getRoll())); ++ p_228378_4_.mulPose(Vector3f.ZP.rotationDegrees(cameraSetup.getRoll())); + - p_228378_4_.func_227863_a_(Vector3f.field_229179_b_.func_229187_a_(activerenderinfo.func_216777_e())); - p_228378_4_.func_227863_a_(Vector3f.field_229181_d_.func_229187_a_(activerenderinfo.func_216778_f() + 180.0F)); - this.field_78531_r.field_71438_f.func_228426_a_(p_228378_4_, p_228378_1_, p_228378_2_, flag, activerenderinfo, this, this.field_78513_d, matrix4f); -+ this.field_78531_r.func_213239_aq().func_219895_b("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.field_78531_r.field_71438_f, p_228378_4_, p_228378_1_, matrix4f, p_228378_2_); - this.field_78531_r.func_213239_aq().func_219895_b("hand"); - if (this.field_175074_C) { - RenderSystem.clear(256, Minecraft.field_142025_a); + p_228378_4_.mulPose(Vector3f.XP.rotationDegrees(activerenderinfo.getXRot())); + p_228378_4_.mulPose(Vector3f.YP.rotationDegrees(activerenderinfo.getYRot() + 180.0F)); + this.minecraft.levelRenderer.renderLevel(p_228378_4_, p_228378_1_, p_228378_2_, flag, activerenderinfo, this, this.lightTexture, matrix4f); ++ this.minecraft.getProfiler().popPush("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.minecraft.levelRenderer, p_228378_4_, p_228378_1_, matrix4f, p_228378_2_); + this.minecraft.getProfiler().popPush("hand"); + if (this.renderHand) { + RenderSystem.clear(256, Minecraft.ON_OSX); @@ -708,5 +_,10 @@ - public OverlayTexture func_228385_m_() { - return this.field_228375_t_; + public OverlayTexture overlayTexture() { + return this.overlayTexture; + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index ed748d5ec8..b629bf0df1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -2,11 +2,11 @@ +++ b/net/minecraft/client/renderer/ItemModelMesher.java @@ -31,7 +_,8 @@ - public TextureAtlasSprite func_199309_a(ItemStack p_199309_1_) { - IBakedModel ibakedmodel = this.func_178089_a(p_199309_1_); -- return ibakedmodel == this.field_178090_d.func_174951_a() && p_199309_1_.func_77973_b() instanceof BlockItem ? this.field_178090_d.func_174954_c().func_178122_a(((BlockItem)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_177554_e(); + public TextureAtlasSprite getParticleIcon(ItemStack p_199309_1_) { + IBakedModel ibakedmodel = this.getItemModel(p_199309_1_); +- return ibakedmodel == this.modelManager.getMissingModel() && p_199309_1_.getItem() instanceof BlockItem ? this.modelManager.getBlockModelShaper().getParticleIcon(((BlockItem)p_199309_1_.getItem()).getBlock().defaultBlockState()) : ibakedmodel.getParticleIcon(); + // FORGE: Make sure to call the item overrides -+ return ibakedmodel == this.field_178090_d.func_174951_a() && p_199309_1_.func_77973_b() instanceof BlockItem ? this.field_178090_d.func_174954_c().func_178122_a(((BlockItem)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_188617_f().func_239290_a_(ibakedmodel, p_199309_1_, null, null).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ return ibakedmodel == this.modelManager.getMissingModel() && p_199309_1_.getItem() instanceof BlockItem ? this.modelManager.getBlockModelShaper().getParticleIcon(((BlockItem)p_199309_1_.getItem()).getBlock().defaultBlockState()) : ibakedmodel.getOverrides().resolve(ibakedmodel, p_199309_1_, null, null).getParticleTexture(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); } - public IBakedModel func_178089_a(ItemStack p_178089_1_) { + public IBakedModel getItemModel(ItemStack p_178089_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 36546c42e0..c6417d0332 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -3,20 +3,20 @@ @@ -59,7 +_,7 @@ public ItemRenderer(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { - this.field_175057_n = p_i46552_1_; -- this.field_175059_m = new ItemModelMesher(p_i46552_2_); -+ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); + this.textureManager = p_i46552_1_; +- this.itemModelShaper = new ItemModelMesher(p_i46552_2_); ++ this.itemModelShaper = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); - for(Item item : Registry.field_212630_s) { - if (!field_195411_c.contains(item)) { + for(Item item : Registry.ITEM) { + if (!IGNORED.contains(item)) { @@ -95,7 +_,7 @@ - p_229111_8_ = this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation("minecraft:trident#inventory")); + p_229111_8_ = this.itemModelShaper.getModelManager().getModel(new ModelResourceLocation("minecraft:trident#inventory")); } -- p_229111_8_.func_177552_f().func_181688_b(p_229111_2_).func_228830_a_(p_229111_3_, p_229111_4_); +- p_229111_8_.getTransforms().getTransform(p_229111_2_).apply(p_229111_3_, p_229111_4_); + p_229111_8_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_229111_4_, p_229111_8_, p_229111_2_, p_229111_3_); - p_229111_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); - if (!p_229111_8_.func_188618_c() && (p_229111_1_.func_77973_b() != Items.field_203184_eO || flag)) { + p_229111_4_.translate(-0.5D, -0.5D, -0.5D); + if (!p_229111_8_.isCustomRenderer() && (p_229111_1_.getItem() != Items.TRIDENT || flag)) { boolean flag1; @@ -105,7 +_,8 @@ } else { @@ -25,64 +25,64 @@ - + if (p_229111_8_.isLayered()) { net.minecraftforge.client.ForgeHooksClient.drawItemLayered(this, p_229111_8_, p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_, flag1); } + else { - RenderType rendertype = RenderTypeLookup.func_239219_a_(p_229111_1_, flag1); + RenderType rendertype = RenderTypeLookup.getRenderType(p_229111_1_, flag1); IVertexBuilder ivertexbuilder; - if (p_229111_1_.func_77973_b() == Items.field_151111_aL && p_229111_1_.func_77962_s()) { + if (p_229111_1_.getItem() == Items.COMPASS && p_229111_1_.hasFoil()) { @@ -131,8 +_,9 @@ } - this.func_229114_a_(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder); + this.renderModelLists(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder); + } } else { -- ItemStackTileEntityRenderer.field_147719_a.func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); -+ p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); +- ItemStackTileEntityRenderer.instance.renderByItem(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); ++ p_229111_1_.getItem().getItemStackTileEntityRenderer().renderByItem(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); } - p_229111_4_.func_227865_b_(); + p_229111_4_.popPose(); @@ -176,7 +_,7 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -- p_229112_2_.func_227889_a_(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_); +- p_229112_2_.putBulkData(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_); + p_229112_2_.addVertexData(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_, true); } } @@ -267,6 +_,7 @@ - crashreportcategory.func_189529_a("Item Type", () -> { - return String.valueOf((Object)p_239387_2_.func_77973_b()); + crashreportcategory.setDetail("Item Type", () -> { + return String.valueOf((Object)p_239387_2_.getItem()); }); -+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_239387_2_.func_77973_b().getRegistryName())); - crashreportcategory.func_189529_a("Item Damage", () -> { - return String.valueOf(p_239387_2_.func_77952_i()); ++ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(p_239387_2_.getItem().getRegistryName())); + crashreportcategory.setDetail("Item Damage", () -> { + return String.valueOf(p_239387_2_.getDamageValue()); }); @@ -298,18 +_,16 @@ - irendertypebuffer$impl.func_228461_a_(); + irendertypebuffer$impl.endBatch(); } -- if (p_180453_2_.func_77951_h()) { -+ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) { +- if (p_180453_2_.isDamaged()) { ++ if (p_180453_2_.getItem().showDurabilityBar(p_180453_2_)) { RenderSystem.disableDepthTest(); RenderSystem.disableTexture(); RenderSystem.disableAlphaTest(); RenderSystem.disableBlend(); - Tessellator tessellator = Tessellator.func_178181_a(); - BufferBuilder bufferbuilder = tessellator.func_178180_c(); -- float f = (float)p_180453_2_.func_77952_i(); -- float f1 = (float)p_180453_2_.func_77958_k(); + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); +- float f = (float)p_180453_2_.getDamageValue(); +- float f1 = (float)p_180453_2_.getMaxDamage(); - float f2 = Math.max(0.0F, (f1 - f) / f1); - int i = Math.round(13.0F - f * 13.0F / f1); -- int j = MathHelper.func_181758_c(f2 / 3.0F, 1.0F, 1.0F); -+ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); +- int j = MathHelper.hsvToRgb(f2 / 3.0F, 1.0F, 1.0F); ++ double health = p_180453_2_.getItem().getDurabilityForDisplay(p_180453_2_); + int i = Math.round(13.0F - (float)health * 13.0F); -+ int j = p_180453_2_.func_77973_b().getRGBDurabilityForDisplay(p_180453_2_); - this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255); ++ int j = p_180453_2_.getItem().getRGBDurabilityForDisplay(p_180453_2_); + this.fillRect(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); + this.fillRect(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255); RenderSystem.enableBlend(); @@ -346,5 +_,10 @@ - public void func_195410_a(IResourceManager p_195410_1_) { - this.field_175059_m.func_178085_b(); + public void onResourceManagerReload(IResourceManager p_195410_1_) { + this.itemModelShaper.rebuildCache(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch index 3c53caba3e..0bd80eac66 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch @@ -3,9 +3,9 @@ @@ -169,7 +_,7 @@ } - public static int func_228450_a_(int p_228450_0_) { + public static int block(int p_228450_0_) { - return p_228450_0_ >> 4 & '\uffff'; + return (p_228450_0_ & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806 } - public static int func_228454_b_(int p_228454_0_) { + public static int sky(int p_228454_0_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch index 12c9ebe93f..b8e7281985 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OverlayRenderer.java.patch @@ -2,33 +2,33 @@ +++ b/net/minecraft/client/renderer/OverlayRenderer.java @@ -27,18 +_,21 @@ RenderSystem.disableAlphaTest(); - PlayerEntity playerentity = p_228734_0_.field_71439_g; - if (!playerentity.field_70145_X) { -- BlockState blockstate = func_230018_a_(playerentity); + PlayerEntity playerentity = p_228734_0_.player; + if (!playerentity.noPhysics) { +- BlockState blockstate = getViewBlockingState(playerentity); - if (blockstate != null) { -- func_228735_a_(p_228734_0_, p_228734_0_.func_175602_ab().func_175023_a().func_178122_a(blockstate), p_228734_1_); +- renderTex(p_228734_0_, p_228734_0_.getBlockRenderer().getBlockModelShaper().getParticleIcon(blockstate), p_228734_1_); + org.apache.commons.lang3.tuple.Pair overlay = getOverlayBlock(playerentity); + if (overlay != null) { + if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(playerentity, p_228734_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) -+ func_228735_a_(p_228734_0_, p_228734_0_.func_175602_ab().func_175023_a().getTexture(overlay.getLeft(), p_228734_0_.field_71441_e, overlay.getRight()), p_228734_1_); ++ renderTex(p_228734_0_, p_228734_0_.getBlockRenderer().getBlockModelShaper().getTexture(overlay.getLeft(), p_228734_0_.level, overlay.getRight()), p_228734_1_); } } - if (!p_228734_0_.field_71439_g.func_175149_v()) { - if (p_228734_0_.field_71439_g.func_208600_a(FluidTags.field_206959_a)) { + if (!p_228734_0_.player.isSpectator()) { + if (p_228734_0_.player.isEyeInFluid(FluidTags.WATER)) { + if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(playerentity, p_228734_1_)) - func_228736_b_(p_228734_0_, p_228734_1_); + renderWater(p_228734_0_, p_228734_1_); } - if (p_228734_0_.field_71439_g.func_70027_ad()) { + if (p_228734_0_.player.isOnFire()) { + if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(playerentity, p_228734_1_)) - func_228737_c_(p_228734_0_, p_228734_1_); + renderFire(p_228734_0_, p_228734_1_); } } @@ -48,6 +_,11 @@ @Nullable - private static BlockState func_230018_a_(PlayerEntity p_230018_0_) { + private static BlockState getViewBlockingState(PlayerEntity p_230018_0_) { + return getOverlayBlock(p_230018_0_).getLeft(); + } + @@ -38,11 +38,11 @@ for(int i = 0; i < 8; ++i) { @@ -57,7 +_,7 @@ - blockpos$mutable.func_189532_c(d0, d1, d2); - BlockState blockstate = p_230018_0_.field_70170_p.func_180495_p(blockpos$mutable); - if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && blockstate.func_215696_m(p_230018_0_.field_70170_p, blockpos$mutable)) { + blockpos$mutable.set(d0, d1, d2); + BlockState blockstate = p_230018_0_.level.getBlockState(blockpos$mutable); + if (blockstate.getRenderShape() != BlockRenderType.INVISIBLE && blockstate.isViewBlocking(p_230018_0_.level, blockpos$mutable)) { - return blockstate; -+ return org.apache.commons.lang3.tuple.Pair.of(blockstate, blockpos$mutable.func_185334_h()); ++ return org.apache.commons.lang3.tuple.Pair.of(blockstate, blockpos$mutable.immutable()); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch index ce87c03e95..0f972a1b41 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch @@ -3,14 +3,14 @@ @@ -215,11 +_,11 @@ } - public static RenderType func_228658_l_(ResourceLocation p_228658_0_) { -- return func_228633_a_("text", DefaultVertexFormats.field_227852_q_, 7, 256, false, true, RenderType.State.func_228694_a_().func_228724_a_(new RenderState.TextureState(p_228658_0_, false, false)).func_228713_a_(field_228517_i_).func_228726_a_(field_228515_g_).func_228719_a_(field_228528_t_).func_228728_a_(false)); + public static RenderType text(ResourceLocation p_228658_0_) { +- return create("text", DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP, 7, 256, false, true, RenderType.State.builder().setTextureState(new RenderState.TextureState(p_228658_0_, false, false)).setAlphaState(DEFAULT_ALPHA).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setLightmapState(LIGHTMAP).createCompositeState(false)); + return net.minecraftforge.client.ForgeRenderTypes.getText(p_228658_0_); } - public static RenderType func_228660_m_(ResourceLocation p_228660_0_) { -- return func_228633_a_("text_see_through", DefaultVertexFormats.field_227852_q_, 7, 256, false, true, RenderType.State.func_228694_a_().func_228724_a_(new RenderState.TextureState(p_228660_0_, false, false)).func_228713_a_(field_228517_i_).func_228726_a_(field_228515_g_).func_228719_a_(field_228528_t_).func_228715_a_(field_228492_B_).func_228727_a_(field_228496_F_).func_228728_a_(false)); + public static RenderType textSeeThrough(ResourceLocation p_228660_0_) { +- return create("text_see_through", DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP, 7, 256, false, true, RenderType.State.builder().setTextureState(new RenderState.TextureState(p_228660_0_, false, false)).setAlphaState(DEFAULT_ALPHA).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setLightmapState(LIGHTMAP).setDepthTestState(NO_DEPTH_TEST).setWriteMaskState(COLOR_WRITE).createCompositeState(false)); + return net.minecraftforge.client.ForgeRenderTypes.getTextSeeThrough(p_228660_0_); } - public static RenderType func_228657_l_() { + public static RenderType lightning() { diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch index 66fb1d3e8a..dc6b2d6e23 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderTypeLookup.java.patch @@ -5,51 +5,51 @@ @OnlyIn(Dist.CLIENT) public class RenderTypeLookup { + @Deprecated - private static final Map field_228386_a_ = Util.func_200696_a(Maps.newHashMap(), (p_228395_0_) -> { - RenderType rendertype = RenderType.func_241715_r_(); - p_228395_0_.put(Blocks.field_150473_bD, rendertype); + private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), (p_228395_0_) -> { + RenderType rendertype = RenderType.tripwire(); + p_228395_0_.put(Blocks.TRIPWIRE, rendertype); @@ -263,6 +_,7 @@ - p_228395_0_.put(Blocks.field_185778_de, rendertype3); - p_228395_0_.put(Blocks.field_203203_C, rendertype3); + p_228395_0_.put(Blocks.FROSTED_ICE, rendertype3); + p_228395_0_.put(Blocks.BUBBLE_COLUMN, rendertype3); }); + @Deprecated - private static final Map field_228387_b_ = Util.func_200696_a(Maps.newHashMap(), (p_228392_0_) -> { - RenderType rendertype = RenderType.func_228645_f_(); - p_228392_0_.put(Fluids.field_207212_b, rendertype); + private static final Map TYPE_BY_FLUID = Util.make(Maps.newHashMap(), (p_228392_0_) -> { + RenderType rendertype = RenderType.translucent(); + p_228392_0_.put(Fluids.FLOWING_WATER, rendertype); @@ -270,6 +_,7 @@ }); - private static boolean field_228388_c_; + private static boolean renderCutout; + @Deprecated // FORGE: Use canRenderInLayer - public static RenderType func_228390_a_(BlockState p_228390_0_) { - Block block = p_228390_0_.func_177230_c(); + public static RenderType getChunkRenderType(BlockState p_228390_0_) { + Block block = p_228390_0_.getBlock(); if (block instanceof LeavesBlock) { @@ -280,6 +_,7 @@ } } + @Deprecated // FORGE: Use canRenderInLayer - public static RenderType func_239221_b_(BlockState p_239221_0_) { - Block block = p_239221_0_.func_177230_c(); + public static RenderType getMovingBlockRenderType(BlockState p_239221_0_) { + Block block = p_239221_0_.getBlock(); if (block instanceof LeavesBlock) { @@ -295,8 +_,7 @@ } - public static RenderType func_239220_a_(BlockState p_239220_0_, boolean p_239220_1_) { -- RenderType rendertype = func_228390_a_(p_239220_0_); -- if (rendertype == RenderType.func_228645_f_()) { -+ if (canRenderInLayer(p_239220_0_, RenderType.func_228645_f_())) { - if (!Minecraft.func_238218_y_()) { - return Atlases.func_228785_j_(); + public static RenderType getRenderType(BlockState p_239220_0_, boolean p_239220_1_) { +- RenderType rendertype = getChunkRenderType(p_239220_0_); +- if (rendertype == RenderType.translucent()) { ++ if (canRenderInLayer(p_239220_0_, RenderType.translucent())) { + if (!Minecraft.useShaderTransparency()) { + return Atlases.translucentCullBlockSheet(); } else { @@ -317,9 +_,58 @@ } } + @Deprecated // FORGE: Use canRenderInLayer - public static RenderType func_228391_a_(FluidState p_228391_0_) { - RenderType rendertype = field_228387_b_.get(p_228391_0_.func_206886_c()); - return rendertype != null ? rendertype : RenderType.func_228639_c_(); + public static RenderType getRenderLayer(FluidState p_228391_0_) { + RenderType rendertype = TYPE_BY_FLUID.get(p_228391_0_.getType()); + return rendertype != null ? rendertype : RenderType.solid(); + } + + // FORGE START @@ -57,29 +57,29 @@ + private static final Map, java.util.function.Predicate> blockRenderChecks = Maps.newHashMap(); + private static final Map, java.util.function.Predicate> fluidRenderChecks = Maps.newHashMap(); + static { -+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); -+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); ++ TYPE_BY_BLOCK.forEach(RenderTypeLookup::setRenderLayer); ++ TYPE_BY_FLUID.forEach(RenderTypeLookup::setRenderLayer); + } + + public static boolean canRenderInLayer(BlockState state, RenderType type) { -+ Block block = state.func_177230_c(); ++ Block block = state.getBlock(); + if (block instanceof LeavesBlock) { -+ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_(); ++ return renderCutout ? type == RenderType.cutoutMipped() : type == RenderType.solid(); + } else { + java.util.function.Predicate rendertype; + synchronized (RenderTypeLookup.class) { + rendertype = blockRenderChecks.get(block.delegate); + } -+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); ++ return rendertype != null ? rendertype.test(type) : type == RenderType.solid(); + } + } + + public static boolean canRenderInLayer(FluidState fluid, RenderType type) { + java.util.function.Predicate rendertype; + synchronized (RenderTypeLookup.class) { -+ rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate); ++ rendertype = fluidRenderChecks.get(fluid.getType().delegate); + } -+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); ++ return rendertype != null ? rendertype.test(type) : type == RenderType.solid(); + } + + public static void setRenderLayer(Block block, RenderType type) { @@ -100,4 +100,4 @@ + fluidRenderChecks.put(fluid.delegate, predicate); } - public static void func_228393_a_(boolean p_228393_0_) { + public static void setFancy(boolean p_228393_0_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 40bd40eceb..d519b32f0d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -3,208 +3,208 @@ @@ -222,6 +_,11 @@ } - private void func_228438_a_(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) { -+ net.minecraftforge.client.IWeatherRenderHandler renderHandler = field_72769_h.func_239132_a_().getWeatherRenderHandler(); + private void renderSnowAndRain(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) { ++ net.minecraftforge.client.IWeatherRenderHandler renderHandler = level.effects().getWeatherRenderHandler(); + if (renderHandler != null) { -+ renderHandler.render(field_72773_u, p_228438_2_, field_72769_h, field_72777_q, p_228438_1_, p_228438_3_, p_228438_5_, p_228438_7_); ++ renderHandler.render(ticks, p_228438_2_, level, minecraft, p_228438_1_, p_228438_3_, p_228438_5_, p_228438_7_); + return; + } - float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_); + float f = this.minecraft.level.getRainLevel(p_228438_2_); if (!(f <= 0.0F)) { - p_228438_1_.func_205109_c(); + p_228438_1_.turnOnLightLayer(); @@ -347,6 +_,11 @@ } - public void func_228436_a_(ActiveRenderInfo p_228436_1_) { -+ net.minecraftforge.client.IWeatherParticleRenderHandler renderHandler = field_72769_h.func_239132_a_().getWeatherParticleRenderHandler(); + public void tickRain(ActiveRenderInfo p_228436_1_) { ++ net.minecraftforge.client.IWeatherParticleRenderHandler renderHandler = level.effects().getWeatherParticleRenderHandler(); + if (renderHandler != null) { -+ renderHandler.render(field_72773_u, field_72769_h, field_72777_q, p_228436_1_); ++ renderHandler.render(ticks, level, minecraft, p_228436_1_); + return; + } - float f = this.field_72777_q.field_71441_e.func_72867_j(1.0F) / (Minecraft.func_71375_t() ? 1.0F : 2.0F); + float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F); if (!(f <= 0.0F)) { - Random random = new Random((long)this.field_72773_u * 312987231L); + Random random = new Random((long)this.ticks * 312987231L); @@ -830,7 +_,7 @@ - this.field_147595_R = true; - BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8); - boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D; -- if (!chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag1) { -+ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrenderdispatcher$chunkrender4.func_188281_o() && !flag1) { - this.field_175009_l.add(chunkrenderdispatcher$chunkrender4); + this.needsUpdate = true; + BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.getOrigin().offset(8, 8, 8); + boolean flag1 = blockpos2.distSqr(blockpos) < 768.0D; +- if (!chunkrenderdispatcher$chunkrender4.isDirtyFromPlayer() && !flag1) { ++ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrenderdispatcher$chunkrender4.isDirtyFromPlayer() && !flag1) { + this.chunksToCompile.add(chunkrenderdispatcher$chunkrender4); } else { - this.field_72777_q.func_213239_aq().func_76320_a("build near"); + this.minecraft.getProfiler().push("build near"); @@ -915,13 +_,13 @@ - float f = p_228426_7_.func_205001_m(); - boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f(); - if (this.field_72777_q.field_71474_y.field_151451_c >= 4) { -- FogRenderer.func_228372_a_(p_228426_6_, FogRenderer.FogType.FOG_SKY, f, flag1); + float f = p_228426_7_.getRenderDistance(); + boolean flag1 = this.minecraft.level.effects().isFoggyAt(MathHelper.floor(d0), MathHelper.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog(); + if (this.minecraft.options.renderDistance >= 4) { +- FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_SKY, f, flag1); + FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_SKY, f, flag1, p_228426_2_); - iprofiler.func_219895_b("sky"); - this.func_228424_a_(p_228426_1_, p_228426_2_); + iprofiler.popPush("sky"); + this.renderSky(p_228426_1_, p_228426_2_); } - iprofiler.func_219895_b("fog"); -- FogRenderer.func_228372_a_(p_228426_6_, FogRenderer.FogType.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1); + iprofiler.popPush("fog"); +- FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1); + FogRenderer.setupFog(p_228426_6_, FogRenderer.FogType.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1, p_228426_2_); - iprofiler.func_219895_b("terrain_setup"); - this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v()); - iprofiler.func_219895_b("updatechunks"); + iprofiler.popPush("terrain_setup"); + this.setupRender(p_228426_6_, clippinghelper, flag, this.frameId++, this.minecraft.player.isSpectator()); + iprofiler.popPush("updatechunks"); @@ -942,7 +_,9 @@ - this.func_174967_a(p_228426_3_ + l1); - iprofiler.func_219895_b("terrain"); - this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2); -+ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).setBlurMipmap(false, this.field_72777_q.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings - this.func_228441_a_(RenderType.func_228641_d_(), p_228426_1_, d0, d1, d2); -+ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).restoreLastBlurMipmap(); - this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2); - if (this.field_72769_h.func_239132_a_().func_239217_c_()) { - RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_()); + this.compileChunksUntil(p_228426_3_ + l1); + iprofiler.popPush("terrain"); + this.renderChunkLayer(RenderType.solid(), p_228426_1_, d0, d1, d2); ++ this.minecraft.getModelManager().getAtlas(AtlasTexture.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings + this.renderChunkLayer(RenderType.cutoutMipped(), p_228426_1_, d0, d1, d2); ++ this.minecraft.getModelManager().getAtlas(AtlasTexture.LOCATION_BLOCKS).restoreLastBlurMipmap(); + this.renderChunkLayer(RenderType.cutout(), p_228426_1_, d0, d1, d2); + if (this.level.effects().constantAmbientLight()) { + RenderHelper.setupNetherLevel(p_228426_1_.last().pose()); @@ -972,7 +_,7 @@ - IRenderTypeBuffer.Impl irendertypebuffer$impl = this.field_228415_m_.func_228487_b_(); + IRenderTypeBuffer.Impl irendertypebuffer$impl = this.renderBuffers.bufferSource(); - for(Entity entity : this.field_72769_h.func_217416_b()) { -- if ((this.field_175010_j.func_229086_a_(entity, clippinghelper, d0, d1, d2) || entity.func_184215_y(this.field_72777_q.field_71439_g)) && (entity != p_228426_6_.func_216773_g() || p_228426_6_.func_216770_i() || p_228426_6_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228426_6_.func_216773_g()).func_70608_bn()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.func_216773_g() == entity)) { -+ if ((this.field_175010_j.func_229086_a_(entity, clippinghelper, d0, d1, d2) || entity.func_184215_y(this.field_72777_q.field_71439_g)) && (entity != p_228426_6_.func_216773_g() || p_228426_6_.func_216770_i() || p_228426_6_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_228426_6_.func_216773_g()).func_70608_bn()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.func_216773_g() == entity || (entity == field_72777_q.field_71439_g && !field_72777_q.field_71439_g.func_175149_v()))) { //FORGE: render local player entity when it is not the renderViewEntity - ++this.field_72749_I; - if (entity.field_70173_aa == 0) { - entity.field_70142_S = entity.func_226277_ct_(); + for(Entity entity : this.level.entitiesForRendering()) { +- if ((this.entityRenderDispatcher.shouldRender(entity, clippinghelper, d0, d1, d2) || entity.hasIndirectPassenger(this.minecraft.player)) && (entity != p_228426_6_.getEntity() || p_228426_6_.isDetached() || p_228426_6_.getEntity() instanceof LivingEntity && ((LivingEntity)p_228426_6_.getEntity()).isSleeping()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.getEntity() == entity)) { ++ if ((this.entityRenderDispatcher.shouldRender(entity, clippinghelper, d0, d1, d2) || entity.hasIndirectPassenger(this.minecraft.player)) && (entity != p_228426_6_.getEntity() || p_228426_6_.isDetached() || p_228426_6_.getEntity() instanceof LivingEntity && ((LivingEntity)p_228426_6_.getEntity()).isSleeping()) && (!(entity instanceof ClientPlayerEntity) || p_228426_6_.getEntity() == entity || (entity == minecraft.player && !minecraft.player.isSpectator()))) { //FORGE: render local player entity when it is not the renderViewEntity + ++this.renderedEntities; + if (entity.tickCount == 0) { + entity.xOld = entity.getX(); @@ -1010,6 +_,7 @@ - List list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b(); + List list = worldrenderer$localrenderinformationcontainer.chunk.getCompiledChunk().getRenderableBlockEntities(); if (!list.isEmpty()) { for(TileEntity tileentity1 : list) { -+ if(!clippinghelper.func_228957_a_(tileentity1.getRenderBoundingBox())) continue; - BlockPos blockpos3 = tileentity1.func_174877_v(); ++ if(!clippinghelper.isVisible(tileentity1.getRenderBoundingBox())) continue; + BlockPos blockpos3 = tileentity1.getBlockPos(); IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl; - p_228426_1_.func_227860_a_(); + p_228426_1_.pushPose(); @@ -1035,6 +_,7 @@ - synchronized(this.field_181024_n) { - for(TileEntity tileentity : this.field_181024_n) { -+ if(!clippinghelper.func_228957_a_(tileentity.getRenderBoundingBox())) continue; - BlockPos blockpos2 = tileentity.func_174877_v(); - p_228426_1_.func_227860_a_(); - p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2); + synchronized(this.globalBlockEntities) { + for(TileEntity tileentity : this.globalBlockEntities) { ++ if(!clippinghelper.isVisible(tileentity.getRenderBoundingBox())) continue; + BlockPos blockpos2 = tileentity.getBlockPos(); + p_228426_1_.pushPose(); + p_228426_1_.translate((double)blockpos2.getX() - d0, (double)blockpos2.getY() - d1, (double)blockpos2.getZ() - d2); @@ -1084,10 +_,13 @@ - iprofiler.func_219895_b("outline"); - BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a(); - BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); -- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { + iprofiler.popPush("outline"); + BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).getBlockPos(); + BlockState blockstate = this.level.getBlockState(blockpos); +- if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos)) { + if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, raytraceresult, p_228426_2_, p_228426_1_, irendertypebuffer$impl)) -+ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { - IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_()); - this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate); ++ if (!blockstate.isAir(this.level, blockpos) && this.level.getWorldBorder().isWithinBounds(blockpos)) { + IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.lines()); + this.renderHitOutline(p_228426_1_, ivertexbuilder2, p_228426_6_.getEntity(), d0, d1, d2, blockpos, blockstate); } -+ } else if (raytraceresult != null && raytraceresult.func_216346_c() == RayTraceResult.Type.ENTITY) { ++ } else if (raytraceresult != null && raytraceresult.getType() == RayTraceResult.Type.ENTITY) { + net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, raytraceresult, p_228426_2_, p_228426_1_, irendertypebuffer$impl); } RenderSystem.pushMatrix(); @@ -1119,7 +_,7 @@ - this.field_239224_H_.func_237506_a_(this.field_72777_q.func_147110_a()); - RenderState.field_239237_T_.func_228547_a_(); - iprofiler.func_219895_b("particles"); -- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_); -+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper); - RenderState.field_239237_T_.func_228549_b_(); + this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); + RenderState.PARTICLES_TARGET.setupRenderState(); + iprofiler.popPush("particles"); +- this.minecraft.particleEngine.render(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_); ++ this.minecraft.particleEngine.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper); + RenderState.PARTICLES_TARGET.clearRenderState(); } else { - iprofiler.func_219895_b("translucent"); + iprofiler.popPush("translucent"); @@ -1129,7 +_,7 @@ - iprofiler.func_219895_b("string"); - this.func_228441_a_(RenderType.func_241715_r_(), p_228426_1_, d0, d1, d2); - iprofiler.func_219895_b("particles"); -- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_); -+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper); + iprofiler.popPush("string"); + this.renderChunkLayer(RenderType.tripwire(), p_228426_1_, d0, d1, d2); + iprofiler.popPush("particles"); +- this.minecraft.particleEngine.render(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_); ++ this.minecraft.particleEngine.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper); } RenderSystem.pushMatrix(); @@ -1481,6 +_,11 @@ } - public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) { -+ net.minecraftforge.client.ISkyRenderHandler renderHandler = field_72769_h.func_239132_a_().getSkyRenderHandler(); + public void renderSky(MatrixStack p_228424_1_, float p_228424_2_) { ++ net.minecraftforge.client.ISkyRenderHandler renderHandler = level.effects().getSkyRenderHandler(); + if (renderHandler != null) { -+ renderHandler.render(field_72773_u, p_228424_2_, p_228424_1_, field_72769_h, field_72777_q); ++ renderHandler.render(ticks, p_228424_2_, p_228424_1_, level, minecraft); + return; + } - if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) { - this.func_228444_b_(p_228424_1_); - } else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) { + if (this.minecraft.level.effects().skyType() == DimensionRenderInfo.FogType.END) { + this.renderEndSky(p_228424_1_); + } else if (this.minecraft.level.effects().skyType() == DimensionRenderInfo.FogType.NORMAL) { @@ -1609,6 +_,11 @@ } - public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) { -+ net.minecraftforge.client.ICloudRenderHandler renderHandler = field_72769_h.func_239132_a_().getCloudRenderHandler(); + public void renderClouds(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) { ++ net.minecraftforge.client.ICloudRenderHandler renderHandler = level.effects().getCloudRenderHandler(); + if (renderHandler != null) { -+ renderHandler.render(field_72773_u, p_228425_2_, p_228425_1_, field_72769_h, field_72777_q, p_228425_3_, p_228425_5_, p_228425_7_); ++ renderHandler.render(ticks, p_228425_2_, p_228425_1_, level, minecraft, p_228425_3_, p_228425_5_, p_228425_7_); + return; + } - float f = this.field_72769_h.func_239132_a_().func_239213_a_(); + float f = this.level.effects().getCloudHeight(); if (!Float.isNaN(f)) { RenderSystem.disableCull(); @@ -1792,7 +_,7 @@ while(iterator.hasNext()) { ChunkRenderDispatcher.ChunkRender chunkrenderdispatcher$chunkrender = iterator.next(); -- if (chunkrenderdispatcher$chunkrender.func_188281_o()) { -+ if (!net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && chunkrenderdispatcher$chunkrender.func_188281_o()) { - this.field_174995_M.func_228902_a_(chunkrenderdispatcher$chunkrender); +- if (chunkrenderdispatcher$chunkrender.isDirtyFromPlayer()) { ++ if (!net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && chunkrenderdispatcher$chunkrender.isDirtyFromPlayer()) { + this.chunkRenderDispatcher.rebuildChunkSync(chunkrenderdispatcher$chunkrender); } else { - chunkrenderdispatcher$chunkrender.func_228929_a_(this.field_174995_M); + chunkrenderdispatcher$chunkrender.rebuildChunkAsync(this.chunkRenderDispatcher); @@ -2076,7 +_,12 @@ - this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_); + this.viewArea.setDirty(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_); } + @Deprecated // Forge: use item aware function below - public void func_184377_a(@Nullable SoundEvent p_184377_1_, BlockPos p_184377_2_) { -+ this.playRecord(p_184377_1_, p_184377_2_, p_184377_1_ == null? null : MusicDiscItem.func_185074_a(p_184377_1_)); + public void playStreamingMusic(@Nullable SoundEvent p_184377_1_, BlockPos p_184377_2_) { ++ this.playRecord(p_184377_1_, p_184377_2_, p_184377_1_ == null? null : MusicDiscItem.getBySound(p_184377_1_)); + } + + public void playRecord(@Nullable SoundEvent p_184377_1_, BlockPos p_184377_2_, @Nullable MusicDiscItem musicDiscItem) { - ISound isound = this.field_147593_P.get(p_184377_2_); + ISound isound = this.playingRecords.get(p_184377_2_); if (isound != null) { - this.field_72777_q.func_147118_V().func_147683_b(isound); + this.minecraft.getSoundManager().stop(isound); @@ -2084,7 +_,7 @@ } if (p_184377_1_ != null) { -- MusicDiscItem musicdiscitem = MusicDiscItem.func_185074_a(p_184377_1_); +- MusicDiscItem musicdiscitem = MusicDiscItem.getBySound(p_184377_1_); + MusicDiscItem musicdiscitem = musicDiscItem; if (musicdiscitem != null) { - this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_()); + this.minecraft.gui.setNowPlaying(musicdiscitem.getDisplayName()); } @@ -2232,7 +_,7 @@ break; case 1010: - if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) { -- this.func_184377_a(((MusicDiscItem)Item.func_150899_d(p_180439_4_)).func_185075_h(), p_180439_3_); -+ this.playRecord(((MusicDiscItem)Item.func_150899_d(p_180439_4_)).func_185075_h(), p_180439_3_, (MusicDiscItem) Item.func_150899_d(p_180439_4_)); + if (Item.byId(p_180439_4_) instanceof MusicDiscItem) { +- this.playStreamingMusic(((MusicDiscItem)Item.byId(p_180439_4_)).getSound(), p_180439_3_); ++ this.playRecord(((MusicDiscItem)Item.byId(p_180439_4_)).getSound(), p_180439_3_, (MusicDiscItem) Item.byId(p_180439_4_)); } else { - this.func_184377_a((SoundEvent)null, p_180439_3_); + this.playStreamingMusic((SoundEvent)null, p_180439_3_); } @@ -2382,8 +_,8 @@ break; case 2001: - BlockState blockstate = Block.func_196257_b(p_180439_4_); -- if (!blockstate.func_196958_f()) { -- SoundType soundtype = blockstate.func_215695_r(); -+ if (!blockstate.isAir(this.field_72769_h, p_180439_3_)) { -+ SoundType soundtype = blockstate.getSoundType(this.field_72769_h, p_180439_3_, null); - this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false); + BlockState blockstate = Block.stateById(p_180439_4_); +- if (!blockstate.isAir()) { +- SoundType soundtype = blockstate.getSoundType(); ++ if (!blockstate.isAir(this.level, p_180439_3_)) { ++ SoundType soundtype = blockstate.getSoundType(this.level, p_180439_3_, null); + this.level.playLocalSound(p_180439_3_, soundtype.getBreakSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false); } @@ -2531,7 +_,7 @@ } else { - int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_); - int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_); -- int k = p_228420_1_.func_185906_d(); + int i = p_228420_0_.getBrightness(LightType.SKY, p_228420_2_); + int j = p_228420_0_.getBrightness(LightType.BLOCK, p_228420_2_); +- int k = p_228420_1_.getLightEmission(); + int k = p_228420_1_.getLightValue(p_228420_0_, p_228420_2_); if (j < k) { j = k; } @@ -2568,6 +_,11 @@ @Nullable - public Framebuffer func_239232_u_() { - return this.field_239226_J_; + public Framebuffer getCloudsTarget() { + return this.cloudsTarget; + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch index e2e74f0945..29f855f714 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java @@ -68,12 +_,15 @@ - private Vector3d field_217672_l = Vector3d.field_186680_a; + private Vector3d camera = Vector3d.ZERO; public ChunkRenderDispatcher(World p_i226020_1_, WorldRenderer p_i226020_2_, Executor p_i226020_3_, boolean p_i226020_4_, RegionRenderCacheBuilder p_i226020_5_) { + this(p_i226020_1_, p_i226020_2_, p_i226020_3_, p_i226020_4_, p_i226020_5_, -1); + } + public ChunkRenderDispatcher(World p_i226020_1_, WorldRenderer p_i226020_2_, Executor p_i226020_3_, boolean p_i226020_4_, RegionRenderCacheBuilder p_i226020_5_, int countRenderBuilders) { - this.field_228893_j_ = p_i226020_1_; - this.field_228894_k_ = p_i226020_2_; - int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / (RenderType.func_228661_n_().stream().mapToInt(RenderType::func_228662_o_).sum() * 4) - 1); + this.level = p_i226020_1_; + this.renderer = p_i226020_2_; + int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / (RenderType.chunkBufferLayers().stream().mapToInt(RenderType::bufferSize).sum() * 4) - 1); int j = Runtime.getRuntime().availableProcessors(); int k = p_i226020_4_ ? j : Math.min(j, 4); - int l = Math.max(1, Math.min(k, i)); + int l = countRenderBuilders < 0 ? Math.max(1, Math.min(k, i)) : countRenderBuilders; - this.field_228890_g_ = p_i226020_5_; + this.fixedBuffers = p_i226020_5_; List list = Lists.newArrayListWithExpectedSize(l); @@ -206,7 +_,7 @@ @@ -23,33 +23,33 @@ @OnlyIn(Dist.CLIENT) - public class ChunkRender { + public class ChunkRender implements net.minecraftforge.client.extensions.IForgeRenderChunk { - public final AtomicReference field_178590_b = new AtomicReference<>(ChunkRenderDispatcher.CompiledChunk.field_178502_a); + public final AtomicReference compiled = new AtomicReference<>(ChunkRenderDispatcher.CompiledChunk.UNCOMPILED); @Nullable - private ChunkRenderDispatcher.ChunkRender.RebuildTask field_228921_d_; + private ChunkRenderDispatcher.ChunkRender.RebuildTask lastRebuildTask; @@ -332,7 +_,7 @@ - if (!chunkrenderdispatcher$compiledchunk.field_178501_c.contains(p_228925_1_)) { + if (!chunkrenderdispatcher$compiledchunk.hasLayer.contains(p_228925_1_)) { return false; } else { -- this.field_228922_e_ = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(this.func_188280_f(), chunkrenderdispatcher$compiledchunk); -+ this.field_228922_e_ = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(new net.minecraft.util.math.ChunkPos(func_178568_j()), this.func_188280_f(), chunkrenderdispatcher$compiledchunk); - p_228925_2_.func_228900_a_(this.field_228922_e_); +- this.lastResortTransparencyTask = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(this.getDistToPlayerSqr(), chunkrenderdispatcher$compiledchunk); ++ this.lastResortTransparencyTask = new ChunkRenderDispatcher.ChunkRender.SortTransparencyTask(new net.minecraft.util.math.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), chunkrenderdispatcher$compiledchunk); + p_228925_2_.schedule(this.lastResortTransparencyTask); return true; } @@ -355,8 +_,8 @@ - this.func_228935_i_(); - BlockPos blockpos = this.field_178586_f.func_185334_h(); + this.cancelTasks(); + BlockPos blockpos = this.origin.immutable(); int i = 1; -- ChunkRenderCache chunkrendercache = ChunkRenderCache.func_212397_a(ChunkRenderDispatcher.this.field_228893_j_, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -- this.field_228921_d_ = new ChunkRenderDispatcher.ChunkRender.RebuildTask(this.func_188280_f(), chunkrendercache); -+ ChunkRenderCache chunkrendercache = createRegionRenderCache(ChunkRenderDispatcher.this.field_228893_j_, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -+ this.field_228921_d_ = new ChunkRenderDispatcher.ChunkRender.RebuildTask(new net.minecraft.util.math.ChunkPos(func_178568_j()), this.func_188280_f(), chunkrendercache); - return this.field_228921_d_; +- ChunkRenderCache chunkrendercache = ChunkRenderCache.createIfNotEmpty(ChunkRenderDispatcher.this.level, blockpos.offset(-1, -1, -1), blockpos.offset(16, 16, 16), 1); +- this.lastRebuildTask = new ChunkRenderDispatcher.ChunkRender.RebuildTask(this.getDistToPlayerSqr(), chunkrendercache); ++ ChunkRenderCache chunkrendercache = createRegionRenderCache(ChunkRenderDispatcher.this.level, blockpos.offset(-1, -1, -1), blockpos.offset(16, 16, 16), 1); ++ this.lastRebuildTask = new ChunkRenderDispatcher.ChunkRender.RebuildTask(new net.minecraft.util.math.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), chunkrendercache); + return this.lastRebuildTask; } @@ -384,9 +_,19 @@ abstract class ChunkRenderTask implements Comparable { - protected final double field_188229_e; - protected final AtomicBoolean field_178554_h = new AtomicBoolean(false); + protected final double distAtCreation; + protected final AtomicBoolean isCancelled = new AtomicBoolean(false); + protected java.util.Map modelData; public ChunkRenderTask(double p_i226023_2_) { @@ -57,18 +57,18 @@ + } + + public ChunkRenderTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226023_2_) { - this.field_188229_e = p_i226023_2_; + this.distAtCreation = p_i226023_2_; + if (pos == null) { + this.modelData = java.util.Collections.emptyMap(); + } else { -+ this.modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, pos); ++ this.modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.getInstance().level, pos); + } } - public abstract CompletableFuture func_225618_a_(RegionRenderCacheBuilder p_225618_1_); + public abstract CompletableFuture doTask(RegionRenderCacheBuilder p_225618_1_); @@ -396,6 +_,10 @@ public int compareTo(ChunkRenderDispatcher.ChunkRender.ChunkRenderTask p_compareTo_1_) { - return Doubles.compare(this.field_188229_e, p_compareTo_1_.field_188229_e); + return Doubles.compare(this.distAtCreation, p_compareTo_1_.distAtCreation); } + + public net.minecraftforge.client.model.data.IModelData getModelData(net.minecraft.util.math.BlockPos pos) { @@ -79,7 +79,7 @@ @OnlyIn(Dist.CLIENT) @@ -403,8 +_,13 @@ @Nullable - protected ChunkRenderCache field_228938_d_; + protected ChunkRenderCache region; + @Deprecated public RebuildTask(double p_i226024_2_, @Nullable ChunkRenderCache p_i226024_4_) { @@ -89,75 +89,75 @@ + + public RebuildTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226024_2_, @Nullable ChunkRenderCache p_i226024_4_) { + super(pos, p_i226024_2_); - this.field_228938_d_ = p_i226024_4_; + this.region = p_i226024_4_; } @@ -470,7 +_,7 @@ - visgraph.func_178606_a(blockpos2); + visgraph.setOpaque(blockpos2); } -- if (block.func_235695_q_()) { +- if (block.isEntityBlock()) { + if (blockstate.hasTileEntity()) { - TileEntity tileentity = chunkrendercache.func_212399_a(blockpos2, Chunk.CreateEntityType.CHECK); + TileEntity tileentity = chunkrendercache.getBlockEntity(blockpos2, Chunk.CreateEntityType.CHECK); if (tileentity != null) { - this.func_228942_a_(p_228940_4_, set, tileentity); + this.handleBlockEntity(p_228940_4_, set, tileentity); @@ -478,8 +_,10 @@ } - FluidState fluidstate = chunkrendercache.func_204610_c(blockpos2); -- if (!fluidstate.func_206888_e()) { -- RenderType rendertype = RenderTypeLookup.func_228391_a_(fluidstate); + FluidState fluidstate = chunkrendercache.getFluidState(blockpos2); +- if (!fluidstate.isEmpty()) { +- RenderType rendertype = RenderTypeLookup.getRenderLayer(fluidstate); + net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2); -+ for (RenderType rendertype : RenderType.func_228661_n_()) { ++ for (RenderType rendertype : RenderType.chunkBufferLayers()) { + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype); -+ if (!fluidstate.func_206888_e() && RenderTypeLookup.canRenderInLayer(fluidstate, rendertype)) { - BufferBuilder bufferbuilder = p_228940_5_.func_228366_a_(rendertype); - if (p_228940_4_.field_178501_c.add(rendertype)) { - ChunkRender.this.func_228923_a_(bufferbuilder); ++ if (!fluidstate.isEmpty() && RenderTypeLookup.canRenderInLayer(fluidstate, rendertype)) { + BufferBuilder bufferbuilder = p_228940_5_.builder(rendertype); + if (p_228940_4_.hasLayer.add(rendertype)) { + ChunkRender.this.beginLayer(bufferbuilder); @@ -491,8 +_,8 @@ } } -- if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { -- RenderType rendertype1 = RenderTypeLookup.func_228390_a_(blockstate); -+ if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && RenderTypeLookup.canRenderInLayer(blockstate, rendertype)) { +- if (blockstate.getRenderShape() != BlockRenderType.INVISIBLE) { +- RenderType rendertype1 = RenderTypeLookup.getChunkRenderType(blockstate); ++ if (blockstate.getRenderShape() != BlockRenderType.INVISIBLE && RenderTypeLookup.canRenderInLayer(blockstate, rendertype)) { + RenderType rendertype1 = rendertype; - BufferBuilder bufferbuilder2 = p_228940_5_.func_228366_a_(rendertype1); - if (p_228940_4_.field_178501_c.add(rendertype1)) { - ChunkRender.this.func_228923_a_(bufferbuilder2); + BufferBuilder bufferbuilder2 = p_228940_5_.builder(rendertype1); + if (p_228940_4_.hasLayer.add(rendertype1)) { + ChunkRender.this.beginLayer(bufferbuilder2); @@ -500,14 +_,16 @@ - matrixstack.func_227860_a_(); - matrixstack.func_227861_a_((double)(blockpos2.func_177958_n() & 15), (double)(blockpos2.func_177956_o() & 15), (double)(blockpos2.func_177952_p() & 15)); -- if (blockrendererdispatcher.func_228793_a_(blockstate, blockpos2, chunkrendercache, matrixstack, bufferbuilder2, true, random)) { + matrixstack.pushPose(); + matrixstack.translate((double)(blockpos2.getX() & 15), (double)(blockpos2.getY() & 15), (double)(blockpos2.getZ() & 15)); +- if (blockrendererdispatcher.renderBatched(blockstate, blockpos2, chunkrendercache, matrixstack, bufferbuilder2, true, random)) { + if (blockrendererdispatcher.renderModel(blockstate, blockpos2, chunkrendercache, matrixstack, bufferbuilder2, true, random, modelData)) { - p_228940_4_.field_178498_d = false; - p_228940_4_.field_178500_b.add(rendertype1); + p_228940_4_.isCompletelyEmpty = false; + p_228940_4_.hasBlocks.add(rendertype1); } - matrixstack.func_227865_b_(); + matrixstack.popPose(); } + } } + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); - if (p_228940_4_.field_178500_b.contains(RenderType.func_228645_f_())) { - BufferBuilder bufferbuilder1 = p_228940_5_.func_228366_a_(RenderType.func_228645_f_()); + if (p_228940_4_.hasBlocks.contains(RenderType.translucent())) { + BufferBuilder bufferbuilder1 = p_228940_5_.builder(RenderType.translucent()); @@ -526,10 +_,10 @@ - private void func_228942_a_(ChunkRenderDispatcher.CompiledChunk p_228942_1_, Set p_228942_2_, E p_228942_3_) { - TileEntityRenderer tileentityrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(p_228942_3_); + private void handleBlockEntity(ChunkRenderDispatcher.CompiledChunk p_228942_1_, Set p_228942_2_, E p_228942_3_) { + TileEntityRenderer tileentityrenderer = TileEntityRendererDispatcher.instance.getRenderer(p_228942_3_); if (tileentityrenderer != null) { -- p_228942_1_.field_178499_e.add(p_228942_3_); - if (tileentityrenderer.func_188185_a(p_228942_3_)) { +- p_228942_1_.renderableBlockEntities.add(p_228942_3_); + if (tileentityrenderer.shouldRenderOffScreen(p_228942_3_)) { p_228942_2_.add(p_228942_3_); } -+ else p_228942_1_.field_178499_e.add(p_228942_3_); //FORGE: Fix MC-112730 ++ else p_228942_1_.renderableBlockEntities.add(p_228942_3_); //FORGE: Fix MC-112730 } } @@ -547,8 +_,13 @@ class SortTransparencyTask extends ChunkRenderDispatcher.ChunkRender.ChunkRenderTask { - private final ChunkRenderDispatcher.CompiledChunk field_228945_e_; + private final ChunkRenderDispatcher.CompiledChunk compiledChunk; + @Deprecated public SortTransparencyTask(double p_i226025_2_, ChunkRenderDispatcher.CompiledChunk p_i226025_4_) { @@ -167,6 +167,6 @@ + + public SortTransparencyTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226025_2_, ChunkRenderDispatcher.CompiledChunk p_i226025_4_) { + super(pos, p_i226025_2_); - this.field_228945_e_ = p_i226025_4_; + this.compiledChunk = p_i226025_4_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch index d2f85a396b..4efdeaa52e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch @@ -4,39 +4,39 @@ @OnlyIn(Dist.CLIENT) public class BlockColors { -- private final ObjectIntIdentityMap field_186725_a = new ObjectIntIdentityMap<>(32); +- private final ObjectIntIdentityMap blockColors = new ObjectIntIdentityMap<>(32); + // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant -+ private final java.util.Map, IBlockColor> field_186725_a = new java.util.HashMap<>(); - private final Map>> field_225311_b = Maps.newHashMap(); ++ private final java.util.Map, IBlockColor> blockColors = new java.util.HashMap<>(); + private final Map>> coloringStates = Maps.newHashMap(); - public static BlockColors func_186723_a() { + public static BlockColors createDefault() { @@ -72,11 +_,12 @@ - blockcolors.func_186722_a((p_228055_0_, p_228055_1_, p_228055_2_, p_228055_3_) -> { + blockcolors.register((p_228055_0_, p_228055_1_, p_228055_2_, p_228055_3_) -> { return p_228055_1_ != null && p_228055_2_ != null ? 2129968 : 7455580; - }, Blocks.field_196651_dG); + }, Blocks.LILY_PAD); + net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors); return blockcolors; } - public int func_189991_a(BlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_) { -- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_189991_1_.func_177230_c())); -+ IBlockColor iblockcolor = this.field_186725_a.get(p_189991_1_.func_177230_c().delegate); + public int getColor(BlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_) { +- IBlockColor iblockcolor = this.blockColors.byId(Registry.BLOCK.getId(p_189991_1_.getBlock())); ++ IBlockColor iblockcolor = this.blockColors.get(p_189991_1_.getBlock().delegate); if (iblockcolor != null) { return iblockcolor.getColor(p_189991_1_, (IBlockDisplayReader)null, (BlockPos)null, 0); } else { @@ -86,13 +_,13 @@ } - public int func_228054_a_(BlockState p_228054_1_, @Nullable IBlockDisplayReader p_228054_2_, @Nullable BlockPos p_228054_3_, int p_228054_4_) { -- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_228054_1_.func_177230_c())); -+ IBlockColor iblockcolor = this.field_186725_a.get(p_228054_1_.func_177230_c().delegate); + public int getColor(BlockState p_228054_1_, @Nullable IBlockDisplayReader p_228054_2_, @Nullable BlockPos p_228054_3_, int p_228054_4_) { +- IBlockColor iblockcolor = this.blockColors.byId(Registry.BLOCK.getId(p_228054_1_.getBlock())); ++ IBlockColor iblockcolor = this.blockColors.get(p_228054_1_.getBlock().delegate); return iblockcolor == null ? -1 : iblockcolor.getColor(p_228054_1_, p_228054_2_, p_228054_3_, p_228054_4_); } - public void func_186722_a(IBlockColor p_186722_1_, Block... p_186722_2_) { + public void register(IBlockColor p_186722_1_, Block... p_186722_2_) { for(Block block : p_186722_2_) { -- this.field_186725_a.func_148746_a(p_186722_1_, Registry.field_212618_g.func_148757_b(block)); -+ this.field_186725_a.put(block.delegate, p_186722_1_); +- this.blockColors.addMapping(p_186722_1_, Registry.BLOCK.getId(block)); ++ this.blockColors.put(block.delegate, p_186722_1_); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch index 0e8add93a8..e3b29e0996 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch @@ -4,30 +4,30 @@ @OnlyIn(Dist.CLIENT) public class ItemColors { -- private final ObjectIntIdentityMap field_186732_a = new ObjectIntIdentityMap<>(32); +- private final ObjectIntIdentityMap itemColors = new ObjectIntIdentityMap<>(32); + // FORGE: Use RegistryDelegates as non-Vanilla item ids are not constant -+ private final java.util.Map, IItemColor> field_186732_a = new java.util.HashMap<>(); ++ private final java.util.Map, IItemColor> itemColors = new java.util.HashMap<>(); - public static ItemColors func_186729_a(BlockColors p_186729_0_) { + public static ItemColors createDefault(BlockColors p_186729_0_) { ItemColors itemcolors = new ItemColors(); @@ -82,17 +_,18 @@ - itemcolors.func_199877_a((p_210237_0_, p_210237_1_) -> { - return p_210237_1_ == 0 ? -1 : FilledMapItem.func_190907_h(p_210237_0_); - }, Items.field_151098_aY); + itemcolors.register((p_210237_0_, p_210237_1_) -> { + return p_210237_1_ == 0 ? -1 : FilledMapItem.getColor(p_210237_0_); + }, Items.FILLED_MAP); + net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_186729_0_); return itemcolors; } - public int func_186728_a(ItemStack p_186728_1_, int p_186728_2_) { -- IItemColor iitemcolor = this.field_186732_a.func_148745_a(Registry.field_212630_s.func_148757_b(p_186728_1_.func_77973_b())); -+ IItemColor iitemcolor = this.field_186732_a.get(p_186728_1_.func_77973_b().delegate); + public int getColor(ItemStack p_186728_1_, int p_186728_2_) { +- IItemColor iitemcolor = this.itemColors.byId(Registry.ITEM.getId(p_186728_1_.getItem())); ++ IItemColor iitemcolor = this.itemColors.get(p_186728_1_.getItem().delegate); return iitemcolor == null ? -1 : iitemcolor.getColor(p_186728_1_, p_186728_2_); } - public void func_199877_a(IItemColor p_199877_1_, IItemProvider... p_199877_2_) { + public void register(IItemColor p_199877_1_, IItemProvider... p_199877_2_) { for(IItemProvider iitemprovider : p_199877_2_) { -- this.field_186732_a.func_148746_a(p_199877_1_, Item.func_150891_b(iitemprovider.func_199767_j())); -+ this.field_186732_a.put(iitemprovider.func_199767_j().delegate, p_199877_1_); +- this.itemColors.addMapping(p_199877_1_, Item.getId(iitemprovider.asItem())); ++ this.itemColors.put(iitemprovider.asItem().delegate, p_199877_1_); } } 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 7c86558676..1e6b2980df 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -3,22 +3,22 @@ @@ -60,8 +_,10 @@ } - public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { -- if (this.func_177070_b(p_225623_1_)) { -- this.func_225629_a_(p_225623_1_, p_225623_1_.func_145748_c_(), p_225623_4_, p_225623_5_, p_225623_6_); -+ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.func_145748_c_(), this, p_225623_4_, p_225623_5_, p_225623_6_, p_225623_3_); + public void render(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { +- if (this.shouldShowName(p_225623_1_)) { +- this.renderNameTag(p_225623_1_, p_225623_1_.getDisplayName(), p_225623_4_, p_225623_5_, p_225623_6_); ++ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.getDisplayName(), this, p_225623_4_, p_225623_5_, p_225623_6_, p_225623_3_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(renderNameplateEvent); -+ if (renderNameplateEvent.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (renderNameplateEvent.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.func_177070_b(p_225623_1_))) { -+ this.func_225629_a_(p_225623_1_, renderNameplateEvent.getContent(), p_225623_4_, p_225623_5_, p_225623_6_); ++ if (renderNameplateEvent.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (renderNameplateEvent.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.shouldShowName(p_225623_1_))) { ++ this.renderNameTag(p_225623_1_, renderNameplateEvent.getContent(), p_225623_4_, p_225623_5_, p_225623_6_); } } @@ -77,7 +_,7 @@ - protected void func_225629_a_(T p_225629_1_, ITextComponent p_225629_2_, MatrixStack p_225629_3_, IRenderTypeBuffer p_225629_4_, int p_225629_5_) { - double d0 = this.field_76990_c.func_229099_b_(p_225629_1_); + protected void renderNameTag(T p_225629_1_, ITextComponent p_225629_2_, MatrixStack p_225629_3_, IRenderTypeBuffer p_225629_4_, int p_225629_5_) { + double d0 = this.entityRenderDispatcher.distanceToSqr(p_225629_1_); - if (!(d0 > 4096.0D)) { + if (net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(p_225629_1_, d0)) { - boolean flag = !p_225629_1_.func_226273_bm_(); - float f = p_225629_1_.func_213302_cg() + 0.5F; + boolean flag = !p_225629_1_.isDiscrete(); + float f = p_225629_1_.getBbHeight() + 0.5F; int i = "deadmau5".equals(p_225629_2_.getString()) ? -10 : 0; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch index f6951f8019..d60ea12da4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch @@ -1,38 +1,38 @@ --- a/net/minecraft/client/renderer/entity/EntityRendererManager.java +++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java @@ -188,7 +_,10 @@ - this.field_178637_m = new PlayerRenderer(this); - this.field_178636_l.put("default", this.field_178637_m); - this.field_178636_l.put("slim", new PlayerRenderer(this, true)); + this.defaultPlayerRenderer = new PlayerRenderer(this); + this.playerRenderers.put("default", this.defaultPlayerRenderer); + this.playerRenderers.put("slim", new PlayerRenderer(this, true)); + } + //FORGE: Validate the existence of a renderer for each entity type after modded entity renderers have been added + public void validateRendererExistence() { - for(EntityType entitytype : Registry.field_212629_r) { - if (entitytype != EntityType.field_200729_aH && !this.field_78729_o.containsKey(entitytype)) { - throw new IllegalStateException("No renderer registered for " + Registry.field_212629_r.func_177774_c(entitytype)); + for(EntityType entitytype : Registry.ENTITY_TYPE) { + if (entitytype != EntityType.PLAYER && !this.renderers.containsKey(entitytype)) { + throw new IllegalStateException("No renderer registered for " + Registry.ENTITY_TYPE.getKey(entitytype)); @@ -280,12 +_,12 @@ - private void func_229093_a_(MatrixStack p_229093_1_, IVertexBuilder p_229093_2_, Entity p_229093_3_, float p_229093_4_) { - float f = p_229093_3_.func_213311_cf() / 2.0F; - this.func_229094_a_(p_229093_1_, p_229093_2_, p_229093_3_, 1.0F, 1.0F, 1.0F); + private void renderHitbox(MatrixStack p_229093_1_, IVertexBuilder p_229093_2_, Entity p_229093_3_, float p_229093_4_) { + float f = p_229093_3_.getBbWidth() / 2.0F; + this.renderBox(p_229093_1_, p_229093_2_, p_229093_3_, 1.0F, 1.0F, 1.0F); - if (p_229093_3_ instanceof EnderDragonEntity) { + if (p_229093_3_.isMultipartEntity()) { - double d0 = -MathHelper.func_219803_d((double)p_229093_4_, p_229093_3_.field_70142_S, p_229093_3_.func_226277_ct_()); - double d1 = -MathHelper.func_219803_d((double)p_229093_4_, p_229093_3_.field_70137_T, p_229093_3_.func_226278_cu_()); - double d2 = -MathHelper.func_219803_d((double)p_229093_4_, p_229093_3_.field_70136_U, p_229093_3_.func_226281_cx_()); + double d0 = -MathHelper.lerp((double)p_229093_4_, p_229093_3_.xOld, p_229093_3_.getX()); + double d1 = -MathHelper.lerp((double)p_229093_4_, p_229093_3_.yOld, p_229093_3_.getY()); + double d2 = -MathHelper.lerp((double)p_229093_4_, p_229093_3_.zOld, p_229093_3_.getZ()); -- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_229093_3_).func_213404_dT()) { +- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_229093_3_).getSubEntities()) { + for(net.minecraftforge.entity.PartEntity enderdragonpartentity : p_229093_3_.getParts()) { - p_229093_1_.func_227860_a_(); - double d3 = d0 + MathHelper.func_219803_d((double)p_229093_4_, enderdragonpartentity.field_70142_S, enderdragonpartentity.func_226277_ct_()); - double d4 = d1 + MathHelper.func_219803_d((double)p_229093_4_, enderdragonpartentity.field_70137_T, enderdragonpartentity.func_226278_cu_()); + p_229093_1_.pushPose(); + double d3 = d0 + MathHelper.lerp((double)p_229093_4_, enderdragonpartentity.xOld, enderdragonpartentity.getX()); + double d4 = d1 + MathHelper.lerp((double)p_229093_4_, enderdragonpartentity.yOld, enderdragonpartentity.getY()); @@ -449,5 +_,9 @@ - public FontRenderer func_78716_a() { - return this.field_78736_p; + public FontRenderer getFont() { + return this.font; + } + + public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); ++ return (Map) java.util.Collections.unmodifiableMap(playerRenderers); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch index 4a47d86d98..c241ffedea 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java +++ b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java @@ -33,7 +_,13 @@ - BlockPos blockpos = new BlockPos(p_225623_1_.func_226277_ct_(), p_225623_1_.func_174813_aQ().field_72337_e, p_225623_1_.func_226281_cx_()); - p_225623_4_.func_227861_a_(-0.5D, 0.0D, -0.5D); - BlockRendererDispatcher blockrendererdispatcher = Minecraft.func_71410_x().func_175602_ab(); -- blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_239221_b_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); -+ for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType.func_228661_n_()) { + BlockPos blockpos = new BlockPos(p_225623_1_.getX(), p_225623_1_.getBoundingBox().maxY, p_225623_1_.getZ()); + p_225623_4_.translate(-0.5D, 0.0D, -0.5D); + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRenderer(); +- blockrendererdispatcher.getModelRenderer().tesselateBlock(world, blockrendererdispatcher.getBlockModel(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.getMovingBlockRenderType(blockstate)), false, new Random(), blockstate.getSeed(p_225623_1_.getStartPos()), OverlayTexture.NO_OVERLAY); ++ for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType.chunkBufferLayers()) { + if (RenderTypeLookup.canRenderInLayer(blockstate, type)) { + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(type); -+ blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(type), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_); ++ blockrendererdispatcher.getModelRenderer().tesselateBlock(world, blockrendererdispatcher.getBlockModel(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(type), false, new Random(), blockstate.getSeed(p_225623_1_.getStartPos()), OverlayTexture.NO_OVERLAY); + } + } + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); - p_225623_4_.func_227865_b_(); - super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); + p_225623_4_.popPose(); + super.render(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); } 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 573a8131b8..d58b12dc9b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -2,43 +2,43 @@ +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java @@ -50,7 +_,7 @@ if (!flag) { - BlockRendererDispatcher blockrendererdispatcher = this.field_147917_g.func_175602_ab(); - ModelManager modelmanager = blockrendererdispatcher.func_175023_a().func_178126_b(); -- ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() == Items.field_151098_aY ? field_209586_g : field_209585_f; -+ ModelResourceLocation modelresourcelocation = p_225623_1_.func_82335_i().func_77973_b() instanceof FilledMapItem ? field_209586_g : field_209585_f; - p_225623_4_.func_227860_a_(); - p_225623_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); - blockrendererdispatcher.func_175019_b().func_228804_a_(p_225623_4_.func_227866_c_(), p_225623_5_.getBuffer(Atlases.func_228782_g_()), (BlockState)null, modelmanager.func_174953_a(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_225623_6_, OverlayTexture.field_229196_a_); + BlockRendererDispatcher blockrendererdispatcher = this.minecraft.getBlockRenderer(); + ModelManager modelmanager = blockrendererdispatcher.getBlockModelShaper().getModelManager(); +- ModelResourceLocation modelresourcelocation = p_225623_1_.getItem().getItem() == Items.FILLED_MAP ? MAP_FRAME_LOCATION : FRAME_LOCATION; ++ ModelResourceLocation modelresourcelocation = p_225623_1_.getItem().getItem() instanceof FilledMapItem ? MAP_FRAME_LOCATION : FRAME_LOCATION; + p_225623_4_.pushPose(); + p_225623_4_.translate(-0.5D, -0.5D, -0.5D); + blockrendererdispatcher.getModelRenderer().renderModel(p_225623_4_.last(), p_225623_5_.getBuffer(Atlases.solidBlockSheet()), (BlockState)null, modelmanager.getModel(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_225623_6_, OverlayTexture.NO_OVERLAY); @@ -59,21 +_,21 @@ - ItemStack itemstack = p_225623_1_.func_82335_i(); - if (!itemstack.func_190926_b()) { -- boolean flag1 = itemstack.func_77973_b() == Items.field_151098_aY; -+ MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_225623_1_.field_70170_p); + ItemStack itemstack = p_225623_1_.getItem(); + if (!itemstack.isEmpty()) { +- boolean flag1 = itemstack.getItem() == Items.FILLED_MAP; ++ MapData mapdata = FilledMapItem.getOrCreateSavedData(itemstack, p_225623_1_.level); if (flag) { - p_225623_4_.func_227861_a_(0.0D, 0.0D, 0.5D); + p_225623_4_.translate(0.0D, 0.0D, 0.5D); } else { - p_225623_4_.func_227861_a_(0.0D, 0.0D, 0.4375D); + p_225623_4_.translate(0.0D, 0.0D, 0.4375D); } -- int i = flag1 ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j(); -+ int i = mapdata != null ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j(); - p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_((float)i * 360.0F / 8.0F)); +- int i = flag1 ? p_225623_1_.getRotation() % 4 * 2 : p_225623_1_.getRotation(); ++ int i = mapdata != null ? p_225623_1_.getRotation() % 4 * 2 : p_225623_1_.getRotation(); + p_225623_4_.mulPose(Vector3f.ZP.rotationDegrees((float)i * 360.0F / 8.0F)); - if (flag1) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_225623_1_, this, p_225623_4_, p_225623_5_, p_225623_6_))) { + if (mapdata != null) { - p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(180.0F)); + p_225623_4_.mulPose(Vector3f.ZP.rotationDegrees(180.0F)); float f = 0.0078125F; - p_225623_4_.func_227862_a_(0.0078125F, 0.0078125F, 0.0078125F); - p_225623_4_.func_227861_a_(-64.0D, -64.0D, 0.0D); -- MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_225623_1_.field_70170_p); - p_225623_4_.func_227861_a_(0.0D, 0.0D, -1.0D); + p_225623_4_.scale(0.0078125F, 0.0078125F, 0.0078125F); + p_225623_4_.translate(-64.0D, -64.0D, 0.0D); +- MapData mapdata = FilledMapItem.getOrCreateSavedData(itemstack, p_225623_1_.level); + p_225623_4_.translate(0.0D, 0.0D, -1.0D); if (mapdata != null) { - this.field_147917_g.field_71460_t.func_147701_i().func_228086_a_(p_225623_4_, p_225623_5_, mapdata, true, p_225623_6_); + this.minecraft.gameRenderer.getMapRenderer().render(p_225623_4_, p_225623_5_, mapdata, true, p_225623_6_); @@ -81,6 +_,7 @@ } else { - p_225623_4_.func_227862_a_(0.5F, 0.5F, 0.5F); - this.field_177074_h.func_229110_a_(itemstack, ItemCameraTransforms.TransformType.FIXED, p_225623_6_, OverlayTexture.field_229196_a_, p_225623_4_, p_225623_5_); + p_225623_4_.scale(0.5F, 0.5F, 0.5F); + this.itemRenderer.renderStatic(itemstack, ItemCameraTransforms.TransformType.FIXED, p_225623_6_, OverlayTexture.NO_OVERLAY, p_225623_4_, p_225623_5_); + } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index e40728095a..17565f15d7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java @@ -54,17 +_,14 @@ - int j = this.func_177078_a(itemstack); + int j = this.getRenderAmount(itemstack); float f = 0.25F; - float f1 = MathHelper.func_76126_a(((float)p_225623_1_.func_174872_o() + p_225623_3_) / 10.0F + p_225623_1_.field_70290_d) * 0.1F + 0.1F; -- float f2 = ibakedmodel.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b(); -+ float f2 = shouldBob() ? ibakedmodel.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b() : 0; - p_225623_4_.func_227861_a_(0.0D, (double)(f1 + 0.25F * f2), 0.0D); - float f3 = p_225623_1_.func_234272_a_(p_225623_3_); - p_225623_4_.func_227863_a_(Vector3f.field_229181_d_.func_229193_c_(f3)); -- float f4 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195899_a(); -- float f5 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195900_b(); -- float f6 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195902_c(); + float f1 = MathHelper.sin(((float)p_225623_1_.getAge() + p_225623_3_) / 10.0F + p_225623_1_.bobOffs) * 0.1F + 0.1F; +- float f2 = ibakedmodel.getTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y(); ++ float f2 = shouldBob() ? ibakedmodel.getTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y() : 0; + p_225623_4_.translate(0.0D, (double)(f1 + 0.25F * f2), 0.0D); + float f3 = p_225623_1_.getSpin(p_225623_3_); + p_225623_4_.mulPose(Vector3f.YP.rotation(f3)); +- float f4 = ibakedmodel.getTransforms().ground.scale.x(); +- float f5 = ibakedmodel.getTransforms().ground.scale.y(); +- float f6 = ibakedmodel.getTransforms().ground.scale.z(); if (!flag) { - float f7 = -0.0F * (float)(j - 1) * 0.5F * f4; - float f8 = -0.0F * (float)(j - 1) * 0.5F * f5; @@ -19,34 +19,34 @@ + float f7 = -0.0F * (float)(j - 1) * 0.5F; + float f8 = -0.0F * (float)(j - 1) * 0.5F; + float f9 = -0.09375F * (float)(j - 1) * 0.5F; - p_225623_4_.func_227861_a_((double)f7, (double)f8, (double)f9); + p_225623_4_.translate((double)f7, (double)f8, (double)f9); } @@ -75,18 +_,18 @@ - float f11 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f13 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f10 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- p_225623_4_.func_227861_a_((double)f11, (double)f13, (double)f10); -+ p_225623_4_.func_227861_a_(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); + float f11 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f13 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f10 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; +- p_225623_4_.translate((double)f11, (double)f13, (double)f10); ++ p_225623_4_.translate(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); } else { - float f12 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - float f14 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; -- p_225623_4_.func_227861_a_((double)f12, (double)f14, 0.0D); -+ p_225623_4_.func_227861_a_(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); + float f12 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; + float f14 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; +- p_225623_4_.translate((double)f12, (double)f14, 0.0D); ++ p_225623_4_.translate(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); } } - this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel); - p_225623_4_.func_227865_b_(); + this.itemRenderer.render(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.NO_OVERLAY, ibakedmodel); + p_225623_4_.popPose(); if (!flag) { -- p_225623_4_.func_227861_a_((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6)); -+ p_225623_4_.func_227861_a_(0.0, 0.0, 0.09375F); +- p_225623_4_.translate((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6)); ++ p_225623_4_.translate(0.0, 0.0, 0.09375F); } } @@ -97,4 +_,21 @@ - public ResourceLocation func_110775_a(ItemEntity p_110775_1_) { - return AtlasTexture.field_110575_b; + public ResourceLocation getTextureLocation(ItemEntity p_110775_1_) { + return AtlasTexture.LOCATION_BLOCKS; } + + /*==================================== FORGE START ===========================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch index 39085f6227..d39569d53d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch @@ -3,36 +3,36 @@ @@ -48,14 +_,17 @@ } - public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { + public void render(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_))) return; - p_225623_4_.func_227860_a_(); - this.field_77045_g.field_217112_c = this.func_77040_d(p_225623_1_, p_225623_3_); -- this.field_77045_g.field_217113_d = p_225623_1_.func_184218_aH(); + p_225623_4_.pushPose(); + this.model.attackTime = this.getAttackAnim(p_225623_1_, p_225623_3_); +- this.model.riding = p_225623_1_.isPassenger(); + -+ boolean shouldSit = p_225623_1_.func_184218_aH() && (p_225623_1_.func_184187_bx() != null && p_225623_1_.func_184187_bx().shouldRiderSit()); -+ this.field_77045_g.field_217113_d = shouldSit; - this.field_77045_g.field_217114_e = p_225623_1_.func_70631_g_(); - float f = MathHelper.func_219805_h(p_225623_3_, p_225623_1_.field_70760_ar, p_225623_1_.field_70761_aq); - float f1 = MathHelper.func_219805_h(p_225623_3_, p_225623_1_.field_70758_at, p_225623_1_.field_70759_as); ++ boolean shouldSit = p_225623_1_.isPassenger() && (p_225623_1_.getVehicle() != null && p_225623_1_.getVehicle().shouldRiderSit()); ++ this.model.riding = shouldSit; + this.model.young = p_225623_1_.isBaby(); + float f = MathHelper.rotLerp(p_225623_3_, p_225623_1_.yBodyRotO, p_225623_1_.yBodyRot); + float f1 = MathHelper.rotLerp(p_225623_3_, p_225623_1_.yHeadRotO, p_225623_1_.yHeadRot); float f2 = f1 - f; -- if (p_225623_1_.func_184218_aH() && p_225623_1_.func_184187_bx() instanceof LivingEntity) { -+ if (shouldSit && p_225623_1_.func_184187_bx() instanceof LivingEntity) { - LivingEntity livingentity = (LivingEntity)p_225623_1_.func_184187_bx(); - f = MathHelper.func_219805_h(p_225623_3_, livingentity.field_70760_ar, livingentity.field_70761_aq); +- if (p_225623_1_.isPassenger() && p_225623_1_.getVehicle() instanceof LivingEntity) { ++ if (shouldSit && p_225623_1_.getVehicle() instanceof LivingEntity) { + LivingEntity livingentity = (LivingEntity)p_225623_1_.getVehicle(); + f = MathHelper.rotLerp(p_225623_3_, livingentity.yBodyRotO, livingentity.yBodyRot); f2 = f1 - f; @@ -92,7 +_,7 @@ - p_225623_4_.func_227861_a_(0.0D, (double)-1.501F, 0.0D); + p_225623_4_.translate(0.0D, (double)-1.501F, 0.0D); float f8 = 0.0F; float f5 = 0.0F; -- if (!p_225623_1_.func_184218_aH() && p_225623_1_.func_70089_S()) { -+ if (!shouldSit && p_225623_1_.func_70089_S()) { - f8 = MathHelper.func_219799_g(p_225623_3_, p_225623_1_.field_184618_aE, p_225623_1_.field_70721_aZ); - f5 = p_225623_1_.field_184619_aG - p_225623_1_.field_70721_aZ * (1.0F - p_225623_3_); - if (p_225623_1_.func_70631_g_()) { +- if (!p_225623_1_.isPassenger() && p_225623_1_.isAlive()) { ++ if (!shouldSit && p_225623_1_.isAlive()) { + f8 = MathHelper.lerp(p_225623_3_, p_225623_1_.animationSpeedOld, p_225623_1_.animationSpeed); + f5 = p_225623_1_.animationPosition - p_225623_1_.animationSpeed * (1.0F - p_225623_3_); + if (p_225623_1_.isBaby()) { @@ -125,6 +_,7 @@ - p_225623_4_.func_227865_b_(); - super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); + p_225623_4_.popPose(); + super.render(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_)); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch index b0f04eabfe..c54d82c28c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch @@ -2,24 +2,24 @@ +++ b/net/minecraft/client/renderer/entity/PlayerRenderer.java @@ -60,7 +_,9 @@ - public void func_225623_a_(AbstractClientPlayerEntity p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { - this.func_177137_d(p_225623_1_); + public void render(AbstractClientPlayerEntity p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { + this.setModelProperties(p_225623_1_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_))) return; - super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); + super.render(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_)); } - public Vector3d func_225627_b_(AbstractClientPlayerEntity p_225627_1_, float p_225627_2_) { + public Vector3d getRenderOffset(AbstractClientPlayerEntity p_225627_1_, float p_225627_2_) { @@ -156,10 +_,12 @@ } - public void func_229144_a_(MatrixStack p_229144_1_, IRenderTypeBuffer p_229144_2_, int p_229144_3_, AbstractClientPlayerEntity p_229144_4_) { + public void renderRightHand(MatrixStack p_229144_1_, IRenderTypeBuffer p_229144_2_, int p_229144_3_, AbstractClientPlayerEntity p_229144_4_) { + if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonArm(p_229144_1_, p_229144_2_, p_229144_3_, p_229144_4_, HandSide.RIGHT)) - this.func_229145_a_(p_229144_1_, p_229144_2_, p_229144_3_, p_229144_4_, (this.field_77045_g).field_178723_h, (this.field_77045_g).field_178732_b); + this.renderHand(p_229144_1_, p_229144_2_, p_229144_3_, p_229144_4_, (this.model).rightArm, (this.model).rightSleeve); } - public void func_229146_b_(MatrixStack p_229146_1_, IRenderTypeBuffer p_229146_2_, int p_229146_3_, AbstractClientPlayerEntity p_229146_4_) { + public void renderLeftHand(MatrixStack p_229146_1_, IRenderTypeBuffer p_229146_2_, int p_229146_3_, AbstractClientPlayerEntity p_229146_4_) { + if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonArm(p_229146_1_, p_229146_2_, p_229146_3_, p_229146_4_, HandSide.LEFT)) - this.func_229145_a_(p_229146_1_, p_229146_2_, p_229146_3_, p_229146_4_, (this.field_77045_g).field_178724_i, (this.field_77045_g).field_178734_a); + this.renderHand(p_229146_1_, p_229146_2_, p_229146_3_, p_229146_4_, (this.model).leftArm, (this.model).leftSleeve); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch index 14c4d7f486..9dc28e4f93 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java @@ -44,19 +_,20 @@ - if (itemstack.func_77973_b() instanceof ArmorItem) { - ArmorItem armoritem = (ArmorItem)itemstack.func_77973_b(); - if (armoritem.func_185083_B_() == p_241739_4_) { + if (itemstack.getItem() instanceof ArmorItem) { + ArmorItem armoritem = (ArmorItem)itemstack.getItem(); + if (armoritem.getSlot() == p_241739_4_) { + p_241739_6_ = getArmorModelHook(p_241739_3_, itemstack, p_241739_4_, p_241739_6_); - this.func_215332_c().func_217148_a(p_241739_6_); - this.func_188359_a(p_241739_6_, p_241739_4_); - boolean flag = this.func_188363_b(p_241739_4_); - boolean flag1 = itemstack.func_77962_s(); + this.getParentModel().copyPropertiesTo(p_241739_6_); + this.setPartVisibility(p_241739_6_, p_241739_4_); + boolean flag = this.usesInnerModel(p_241739_4_); + boolean flag1 = itemstack.hasFoil(); - if (armoritem instanceof DyeableArmorItem) { -- int i = ((DyeableArmorItem)armoritem).func_200886_f(itemstack); +- int i = ((DyeableArmorItem)armoritem).getColor(itemstack); + if (armoritem instanceof net.minecraft.item.IDyeableArmorItem) { -+ int i = ((net.minecraft.item.IDyeableArmorItem)armoritem).func_200886_f(itemstack); ++ int i = ((net.minecraft.item.IDyeableArmorItem)armoritem).getColor(itemstack); float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, f, f1, f2, (String)null); -- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, "overlay"); +- this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, f, f1, f2, (String)null); +- this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, "overlay"); + this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, f, f1, f2, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, null)); + this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, "overlay")); } else { -- this.func_241738_a_(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, (String)null); +- this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, armoritem, flag1, p_241739_6_, flag, 1.0F, 1.0F, 1.0F, (String)null); + this.renderModel(p_241739_1_, p_241739_2_, p_241739_5_, flag1, p_241739_6_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_241739_3_, itemstack, p_241739_4_, null)); } @@ -29,13 +29,13 @@ @@ -88,7 +_,10 @@ } - private void func_241738_a_(MatrixStack p_241738_1_, IRenderTypeBuffer p_241738_2_, int p_241738_3_, ArmorItem p_241738_4_, boolean p_241738_5_, A p_241738_6_, boolean p_241738_7_, float p_241738_8_, float p_241738_9_, float p_241738_10_, @Nullable String p_241738_11_) { -- IVertexBuilder ivertexbuilder = ItemRenderer.func_239386_a_(p_241738_2_, RenderType.func_239263_a_(this.func_241737_a_(p_241738_4_, p_241738_7_, p_241738_11_)), false, p_241738_5_); -+ renderModel(p_241738_1_, p_241738_2_, p_241738_3_, p_241738_5_, p_241738_6_, p_241738_8_, p_241738_9_, p_241738_10_, this.func_241737_a_(p_241738_4_, p_241738_7_, p_241738_11_)); + private void renderModel(MatrixStack p_241738_1_, IRenderTypeBuffer p_241738_2_, int p_241738_3_, ArmorItem p_241738_4_, boolean p_241738_5_, A p_241738_6_, boolean p_241738_7_, float p_241738_8_, float p_241738_9_, float p_241738_10_, @Nullable String p_241738_11_) { +- IVertexBuilder ivertexbuilder = ItemRenderer.getArmorFoilBuffer(p_241738_2_, RenderType.armorCutoutNoCull(this.getArmorLocation(p_241738_4_, p_241738_7_, p_241738_11_)), false, p_241738_5_); ++ renderModel(p_241738_1_, p_241738_2_, p_241738_3_, p_241738_5_, p_241738_6_, p_241738_8_, p_241738_9_, p_241738_10_, this.getArmorLocation(p_241738_4_, p_241738_7_, p_241738_11_)); + } + private void renderModel(MatrixStack p_241738_1_, IRenderTypeBuffer p_241738_2_, int p_241738_3_, boolean p_241738_5_, A p_241738_6_, float p_241738_8_, float p_241738_9_, float p_241738_10_, ResourceLocation armorResource) { -+ IVertexBuilder ivertexbuilder = ItemRenderer.func_239386_a_(p_241738_2_, RenderType.func_239263_a_(armorResource), false, p_241738_5_); - p_241738_6_.func_225598_a_(p_241738_1_, ivertexbuilder, p_241738_3_, OverlayTexture.field_229196_a_, p_241738_8_, p_241738_9_, p_241738_10_, 1.0F); ++ IVertexBuilder ivertexbuilder = ItemRenderer.getArmorFoilBuffer(p_241738_2_, RenderType.armorCutoutNoCull(armorResource), false, p_241738_5_); + p_241738_6_.renderToBuffer(p_241738_1_, ivertexbuilder, p_241738_3_, OverlayTexture.NO_OVERLAY, p_241738_8_, p_241738_9_, p_241738_10_, 1.0F); } @@ -100,8 +_,50 @@ @@ -43,9 +43,9 @@ } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_241737_a_(ArmorItem p_241737_1_, boolean p_241737_2_, @Nullable String p_241737_3_) { - String s = "textures/models/armor/" + p_241737_1_.func_200880_d().func_200897_d() + "_layer_" + (p_241737_2_ ? 2 : 1) + (p_241737_3_ == null ? "" : "_" + p_241737_3_) + ".png"; - return field_177191_j.computeIfAbsent(s, ResourceLocation::new); + private ResourceLocation getArmorLocation(ArmorItem p_241737_1_, boolean p_241737_2_, @Nullable String p_241737_3_) { + String s = "textures/models/armor/" + p_241737_1_.getMaterial().getName() + "_layer_" + (p_241737_2_ ? 2 : 1) + (p_241737_3_ == null ? "" : "_" + p_241737_3_) + ".png"; + return ARMOR_LOCATION_CACHE.computeIfAbsent(s, ResourceLocation::new); } + + /*=================================== FORGE START =========================================*/ @@ -67,22 +67,22 @@ + * @return ResourceLocation pointing at the armor's texture + */ + public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EquipmentSlotType slot, @Nullable String type) { -+ ArmorItem item = (ArmorItem)stack.func_77973_b(); -+ String texture = item.func_200880_d().func_200897_d(); ++ ArmorItem item = (ArmorItem)stack.getItem(); ++ String texture = item.getMaterial().getName(); + String domain = "minecraft"; + int idx = texture.indexOf(':'); + if (idx != -1) { + domain = texture.substring(0, idx); + texture = texture.substring(idx + 1); + } -+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (usesInnerModel(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); + + s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = field_177191_j.get(s1); ++ ResourceLocation resourcelocation = ARMOR_LOCATION_CACHE.get(s1); + + if (resourcelocation == null) { + resourcelocation = new ResourceLocation(s1); -+ field_177191_j.put(s1, resourcelocation); ++ ARMOR_LOCATION_CACHE.put(s1, resourcelocation); + } + + return resourcelocation; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/ElytraLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ElytraLayer.java.patch index dfd72d6fe4..497b201b10 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/ElytraLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ElytraLayer.java.patch @@ -2,29 +2,29 @@ +++ b/net/minecraft/client/renderer/entity/layers/ElytraLayer.java @@ -30,7 +_,7 @@ - public void func_225628_a_(MatrixStack p_225628_1_, IRenderTypeBuffer p_225628_2_, int p_225628_3_, T p_225628_4_, float p_225628_5_, float p_225628_6_, float p_225628_7_, float p_225628_8_, float p_225628_9_, float p_225628_10_) { - ItemStack itemstack = p_225628_4_.func_184582_a(EquipmentSlotType.CHEST); -- if (itemstack.func_77973_b() == Items.field_185160_cR) { + public void render(MatrixStack p_225628_1_, IRenderTypeBuffer p_225628_2_, int p_225628_3_, T p_225628_4_, float p_225628_5_, float p_225628_6_, float p_225628_7_, float p_225628_8_, float p_225628_9_, float p_225628_10_) { + ItemStack itemstack = p_225628_4_.getItemBySlot(EquipmentSlotType.CHEST); +- if (itemstack.getItem() == Items.ELYTRA) { + if (shouldRender(itemstack, p_225628_4_)) { ResourceLocation resourcelocation; if (p_225628_4_ instanceof AbstractClientPlayerEntity) { AbstractClientPlayerEntity abstractclientplayerentity = (AbstractClientPlayerEntity)p_225628_4_; @@ -39,10 +_,10 @@ - } else if (abstractclientplayerentity.func_152122_n() && abstractclientplayerentity.func_110303_q() != null && abstractclientplayerentity.func_175148_a(PlayerModelPart.CAPE)) { - resourcelocation = abstractclientplayerentity.func_110303_q(); + } else if (abstractclientplayerentity.isCapeLoaded() && abstractclientplayerentity.getCloakTextureLocation() != null && abstractclientplayerentity.isModelPartShown(PlayerModelPart.CAPE)) { + resourcelocation = abstractclientplayerentity.getCloakTextureLocation(); } else { -- resourcelocation = field_188355_a; +- resourcelocation = WINGS_LOCATION; + resourcelocation = getElytraTexture(itemstack, p_225628_4_); } } else { -- resourcelocation = field_188355_a; +- resourcelocation = WINGS_LOCATION; + resourcelocation = getElytraTexture(itemstack, p_225628_4_); } - p_225628_1_.func_227860_a_(); + p_225628_1_.pushPose(); @@ -53,5 +_,30 @@ - this.field_188357_c.func_225598_a_(p_225628_1_, ivertexbuilder, p_225628_3_, OverlayTexture.field_229196_a_, 1.0F, 1.0F, 1.0F, 1.0F); - p_225628_1_.func_227865_b_(); + this.elytraModel.renderToBuffer(p_225628_1_, ivertexbuilder, p_225628_3_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + p_225628_1_.popPose(); } + } + @@ -38,7 +38,7 @@ + * @return If the ElytraLayer should render. + */ + public boolean shouldRender(ItemStack stack, T entity) { -+ return stack.func_77973_b() == Items.field_185160_cR; ++ return stack.getItem() == Items.ELYTRA; + } + + /** @@ -50,6 +50,6 @@ + * @return The texture. + */ + public ResourceLocation getElytraTexture(ItemStack stack, T entity) { -+ return field_188355_a; ++ return WINGS_LOCATION; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch index 73808c286e..2e2b7c588c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch @@ -6,13 +6,13 @@ @OnlyIn(Dist.CLIENT) -public class BakedQuad { +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { - protected final int[] field_178215_a; - protected final int field_178213_b; - protected final Direction field_178214_c; + protected final int[] vertices; + protected final int tintIndex; + protected final Direction direction; @@ -35,6 +_,15 @@ - public Direction func_178210_d() { - return this.field_178214_c; + public Direction getDirection() { + return this.direction; + } + + @Override @@ -20,8 +20,8 @@ + net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); + } + -+ public TextureAtlasSprite func_187508_a() { -+ return field_187509_d; ++ public TextureAtlasSprite getSprite() { ++ return sprite; } - public boolean func_239287_f_() { + public boolean isShade() { diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch index 465ebe3db4..063af3ac10 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch @@ -1,88 +1,88 @@ --- a/net/minecraft/client/renderer/model/BlockModel.java +++ b/net/minecraft/client/renderer/model/BlockModel.java @@ -57,9 +_,10 @@ - public BlockModel field_178315_d; + public BlockModel parent; @Nullable - protected ResourceLocation field_178316_e; + protected ResourceLocation parentLocation; + public final net.minecraftforge.client.model.BlockModelConfiguration customData = new net.minecraftforge.client.model.BlockModelConfiguration(this); - public static BlockModel func_178307_a(Reader p_178307_0_) { -- return JSONUtils.func_193839_a(field_178319_a, p_178307_0_, BlockModel.class); -+ return JSONUtils.func_193839_a(net.minecraftforge.client.model.ModelLoaderRegistry.ExpandedBlockModelDeserializer.INSTANCE, p_178307_0_, BlockModel.class); + public static BlockModel fromStream(Reader p_178307_0_) { +- return JSONUtils.fromJson(GSON, p_178307_0_, BlockModel.class); ++ return JSONUtils.fromJson(net.minecraftforge.client.model.ModelLoaderRegistry.ExpandedBlockModelDeserializer.INSTANCE, p_178307_0_, BlockModel.class); } - public static BlockModel func_178294_a(String p_178294_0_) { + public static BlockModel fromString(String p_178294_0_) { @@ -76,10 +_,15 @@ - this.field_187968_k = p_i230056_7_; + this.overrides = p_i230056_7_; } + @Deprecated - public List func_178298_a() { + public List getElements() { + if (customData.hasCustomGeometry()) return java.util.Collections.emptyList(); - return this.field_178314_g.isEmpty() && this.field_178315_d != null ? this.field_178315_d.func_178298_a() : this.field_178314_g; + return this.elements.isEmpty() && this.parent != null ? this.parent.getElements() : this.elements; } + @Nullable -+ public ResourceLocation getParentLocation() { return field_178316_e; } ++ public ResourceLocation getParentLocation() { return parentLocation; } + - public boolean func_178309_b() { - return this.field_178315_d != null ? this.field_178315_d.func_178309_b() : this.field_178322_i; + public boolean hasAmbientOcclusion() { + return this.parent != null ? this.parent.hasAmbientOcclusion() : this.hasAmbientOcclusion; } @@ -100,6 +_,10 @@ - return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, this.field_187968_k); + return this.overrides.isEmpty() ? ItemOverrideList.EMPTY : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::getModel, this.overrides); } + public ItemOverrideList getOverrides(ModelBakery p_217646_1_, BlockModel p_217646_2_, Function textureGetter) { -+ return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, textureGetter, this.field_187968_k); ++ return this.overrides.isEmpty() ? ItemOverrideList.EMPTY : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::getModel, textureGetter, this.overrides); + } + - public Collection func_187965_e() { + public Collection getDependencies() { Set set = Sets.newHashSet(); @@ -143,6 +_,9 @@ - Set set1 = Sets.newHashSet(this.func_228816_c_("particle")); + Set set1 = Sets.newHashSet(this.getMaterial("particle")); + if(customData.hasCustomGeometry()) + set1.addAll(customData.getTextureDependencies(p_225614_1_, p_225614_2_)); + else - for(BlockPart blockpart : this.func_178298_a()) { - for(BlockPartFace blockpartface : blockpart.field_178240_c.values()) { - RenderMaterial rendermaterial = this.func_228816_c_(blockpartface.field_178242_d); + for(BlockPart blockpart : this.getElements()) { + for(BlockPartFace blockpartface : blockpart.faces.values()) { + RenderMaterial rendermaterial = this.getMaterial(blockpartface.texture); @@ -169,11 +_,17 @@ return set1; } + @Deprecated //Forge: Use Boolean variant - public IBakedModel func_225613_a_(ModelBakery p_225613_1_, Function p_225613_2_, IModelTransform p_225613_3_, ResourceLocation p_225613_4_) { - return this.func_228813_a_(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_, true); + public IBakedModel bake(ModelBakery p_225613_1_, Function p_225613_2_, IModelTransform p_225613_3_, ResourceLocation p_225613_4_) { + return this.bake(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_, true); } - public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { + public IBakedModel bake(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { + return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_); + } + + @Deprecated //Forge: exposed for our callbacks only. Use the above function. + public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) { - TextureAtlasSprite textureatlassprite = p_228813_3_.apply(this.func_228816_c_("particle")); - if (this.func_178310_f() == ModelBakery.field_177616_r) { - return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_228813_1_, p_228813_2_), textureatlassprite, this.func_230176_c_().func_230178_a_()); + TextureAtlasSprite textureatlassprite = p_228813_3_.apply(this.getMaterial("particle")); + if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) { + return new BuiltInModel(this.getTransforms(), this.getItemOverrides(p_228813_1_, p_228813_2_), textureatlassprite, this.getGuiLight().lightLikeBlock()); @@ -200,6 +_,10 @@ - return field_217647_g.func_228824_a_(p_228812_0_.field_178241_a, p_228812_0_.field_178239_b, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_0_.field_178237_d, p_228812_0_.field_178238_e, p_228812_5_); + return FACE_BAKERY.bakeQuad(p_228812_0_.from, p_228812_0_.to, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_0_.rotation, p_228812_0_.shade, p_228812_5_); } + public static BakedQuad makeBakedQuad(BlockPart p_228812_0_, BlockPartFace p_228812_1_, TextureAtlasSprite p_228812_2_, Direction p_228812_3_, IModelTransform p_228812_4_, ResourceLocation p_228812_5_) { -+ return func_228812_a_(p_228812_0_, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_5_); ++ return bakeFace(p_228812_0_, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_5_); + } + - public boolean func_178300_b(String p_178300_1_) { - return !MissingTextureSprite.func_195675_b().equals(this.func_228816_c_(p_178300_1_).func_229313_b_()); + public boolean hasTexture(String p_178300_1_) { + return !MissingTextureSprite.getLocation().equals(this.getMaterial(p_178300_1_).texture()); } @@ -373,5 +_,7 @@ - public boolean func_230178_a_() { + public boolean lightLikeBlock() { return this == SIDE; } + -+ public String getSerializedName() { return field_230177_c_; } ++ public String getSerializedName() { return name; } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch index e6e25e1e64..f049a987d2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java @@ -43,6 +_,7 @@ - this.func_178408_a(aint, direction); + this.recalculateWinding(aint, direction); } + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction); - return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_); + return new BakedQuad(aint, p_228824_3_.tintIndex, direction, p_228824_4_, p_228824_8_); } @@ -125,8 +_,8 @@ - p_239288_1_[i + 1] = Float.floatToRawIntBits(p_239288_3_.func_195900_b()); - p_239288_1_[i + 2] = Float.floatToRawIntBits(p_239288_3_.func_195902_c()); + p_239288_1_[i + 1] = Float.floatToRawIntBits(p_239288_3_.y()); + p_239288_1_[i + 2] = Float.floatToRawIntBits(p_239288_3_.z()); p_239288_1_[i + 3] = -1; -- p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.func_94214_a((double)p_239288_5_.func_178348_a(p_239288_2_))); -- p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.func_94207_b((double)p_239288_5_.func_178346_b(p_239288_2_))); -+ p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.func_94214_a((double)p_239288_5_.func_178348_a(p_239288_2_) * .999 + p_239288_5_.func_178348_a((p_239288_2_ + 2) % 4) * .001)); -+ p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.func_94207_b((double)p_239288_5_.func_178346_b(p_239288_2_) * .999 + p_239288_5_.func_178346_b((p_239288_2_ + 2) % 4) * .001)); +- p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.getU((double)p_239288_5_.getU(p_239288_2_))); +- p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.getV((double)p_239288_5_.getV(p_239288_2_))); ++ p_239288_1_[i + 4] = Float.floatToRawIntBits(p_239288_4_.getU((double)p_239288_5_.getU(p_239288_2_) * .999 + p_239288_5_.getU((p_239288_2_ + 2) % 4) * .001)); ++ p_239288_1_[i + 4 + 1] = Float.floatToRawIntBits(p_239288_4_.getV((double)p_239288_5_.getV(p_239288_2_) * .999 + p_239288_5_.getV((p_239288_2_ + 2) % 4) * .001)); } - private void func_199336_a(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) { + private void applyElementRotation(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch index cbc0270cfb..98880a719b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch @@ -8,21 +8,21 @@ +public interface IBakedModel extends net.minecraftforge.client.extensions.IForgeBakedModel { + /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#getQuads(IBlockState, EnumFacing, Random, net.minecraftforge.client.model.data.IModelData)}*/ + @Deprecated - List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); + List getQuads(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); - boolean func_177555_b(); + boolean useAmbientOcclusion(); @@ -21,9 +_,13 @@ - boolean func_188618_c(); + boolean isCustomRenderer(); + /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#getParticleTexture(net.minecraftforge.client.model.data.IModelData)}*/ + @Deprecated - TextureAtlasSprite func_177554_e(); + TextureAtlasSprite getParticleIcon(); -- ItemCameraTransforms func_177552_f(); +- ItemCameraTransforms getTransforms(); + /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#handlePerspective(net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType, com.mojang.blaze3d.matrix.MatrixStack)} instead */ + @Deprecated -+ default ItemCameraTransforms func_177552_f() { return ItemCameraTransforms.field_178357_a; } ++ default ItemCameraTransforms getTransforms() { return ItemCameraTransforms.NO_TRANSFORMS; } - ItemOverrideList func_188617_f(); + ItemOverrideList getOverrides(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch index 8c3dcd2da4..6be92310a5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IModelTransform.java.patch @@ -6,6 +6,6 @@ @OnlyIn(Dist.CLIENT) -public interface IModelTransform { +public interface IModelTransform extends net.minecraftforge.client.extensions.IForgeModelTransform { - default TransformationMatrix func_225615_b_() { - return TransformationMatrix.func_227983_a_(); + default TransformationMatrix getRotation() { + return TransformationMatrix.identity(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch index 3cfed35858..84092e06b6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch @@ -6,6 +6,6 @@ @OnlyIn(Dist.CLIENT) -public interface IUnbakedModel { +public interface IUnbakedModel extends net.minecraftforge.client.extensions.IForgeUnbakedModel { - Collection func_187965_e(); + Collection getDependencies(); - Collection func_225614_a_(Function p_225614_1_, Set> p_225614_2_); + Collection getMaterials(Function p_225614_1_, Set> p_225614_2_); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch index 31063f7cc9..5fb4b65006 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/client/renderer/model/ItemCameraTransforms.java +++ b/net/minecraft/client/renderer/model/ItemCameraTransforms.java @@ -25,6 +_,7 @@ - this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a); + this(ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM, ItemTransformVec3f.NO_TRANSFORM); } + @Deprecated public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) { - this.field_188036_k = p_i46443_1_.field_188036_k; - this.field_188037_l = p_i46443_1_.field_188037_l; + this.thirdPersonLeftHand = p_i46443_1_.thirdPersonLeftHand; + this.thirdPersonRightHand = p_i46443_1_.thirdPersonRightHand; @@ -36,6 +_,7 @@ - this.field_181700_p = p_i46443_1_.field_181700_p; + this.fixed = p_i46443_1_.fixed; } + @Deprecated public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) { - this.field_188036_k = p_i46569_1_; - this.field_188037_l = p_i46569_2_; + this.thirdPersonLeftHand = p_i46569_1_; + this.thirdPersonRightHand = p_i46569_2_; @@ -47,6 +_,7 @@ - this.field_181700_p = p_i46569_8_; + this.fixed = p_i46569_8_; } + @Deprecated - public ItemTransformVec3f func_181688_b(ItemCameraTransforms.TransformType p_181688_1_) { + public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType p_181688_1_) { switch(p_181688_1_) { case THIRD_PERSON_LEFT_HAND: diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemModelGenerator.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemModelGenerator.java.patch index 6eb5bfd1ab..55613df9d1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemModelGenerator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemModelGenerator.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/renderer/model/ItemModelGenerator.java +++ b/net/minecraft/client/renderer/model/ItemModelGenerator.java @@ -36,6 +_,7 @@ - map.put("particle", p_209579_2_.func_178300_b("particle") ? Either.left(p_209579_2_.func_228816_c_("particle")) : map.get("layer0")); - BlockModel blockmodel = new BlockModel((ResourceLocation)null, list, map, false, p_209579_2_.func_230176_c_(), p_209579_2_.func_181682_g(), p_209579_2_.func_187966_f()); - blockmodel.field_178317_b = p_209579_2_.field_178317_b; + map.put("particle", p_209579_2_.hasTexture("particle") ? Either.left(p_209579_2_.getMaterial("particle")) : map.get("layer0")); + BlockModel blockmodel = new BlockModel((ResourceLocation)null, list, map, false, p_209579_2_.getGuiLight(), p_209579_2_.getTransforms(), p_209579_2_.getOverrides()); + blockmodel.name = p_209579_2_.name; + blockmodel.customData.copyFrom(p_209579_2_.customData); return blockmodel; } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch index 61cc49b6ac..75ffb6a2c2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/renderer/model/ItemOverrideList.java +++ b/net/minecraft/client/renderer/model/ItemOverrideList.java @@ -24,10 +_,14 @@ - this.field_209582_c = Collections.emptyList(); + this.overrideModels = Collections.emptyList(); } + @Deprecated //Forge: Use IUnbakedModel, add texture getter public ItemOverrideList(ModelBakery p_i50984_1_, BlockModel p_i50984_2_, Function p_i50984_3_, List p_i50984_4_) { -+ this(p_i50984_1_, (IUnbakedModel)p_i50984_2_, p_i50984_3_, p_i50984_1_.getSpriteMap()::func_229151_a_, p_i50984_4_); ++ this(p_i50984_1_, (IUnbakedModel)p_i50984_2_, p_i50984_3_, p_i50984_1_.getSpriteMap()::getSprite, p_i50984_4_); + } + public ItemOverrideList(ModelBakery p_i50984_1_, IUnbakedModel p_i50984_2_, Function p_i50984_3_, Function textureGetter, List p_i50984_4_) { - this.field_209582_c = p_i50984_4_.stream().map((p_217649_3_) -> { - IUnbakedModel iunbakedmodel = p_i50984_3_.apply(p_217649_3_.func_188026_a()); -- return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.func_217845_a(p_217649_3_.func_188026_a(), ModelRotation.X0_Y0); -+ return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.getBakedModel(p_217649_3_.func_188026_a(), ModelRotation.X0_Y0, textureGetter); + this.overrideModels = p_i50984_4_.stream().map((p_217649_3_) -> { + IUnbakedModel iunbakedmodel = p_i50984_3_.apply(p_217649_3_.getModel()); +- return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.bake(p_217649_3_.getModel(), ModelRotation.X0_Y0); ++ return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.getBakedModel(p_217649_3_.getModel(), ModelRotation.X0_Y0, textureGetter); }).collect(Collectors.toList()); - Collections.reverse(this.field_209582_c); + Collections.reverse(this.overrideModels); @@ -54,5 +_,9 @@ } @@ -23,6 +23,6 @@ + } + + public com.google.common.collect.ImmutableList getOverrides() { -+ return com.google.common.collect.ImmutableList.copyOf(field_188023_b); ++ return com.google.common.collect.ImmutableList.copyOf(overrides); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch index f6822bc383..d717ab47b3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch @@ -10,5 +10,5 @@ @OnlyIn(Dist.CLIENT) +@Deprecated public class ItemTransformVec3f { - public static final ItemTransformVec3f field_178366_a = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - public final Vector3f field_178364_b; + public static final ItemTransformVec3f NO_TRANSFORM = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + public final Vector3f rotation; diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch index 461a14cdce..2529852590 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch @@ -9,84 +9,84 @@ + } + + protected ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, boolean vanillaBakery) { - this.field_177598_f = p_i226056_1_; - this.field_225365_D = p_i226056_2_; + this.resourceManager = p_i226056_1_; + this.blockColors = p_i226056_2_; + } + + protected void processLoading(IProfiler p_i226056_3_, int p_i226056_4_) { + net.minecraftforge.client.model.ModelLoaderRegistry.onModelLoadingStart(); - p_i226056_3_.func_76320_a("missing_model"); + p_i226056_3_.push("missing_model"); try { @@ -180,12 +_,16 @@ - p_i226056_3_.func_219895_b("special"); - this.func_217843_a(new ModelResourceLocation("minecraft:trident_in_hand#inventory")); + p_i226056_3_.popPush("special"); + this.loadTopLevel(new ModelResourceLocation("minecraft:trident_in_hand#inventory")); + for (ResourceLocation rl : getSpecialModels()) { + addModelToCache(rl); + } - p_i226056_3_.func_219895_b("textures"); + p_i226056_3_.popPush("textures"); Set> set = Sets.newLinkedHashSet(); - Set set1 = this.field_217851_H.values().stream().flatMap((p_229342_2_) -> { - return p_229342_2_.func_225614_a_(this::func_209597_a, set).stream(); + Set set1 = this.topLevelModels.values().stream().flatMap((p_229342_2_) -> { + return p_229342_2_.getMaterials(this::getModel, set).stream(); }).collect(Collectors.toSet()); - set1.addAll(field_177602_b); + set1.addAll(UNREFERENCED_TEXTURES); + net.minecraftforge.client.ForgeHooksClient.gatherFluidTextures(set1); set.stream().filter((p_229346_0_) -> { - return !p_229346_0_.getSecond().equals(field_229321_r_); + return !p_229346_0_.getSecond().equals(MISSING_MODEL_LOCATION_STRING); }).forEach((p_229330_0_) -> { @@ -224,6 +_,7 @@ try { - ibakedmodel = this.func_217845_a(p_229350_1_, ModelRotation.X0_Y0); + ibakedmodel = this.bake(p_229350_1_, ModelRotation.X0_Y0); } catch (Exception exception) { + exception.printStackTrace(); - field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception); + LOGGER.warn("Unable to bake model: '{}': {}", p_229350_1_, exception); } @@ -442,6 +_,13 @@ - this.field_217848_D.addAll(p_209593_2_.func_187965_e()); + this.loadingStack.addAll(p_209593_2_.getDependencies()); } + // Same as loadTopModel but without restricting to MRL's + private void addModelToCache(ResourceLocation p_217843_1_) { -+ IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_); -+ this.field_217849_F.put(p_217843_1_, iunbakedmodel); -+ this.field_217851_H.put(p_217843_1_, iunbakedmodel); ++ IUnbakedModel iunbakedmodel = this.getModel(p_217843_1_); ++ this.unbakedCache.put(p_217843_1_, iunbakedmodel); ++ this.topLevelModels.put(p_217843_1_, iunbakedmodel); + } + - private void func_217843_a(ModelResourceLocation p_217843_1_) { - IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_); - this.field_217849_F.put(p_217843_1_, iunbakedmodel); + private void loadTopLevel(ModelResourceLocation p_217843_1_) { + IUnbakedModel iunbakedmodel = this.getModel(p_217843_1_); + this.unbakedCache.put(p_217843_1_, iunbakedmodel); @@ -456,7 +_,13 @@ } @Nullable + @Deprecated - public IBakedModel func_217845_a(ResourceLocation p_217845_1_, IModelTransform p_217845_2_) { -+ return getBakedModel(p_217845_1_, p_217845_2_, this.field_229322_z_::func_229151_a_); + public IBakedModel bake(ResourceLocation p_217845_1_, IModelTransform p_217845_2_) { ++ return getBakedModel(p_217845_1_, p_217845_2_, this.atlasSet::getSprite); + } + + @Nullable + public IBakedModel getBakedModel(ResourceLocation p_217845_1_, IModelTransform p_217845_2_, java.util.function.Function textureGetter) { - Triple triple = Triple.of(p_217845_1_, p_217845_2_.func_225615_b_(), p_217845_2_.func_188049_c()); - if (this.field_217850_G.containsKey(triple)) { - return this.field_217850_G.get(triple); + Triple triple = Triple.of(p_217845_1_, p_217845_2_.getRotation(), p_217845_2_.isUvLocked()); + if (this.bakedCache.containsKey(triple)) { + return this.bakedCache.get(triple); @@ -467,11 +_,11 @@ if (iunbakedmodel instanceof BlockModel) { BlockModel blockmodel = (BlockModel)iunbakedmodel; - if (blockmodel.func_178310_f() == field_177606_o) { -- return field_217854_z.func_209579_a(this.field_229322_z_::func_229151_a_, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_, false); -+ return field_217854_z.func_209579_a(textureGetter, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_, false); + if (blockmodel.getRootModel() == GENERATION_MARKER) { +- return ITEM_MODEL_GENERATOR.generateBlockModel(this.atlasSet::getSprite, blockmodel).bake(this, blockmodel, this.atlasSet::getSprite, p_217845_2_, p_217845_1_, false); ++ return ITEM_MODEL_GENERATOR.generateBlockModel(textureGetter, blockmodel).bake(this, blockmodel, this.atlasSet::getSprite, p_217845_2_, p_217845_1_, false); } } -- IBakedModel ibakedmodel = iunbakedmodel.func_225613_a_(this, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_); -+ IBakedModel ibakedmodel = iunbakedmodel.func_225613_a_(this, textureGetter, p_217845_2_, p_217845_1_); - this.field_217850_G.put(triple, ibakedmodel); +- IBakedModel ibakedmodel = iunbakedmodel.bake(this, this.atlasSet::getSprite, p_217845_2_, p_217845_1_); ++ IBakedModel ibakedmodel = iunbakedmodel.bake(this, textureGetter, p_217845_2_, p_217845_1_); + this.bakedCache.put(triple, ibakedmodel); return ibakedmodel; } @@ -524,11 +_,19 @@ - return this.field_225367_M; + return this.modelGroups; } + public Set getSpecialModels() { @@ -101,7 +101,7 @@ + } + + public SpriteMap getSpriteMap() { -+ return this.field_229322_z_; ++ return this.atlasSet; } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch index e7076f854c..dd87792d0c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch @@ -4,51 +4,51 @@ @OnlyIn(Dist.CLIENT) public class ModelManager extends ReloadListener implements AutoCloseable { -- private Map field_174958_a; -+ private Map field_174958_a = new java.util.HashMap<>(); +- private Map bakedRegistry; ++ private Map bakedRegistry = new java.util.HashMap<>(); @Nullable - private SpriteMap field_229352_b_; - private final BlockModelShapes field_174957_c; + private SpriteMap atlases; + private final BlockModelShapes blockModelShaper; @@ -36,6 +_,10 @@ - this.field_174957_c = new BlockModelShapes(this); + this.blockModelShaper = new BlockModelShapes(this); } + public IBakedModel getModel(ResourceLocation modelLocation) { -+ return this.field_174958_a.getOrDefault(modelLocation, this.field_174955_d); ++ return this.bakedRegistry.getOrDefault(modelLocation, this.missingModel); + } + - public IBakedModel func_174953_a(ModelResourceLocation p_174953_1_) { - return this.field_174958_a.getOrDefault(p_174953_1_, this.field_174955_d); + public IBakedModel getModel(ModelResourceLocation p_174953_1_) { + return this.bakedRegistry.getOrDefault(p_174953_1_, this.missingModel); } @@ -50,7 +_,7 @@ - protected ModelBakery func_212854_a_(IResourceManager p_212854_1_, IProfiler p_212854_2_) { - p_212854_2_.func_219894_a(); -- ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); -+ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); - p_212854_2_.func_219897_b(); + protected ModelBakery prepare(IResourceManager p_212854_1_, IProfiler p_212854_2_) { + p_212854_2_.startTick(); +- ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.blockColors, p_212854_2_, this.maxMipmapLevels); ++ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.blockColors, p_212854_2_, this.maxMipmapLevels); + p_212854_2_.endTick(); return modelbakery; } @@ -66,6 +_,7 @@ - this.field_174958_a = p_212853_1_.func_217846_a(); - this.field_224744_f = p_212853_1_.func_225354_b(); - this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, (net.minecraftforge.client.model.ModelLoader) p_212853_1_); - p_212853_3_.func_219895_b("cache"); - this.field_174957_c.func_178124_c(); - p_212853_3_.func_76319_b(); + this.bakedRegistry = p_212853_1_.getBakedTopLevelModels(); + this.modelGroups = p_212853_1_.getModelGroups(); + this.missingModel = this.bakedRegistry.get(ModelBakery.MISSING_MODEL_LOCATION); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.bakedRegistry, (net.minecraftforge.client.model.ModelLoader) p_212853_1_); + p_212853_3_.popPush("cache"); + this.blockModelShaper.rebuildCache(); + p_212853_3_.pop(); @@ -91,6 +_,7 @@ } - public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) { -+ if (this.field_229352_b_ == null) throw new RuntimeException("getAtlasTexture called too early!"); - return this.field_229352_b_.func_229152_a_(p_229356_1_); + public AtlasTexture getAtlas(ResourceLocation p_229356_1_) { ++ if (this.atlases == null) throw new RuntimeException("getAtlasTexture called too early!"); + return this.atlases.getAtlas(p_229356_1_); } @@ -103,5 +_,11 @@ - public void func_229355_a_(int p_229355_1_) { - this.field_229354_f_ = p_229355_1_; + public void updateMaxMipLevel(int p_229355_1_) { + this.maxMipmapLevels = p_229355_1_; + } + + // TODO diff --git a/patches/minecraft/net/minecraft/client/renderer/model/MultipartBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/MultipartBakedModel.java.patch index d0cd640fca..95aba1b85b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/MultipartBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/MultipartBakedModel.java.patch @@ -6,27 +6,27 @@ @OnlyIn(Dist.CLIENT) -public class MultipartBakedModel implements IBakedModel { +public class MultipartBakedModel implements net.minecraftforge.client.model.data.IDynamicBakedModel { - private final List, IBakedModel>> field_188626_f; - protected final boolean field_188621_a; - protected final boolean field_188622_b; + private final List, IBakedModel>> selectors; + protected final boolean hasAmbientOcclusion; + protected final boolean isGui3d; @@ -27,10 +_,12 @@ - protected final ItemCameraTransforms field_188624_d; - protected final ItemOverrideList field_188625_e; - private final Map field_210277_g = new Object2ObjectOpenCustomHashMap<>(Util.func_212443_g()); + protected final ItemCameraTransforms transforms; + protected final ItemOverrideList overrides; + private final Map selectorCache = new Object2ObjectOpenCustomHashMap<>(Util.identityStrategy()); + private final IBakedModel defaultModel; public MultipartBakedModel(List, IBakedModel>> p_i48273_1_) { - this.field_188626_f = p_i48273_1_; + this.selectors = p_i48273_1_; IBakedModel ibakedmodel = p_i48273_1_.iterator().next().getRight(); + this.defaultModel = ibakedmodel; - this.field_188621_a = ibakedmodel.func_177555_b(); - this.field_188622_b = ibakedmodel.func_177556_c(); - this.field_230185_c_ = ibakedmodel.func_230044_c_(); + this.hasAmbientOcclusion = ibakedmodel.useAmbientOcclusion(); + this.isGui3d = ibakedmodel.isGui3d(); + this.usesBlockLight = ibakedmodel.usesBlockLight(); @@ -39,7 +_,8 @@ - this.field_188625_e = ibakedmodel.func_188617_f(); + this.overrides = ibakedmodel.getOverrides(); } -- public List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_) { +- public List getQuads(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_) { + // FORGE: Implement our overloads (here and below) so child models can have custom logic + public List getQuads(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_, net.minecraftforge.client.model.data.IModelData modelData) { if (p_200117_1_ == null) { @@ -36,29 +36,29 @@ for(int j = 0; j < bitset.length(); ++j) { if (bitset.get(j)) { -- list.addAll(this.field_188626_f.get(j).getRight().func_200117_a(p_200117_1_, p_200117_2_, new Random(k))); -+ list.addAll(this.field_188626_f.get(j).getRight().getQuads(p_200117_1_, p_200117_2_, new Random(k), net.minecraftforge.client.model.data.MultipartModelData.resolve(this.field_188626_f.get(j).getRight(), modelData))); +- list.addAll(this.selectors.get(j).getRight().getQuads(p_200117_1_, p_200117_2_, new Random(k))); ++ list.addAll(this.selectors.get(j).getRight().getQuads(p_200117_1_, p_200117_2_, new Random(k), net.minecraftforge.client.model.data.MultipartModelData.resolve(this.selectors.get(j).getRight(), modelData))); } } @@ -74,6 +_,10 @@ - return this.field_188621_a; + return this.hasAmbientOcclusion; } + public boolean isAmbientOcclusion(BlockState state) { + return this.defaultModel.isAmbientOcclusion(state); + } + - public boolean func_177556_c() { - return this.field_188622_b; + public boolean isGui3d() { + return this.isGui3d; } @@ -86,16 +_,31 @@ return false; } + @Deprecated - public TextureAtlasSprite func_177554_e() { - return this.field_188623_c; + public TextureAtlasSprite getParticleIcon() { + return this.particleIcon; } + public TextureAtlasSprite getParticleTexture(net.minecraftforge.client.model.data.IModelData modelData) { @@ -66,21 +66,21 @@ + } + + @Deprecated - public ItemCameraTransforms func_177552_f() { - return this.field_188624_d; + public ItemCameraTransforms getTransforms() { + return this.transforms; } + public IBakedModel handlePerspective(net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType transformType, com.mojang.blaze3d.matrix.MatrixStack matrixStack) { + return this.defaultModel.handlePerspective(transformType, matrixStack); + } + - public ItemOverrideList func_188617_f() { - return this.field_188625_e; + public ItemOverrideList getOverrides() { + return this.overrides; + } + + @Override + public net.minecraftforge.client.model.data.IModelData getModelData(net.minecraft.world.IBlockDisplayReader world, net.minecraft.util.math.BlockPos pos, BlockState state, net.minecraftforge.client.model.data.IModelData tileData) { -+ return net.minecraftforge.client.model.data.MultipartModelData.create(field_188626_f, world, pos, state, tileData); ++ return net.minecraftforge.client.model.data.MultipartModelData.create(selectors, world, pos, state, tileData); } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch index 9c005a5242..e46269d4cd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/client/renderer/model/SimpleBakedModel.java +++ b/net/minecraft/client/renderer/model/SimpleBakedModel.java @@ -77,6 +_,10 @@ - private final boolean field_177653_e; - private final ItemCameraTransforms field_177651_f; + private final boolean isGui3d; + private final ItemCameraTransforms transforms; + public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) { + this(model.useSmoothLighting(), model.isSideLit(), model.isShadedInGui(), model.getCameraTransforms(), overrides); + } + public Builder(BlockModel p_i230060_1_, ItemOverrideList p_i230060_2_, boolean p_i230060_3_) { - this(p_i230060_1_.func_178309_b(), p_i230060_1_.func_230176_c_().func_230178_a_(), p_i230060_3_, p_i230060_1_.func_181682_g(), p_i230060_2_); + this(p_i230060_1_.hasAmbientOcclusion(), p_i230060_1_.getGuiLight().lightLikeBlock(), p_i230060_3_, p_i230060_1_.getTransforms(), p_i230060_2_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/UVTransformationUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/UVTransformationUtil.java.patch deleted file mode 100644 index 87a4daee4c..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/UVTransformationUtil.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/client/renderer/model/UVTransformationUtil.java -+++ b/net/minecraft/client/renderer/model/UVTransformationUtil.java -@@ -27,7 +_,7 @@ - }); - public static final EnumMap field_229377_b_ = Util.func_200696_a(Maps.newEnumMap(Direction.class), (p_229381_0_) -> { - for(Direction direction : Direction.values()) { -- p_229381_0_.put(direction, field_229376_a_.get(direction).func_227987_b_()); -+ p_229381_0_.put(direction, field_229376_a_.get(direction).inverse()); - } - - }); -@@ -41,12 +_,12 @@ - - public static TransformationMatrix func_229380_a_(TransformationMatrix p_229380_0_, Direction p_229380_1_, Supplier p_229380_2_) { - Direction direction = Direction.func_229385_a_(p_229380_0_.func_227988_c_(), p_229380_1_); -- TransformationMatrix transformationmatrix = p_229380_0_.func_227987_b_(); -+ TransformationMatrix transformationmatrix = p_229380_0_.inverse(); - if (transformationmatrix == null) { - field_229378_c_.warn(p_229380_2_.get()); - return new TransformationMatrix((Vector3f)null, (Quaternion)null, new Vector3f(0.0F, 0.0F, 0.0F), (Quaternion)null); - } else { -- TransformationMatrix transformationmatrix1 = field_229377_b_.get(p_229380_1_).func_227985_a_(transformationmatrix).func_227985_a_(field_229376_a_.get(direction)); -+ TransformationMatrix transformationmatrix1 = field_229377_b_.get(p_229380_1_).compose(transformationmatrix).compose(field_229376_a_.get(direction)); - return func_229379_a_(transformationmatrix1); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch index 8819b7f91d..14105d7aea 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch @@ -3,9 +3,9 @@ @@ -64,7 +_,7 @@ WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); - for(Variant variant : this.func_188114_a()) { -- IBakedModel ibakedmodel = p_225613_1_.func_217845_a(variant.func_188046_a(), variant); -+ IBakedModel ibakedmodel = p_225613_1_.getBakedModel(variant.func_188046_a(), variant, p_225613_2_); - weightedbakedmodel$builder.func_177677_a(ibakedmodel, variant.func_188047_d()); + for(Variant variant : this.getVariants()) { +- IBakedModel ibakedmodel = p_225613_1_.bake(variant.getModelLocation(), variant); ++ IBakedModel ibakedmodel = p_225613_1_.getBakedModel(variant.getModelLocation(), variant, p_225613_2_); + weightedbakedmodel$builder.add(ibakedmodel, variant.getWeight()); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch index 39b760f11c..f03db940a1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch @@ -6,46 +6,46 @@ @OnlyIn(Dist.CLIENT) -public class WeightedBakedModel implements IBakedModel { +public class WeightedBakedModel implements net.minecraftforge.client.model.data.IDynamicBakedModel { - private final int field_177567_a; - private final List field_177565_b; - private final IBakedModel field_177566_c; + private final int totalWeight; + private final List list; + private final IBakedModel wrapped; @@ -23,14 +_,20 @@ - this.field_177566_c = (p_i46073_1_.get(0)).field_185281_b; + this.wrapped = (p_i46073_1_.get(0)).model; } -- public List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_) { -- return (WeightedRandom.func_180166_a(this.field_177565_b, Math.abs((int)p_200117_3_.nextLong()) % this.field_177567_a)).field_185281_b.func_200117_a(p_200117_1_, p_200117_2_, p_200117_3_); +- public List getQuads(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_) { +- return (WeightedRandom.getWeightedItem(this.list, Math.abs((int)p_200117_3_.nextLong()) % this.totalWeight)).model.getQuads(p_200117_1_, p_200117_2_, p_200117_3_); + // FORGE: Implement our overloads (here and below) so child models can have custom logic + public List getQuads(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_, net.minecraftforge.client.model.data.IModelData modelData) { -+ return (WeightedRandom.func_180166_a(this.field_177565_b, Math.abs((int)p_200117_3_.nextLong()) % this.field_177567_a)).field_185281_b.getQuads(p_200117_1_, p_200117_2_, p_200117_3_, modelData); ++ return (WeightedRandom.getWeightedItem(this.list, Math.abs((int)p_200117_3_.nextLong()) % this.totalWeight)).model.getQuads(p_200117_1_, p_200117_2_, p_200117_3_, modelData); } - public boolean func_177555_b() { - return this.field_177566_c.func_177555_b(); + public boolean useAmbientOcclusion() { + return this.wrapped.useAmbientOcclusion(); } + @Override + public boolean isAmbientOcclusion(BlockState state) { -+ return this.field_177566_c.isAmbientOcclusion(state); ++ return this.wrapped.isAmbientOcclusion(state); + } + - public boolean func_177556_c() { - return this.field_177566_c.func_177556_c(); + public boolean isGui3d() { + return this.wrapped.isGui3d(); } @@ -47,8 +_,16 @@ - return this.field_177566_c.func_177554_e(); + return this.wrapped.getParticleIcon(); } + public TextureAtlasSprite getParticleTexture(net.minecraftforge.client.model.data.IModelData modelData) { -+ return this.field_177566_c.getParticleTexture(modelData); ++ return this.wrapped.getParticleTexture(modelData); + } + - public ItemCameraTransforms func_177552_f() { - return this.field_177566_c.func_177552_f(); + public ItemCameraTransforms getTransforms() { + return this.wrapped.getTransforms(); + } + + public IBakedModel handlePerspective(net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType transformType, com.mojang.blaze3d.matrix.MatrixStack matrixStack) { -+ return this.field_177566_c.handlePerspective(transformType, matrixStack); ++ return this.wrapped.handlePerspective(transformType, matrixStack); } - public ItemOverrideList func_188617_f() { + public ItemOverrideList getOverrides() { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch index 3299f161cd..95e6d9f2d1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch @@ -7,31 +7,31 @@ + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); } - public AtlasTexture.SheetData func_229220_a_(IResourceManager p_229220_1_, Stream p_229220_2_, IProfiler p_229220_3_, int p_229220_4_) { + public AtlasTexture.SheetData prepareToStitch(IResourceManager p_229220_1_, Stream p_229220_2_, IProfiler p_229220_3_, int p_229220_4_) { @@ -92,6 +_,7 @@ int j = Integer.MAX_VALUE; int k = 1 << p_229220_4_; - p_229220_3_.func_219895_b("extracting_frames"); + p_229220_3_.popPush("extracting_frames"); + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this, set); - for(TextureAtlasSprite.Info textureatlassprite$info : this.func_215256_a(p_229220_1_, set)) { - j = Math.min(j, Math.min(textureatlassprite$info.func_229250_b_(), textureatlassprite$info.func_229252_c_())); + for(TextureAtlasSprite.Info textureatlassprite$info : this.getBasicSpriteInfos(p_229220_1_, set)) { + j = Math.min(j, Math.min(textureatlassprite$info.width(), textureatlassprite$info.height())); @@ -106,7 +_,8 @@ int i1 = Math.min(j, k); - int j1 = MathHelper.func_151239_c(i1); + int j1 = MathHelper.log2(i1); - int k1; + int k1 = p_229220_4_; + if (false) // FORGE: do not lower the mipmap level if (j1 < p_229220_4_) { - field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_229214_j_, p_229220_4_, j1, i1); + LOGGER.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.location, p_229220_4_, j1, i1); k1 = j1; @@ -200,6 +_,8 @@ - try (IResource iresource = p_229218_1_.func_199002_a(resourcelocation)) { - NativeImage nativeimage = NativeImage.func_195713_a(iresource.func_199027_b()); + try (IResource iresource = p_229218_1_.getResource(resourcelocation)) { + NativeImage nativeimage = NativeImage.read(iresource.getInputStream()); + TextureAtlasSprite customSprite = net.minecraftforge.client.ForgeHooksClient.loadTextureAtlasSprite(this, p_229218_1_, p_229218_2_, iresource, p_229218_3_, p_229218_4_, p_229218_6_, p_229218_7_, p_229218_5_, nativeimage); + if (customSprite != null) return customSprite; return new TextureAtlasSprite(this, p_229218_2_, p_229218_5_, p_229218_3_, p_229218_4_, p_229218_6_, p_229218_7_, nativeimage); } catch (RuntimeException runtimeexception) { - field_147635_d.error("Unable to parse metadata from {}", resourcelocation, runtimeexception); + LOGGER.error("Unable to parse metadata from {}", resourcelocation, runtimeexception); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch index efe902042a..dfe85f7eb6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/NativeImage.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/client/renderer/texture/NativeImage.java +++ b/net/minecraft/client/renderer/texture/NativeImage.java @@ -180,7 +_,7 @@ - public int func_195709_a(int p_195709_1_, int p_195709_2_) { - if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { - throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); -- } else if (p_195709_1_ <= this.field_195719_a && p_195709_2_ <= this.field_195720_b) { -+ } else if (p_195709_1_ >= 0 && p_195709_2_ >= 0 && p_195709_1_ < this.field_195719_a && p_195709_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` - this.func_195696_g(); - long i = (long)((p_195709_1_ + p_195709_2_ * this.field_195719_a) * 4); - return MemoryUtil.memGetInt(this.field_195722_d + i); + public int getPixelRGBA(int p_195709_1_, int p_195709_2_) { + if (this.format != NativeImage.PixelFormat.RGBA) { + throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.format)); +- } else if (p_195709_1_ <= this.width && p_195709_2_ <= this.height) { ++ } else if (p_195709_1_ >= 0 && p_195709_2_ >= 0 && p_195709_1_ < this.width && p_195709_2_ < this.height) { //Fix MC-162953 bounds checks in `NativeImage` + this.checkAllocated(); + long i = (long)((p_195709_1_ + p_195709_2_ * this.width) * 4); + return MemoryUtil.memGetInt(this.pixels + i); @@ -192,7 +_,7 @@ - public void func_195700_a(int p_195700_1_, int p_195700_2_, int p_195700_3_) { - if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { - throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); -- } else if (p_195700_1_ <= this.field_195719_a && p_195700_2_ <= this.field_195720_b) { -+ } else if (p_195700_1_ >= 0 && p_195700_2_ >= 0 && p_195700_1_ < this.field_195719_a && p_195700_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` - this.func_195696_g(); - long i = (long)((p_195700_1_ + p_195700_2_ * this.field_195719_a) * 4); - MemoryUtil.memPutInt(this.field_195722_d + i, p_195700_3_); + public void setPixelRGBA(int p_195700_1_, int p_195700_2_, int p_195700_3_) { + if (this.format != NativeImage.PixelFormat.RGBA) { + throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.format)); +- } else if (p_195700_1_ <= this.width && p_195700_2_ <= this.height) { ++ } else if (p_195700_1_ >= 0 && p_195700_2_ >= 0 && p_195700_1_ < this.width && p_195700_2_ < this.height) { //Fix MC-162953 bounds checks in `NativeImage` + this.checkAllocated(); + long i = (long)((p_195700_1_ + p_195700_2_ * this.width) * 4); + MemoryUtil.memPutInt(this.pixels + i, p_195700_3_); @@ -204,7 +_,7 @@ - public byte func_211675_e(int p_211675_1_, int p_211675_2_) { - if (!this.field_211680_b.func_211653_r()) { - throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.field_211680_b)); -- } else if (p_211675_1_ <= this.field_195719_a && p_211675_2_ <= this.field_195720_b) { -+ } else if (p_211675_1_ >= 0 && p_211675_2_ >= 0 && p_211675_1_ < this.field_195719_a && p_211675_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage` - int i = (p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8; - return MemoryUtil.memGetByte(this.field_195722_d + (long)i); + public byte getLuminanceOrAlpha(int p_211675_1_, int p_211675_2_) { + if (!this.format.hasLuminanceOrAlpha()) { + throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.format)); +- } else if (p_211675_1_ <= this.width && p_211675_2_ <= this.height) { ++ } else if (p_211675_1_ >= 0 && p_211675_2_ >= 0 && p_211675_1_ < this.width && p_211675_2_ < this.height) { //Fix MC-162953 bounds checks in `NativeImage` + int i = (p_211675_1_ + p_211675_2_ * this.width) * this.format.components() + this.format.luminanceOrAlphaOffset() / 8; + return MemoryUtil.memGetByte(this.pixels + (long)i); } else { 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 1514b46184..a6c5f0b996 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -6,21 +6,21 @@ public class Stitcher { + private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); + - private static final Comparator field_217797_a = Comparator.comparing((p_217793_0_) -> { - return -p_217793_0_.field_94201_d; + private static final Comparator HOLDER_COMPARATOR = Comparator.comparing((p_217793_0_) -> { + return -p_217793_0_.height; }).thenComparing((p_217795_0_) -> { @@ -54,6 +_,12 @@ for(Stitcher.Holder stitcher$holder : list) { - if (!this.func_94310_b(stitcher$holder)) { + if (!this.addToStorage(stitcher$holder)) { + LOGGER.info(new net.minecraftforge.fml.loading.AdvancedLogMessageAdapter(sb->{ -+ sb.append("Unable to fit: ").append(stitcher$holder.field_229213_a_.func_229248_a_()); -+ sb.append(" - size: ").append(stitcher$holder.field_229213_a_.func_229250_b_()).append("x").append(stitcher$holder.field_229213_a_.func_229252_c_()); ++ sb.append("Unable to fit: ").append(stitcher$holder.spriteInfo.name()); ++ sb.append(" - size: ").append(stitcher$holder.spriteInfo.width()).append("x").append(stitcher$holder.spriteInfo.height()); + sb.append(" - Maybe try a lower resolution resourcepack?\n"); + list.forEach(h-> sb.append("\t").append(h).append("\n")); + })); - throw new StitcherException(stitcher$holder.field_229213_a_, list.stream().map((p_229212_0_) -> { - return p_229212_0_.field_229213_a_; + throw new StitcherException(stitcher$holder.spriteInfo, list.stream().map((p_229212_0_) -> { + return p_229212_0_.spriteInfo; }).collect(ImmutableList.toImmutableList())); @@ -103,7 +_,7 @@ boolean flag4 = flag2 && j != l; @@ -35,8 +35,8 @@ } public String toString() { -- return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + '}'; -+ return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + ", name=" + this.field_229213_a_.func_229248_a_() + '}'; +- return "Holder{width=" + this.width + ", height=" + this.height + '}'; ++ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.spriteInfo.name() + '}'; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch index 1c984d8568..e0248fdc8b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/texture/Texture.java +++ b/net/minecraft/client/renderer/texture/Texture.java @@ -33,6 +_,20 @@ - GlStateManager.func_227677_b_(3553, 10240, j); + GlStateManager._texParameter(3553, 10240, j); } + // FORGE: This seems to have been stripped out, but we need it @@ -9,15 +9,15 @@ + private boolean lastMipmap; + + public void setBlurMipmap(boolean blur, boolean mipmap) { -+ this.lastBlur = this.field_174940_b; -+ this.lastMipmap = this.field_174941_c; -+ func_174937_a(blur, mipmap); ++ this.lastBlur = this.blur; ++ this.lastMipmap = this.mipmap; ++ setFilter(blur, mipmap); + } + + public void restoreLastBlurMipmap() { -+ func_174937_a(this.lastBlur, this.lastMipmap); ++ setFilter(this.lastBlur, this.lastMipmap); + } + - public int func_110552_b() { + public int getId() { RenderSystem.assertThread(RenderSystem::isOnRenderThreadOrInit); - if (this.field_110553_a == -1) { + if (this.id == -1) { 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 eed3bcf8e4..fc822b9959 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -6,15 +6,15 @@ @OnlyIn(Dist.CLIENT) -public class TextureAtlasSprite implements AutoCloseable { +public class TextureAtlasSprite implements AutoCloseable, net.minecraftforge.client.extensions.IForgeTextureAtlasSprite { - private final AtlasTexture field_229225_b_; - private final TextureAtlasSprite.Info field_229226_c_; - private final AnimationMetadataSection field_110982_k; + private final AtlasTexture atlas; + private final TextureAtlasSprite.Info info; + private final AnimationMetadataSection metadata; @@ -135,6 +_,7 @@ - private void func_195667_a(int p_195667_1_, int p_195667_2_, NativeImage[] p_195667_3_) { - for(int i = 0; i < this.field_195670_c.length; ++i) { -+ if ((this.field_229226_c_.field_229245_b_ >> i <= 0) || (this.field_229226_c_.field_229246_c_ >> i <= 0)) break; - p_195667_3_[i].func_227788_a_(i, this.field_110975_c >> i, this.field_110974_d >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.field_229226_c_.field_229245_b_ >> i, this.field_229226_c_.field_229246_c_ >> i, this.field_195670_c.length > 1, false); + private void upload(int p_195667_1_, int p_195667_2_, NativeImage[] p_195667_3_) { + for(int i = 0; i < this.mainImage.length; ++i) { ++ if ((this.info.width >> i <= 0) || (this.info.height >> i <= 0)) break; + p_195667_3_[i].upload(i, this.x >> i, this.y >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.info.width >> i, this.info.height >> i, this.mainImage.length > 1, false); } @@ -340,5 +_,10 @@ @@ -25,6 +25,6 @@ + + // Forge Start + public int getPixelRGBA(int frameIndex, int x, int y) { -+ return this.field_195670_c[0].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b()); ++ return this.mainImage[0].getPixelRGBA(x + this.framesX[frameIndex] * getWidth(), y + this.framesY[frameIndex] * getHeight()); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index da101b2413..300e045e60 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java @@ -157,6 +_,7 @@ - public void func_147645_c(ResourceLocation p_147645_1_) { - Texture texture = this.func_229267_b_(p_147645_1_); + public void release(ResourceLocation p_147645_1_) { + Texture texture = this.getTexture(p_147645_1_); if (texture != null) { -+ this.field_110585_a.remove(p_147645_1_); // Forge: fix MC-98707 - TextureUtil.func_225679_a_(texture.func_110552_b()); ++ this.byPath.remove(p_147645_1_); // Forge: fix MC-98707 + TextureUtil.releaseTextureId(texture.getId()); } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch index 66f6cfad8b..b242c9d8e9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java.patch @@ -4,18 +4,18 @@ f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; int i = icallbackwrapper.apply(new DualBrightnessCallback<>()).applyAsInt(p_225616_5_); -- RenderMaterial rendermaterial = Atlases.func_228771_a_(p_225616_1_, chesttype, this.field_147509_j); +- RenderMaterial rendermaterial = Atlases.chooseMaterial(p_225616_1_, chesttype, this.xmasTextures); + RenderMaterial rendermaterial = this.getMaterial(p_225616_1_, chesttype); - IVertexBuilder ivertexbuilder = rendermaterial.func_229311_a_(p_225616_4_, RenderType::func_228638_b_); + IVertexBuilder ivertexbuilder = rendermaterial.buffer(p_225616_4_, RenderType::entityCutout); if (flag1) { if (chesttype == ChestType.LEFT) { @@ -122,5 +_,9 @@ - p_228871_3_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); - p_228871_4_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); - p_228871_5_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); + p_228871_3_.render(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); + p_228871_4_.render(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); + p_228871_5_.render(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_); + } + + protected RenderMaterial getMaterial(T tileEntity, ChestType chestType) { -+ return Atlases.func_228771_a_(tileEntity, chestType, this.field_147509_j); ++ return Atlases.chooseMaterial(tileEntity, chestType, this.xmasTextures); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch index a083d777f4..c7494f5bbd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch @@ -3,12 +3,12 @@ @@ -61,8 +_,11 @@ } - private void func_228876_a_(BlockPos p_228876_1_, BlockState p_228876_2_, MatrixStack p_228876_3_, IRenderTypeBuffer p_228876_4_, World p_228876_5_, boolean p_228876_6_, int p_228876_7_) { -+ net.minecraftforge.client.ForgeHooksClient.renderPistonMovedBlocks(p_228876_1_, p_228876_2_, p_228876_3_, p_228876_4_, p_228876_5_, p_228876_6_, p_228876_7_, field_178462_c == null ? field_178462_c = Minecraft.func_71410_x().func_175602_ab() : field_178462_c); + private void renderBlock(BlockPos p_228876_1_, BlockState p_228876_2_, MatrixStack p_228876_3_, IRenderTypeBuffer p_228876_4_, World p_228876_5_, boolean p_228876_6_, int p_228876_7_) { ++ net.minecraftforge.client.ForgeHooksClient.renderPistonMovedBlocks(p_228876_1_, p_228876_2_, p_228876_3_, p_228876_4_, p_228876_5_, p_228876_6_, p_228876_7_, blockRenderer == null ? blockRenderer = Minecraft.getInstance().getBlockRenderer() : blockRenderer); + if(false) { - RenderType rendertype = RenderTypeLookup.func_239221_b_(p_228876_2_); + RenderType rendertype = RenderTypeLookup.getMovingBlockRenderType(p_228876_2_); IVertexBuilder ivertexbuilder = p_228876_4_.getBuffer(rendertype); - this.field_178462_c.func_175019_b().func_228802_a_(p_228876_5_, this.field_178462_c.func_184389_a(p_228876_2_), p_228876_2_, p_228876_1_, p_228876_3_, ivertexbuilder, p_228876_6_, new Random(), p_228876_2_.func_209533_a(p_228876_1_), p_228876_7_); + this.blockRenderer.getModelRenderer().tesselateBlock(p_228876_5_, this.blockRenderer.getBlockModel(p_228876_2_), p_228876_2_, p_228876_1_, p_228876_3_, ivertexbuilder, p_228876_6_, new Random(), p_228876_2_.getSeed(p_228876_1_), p_228876_7_); + } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java.patch index 8d3d701a96..545380f21a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java +++ b/net/minecraft/client/renderer/tileentity/SignTileEntityRenderer.java @@ -89,7 +_,7 @@ - woodtype = WoodType.field_227038_a_; + woodtype = WoodType.OAK; } -- return Atlases.func_228773_a_(woodtype); -+ return Atlases.field_228750_i_.get(woodtype); +- return Atlases.signTexture(woodtype); ++ return Atlases.SIGN_MATERIALS.get(woodtype); } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index 830b85f814..ade5ce1b37 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ b/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java @@ -135,4 +_,9 @@ - public FontRenderer func_147548_a() { - return this.field_147557_n; + public FontRenderer getFont() { + return this.font; } + + //Internal, Do not call Use ClientRegistry. + public synchronized void setSpecialRendererInternal(TileEntityType tileEntityType, TileEntityRenderer specialRenderer) { -+ this.field_147559_m.put(tileEntityType, specialRenderer); ++ this.renderers.put(tileEntityType, specialRenderer); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch index 21b3a66fb4..5dab39a825 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java.patch @@ -6,9 +6,9 @@ } + + // Forge start -+ public int getOffset(int index) { return field_177356_c.getInt(index); } -+ public boolean hasPosition() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.POSITION); } -+ public boolean hasNormal() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.NORMAL); } -+ public boolean hasColor() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.COLOR); } -+ public boolean hasUV(int which) { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.UV && e.func_177369_e() == which); } ++ public int getOffset(int index) { return offsets.getInt(index); } ++ public boolean hasPosition() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.POSITION); } ++ public boolean hasNormal() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.NORMAL); } ++ public boolean hasColor() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.COLOR); } ++ public boolean hasUV(int which) { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == which); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch index fc3172d78e..f2165eaec4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/renderer/vertex/VertexFormatElement.java +++ b/net/minecraft/client/renderer/vertex/VertexFormatElement.java @@ -88,6 +_,12 @@ - this.field_177380_c.func_227901_a_(this.field_177377_d); + this.usage.clearBufferState(this.index); } + //Forge Start + public int getElementCount() { -+ return field_177378_e; ++ return count; + } + //Forge End + diff --git a/patches/minecraft/net/minecraft/client/resources/ClientLanguageMap.java.patch b/patches/minecraft/net/minecraft/client/resources/ClientLanguageMap.java.patch index c434417ba1..3774ce5da7 100644 --- a/patches/minecraft/net/minecraft/client/resources/ClientLanguageMap.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/ClientLanguageMap.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/resources/ClientLanguageMap.java +++ b/net/minecraft/client/resources/ClientLanguageMap.java @@ -78,4 +_,9 @@ - public IReorderingProcessor func_241870_a(ITextProperties p_241870_1_) { - return BidiReorderer.func_243508_a(p_241870_1_, this.field_239496_d_); + public IReorderingProcessor getVisualOrder(ITextProperties p_241870_1_) { + return BidiReorderer.reorder(p_241870_1_, this.defaultRightToLeft); } + + @Override + public Map getLanguageData() { -+ return field_239495_c_; ++ return storage; + } } diff --git a/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch b/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch index 041ab490e8..f0f33974e0 100644 --- a/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/resources/FoliageColorReloadListener.java +++ b/net/minecraft/client/resources/FoliageColorReloadListener.java @@ -23,4 +_,9 @@ - protected void func_212853_a_(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { - FoliageColors.func_77467_a(p_212853_1_); + protected void apply(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { + FoliageColors.init(p_212853_1_); } + + //@Override //Forge: TODO: Filtered resource reloading diff --git a/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch b/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch index c97f584313..7b05017830 100644 --- a/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/resources/GrassColorReloadListener.java +++ b/net/minecraft/client/resources/GrassColorReloadListener.java @@ -23,4 +_,9 @@ - protected void func_212853_a_(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { - GrassColors.func_77479_a(p_212853_1_); + protected void apply(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { + GrassColors.init(p_212853_1_); } + + //@Override //Forge: TODO: Filtered resource reloading diff --git a/patches/minecraft/net/minecraft/client/resources/I18n.java.patch b/patches/minecraft/net/minecraft/client/resources/I18n.java.patch index 5dd3696c78..fec3b7af35 100644 --- a/patches/minecraft/net/minecraft/client/resources/I18n.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/I18n.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/client/resources/I18n.java @@ -11,6 +_,7 @@ - static void func_239502_a_(LanguageMap p_239502_0_) { - field_239501_a_ = p_239502_0_; + static void setLanguage(LanguageMap p_239502_0_) { + language = p_239502_0_; + net.minecraftforge.fml.ForgeI18n.loadLanguageData(p_239502_0_.getLanguageData()); } - public static String func_135052_a(String p_135052_0_, Object... p_135052_1_) { + public static String get(String p_135052_0_, Object... p_135052_1_) { diff --git a/patches/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch b/patches/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch index 6a47a9bf27..8ed10f182c 100644 --- a/patches/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/JsonReloadListener.java.patch @@ -6,6 +6,6 @@ } + + protected ResourceLocation getPreparedPath(ResourceLocation rl) { -+ return new ResourceLocation(rl.func_110624_b(), this.field_223383_d + "/" + rl.func_110623_a() + ".json"); ++ return new ResourceLocation(rl.getNamespace(), this.directory + "/" + rl.getPath() + ".json"); + } } diff --git a/patches/minecraft/net/minecraft/client/resources/Language.java.patch b/patches/minecraft/net/minecraft/client/resources/Language.java.patch index 26c3435886..a532a0320a 100644 --- a/patches/minecraft/net/minecraft/client/resources/Language.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/Language.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/resources/Language.java +++ b/net/minecraft/client/resources/Language.java @@ -15,6 +_,12 @@ - this.field_135037_b = p_i1303_2_; - this.field_135038_c = p_i1303_3_; - this.field_135036_d = p_i1303_4_; -+ String[] splitLangCode = field_135039_a.split("_", 2); + this.region = p_i1303_2_; + this.name = p_i1303_3_; + this.bidirectional = p_i1303_4_; ++ String[] splitLangCode = code.split("_", 2); + if (splitLangCode.length == 1) { // Vanilla has some languages without underscores -+ this.javaLocale = new java.util.Locale(field_135039_a); ++ this.javaLocale = new java.util.Locale(code); + } else { + this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]); + } @@ -15,7 +15,7 @@ public String getCode() { @@ -52,4 +_,8 @@ public int compareTo(Language p_compareTo_1_) { - return this.field_135039_a.compareTo(p_compareTo_1_.field_135039_a); + return this.code.compareTo(p_compareTo_1_.code); } + + // Forge: add access to Locale so modders can create correct string and number formatters diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch index d70771bb14..d3a5726b87 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/resources/LanguageManager.java +++ b/net/minecraft/client/resources/LanguageManager.java @@ -79,4 +_,9 @@ - public Language func_191960_a(String p_191960_1_) { - return this.field_135046_d.get(p_191960_1_); + public Language getLanguage(String p_191960_1_) { + return this.languages.get(p_191960_1_); } + + @Override diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index 9a6d9cb9e7..1fbf106515 100644 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -6,77 +6,77 @@ @OnlyIn(Dist.CLIENT) -public class KeyBinding implements Comparable { +public class KeyBinding implements Comparable, net.minecraftforge.client.extensions.IForgeKeybinding { - private static final Map field_74516_a = Maps.newHashMap(); -- private static final Map field_74514_b = Maps.newHashMap(); -+ private static final net.minecraftforge.client.settings.KeyBindingMap field_74514_b = new net.minecraftforge.client.settings.KeyBindingMap(); - private static final Set field_151473_c = Sets.newHashSet(); - private static final Map field_193627_d = Util.func_200696_a(Maps.newHashMap(), (p_205215_0_) -> { + private static final Map ALL = Maps.newHashMap(); +- private static final Map MAP = Maps.newHashMap(); ++ private static final net.minecraftforge.client.settings.KeyBindingMap MAP = new net.minecraftforge.client.settings.KeyBindingMap(); + private static final Set CATEGORIES = Sets.newHashSet(); + private static final Map CATEGORY_SORT_ORDER = Util.make(Maps.newHashMap(), (p_205215_0_) -> { p_205215_0_.put("key.categories.movement", 1); @@ -36,7 +_,7 @@ - private int field_151474_i; + private int clickCount; - public static void func_197981_a(InputMappings.Input p_197981_0_) { -- KeyBinding keybinding = field_74514_b.get(p_197981_0_); -+ KeyBinding keybinding = field_74514_b.lookupActive(p_197981_0_); + public static void click(InputMappings.Input p_197981_0_) { +- KeyBinding keybinding = MAP.get(p_197981_0_); ++ KeyBinding keybinding = MAP.lookupActive(p_197981_0_); if (keybinding != null) { - ++keybinding.field_151474_i; + ++keybinding.clickCount; } @@ -44,7 +_,7 @@ } - public static void func_197980_a(InputMappings.Input p_197980_0_, boolean p_197980_1_) { -- KeyBinding keybinding = field_74514_b.get(p_197980_0_); -+ for (KeyBinding keybinding : field_74514_b.lookupAll(p_197980_0_)) + public static void set(InputMappings.Input p_197980_0_, boolean p_197980_1_) { +- KeyBinding keybinding = MAP.get(p_197980_0_); ++ for (KeyBinding keybinding : MAP.lookupAll(p_197980_0_)) if (keybinding != null) { - keybinding.func_225593_a_(p_197980_1_); + keybinding.setDown(p_197980_1_); } @@ -68,10 +_,10 @@ } - public static void func_74508_b() { -- field_74514_b.clear(); -+ field_74514_b.clearMap(); + public static void resetMapping() { +- MAP.clear(); ++ MAP.clearMap(); - for(KeyBinding keybinding : field_74516_a.values()) { -- field_74514_b.put(keybinding.field_74512_d, keybinding); -+ field_74514_b.addKey(keybinding.field_74512_d, keybinding); + for(KeyBinding keybinding : ALL.values()) { +- MAP.put(keybinding.key, keybinding); ++ MAP.addKey(keybinding.key, keybinding); } } @@ -86,12 +_,12 @@ - this.field_151472_e = this.field_74512_d; - this.field_151471_f = p_i47675_4_; - field_74516_a.put(p_i47675_1_, this); -- field_74514_b.put(this.field_74512_d, this); -+ field_74514_b.addKey(this.field_74512_d, this); - field_151473_c.add(p_i47675_4_); + this.defaultKey = this.key; + this.category = p_i47675_4_; + ALL.put(p_i47675_1_, this); +- MAP.put(this.key, this); ++ MAP.addKey(this.key, this); + CATEGORIES.add(p_i47675_4_); } - public boolean func_151470_d() { -- return this.field_74513_e; -+ return this.field_74513_e && isConflictContextAndModifierActive(); + public boolean isDown() { +- return this.isDown; ++ return this.isDown && isConflictContextAndModifierActive(); } - public String func_151466_e() { + public String getCategory() { @@ -125,7 +_,13 @@ } public int compareTo(KeyBinding p_compareTo_1_) { -- return this.field_151471_f.equals(p_compareTo_1_.field_151471_f) ? I18n.func_135052_a(this.field_74515_c).compareTo(I18n.func_135052_a(p_compareTo_1_.field_74515_c)) : field_193627_d.get(this.field_151471_f).compareTo(field_193627_d.get(p_compareTo_1_.field_151471_f)); -+ if (this.field_151471_f.equals(p_compareTo_1_.field_151471_f)) return I18n.func_135052_a(this.field_74515_c).compareTo(I18n.func_135052_a(p_compareTo_1_.field_74515_c)); -+ Integer tCat = field_193627_d.get(this.field_151471_f); -+ Integer oCat = field_193627_d.get(p_compareTo_1_.field_151471_f); +- return this.category.equals(p_compareTo_1_.category) ? I18n.get(this.name).compareTo(I18n.get(p_compareTo_1_.name)) : CATEGORY_SORT_ORDER.get(this.category).compareTo(CATEGORY_SORT_ORDER.get(p_compareTo_1_.category)); ++ if (this.category.equals(p_compareTo_1_.category)) return I18n.get(this.name).compareTo(I18n.get(p_compareTo_1_.name)); ++ Integer tCat = CATEGORY_SORT_ORDER.get(this.category); ++ Integer oCat = CATEGORY_SORT_ORDER.get(p_compareTo_1_.category); + if (tCat == null && oCat != null) return 1; + if (tCat != null && oCat == null) return -1; -+ if (tCat == null && oCat == null) return I18n.func_135052_a(this.field_151471_f).compareTo(I18n.func_135052_a(p_compareTo_1_.field_151471_f)); ++ if (tCat == null && oCat == null) return I18n.get(this.category).compareTo(I18n.get(p_compareTo_1_.category)); + return tCat.compareTo(oCat); } - public static Supplier func_193626_b(String p_193626_0_) { + public static Supplier createNameSupplier(String p_193626_0_) { @@ -136,6 +_,20 @@ } - public boolean func_197983_b(KeyBinding p_197983_1_) { + public boolean same(KeyBinding p_197983_1_) { + if (getKeyConflictContext().conflicts(p_197983_1_.getKeyConflictContext()) || p_197983_1_.getKeyConflictContext().conflicts(getKeyConflictContext())) { + net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier(); + net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_197983_1_.getKeyModifier(); @@ -91,27 +91,27 @@ + (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE)); + } + } - return this.field_74512_d.equals(p_197983_1_.field_74512_d); + return this.key.equals(p_197983_1_.key); } @@ -156,11 +_,13 @@ } - public ITextComponent func_238171_j_() { -+ return getKeyModifier().getCombinedName(field_74512_d, () -> { - return this.field_74512_d.func_237520_d_(); + public ITextComponent getTranslatedKeyMessage() { ++ return getKeyModifier().getCombinedName(key, () -> { + return this.key.getDisplayName(); + }); } - public boolean func_197985_l() { -- return this.field_74512_d.equals(this.field_151472_e); -+ return this.field_74512_d.equals(this.field_151472_e) && getKeyModifier() == getKeyModifierDefault(); + public boolean isDefault() { +- return this.key.equals(this.defaultKey); ++ return this.key.equals(this.defaultKey) && getKeyModifier() == getKeyModifierDefault(); } - public String func_197982_m() { + public String saveString() { @@ -170,4 +_,84 @@ - public void func_225593_a_(boolean p_225593_1_) { - this.field_74513_e = p_225593_1_; + public void setDown(boolean p_225593_1_) { + this.isDown = p_225593_1_; } + + /****************** Forge Start *****************************/ @@ -123,7 +123,7 @@ + * Convenience constructor for creating KeyBindings with keyConflictContext set. + */ + public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputMappings.Type inputType, final int keyCode, String category) { -+ this(description, keyConflictContext, inputType.func_197944_a(keyCode), category); ++ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category); + } + + /** @@ -137,30 +137,30 @@ + * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. + */ + public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputMappings.Type inputType, final int keyCode, String category) { -+ this(description, keyConflictContext, keyModifier, inputType.func_197944_a(keyCode), category); ++ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category); + } + + /** + * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. + */ + public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode, String category) { -+ this.field_74515_c = description; -+ this.field_74512_d = keyCode; -+ this.field_151472_e = keyCode; -+ this.field_151471_f = category; ++ this.name = description; ++ this.key = keyCode; ++ this.defaultKey = keyCode; ++ this.category = category; + this.keyConflictContext = keyConflictContext; + this.keyModifier = keyModifier; + this.keyModifierDefault = keyModifier; + if (this.keyModifier.matches(keyCode)) + this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; -+ field_74516_a.put(description, this); -+ field_74514_b.addKey(keyCode, this); -+ field_151473_c.add(category); ++ ALL.put(description, this); ++ MAP.addKey(keyCode, this); ++ CATEGORIES.add(category); + } + + @Override + public InputMappings.Input getKey() { -+ return this.field_74512_d; ++ return this.key; + } + + @Override @@ -185,12 +185,12 @@ + + @Override + public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode) { -+ this.field_74512_d = keyCode; ++ this.key = keyCode; + if (keyModifier.matches(keyCode)) + keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; -+ field_74514_b.removeKey(this); ++ MAP.removeKey(this); + this.keyModifier = keyModifier; -+ field_74514_b.addKey(keyCode, this); ++ MAP.addKey(keyCode, this); + } + /****************** Forge End *****************************/ } diff --git a/patches/minecraft/net/minecraft/client/settings/ToggleableKeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/ToggleableKeyBinding.java.patch index 2490362ac9..07ff6613f4 100644 --- a/patches/minecraft/net/minecraft/client/settings/ToggleableKeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/ToggleableKeyBinding.java.patch @@ -2,16 +2,16 @@ +++ b/net/minecraft/client/settings/ToggleableKeyBinding.java @@ -16,7 +_,7 @@ - public void func_225593_a_(boolean p_225593_1_) { - if (this.field_228053_a_.getAsBoolean()) { + public void setDown(boolean p_225593_1_) { + if (this.needsToggle.getAsBoolean()) { - if (p_225593_1_) { + if (p_225593_1_ && isConflictContextAndModifierActive()) { - super.func_225593_a_(!this.func_151470_d()); + super.setDown(!this.isDown()); } } else { @@ -24,4 +_,5 @@ } } -+ @Override public boolean func_151470_d() { return this.field_74513_e && (isConflictContextAndModifierActive() || field_228053_a_.getAsBoolean()); } ++ @Override public boolean isDown() { return this.isDown && (isConflictContextAndModifierActive() || needsToggle.getAsBoolean()); } } diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index cdaab7c312..5081ee84de 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,34 +1,34 @@ --- a/net/minecraft/client/shader/Framebuffer.java +++ b/net/minecraft/client/shader/Framebuffer.java @@ -118,7 +_,10 @@ - GlStateManager.func_227677_b_(3553, 10242, 10496); - GlStateManager.func_227677_b_(3553, 10243, 10496); - GlStateManager.func_227677_b_(3553, 34892, 0); + GlStateManager._texParameter(3553, 10242, 10496); + GlStateManager._texParameter(3553, 10243, 10496); + GlStateManager._texParameter(3553, 34892, 0); + if (!stencilEnabled) - GlStateManager.func_227647_a_(3553, 0, 6402, this.field_147622_a, this.field_147620_b, 0, 6402, 5126, (IntBuffer)null); + GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, (IntBuffer)null); + else -+ GlStateManager.func_227647_a_(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.field_147622_a, this.field_147620_b, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); ++ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); } - this.func_147607_a(9728); + this.setFilterMode(9728); @@ -127,7 +_,14 @@ - GlStateManager.func_227727_h_(FramebufferConstants.field_227592_a_, this.field_147616_f); - GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0); - if (this.field_147619_e) { + GlStateManager._glBindFramebuffer(FramebufferConstants.GL_FRAMEBUFFER, this.frameBufferId); + GlStateManager._glFramebufferTexture2D(FramebufferConstants.GL_FRAMEBUFFER, FramebufferConstants.GL_COLOR_ATTACHMENT0, 3553, this.colorTextureId, 0); + if (this.useDepth) { + if(!stencilEnabled) - GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, 3553, this.field_147624_h, 0); + GlStateManager._glFramebufferTexture2D(FramebufferConstants.GL_FRAMEBUFFER, FramebufferConstants.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0); + else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) { -+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.field_147624_h, 0); ++ GlStateManager._glFramebufferTexture2D(FramebufferConstants.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0); + } else { -+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.field_147624_h, 0); -+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.field_147624_h, 0); ++ GlStateManager._glFramebufferTexture2D(FramebufferConstants.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0); ++ GlStateManager._glFramebufferTexture2D(FramebufferConstants.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0); + } } - this.func_147611_b(); + this.checkStatus(); @@ -280,6 +_,32 @@ - GlStateManager.func_227658_a_(i, p_216493_1_); - this.func_147609_e(); + GlStateManager._clear(i, p_216493_1_); + this.unbindWrite(); } + + @@ -44,7 +44,7 @@ + { + if(stencilEnabled) return; + stencilEnabled = true; -+ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a); ++ this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX); + } + + /** @@ -57,5 +57,5 @@ + } + /*================================ FORGE END ================================================*/ - public int func_242996_f() { - return this.field_147617_g; + public int getColorTextureId() { + return this.colorTextureId; diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch index 0dc2aa7202..7aafc1ef29 100644 --- a/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch @@ -5,16 +5,16 @@ } - ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png"); -+ ResourceLocation rl = ResourceLocation.func_208304_a(s4); -+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "textures/effect/" + rl.func_110623_a() + ".png"); ++ ResourceLocation rl = ResourceLocation.tryParse(s4); ++ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png"); IResource iresource = null; try { @@ -273,6 +_,7 @@ - public void func_148020_a(String p_148020_1_, int p_148020_2_, int p_148020_3_) { - Framebuffer framebuffer = new Framebuffer(p_148020_2_, p_148020_3_, true, Minecraft.field_142025_a); - framebuffer.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); -+ if (field_148035_a.isStencilEnabled()) framebuffer.enableStencil(); - this.field_148032_e.put(p_148020_1_, framebuffer); - if (p_148020_2_ == this.field_148038_h && p_148020_3_ == this.field_148039_i) { - this.field_148029_f.add(framebuffer); + public void addTempTarget(String p_148020_1_, int p_148020_2_, int p_148020_3_) { + Framebuffer framebuffer = new Framebuffer(p_148020_2_, p_148020_3_, true, Minecraft.ON_OSX); + framebuffer.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); ++ if (screenTarget.isStencilEnabled()) framebuffer.enableStencil(); + this.customRenderTargets.put(p_148020_1_, framebuffer); + if (p_148020_2_ == this.screenWidth && p_148020_3_ == this.screenHeight) { + this.fullSizedTargets.add(framebuffer); diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch index e15b693e17..8e45e16a2f 100644 --- a/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/shader/ShaderInstance.java +++ b/net/minecraft/client/shader/ShaderInstance.java @@ -51,7 +_,8 @@ - private final ShaderLoader field_216563_s; + private final ShaderLoader fragmentProgram; public ShaderInstance(IResourceManager p_i50988_1_, String p_i50988_2_) throws IOException { - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_i50988_2_ + ".json"); -+ ResourceLocation rl = ResourceLocation.func_208304_a(p_i50988_2_); -+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + ".json"); - this.field_216556_l = p_i50988_2_; ++ ResourceLocation rl = ResourceLocation.tryParse(p_i50988_2_); ++ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json"); + this.name = p_i50988_2_; IResource iresource = null; @@ -149,7 +_,8 @@ - public static ShaderLoader func_216542_a(IResourceManager p_216542_0_, ShaderLoader.ShaderType p_216542_1_, String p_216542_2_) throws IOException { - ShaderLoader shaderloader = p_216542_1_.func_148064_d().get(p_216542_2_); + public static ShaderLoader getOrCreate(IResourceManager p_216542_0_, ShaderLoader.ShaderType p_216542_1_, String p_216542_2_) throws IOException { + ShaderLoader shaderloader = p_216542_1_.getPrograms().get(p_216542_2_); if (shaderloader == null) { -- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_216542_2_ + p_216542_1_.func_148063_b()); -+ ResourceLocation rl = ResourceLocation.func_208304_a(p_216542_2_); -+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + p_216542_1_.func_148063_b()); - IResource iresource = p_216542_0_.func_199002_a(resourcelocation); +- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_216542_2_ + p_216542_1_.getExtension()); ++ ResourceLocation rl = ResourceLocation.tryParse(p_216542_2_); ++ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_216542_1_.getExtension()); + IResource iresource = p_216542_0_.getResource(resourcelocation); try { diff --git a/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch b/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch index a658e36deb..87ed676481 100644 --- a/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch +++ b/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/util/SearchTreeManager.java +++ b/net/minecraft/client/util/SearchTreeManager.java @@ -31,6 +_,11 @@ - return (IMutableSearchTree)this.field_194013_c.get(p_215358_1_); + return (IMutableSearchTree)this.searchTrees.get(p_215358_1_); } + @Override diff --git a/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch index c917be87bf..5f0d1964b6 100644 --- a/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch @@ -1,96 +1,96 @@ --- a/net/minecraft/client/world/ClientWorld.java +++ b/net/minecraft/client/world/ClientWorld.java @@ -93,6 +_,7 @@ - p_228319_0_.put(BiomeColors.field_180290_c, new ColorCache()); + p_228319_0_.put(BiomeColors.WATER_COLOR_RESOLVER, new ColorCache()); }); - private final ClientChunkProvider field_239129_E_; + private final ClientChunkProvider chunkSource; + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); public ClientWorld(ClientPlayNetHandler p_i242067_1_, ClientWorld.ClientWorldInfo p_i242067_2_, RegistryKey p_i242067_3_, DimensionType p_i242067_4_, int p_i242067_5_, Supplier p_i242067_6_, WorldRenderer p_i242067_7_, boolean p_i242067_8_, long p_i242067_9_) { super(p_i242067_2_, p_i242067_3_, p_i242067_4_, p_i242067_6_, true, p_i242067_8_, p_i242067_9_); @@ -104,6 +_,8 @@ - this.func_239136_a_(new BlockPos(8, 64, 8), 0.0F); - this.func_72966_v(); - this.func_72947_a(); + this.setDefaultSpawnPos(new BlockPos(8, 64, 8), 0.0F); + this.updateSkyBrightness(); + this.prepareWeather(); + this.gatherCapabilities(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); } - public DimensionRenderInfo func_239132_a_() { + public DimensionRenderInfo effects() { @@ -186,6 +_,7 @@ - this.func_217381_Z().func_194340_a(() -> { - return Registry.field_212629_r.func_177774_c(p_217418_1_.func_200600_R()).toString(); + this.getProfiler().push(() -> { + return Registry.ENTITY_TYPE.getKey(p_217418_1_.getType()).toString(); }); + if (p_217418_1_.canUpdate()) - p_217418_1_.func_70071_h_(); - this.func_217381_Z().func_76319_b(); + p_217418_1_.tick(); + this.getProfiler().pop(); } @@ -285,9 +_,16 @@ } - private void func_217424_b(int p_217424_1_, Entity p_217424_2_) { + private void addEntity(int p_217424_1_, Entity p_217424_2_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217424_2_, this))) return; - this.func_217413_d(p_217424_1_); - this.field_217429_b.put(p_217424_1_, p_217424_2_); - this.func_72863_F().func_212849_a_(MathHelper.func_76128_c(p_217424_2_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_217424_2_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, true).func_76612_a(p_217424_2_); + this.removeEntity(p_217424_1_); + this.entitiesById.put(p_217424_1_, p_217424_2_); + this.getChunkSource().getChunk(MathHelper.floor(p_217424_2_.getX() / 16.0D), MathHelper.floor(p_217424_2_.getZ() / 16.0D), ChunkStatus.FULL, true).addEntity(p_217424_2_); + p_217424_2_.onAddedToWorld(); + if (p_217424_2_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity part : p_217424_2_.getParts()) { -+ this.partEntities.put(part.func_145782_y(), part); ++ this.partEntities.put(part.getId(), part); + } + } } - public void func_217413_d(int p_217413_1_) { + public void removeEntity(int p_217413_1_) { @@ -306,6 +_,13 @@ } - this.field_217431_w.remove(p_217414_1_); + this.players.remove(p_217414_1_); + p_217414_1_.onRemovedFromWorld(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_217414_1_, this)); + if (p_217414_1_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity part : p_217414_1_.getParts()) { -+ this.partEntities.remove(part.func_145782_y()); ++ this.partEntities.remove(part.getId()); + } + } } - public void func_217417_b(Chunk p_217417_1_) { + public void reAddEntitiesToChunk(Chunk p_217417_1_) { @@ -448,6 +_,11 @@ } - public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { + public void playSound(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); + if (event.isCanceled() || event.getSound() == null) return; + p_184148_8_ = event.getSound(); + p_184148_9_ = event.getCategory(); + p_184148_10_ = event.getVolume(); - if (p_184148_1_ == this.field_73037_M.field_71439_g) { - this.func_184134_a(p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_, false); + if (p_184148_1_ == this.minecraft.player) { + this.playLocalSound(p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_, false); } @@ -455,6 +_,11 @@ } - public void func_217384_a(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) { + public void playSound(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_217384_1_, p_217384_3_, p_217384_4_, p_217384_5_, p_217384_6_); + if (event.isCanceled() || event.getSound() == null) return; + p_217384_3_ = event.getSound(); + p_217384_4_ = event.getCategory(); + p_217384_5_ = event.getVolume(); - if (p_217384_1_ == this.field_73037_M.field_71439_g) { - this.field_73037_M.func_147118_V().func_147682_a(new EntityTickableSound(p_217384_3_, p_217384_4_, p_217384_2_)); + if (p_217384_1_ == this.minecraft.player) { + this.minecraft.getSoundManager().play(new EntityTickableSound(p_217384_3_, p_217384_4_, p_217384_2_)); } @@ -876,6 +_,7 @@ } - public void func_239156_a_(Difficulty p_239156_1_) { -+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_239156_1_, this.field_239153_j_); - this.field_239153_j_ = p_239156_1_; + public void setDifficulty(Difficulty p_239156_1_) { ++ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_239156_1_, this.difficulty); + this.difficulty = p_239156_1_; } @@ -890,5 +_,10 @@ - public double func_239160_g_() { - return this.field_239146_c_ ? 1.0D : 0.03125D; + public double getClearColorScale() { + return this.isFlat ? 1.0D : 0.03125D; } + } + diff --git a/patches/minecraft/net/minecraft/client/world/DimensionRenderInfo.java.patch b/patches/minecraft/net/minecraft/client/world/DimensionRenderInfo.java.patch index 84155dbfcc..5bfeb31a56 100644 --- a/patches/minecraft/net/minecraft/client/world/DimensionRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/world/DimensionRenderInfo.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/world/DimensionRenderInfo.java +++ b/net/minecraft/client/world/DimensionRenderInfo.java @@ -26,6 +_,10 @@ - private final DimensionRenderInfo.FogType field_241680_e_; - private final boolean field_241681_f_; - private final boolean field_239212_e_; + private final DimensionRenderInfo.FogType skyType; + private final boolean forceBrightLightmap; + private final boolean constantAmbientLight; + private net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler = null; + private net.minecraftforge.client.IWeatherParticleRenderHandler weatherParticleRenderHandler = null; + private net.minecraftforge.client.ISkyRenderHandler skyRenderHandler = null; + private net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler = null; public DimensionRenderInfo(float p_i241259_1_, boolean p_i241259_2_, DimensionRenderInfo.FogType p_i241259_3_, boolean p_i241259_4_, boolean p_i241259_5_) { - this.field_239210_c_ = p_i241259_1_; + this.cloudLevel = p_i241259_1_; @@ -80,6 +_,35 @@ - public boolean func_239217_c_() { - return this.field_239212_e_; + public boolean constantAmbientLight() { + return this.constantAmbientLight; + } + + public void setWeatherRenderHandler(net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler) { diff --git a/patches/minecraft/net/minecraft/command/Commands.java.patch b/patches/minecraft/net/minecraft/command/Commands.java.patch index 2c08f0ca61..84f2801b26 100644 --- a/patches/minecraft/net/minecraft/command/Commands.java.patch +++ b/patches/minecraft/net/minecraft/command/Commands.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/command/Commands.java +++ b/net/minecraft/command/Commands.java @@ -186,6 +_,7 @@ - if (p_i232148_1_.field_237219_d_) { - PublishCommand.func_198581_a(this.field_197062_b); + if (p_i232148_1_.includeIntegrated) { + PublishCommand.register(this.dispatcher); } -+ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.field_197062_b, p_i232148_1_); ++ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.dispatcher, p_i232148_1_); - this.field_197062_b.findAmbiguities((p_201302_1_, p_201302_2_, p_201302_3_, p_201302_4_) -> { - field_197061_a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.field_197062_b.getPath(p_201302_2_), this.field_197062_b.getPath(p_201302_3_), p_201302_4_); + this.dispatcher.findAmbiguities((p_201302_1_, p_201302_2_, p_201302_3_, p_201302_4_) -> { + LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.dispatcher.getPath(p_201302_2_), this.dispatcher.getPath(p_201302_3_), p_201302_4_); @@ -205,7 +_,15 @@ try { try { -- return this.field_197062_b.execute(stringreader, p_197059_1_); -+ ParseResults parse = this.field_197062_b.parse(stringreader, p_197059_1_); +- return this.dispatcher.execute(stringreader, p_197059_1_); ++ ParseResults parse = this.dispatcher.parse(stringreader, p_197059_1_); + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(parse); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { + if (event.getException() != null) { @@ -21,7 +21,7 @@ + } + return 1; + } -+ return this.field_197062_b.execute(event.getParseResults()); ++ return this.dispatcher.execute(event.getParseResults()); } catch (CommandException commandexception) { - p_197059_1_.func_197021_a(commandexception.func_197003_a()); + p_197059_1_.sendFailure(commandexception.getComponent()); return 0; diff --git a/patches/minecraft/net/minecraft/command/arguments/ArgumentTypes.java.patch b/patches/minecraft/net/minecraft/command/arguments/ArgumentTypes.java.patch index 2991a1e760..0970493b26 100644 --- a/patches/minecraft/net/minecraft/command/arguments/ArgumentTypes.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/ArgumentTypes.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/command/arguments/ArgumentTypes.java +++ b/net/minecraft/command/arguments/ArgumentTypes.java @@ -220,4 +_,8 @@ - this.field_197481_c = p_i48088_3_; + this.name = p_i48088_3_; } } + @javax.annotation.Nullable public static ResourceLocation getId(ArgumentType type) { -+ Entry entry = func_201040_a(type); -+ return entry == null ? null : entry.field_197481_c; ++ Entry entry = get(type); ++ return entry == null ? null : entry.name; + } } diff --git a/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch b/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch index 6eea99958b..e9445f45d7 100644 --- a/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/BlockStateParser.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/command/arguments/BlockStateParser.java @@ -169,7 +_,7 @@ - private boolean func_212598_k(ITagCollection p_212598_1_) { - if (this.field_197270_l != null) { -- return this.field_197270_l.func_177230_c().func_235695_q_(); -+ return this.field_197270_l.hasTileEntity(); + private boolean hasBlockEntity(ITagCollection p_212598_1_) { + if (this.state != null) { +- return this.state.getBlock().isEntityBlock(); ++ return this.state.hasTileEntity(); } else { - if (this.field_199833_p != null) { - ITag itag = p_212598_1_.func_199910_a(this.field_199833_p); + if (this.tag != null) { + ITag itag = p_212598_1_.getTag(this.tag); @@ -283,7 +_,7 @@ p_197255_1_.suggest(String.valueOf('[')); } -- if (this.field_197270_l.func_177230_c().func_235695_q_()) { -+ if (this.field_197270_l.hasTileEntity()) { +- if (this.state.getBlock().isEntityBlock()) { ++ if (this.state.hasTileEntity()) { p_197255_1_.suggest(String.valueOf('{')); } } diff --git a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch index 720da88a5b..c07a52af40 100644 --- a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch @@ -3,13 +3,13 @@ @@ -448,6 +_,9 @@ } - this.field_197417_j.skip(); + this.reader.skip(); + EntitySelector forgeSelector = net.minecraftforge.common.command.EntitySelectorManager.parseSelector(this); + if (forgeSelector != null) + return forgeSelector; - this.func_197403_b(); + this.parseSelector(); } else { - this.func_197382_c(); + this.parseNameOrUUID(); @@ -463,6 +_,7 @@ p_210326_0_.suggest("@r", new TranslationTextComponent("argument.entity.selector.randomPlayer")); p_210326_0_.suggest("@s", new TranslationTextComponent("argument.entity.selector.self")); @@ -17,4 +17,4 @@ + net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(p_210326_0_); } - private CompletableFuture func_201981_b(SuggestionsBuilder p_201981_1_, Consumer p_201981_2_) { + private CompletableFuture suggestNameOrSelector(SuggestionsBuilder p_201981_1_, Consumer p_201981_2_) { diff --git a/patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch b/patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch index d9bd5fa43f..74d67ff48a 100644 --- a/patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch +++ b/patches/minecraft/net/minecraft/command/impl/LocateCommand.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/command/impl/LocateCommand.java +++ b/net/minecraft/command/impl/LocateCommand.java @@ -25,11 +_,18 @@ - return p_198533_0_.func_197034_c(2); + return p_198533_0_.hasPermission(2); }); + if (false) - for(Entry> entry : Structure.field_236365_a_.entrySet()) { - literalargumentbuilder = literalargumentbuilder.then(Commands.func_197057_a(entry.getKey()).executes((p_241056_1_) -> { - return func_241053_a_(p_241056_1_.getSource(), entry.getValue()); + for(Entry> entry : Structure.STRUCTURES_REGISTRY.entrySet()) { + literalargumentbuilder = literalargumentbuilder.then(Commands.literal(entry.getKey()).executes((p_241056_1_) -> { + return locate(p_241056_1_.getSource(), entry.getValue()); })); } + else { + for (Structure structureFeature : net.minecraftforge.registries.ForgeRegistries.STRUCTURE_FEATURES) { + String name = structureFeature.getRegistryName().toString().replace("minecraft:", ""); -+ literalargumentbuilder = literalargumentbuilder.then(Commands.func_197057_a(name) -+ .executes(ctx -> func_241053_a_(ctx.getSource(), structureFeature))); ++ literalargumentbuilder = literalargumentbuilder.then(Commands.literal(name) ++ .executes(ctx -> locate(ctx.getSource(), structureFeature))); + }} p_198528_0_.register(literalargumentbuilder); diff --git a/patches/minecraft/net/minecraft/command/impl/SpreadPlayersCommand.java.patch b/patches/minecraft/net/minecraft/command/impl/SpreadPlayersCommand.java.patch index ad41620595..d42f712e46 100644 --- a/patches/minecraft/net/minecraft/command/impl/SpreadPlayersCommand.java.patch +++ b/patches/minecraft/net/minecraft/command/impl/SpreadPlayersCommand.java.patch @@ -4,9 +4,9 @@ spreadplayerscommand$position = p_241072_2_[i++]; } -- entity.func_223102_j((double)MathHelper.func_76128_c(spreadplayerscommand$position.field_198713_a) + 0.5D, (double)spreadplayerscommand$position.func_198710_a(p_241072_1_, p_241072_3_), (double)MathHelper.func_76128_c(spreadplayerscommand$position.field_198714_b) + 0.5D); -+ net.minecraftforge.event.entity.living.EntityTeleportEvent.SpreadPlayersCommand event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportSpreadPlayersCommand(entity, (double)MathHelper.func_76128_c(spreadplayerscommand$position.field_198713_a) + 0.5D, (double)spreadplayerscommand$position.func_198710_a(p_241072_1_, p_241072_3_), (double)MathHelper.func_76128_c(spreadplayerscommand$position.field_198714_b) + 0.5D); -+ if (!event.isCanceled()) entity.func_223102_j(event.getTargetX(), event.getTargetY(), event.getTargetZ()); +- entity.teleportToWithTicket((double)MathHelper.floor(spreadplayerscommand$position.x) + 0.5D, (double)spreadplayerscommand$position.getSpawnY(p_241072_1_, p_241072_3_), (double)MathHelper.floor(spreadplayerscommand$position.z) + 0.5D); ++ net.minecraftforge.event.entity.living.EntityTeleportEvent.SpreadPlayersCommand event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportSpreadPlayersCommand(entity, (double)MathHelper.floor(spreadplayerscommand$position.x) + 0.5D, (double)spreadplayerscommand$position.getSpawnY(p_241072_1_, p_241072_3_), (double)MathHelper.floor(spreadplayerscommand$position.z) + 0.5D); ++ if (!event.isCanceled()) entity.teleportToWithTicket(event.getTargetX(), event.getTargetY(), event.getTargetZ()); double d2 = Double.MAX_VALUE; for(SpreadPlayersCommand.Position spreadplayerscommand$position1 : p_241072_2_) { diff --git a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch index e1e7468893..699cea5e58 100644 --- a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch @@ -3,18 +3,18 @@ @@ -121,6 +_,9 @@ } - private static void func_201127_a(CommandSource p_201127_0_, Entity p_201127_1_, ServerWorld p_201127_2_, double p_201127_3_, double p_201127_5_, double p_201127_7_, Set p_201127_9_, float p_201127_10_, float p_201127_11_, @Nullable TeleportCommand.Facing p_201127_12_) throws CommandSyntaxException { + private static void performTeleport(CommandSource p_201127_0_, Entity p_201127_1_, ServerWorld p_201127_2_, double p_201127_3_, double p_201127_5_, double p_201127_7_, Set p_201127_9_, float p_201127_10_, float p_201127_11_, @Nullable TeleportCommand.Facing p_201127_12_) throws CommandSyntaxException { + net.minecraftforge.event.entity.living.EntityTeleportEvent.TeleportCommand event = net.minecraftforge.event.ForgeEventFactory.onEntityTeleportCommand(p_201127_1_, p_201127_3_, p_201127_5_, p_201127_7_); + if (event.isCanceled()) return; + p_201127_3_ = event.getTargetX(); p_201127_5_ = event.getTargetY(); p_201127_7_ = event.getTargetZ(); BlockPos blockpos = new BlockPos(p_201127_3_, p_201127_5_, p_201127_7_); - if (!World.func_234935_k_(blockpos)) { - throw field_241077_a_.create(); + if (!World.isInSpawnableBounds(blockpos)) { + throw INVALID_POSITION.create(); @@ -159,7 +_,6 @@ - p_201127_1_.func_70012_b(p_201127_3_, p_201127_5_, p_201127_7_, f1, f); - p_201127_1_.func_70034_d(f1); - p_201127_2_.func_217460_e(p_201127_1_); -- entity.field_70128_L = true; + p_201127_1_.moveTo(p_201127_3_, p_201127_5_, p_201127_7_, f1, f); + p_201127_1_.setYHeadRot(f1); + p_201127_2_.addFromAnotherDimension(p_201127_1_); +- entity.removed = true; } } diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index 7937c3b293..b184a15796 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/crash/CrashReport.java +++ b/net/minecraft/crash/CrashReport.java @@ -69,6 +_,7 @@ - List list = Util.func_211565_f().collect(Collectors.toList()); + List list = Util.getVmArguments().collect(Collectors.toList()); return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" "))); }); -+ net.minecraftforge.fml.CrashReportExtender.enhanceCrashReport(this, this.field_85061_c); ++ net.minecraftforge.fml.CrashReportExtender.enhanceCrashReport(this, this.systemDetails); } - public String func_71501_a() { + public String getTitle() { @@ -87,14 +_,8 @@ - if (this.field_85060_g != null && this.field_85060_g.length > 0) { + if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) { p_71506_1_.append("-- Head --\n"); p_71506_1_.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); - p_71506_1_.append("Stacktrace:\n"); - -- for(StackTraceElement stacktraceelement : this.field_85060_g) { +- for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { - p_71506_1_.append("\t").append("at ").append((Object)stacktraceelement); - p_71506_1_.append("\n"); - } - - p_71506_1_.append("\n"); + p_71506_1_.append("Stacktrace:"); -+ p_71506_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.field_85060_g)); ++ p_71506_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace)); } - for(CrashReportCategory crashreportcategory : this.field_71512_c) { + for(CrashReportCategory crashreportcategory : this.details) { @@ -121,23 +_,13 @@ - throwable.setStackTrace(this.field_71511_b.getStackTrace()); + throwable.setStackTrace(this.exception.getStackTrace()); } - String s; @@ -44,10 +44,10 @@ + return net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(throwable); } - public String func_71502_e() { + public String getFriendlyReport() { StringBuilder stringbuilder = new StringBuilder(); stringbuilder.append("---- Minecraft Crash Report ----\n"); + net.minecraftforge.fml.CrashReportExtender.addCrashReportHeader(stringbuilder, this); stringbuilder.append("// "); - stringbuilder.append(func_71503_h()); + stringbuilder.append(getErrorComment()); stringbuilder.append("\n\n"); diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index e52687e8b0..cf458697ac 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -4,35 +4,35 @@ if (astacktraceelement.length <= 0) { return 0; } else { -- this.field_85075_d = new StackTraceElement[astacktraceelement.length - 3 - p_85073_1_]; -- System.arraycopy(astacktraceelement, 3 + p_85073_1_, this.field_85075_d, 0, this.field_85075_d.length); +- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - p_85073_1_]; +- System.arraycopy(astacktraceelement, 3 + p_85073_1_, this.stackTrace, 0, this.stackTrace.length); + int len = astacktraceelement.length - 3 - p_85073_1_; + if (len <= 0) len = astacktraceelement.length; -+ this.field_85075_d = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.field_85075_d, 0, this.field_85075_d.length); - return this.field_85075_d.length; ++ this.stackTrace = new StackTraceElement[len]; ++ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; } } @@ -145,17 +_,17 @@ - if (this.field_85075_d != null && this.field_85075_d.length > 0) { + if (this.stackTrace != null && this.stackTrace.length > 0) { p_85072_1_.append("\nStacktrace:"); - -- for(StackTraceElement stacktraceelement : this.field_85075_d) { +- for(StackTraceElement stacktraceelement : this.stackTrace) { - p_85072_1_.append("\n\tat "); - p_85072_1_.append((Object)stacktraceelement); - } -+ p_85072_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.field_85075_d)); ++ p_85072_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace)); } } - public StackTraceElement[] func_147152_a() { - return this.field_85075_d; + public StackTraceElement[] getStacktrace() { + return this.stackTrace; + } + + public void applyStackTrace(Throwable t) { -+ this.field_85075_d = t.getStackTrace(); ++ this.stackTrace = t.getStackTrace(); } - public static void func_175750_a(CrashReportCategory p_175750_0_, BlockPos p_175750_1_, @Nullable BlockState p_175750_2_) { + public static void populateBlockDetails(CrashReportCategory p_175750_0_, BlockPos p_175750_1_, @Nullable BlockState p_175750_2_) { diff --git a/patches/minecraft/net/minecraft/data/AdvancementProvider.java.patch b/patches/minecraft/net/minecraft/data/AdvancementProvider.java.patch index 78f16e3d44..397d38cbf4 100644 --- a/patches/minecraft/net/minecraft/data/AdvancementProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/AdvancementProvider.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/data/AdvancementProvider.java +++ b/net/minecraft/data/AdvancementProvider.java @@ -24,11 +_,18 @@ - private static final Gson field_204024_b = (new GsonBuilder()).setPrettyPrinting().create(); - private final DataGenerator field_204025_c; - private final List>> field_204283_d = ImmutableList.of(new EndAdvancements(), new HusbandryAdvancements(), new AdventureAdvancements(), new NetherAdvancements(), new StoryAdvancements()); + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); + private final DataGenerator generator; + private final List>> tabs = ImmutableList.of(new EndAdvancements(), new HusbandryAdvancements(), new AdventureAdvancements(), new NetherAdvancements(), new StoryAdvancements()); + protected net.minecraftforge.common.data.ExistingFileHelper fileHelper; + @Deprecated public AdvancementProvider(DataGenerator p_i48869_1_) { - this.field_204025_c = p_i48869_1_; + this.generator = p_i48869_1_; } + public AdvancementProvider(DataGenerator generatorIn, net.minecraftforge.common.data.ExistingFileHelper fileHelperIn) { -+ this.field_204025_c = generatorIn; ++ this.generator = generatorIn; + this.fileHelper = fileHelperIn; + } + - public void func_200398_a(DirectoryCache p_200398_1_) throws IOException { - Path path = this.field_204025_c.func_200391_b(); + public void run(DirectoryCache p_200398_1_) throws IOException { + Path path = this.generator.getOutputFolder(); Set set = Sets.newHashSet(); @@ -47,6 +_,16 @@ } @@ -33,6 +33,6 @@ + * @param fileHelper used for the register function from {@link Advancement.Builder} + */ + protected void registerAdvancements(Consumer consumer, net.minecraftforge.common.data.ExistingFileHelper fileHelper) { - for(Consumer> consumer1 : this.field_204283_d) { + for(Consumer> consumer1 : this.tabs) { consumer1.accept(consumer); } diff --git a/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch index d1c1772b4c..16521a5252 100644 --- a/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch @@ -6,10 +6,10 @@ public class BlockTagsProvider extends TagsProvider { + @Deprecated public BlockTagsProvider(DataGenerator p_i48256_1_) { - super(p_i48256_1_, Registry.field_212618_g); + super(p_i48256_1_, Registry.BLOCK); + } + public BlockTagsProvider(DataGenerator p_i48256_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_i48256_1_, Registry.field_212618_g, modId, existingFileHelper); ++ super(p_i48256_1_, Registry.BLOCK, modId, existingFileHelper); } - protected void func_200432_c() { + protected void addTags() { diff --git a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch index 8ef33b7978..d349b59964 100644 --- a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/data/DataGenerator.java +++ b/net/minecraft/data/DataGenerator.java @@ -16,10 +_,11 @@ - private final Collection field_200394_b; - private final Path field_200395_c; - private final List field_200396_d = Lists.newArrayList(); -+ private final List providerView = java.util.Collections.unmodifiableList(field_200396_d); + private final Collection inputFolders; + private final Path outputFolder; + private final List providers = Lists.newArrayList(); ++ private final List providerView = java.util.Collections.unmodifiableList(providers); public DataGenerator(Path p_i48266_1_, Collection p_i48266_2_) { - this.field_200395_c = p_i48266_1_; -- this.field_200394_b = p_i48266_2_; -+ this.field_200394_b = Lists.newArrayList(p_i48266_2_); + this.outputFolder = p_i48266_1_; +- this.inputFolders = p_i48266_2_; ++ this.inputFolders = Lists.newArrayList(p_i48266_2_); } - public Collection func_200389_a() { + public Collection getInputFolders() { @@ -38,6 +_,7 @@ - for(IDataProvider idataprovider : this.field_200396_d) { - field_200393_a.info("Starting provider: {}", (Object)idataprovider.func_200397_b()); -+ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + idataprovider.func_200397_b()); + for(IDataProvider idataprovider : this.providers) { + LOGGER.info("Starting provider: {}", (Object)idataprovider.getName()); ++ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + idataprovider.getName()); stopwatch1.start(); - idataprovider.func_200398_a(directorycache); + idataprovider.run(directorycache); stopwatch1.stop(); @@ -51,6 +_,14 @@ - public void func_200390_a(IDataProvider p_200390_1_) { - this.field_200396_d.add(p_200390_1_); + public void addProvider(IDataProvider p_200390_1_) { + this.providers.add(p_200390_1_); + } + + public List getProviders() { @@ -32,7 +32,7 @@ + } + + public void addInput(Path value) { -+ this.field_200394_b.add(value); ++ this.inputFolders.add(value); } static { diff --git a/patches/minecraft/net/minecraft/data/DirectoryCache.java.patch b/patches/minecraft/net/minecraft/data/DirectoryCache.java.patch index cb1563fc3a..624ec689c3 100644 --- a/patches/minecraft/net/minecraft/data/DirectoryCache.java.patch +++ b/patches/minecraft/net/minecraft/data/DirectoryCache.java.patch @@ -3,11 +3,11 @@ @@ -55,8 +_,8 @@ } - IOUtils.writeLines(this.field_208329_f.entrySet().stream().map((p_208319_1_) -> { -- return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey()); + IOUtils.writeLines(this.newCache.entrySet().stream().map((p_208319_1_) -> { +- return (String)p_208319_1_.getValue() + ' ' + this.path.relativize(p_208319_1_.getKey()); - }).collect(Collectors.toList()), System.lineSeparator(), writer); -+ return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey()).toString().replace('\\', '/'); //Forge: Standardize file paths. ++ return (String)p_208319_1_.getValue() + ' ' + this.path.relativize(p_208319_1_.getKey()).toString().replace('\\', '/'); //Forge: Standardize file paths. + }).sorted(java.util.Comparator.comparing(a -> a.split(" ")[1])).collect(Collectors.toList()), System.lineSeparator(), writer); writer.close(); - field_208324_a.debug("Caching: cache hits: {}, created: {} removed: {}", this.field_208327_d, this.field_208329_f.size() - this.field_208327_d, this.field_208328_e.size()); + LOGGER.debug("Caching: cache hits: {}, created: {} removed: {}", this.hits, this.newCache.size() - this.hits, this.oldCache.size()); } diff --git a/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch index 5d51019dce..9c4a08a04c 100644 --- a/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch @@ -6,10 +6,10 @@ public class EntityTypeTagsProvider extends TagsProvider> { + @Deprecated public EntityTypeTagsProvider(DataGenerator p_i50784_1_) { - super(p_i50784_1_, Registry.field_212629_r); + super(p_i50784_1_, Registry.ENTITY_TYPE); + } + public EntityTypeTagsProvider(DataGenerator p_i50784_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_i50784_1_, Registry.field_212629_r, modId, existingFileHelper); ++ super(p_i50784_1_, Registry.ENTITY_TYPE, modId, existingFileHelper); } - protected void func_200432_c() { + protected void addTags() { diff --git a/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch index f0b17cd0e8..519f76ecb1 100644 --- a/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch @@ -6,10 +6,10 @@ public class FluidTagsProvider extends TagsProvider { + @Deprecated public FluidTagsProvider(DataGenerator p_i49156_1_) { - super(p_i49156_1_, Registry.field_212619_h); + super(p_i49156_1_, Registry.FLUID); + } + public FluidTagsProvider(DataGenerator p_i49156_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_i49156_1_, Registry.field_212619_h, modId, existingFileHelper); ++ super(p_i49156_1_, Registry.FLUID, modId, existingFileHelper); } - protected void func_200432_c() { + protected void addTags() { diff --git a/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch index 104d543c35..cbbe886838 100644 --- a/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch @@ -2,15 +2,15 @@ +++ b/net/minecraft/data/ItemTagsProvider.java @@ -14,8 +_,13 @@ public class ItemTagsProvider extends TagsProvider { - private final Function, ITag.Builder> field_240520_d_; + private final Function, ITag.Builder> blockTags; + @Deprecated public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_) { - super(p_i232552_1_, Registry.field_212630_s); -+ this.field_240520_d_ = p_i232552_2_::func_240525_b_; + super(p_i232552_1_, Registry.ITEM); ++ this.blockTags = p_i232552_2_::getOrCreateRawBuilder; + } + public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_i232552_1_, Registry.field_212630_s, modId, existingFileHelper); - this.field_240520_d_ = p_i232552_2_::func_240525_b_; ++ super(p_i232552_1_, Registry.ITEM, modId, existingFileHelper); + this.blockTags = p_i232552_2_::getOrCreateRawBuilder; } diff --git a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch index 12e4e44205..4dcc08c446 100644 --- a/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/LootTableProvider.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/data/LootTableProvider.java +++ b/net/minecraft/data/LootTableProvider.java @@ -43,7 +_,7 @@ - public void func_200398_a(DirectoryCache p_200398_1_) { - Path path = this.field_218443_d.func_200391_b(); + public void run(DirectoryCache p_200398_1_) { + Path path = this.generator.getOutputFolder(); Map map = Maps.newHashMap(); -- this.field_218444_e.forEach((p_218438_1_) -> { +- this.subProviders.forEach((p_218438_1_) -> { + this.getTables().forEach((p_218438_1_) -> { p_218438_1_.getFirst().get().accept((p_218437_2_, p_218437_3_) -> { - if (map.put(p_218437_2_, p_218437_3_.func_216039_a(p_218438_1_.getSecond()).func_216038_b()) != null) { + if (map.put(p_218437_2_, p_218437_3_.setParamSet(p_218438_1_.getSecond()).build()) != null) { throw new IllegalStateException("Duplicate loot table " + p_218437_2_); @@ -54,13 +_,8 @@ return null; }, map::get); -- for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { -- validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); +- for(ResourceLocation resourcelocation : Sets.difference(LootTables.all(), map.keySet())) { +- validationtracker.reportProblem("Missing built-in table: " + resourcelocation); - } + validate(map, validationtracker); - map.forEach((p_229439_1_, p_229439_2_) -> { -- LootTableManager.func_227508_a_(validationtracker, p_229439_1_, p_229439_2_); +- LootTableManager.validate(validationtracker, p_229439_1_, p_229439_2_); - }); - Multimap multimap = validationtracker.func_227527_a_(); + Multimap multimap = validationtracker.getProblems(); if (!multimap.isEmpty()) { multimap.forEach((p_229440_0_, p_229440_1_) -> { @@ -79,6 +_,20 @@ @@ -31,17 +31,17 @@ + } + + protected List>>, LootParameterSet>> getTables() { -+ return field_218444_e; ++ return subProviders; + } + + protected void validate(Map map, ValidationTracker validationtracker) { -+ for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) { -+ validationtracker.func_227530_a_("Missing built-in table: " + resourcelocation); ++ for(ResourceLocation resourcelocation : Sets.difference(LootTables.all(), map.keySet())) { ++ validationtracker.reportProblem("Missing built-in table: " + resourcelocation); + } + + map.forEach((p_218436_2_, p_218436_3_) -> { -+ LootTableManager.func_227508_a_(validationtracker, p_218436_2_, p_218436_3_); ++ LootTableManager.validate(validationtracker, p_218436_2_, p_218436_3_); + }); } - private static Path func_218439_a(Path p_218439_0_, ResourceLocation p_218439_1_) { + private static Path createPath(Path p_218439_0_, ResourceLocation p_218439_1_) { diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index 44642ad784..74020e4c12 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -21,10 +21,10 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); -- DataGenerator datagenerator = func_200264_a(path, optionset.valuesOf(optionspec8).stream().map((p_200263_0_) -> { +- DataGenerator datagenerator = createStandardGenerator(path, optionset.valuesOf(optionspec8).stream().map((p_200263_0_) -> { - return Paths.get(p_200263_0_); - }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5); -- datagenerator.func_200392_c(); +- datagenerator.run(); + Collection inputs = optionset.valuesOf(optionspec8).stream().map(Paths::get).collect(Collectors.toList()); + Collection existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList()); + java.util.Set existingMods = new java.util.HashSet<>(optionset.valuesOf(existingMod)); @@ -32,7 +32,7 @@ + boolean isFlat = mods.isEmpty() || optionset.has(flat); + net.minecraftforge.fml.DatagenModLoader.begin(mods, path, inputs, existingPacks, existingMods, flag2, flag1, flag3, flag4, flag5, isFlat, optionset.valueOf(assetIndex), optionset.valueOf(assetsDir)); + if (mods.contains("minecraft") || mods.isEmpty()) -+ func_200264_a(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).func_200392_c(); ++ createStandardGenerator(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).run(); } else { optionparser.printHelpOn(System.out); } diff --git a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch index db4071b6c4..0cc8c1f776 100644 --- a/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/RecipeProvider.java.patch @@ -5,24 +5,24 @@ } }); + if (this.getClass() == RecipeProvider.class) //Forge: Subclasses don't need this. - func_208310_b(p_200398_1_, Advancement.Builder.func_200278_a().func_200275_a("impossible", new ImpossibleTrigger.Instance()).func_200273_b(), path.resolve("data/minecraft/advancements/recipes/root.json")); + saveAdvancement(p_200398_1_, Advancement.Builder.advancement().addCriterion("impossible", new ImpossibleTrigger.Instance()).serializeToJson(), path.resolve("data/minecraft/advancements/recipes/root.json")); } @@ -81,7 +_,7 @@ } -- protected static void func_208310_b(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { -+ protected void func_208310_b(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { +- protected static void saveAdvancement(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { ++ protected void saveAdvancement(DirectoryCache p_208310_0_, JsonObject p_208310_1_, Path p_208310_2_) { try { - String s = field_200412_b.toJson((JsonElement)p_208310_1_); - String s1 = field_208307_a.hashUnencodedChars(s).toString(); + String s = GSON.toJson((JsonElement)p_208310_1_); + String s1 = SHA1.hashUnencodedChars(s).toString(); @@ -100,7 +_,7 @@ } -- protected static void func_200404_a(Consumer p_200404_0_) { -+ protected void func_200404_a(Consumer p_200404_0_) { - func_240470_a_(p_200404_0_, Blocks.field_196670_r, ItemTags.field_203297_q); - func_240472_b_(p_200404_0_, Blocks.field_196666_p, ItemTags.field_203296_p); - func_240472_b_(p_200404_0_, Blocks.field_235344_mC_, ItemTags.field_232913_w_); +- protected static void buildShapelessRecipes(Consumer p_200404_0_) { ++ protected void buildShapelessRecipes(Consumer p_200404_0_) { + planksFromLog(p_200404_0_, Blocks.ACACIA_PLANKS, ItemTags.ACACIA_LOGS); + planksFromLogs(p_200404_0_, Blocks.BIRCH_PLANKS, ItemTags.BIRCH_LOGS); + planksFromLogs(p_200404_0_, Blocks.CRIMSON_PLANKS, ItemTags.CRIMSON_STEMS); diff --git a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch index d4250c786e..eb8527ef85 100644 --- a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/data/TagsProvider.java +++ b/net/minecraft/data/TagsProvider.java @@ -28,10 +_,28 @@ - protected final DataGenerator field_200433_a; - protected final Registry field_200435_c; - protected final Map field_200434_b = Maps.newLinkedHashMap(); + protected final DataGenerator generator; + protected final Registry registry; + protected final Map builders = Maps.newLinkedHashMap(); + protected final String modId; + protected final String folder; + protected final net.minecraftforge.common.data.ExistingFileHelper existingFileHelper; @@ -17,8 +17,8 @@ + this(p_i49827_1_, p_i49827_2_, modId, existingFileHelper, null); + } + protected TagsProvider(DataGenerator p_i49827_1_, Registry p_i49827_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper, @javax.annotation.Nullable String folder) { - this.field_200433_a = p_i49827_1_; - this.field_200435_c = p_i49827_2_; + this.generator = p_i49827_1_; + this.registry = p_i49827_2_; + this.modId = modId; + this.existingFileHelper = existingFileHelper; + if (folder == null) {//TODO - 1.17: Remove getTagFolder as a method, and inline the default implementation here @@ -28,29 +28,29 @@ + this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.resources.ResourcePackType.SERVER_DATA, ".json", "tags/" + this.folder); } - protected abstract void func_200432_c(); + protected abstract void addTags(); @@ -47,12 +_,14 @@ - return this.field_200435_c.func_241873_b(p_240527_1_).orElse((T)null); + return this.registry.getOptional(p_240527_1_).orElse((T)null); }; - this.field_200434_b.forEach((p_240524_4_, p_240524_5_) -> { -- List list = p_240524_5_.func_232963_b_(function, function1).collect(Collectors.toList()); + this.builders.forEach((p_240524_4_, p_240524_5_) -> { +- List list = p_240524_5_.getUnresolvedEntries(function, function1).collect(Collectors.toList()); + // FORGE: Add validation via existing resources -+ List list = p_240524_5_.func_232963_b_(function, function1).filter(this::missing).collect(Collectors.toList()); ++ List list = p_240524_5_.getUnresolvedEntries(function, function1).filter(this::missing).collect(Collectors.toList()); if (!list.isEmpty()) { throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_240524_4_, list.stream().map(Objects::toString).collect(Collectors.joining(",")))); } else { - JsonObject jsonobject = p_240524_5_.func_232965_c_(); - Path path = this.func_200431_a(p_240524_4_); + JsonObject jsonobject = p_240524_5_.serializeToJson(); + Path path = this.getPath(p_240524_4_); + if (path == null) return; //Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. try { - String s = field_200437_e.toJson((JsonElement)jsonobject); + String s = GSON.toJson((JsonElement)jsonobject); @@ -74,20 +_,36 @@ }); } + private boolean missing(ITag.Proxy reference) { -+ ITag.ITagEntry entry = reference.func_232968_a_(); ++ ITag.ITagEntry entry = reference.getEntry(); + // We only care about non-optional tag entries, this is the only type that can reference a resource and needs validation + // Optional tags should not be validated + if (entry instanceof ITag.TagEntry) { @@ -61,19 +61,19 @@ + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected String getTagFolder() { -+ return ((Registry)Registry.field_212617_f).func_177774_c(field_200435_c).func_110623_a() + "s"; ++ return ((Registry)Registry.REGISTRY).getKey(registry).getPath() + "s"; + } + - protected abstract Path func_200431_a(ResourceLocation p_200431_1_); + protected abstract Path getPath(ResourceLocation p_200431_1_); - protected TagsProvider.Builder func_240522_a_(ITag.INamedTag p_240522_1_) { - ITag.Builder itag$builder = this.func_240525_b_(p_240522_1_); -- return new TagsProvider.Builder<>(itag$builder, this.field_200435_c, "vanilla"); -+ return new TagsProvider.Builder<>(itag$builder, this.field_200435_c, modId); + protected TagsProvider.Builder tag(ITag.INamedTag p_240522_1_) { + ITag.Builder itag$builder = this.getOrCreateRawBuilder(p_240522_1_); +- return new TagsProvider.Builder<>(itag$builder, this.registry, "vanilla"); ++ return new TagsProvider.Builder<>(itag$builder, this.registry, modId); } - protected ITag.Builder func_240525_b_(ITag.INamedTag p_240525_1_) { - return this.field_200434_b.computeIfAbsent(p_240525_1_.func_230234_a_(), (p_240526_0_) -> { + protected ITag.Builder getOrCreateRawBuilder(ITag.INamedTag p_240525_1_) { + return this.builders.computeIfAbsent(p_240525_1_.getName(), (p_240526_0_) -> { + existingFileHelper.trackGenerated(p_240526_0_, resourceType); return new ITag.Builder(); }); @@ -81,26 +81,26 @@ - public static class Builder { + public static class Builder implements net.minecraftforge.common.extensions.IForgeTagBuilder { - private final ITag.Builder field_240528_a_; - private final Registry field_240529_b_; - private final String field_240530_c_; + private final ITag.Builder builder; + private final Registry registry; + private final String source; @@ -114,6 +_,19 @@ - this.field_240528_a_.func_232961_a_(p_240533_1_, this.field_240530_c_); + this.builder.addElement(p_240533_1_, this.source); }); return this; + } + + public TagsProvider.Builder add(ITag.ITagEntry tag) { -+ field_240528_a_.func_232955_a_(tag, field_240530_c_); ++ builder.add(tag, source); + return this; + } + + public ITag.Builder getInternalBuilder() { -+ return field_240528_a_; ++ return builder; + } + + public String getModID() { -+ return field_240530_c_; ++ return source; } } } diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch index 6bb1c87d71..ed458e9761 100644 --- a/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/BlockLootTables.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/data/loot/BlockLootTables.java +++ b/net/minecraft/data/loot/BlockLootTables.java @@ -216,7 +_,7 @@ - return LootTable.func_216119_b(); + return LootTable.lootTable(); } - public void accept(BiConsumer p_accept_1_) { + protected void addTables() { - this.func_218492_c(Blocks.field_196650_c); - this.func_218492_c(Blocks.field_196652_d); - this.func_218492_c(Blocks.field_196654_e); + this.dropSelf(Blocks.GRANITE); + this.dropSelf(Blocks.POLISHED_GRANITE); + this.dropSelf(Blocks.DIORITE); @@ -1066,9 +_,13 @@ - this.func_218507_a(Blocks.field_150480_ab, func_218482_a()); - this.func_218507_a(Blocks.field_235335_bO_, func_218482_a()); - this.func_218507_a(Blocks.field_150427_aO, func_218482_a()); + this.add(Blocks.FIRE, noDrop()); + this.add(Blocks.SOUL_FIRE, noDrop()); + this.add(Blocks.NETHER_PORTAL, noDrop()); + } + + public void accept(BiConsumer p_accept_1_) { + this.addTables(); Set set = Sets.newHashSet(); -- for(Block block : Registry.field_212618_g) { +- for(Block block : Registry.BLOCK) { + for(Block block : getKnownBlocks()) { - ResourceLocation resourcelocation = block.func_220068_i(); - if (resourcelocation != LootTables.field_186419_a && set.add(resourcelocation)) { - LootTable.Builder loottable$builder = this.field_218581_i.remove(resourcelocation); + ResourceLocation resourcelocation = block.getLootTable(); + if (resourcelocation != LootTables.EMPTY && set.add(resourcelocation)) { + LootTable.Builder loottable$builder = this.map.remove(resourcelocation); @@ -1093,6 +_,10 @@ - public static LootTable.Builder func_239829_a_(Block p_239829_0_) { - return func_218562_a(p_239829_0_, DoorBlock.field_176523_O, DoubleBlockHalf.LOWER); + public static LootTable.Builder createDoorTable(Block p_239829_0_) { + return createSinglePropConditionTable(p_239829_0_, DoorBlock.HALF, DoubleBlockHalf.LOWER); + } + + protected Iterable getKnownBlocks() { -+ return Registry.field_212618_g; ++ return Registry.BLOCK; } - public void func_218547_a(Block p_218547_1_) { + public void dropPottedContents(Block p_218547_1_) { diff --git a/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch index dfcfd949a5..1192518777 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLootTables.java.patch @@ -1,44 +1,44 @@ --- a/net/minecraft/data/loot/EntityLootTables.java +++ b/net/minecraft/data/loot/EntityLootTables.java @@ -50,7 +_,7 @@ - return LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(p_218583_0_))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(TableLootEntry.func_216171_a(EntityType.field_200737_ac.func_220348_g()))); + return LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(p_218583_0_))).withPool(LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(TableLootEntry.lootTableReference(EntityType.SHEEP.getDefaultLootTable()))); } - public void accept(BiConsumer p_accept_1_) { + protected void addTables() { - this.func_218582_a(EntityType.field_200789_c, LootTable.func_216119_b()); - this.func_218582_a(EntityType.field_200791_e, LootTable.func_216119_b()); - this.func_218582_a(EntityType.field_226289_e_, LootTable.func_216119_b()); + this.add(EntityType.ARMOR_STAND, LootTable.lootTable()); + this.add(EntityType.BAT, LootTable.lootTable()); + this.add(EntityType.BEE, LootTable.lootTable()); @@ -141,11 +_,15 @@ - this.func_218582_a(EntityType.field_233591_ai_, LootTable.func_216119_b()); - this.func_218582_a(EntityType.field_242287_aj, LootTable.func_216119_b()); - this.func_218582_a(EntityType.field_200727_aF, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151042_j)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151172_bF)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151174_bG)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F)))); + this.add(EntityType.PIGLIN, LootTable.lootTable()); + this.add(EntityType.PIGLIN_BRUTE, LootTable.lootTable()); + this.add(EntityType.ZOMBIE_VILLAGER, LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(Items.ROTTEN_FLESH).apply(SetCount.setCount(RandomValueRange.between(0.0F, 2.0F))).apply(LootingEnchantBonus.lootingMultiplier(RandomValueRange.between(0.0F, 1.0F))))).withPool(LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(Items.IRON_INGOT)).add(ItemLootEntry.lootTableItem(Items.CARROT)).add(ItemLootEntry.lootTableItem(Items.POTATO)).when(KilledByPlayer.killedByPlayer()).when(RandomChanceWithLooting.randomChanceAndLootingBoost(0.025F, 0.01F)))); + } + + public void accept(BiConsumer p_accept_1_) { + this.addTables(); Set set = Sets.newHashSet(); -- for(EntityType entitytype : Registry.field_212629_r) { +- for(EntityType entitytype : Registry.ENTITY_TYPE) { + for(EntityType entitytype : getKnownEntities()) { - ResourceLocation resourcelocation = entitytype.func_220348_g(); -- if (!field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC) { + ResourceLocation resourcelocation = entitytype.getDefaultLootTable(); +- if (!SPECIAL_LOOT_TABLE_TYPES.contains(entitytype) && entitytype.getCategory() == EntityClassification.MISC) { + if (isNonLiving(entitytype)) { - if (resourcelocation != LootTables.field_186419_a && this.field_218587_b.remove(resourcelocation) != null) { - throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.field_212629_r.func_177774_c(entitytype))); + if (resourcelocation != LootTables.EMPTY && this.map.remove(resourcelocation) != null) { + throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.ENTITY_TYPE.getKey(entitytype))); } @@ -160,6 +_,14 @@ } - this.field_218587_b.forEach(p_accept_1_::accept); + this.map.forEach(p_accept_1_::accept); + } + + protected Iterable> getKnownEntities() { -+ return Registry.field_212629_r; ++ return Registry.ENTITY_TYPE; + } + + protected boolean isNonLiving(EntityType entitytype) { -+ return !field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC; ++ return !SPECIAL_LOOT_TABLE_TYPES.contains(entitytype) && entitytype.getCategory() == EntityClassification.MISC; } - protected void func_218582_a(EntityType p_218582_1_, LootTable.Builder p_218582_2_) { + protected void add(EntityType p_218582_1_, LootTable.Builder p_218582_2_) { diff --git a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch index 3e36783022..cdb09ad6fe 100644 --- a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch @@ -5,32 +5,32 @@ public interface IDispenseItemBehavior { + org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); - IDispenseItemBehavior field_223216_a_ = (p_210297_0_, p_210297_1_) -> { + IDispenseItemBehavior NOOP = (p_210297_0_, p_210297_1_) -> { return p_210297_1_; }; @@ -169,7 +_,12 @@ - public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) { - Direction direction = p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a); - EntityType entitytype = ((SpawnEggItem)p_82487_2_.func_77973_b()).func_208076_b(p_82487_2_.func_77978_p()); -- entitytype.func_220331_a(p_82487_1_.func_197524_h(), p_82487_2_, (PlayerEntity)null, p_82487_1_.func_180699_d().func_177972_a(direction), SpawnReason.DISPENSER, direction != Direction.UP, false); + public ItemStack execute(IBlockSource p_82487_1_, ItemStack p_82487_2_) { + Direction direction = p_82487_1_.getBlockState().getValue(DispenserBlock.FACING); + EntityType entitytype = ((SpawnEggItem)p_82487_2_.getItem()).getType(p_82487_2_.getTag()); +- entitytype.spawn(p_82487_1_.getLevel(), p_82487_2_, (PlayerEntity)null, p_82487_1_.getPos().relative(direction), SpawnReason.DISPENSER, direction != Direction.UP, false); + try { // FORGE: fix potential crash -+ entitytype.func_220331_a(p_82487_1_.func_197524_h(), p_82487_2_, (PlayerEntity) null, p_82487_1_.func_180699_d().func_177972_a(direction), SpawnReason.DISPENSER, direction != Direction.UP, false); ++ entitytype.spawn(p_82487_1_.getLevel(), p_82487_2_, (PlayerEntity) null, p_82487_1_.getPos().relative(direction), SpawnReason.DISPENSER, direction != Direction.UP, false); + } catch (Exception e) { -+ LOGGER.error("Error while dispensing spawn egg from dispenser at {}", p_82487_1_.func_180699_d(), e); -+ return ItemStack.field_190927_a; ++ LOGGER.error("Error while dispensing spawn egg from dispenser at {}", p_82487_1_.getPos(), e); ++ return ItemStack.EMPTY; + } - p_82487_2_.func_190918_g(1); + p_82487_2_.shrink(1); return p_82487_2_; } @@ -373,8 +_,9 @@ - world.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(world, blockpos)); - } else if (CampfireBlock.func_241470_h_(blockstate)) { - world.func_175656_a(blockpos, blockstate.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true))); -- } else if (blockstate.func_177230_c() instanceof TNTBlock) { -- TNTBlock.func_196534_a(world, blockpos); -+ } else if (blockstate.isFlammable(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d())) { -+ blockstate.catchFire(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d(), null); -+ if (blockstate.func_177230_c() instanceof TNTBlock) - world.func_217377_a(blockpos, false); + world.setBlockAndUpdate(blockpos, AbstractFireBlock.getState(world, blockpos)); + } else if (CampfireBlock.canLight(blockstate)) { + world.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, Boolean.valueOf(true))); +- } else if (blockstate.getBlock() instanceof TNTBlock) { +- TNTBlock.explode(world, blockpos); ++ } else if (blockstate.isFlammable(world, blockpos, p_82487_1_.getBlockState().getValue(DispenserBlock.FACING).getOpposite())) { ++ blockstate.catchFire(world, blockpos, p_82487_1_.getBlockState().getValue(DispenserBlock.FACING).getOpposite(), null); ++ if (blockstate.getBlock() instanceof TNTBlock) + world.removeBlock(blockpos, false); } else { - this.func_239796_a_(false); + this.setSuccess(false); diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index c9f257faf8..1a5d4099c9 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -6,12 +6,12 @@ -public abstract class Enchantment { +public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry { -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.func_242178_a().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.ENCHANTMENTS)); - private final EquipmentSlotType[] field_185263_a; - private final Enchantment.Rarity field_77333_a; - public final EnchantmentType field_77351_y; ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.getInstance().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.ENCHANTMENTS)); + private final EquipmentSlotType[] slots; + private final Enchantment.Rarity rarity; + public final EnchantmentType category; @@ -37,6 +_,14 @@ - this.field_185263_a = p_i46731_3_; + this.slots = p_i46731_3_; } + public java.util.Set getTags() { @@ -19,25 +19,25 @@ + } + + public boolean isIn(net.minecraft.tags.ITag tag) { -+ return tag.func_230235_a_(this); ++ return tag.contains(this); + } + - public Map func_222181_a(LivingEntity p_222181_1_) { + public Map getSlotItems(LivingEntity p_222181_1_) { Map map = Maps.newEnumMap(EquipmentSlotType.class); @@ -114,7 +_,7 @@ } - public boolean func_92089_a(ItemStack p_92089_1_) { -- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b()); + public boolean canEnchant(ItemStack p_92089_1_) { +- return this.category.canEnchant(p_92089_1_.getItem()); + return canApplyAtEnchantingTable(p_92089_1_); } - public void func_151368_a(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) { + public void doPostAttack(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) { @@ -136,6 +_,24 @@ } - public boolean func_230310_i_() { + public boolean isDiscoverable() { + return true; + } + diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index d752315bd8..fad78a1d68 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -2,28 +2,28 @@ +++ b/net/minecraft/enchantment/EnchantmentHelper.java @@ -274,7 +_,7 @@ - public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { - Item item = p_77514_3_.func_77973_b(); -- int i = item.func_77619_b(); + public static int getEnchantmentCost(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { + Item item = p_77514_3_.getItem(); +- int i = item.getEnchantmentValue(); + int i = p_77514_3_.getItemEnchantability(); if (i <= 0) { return 0; } else { @@ -312,7 +_,7 @@ - public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_, boolean p_77513_3_) { + public static List selectEnchantment(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_, boolean p_77513_3_) { List list = Lists.newArrayList(); - Item item = p_77513_1_.func_77973_b(); -- int i = item.func_77619_b(); + Item item = p_77513_1_.getItem(); +- int i = item.getEnchantmentValue(); + int i = p_77513_1_.getItemEnchantability(); if (i <= 0) { return list; } else { @@ -365,7 +_,7 @@ - boolean flag = p_185291_1_.func_77973_b() == Items.field_151122_aG; + boolean flag = p_185291_1_.getItem() == Items.BOOK; - for(Enchantment enchantment : Registry.field_212628_q) { -- if ((!enchantment.func_185261_e() || p_185291_2_) && enchantment.func_230310_i_() && (enchantment.field_77351_y.func_77557_a(item) || flag)) { -+ if ((!enchantment.func_185261_e() || p_185291_2_) && enchantment.func_230310_i_() && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) { - for(int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i) { - if (p_185291_0_ >= enchantment.func_77321_a(i) && p_185291_0_ <= enchantment.func_223551_b(i)) { + for(Enchantment enchantment : Registry.ENCHANTMENT) { +- if ((!enchantment.isTreasureOnly() || p_185291_2_) && enchantment.isDiscoverable() && (enchantment.category.canEnchant(item) || flag)) { ++ if ((!enchantment.isTreasureOnly() || p_185291_2_) && enchantment.isDiscoverable() && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) { + for(int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) { + if (p_185291_0_ >= enchantment.getMinCost(i) && p_185291_0_ <= enchantment.getMaxCost(i)) { list.add(new EnchantmentData(enchantment, i)); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch index 6691ea30c3..a980d5b9f0 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch @@ -7,13 +7,13 @@ -public enum EnchantmentType { +public enum EnchantmentType implements net.minecraftforge.common.IExtensibleEnum { ARMOR { - public boolean func_77557_a(Item p_77557_1_) { + public boolean canEnchant(Item p_77557_1_) { return p_77557_1_ instanceof ArmorItem; @@ -86,5 +_,16 @@ private EnchantmentType() { } -- public abstract boolean func_77557_a(Item p_77557_1_); +- public abstract boolean canEnchant(Item p_77557_1_); + private java.util.function.Predicate delegate; + private EnchantmentType(java.util.function.Predicate delegate) { + this.delegate = delegate; @@ -23,7 +23,7 @@ + throw new IllegalStateException("Enum not extended"); + } + -+ public boolean func_77557_a(Item p_77557_1_) { ++ public boolean canEnchant(Item p_77557_1_) { + return this.delegate == null ? false : this.delegate.test(p_77557_1_); + } } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch index c6a22a2b7b..95cdc7078e 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch @@ -6,5 +6,5 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class Enchantments { - private static final EquipmentSlotType[] field_222195_L = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; - public static final Enchantment field_180310_c = func_222191_a("protection", new ProtectionEnchantment(Enchantment.Rarity.COMMON, ProtectionEnchantment.Type.ALL, field_222195_L)); + private static final EquipmentSlotType[] ARMOR_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; + public static final Enchantment ALL_DAMAGE_PROTECTION = register("protection", new ProtectionEnchantment(Enchantment.Rarity.COMMON, ProtectionEnchantment.Type.ALL, ARMOR_SLOTS)); diff --git a/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch index e93f81db7e..42f53160d5 100644 --- a/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/enchantment/FrostWalkerEnchantment.java +++ b/net/minecraft/enchantment/FrostWalkerEnchantment.java @@ -42,9 +_,10 @@ - if (blockpos.func_218137_a(p_185266_0_.func_213303_ch(), (double)f)) { - blockpos$mutable.func_181079_c(blockpos.func_177958_n(), blockpos.func_177956_o() + 1, blockpos.func_177952_p()); - BlockState blockstate1 = p_185266_1_.func_180495_p(blockpos$mutable); -- if (blockstate1.func_196958_f()) { + if (blockpos.closerThan(p_185266_0_.position(), (double)f)) { + blockpos$mutable.set(blockpos.getX(), blockpos.getY() + 1, blockpos.getZ()); + BlockState blockstate1 = p_185266_1_.getBlockState(blockpos$mutable); +- if (blockstate1.isAir()) { + if (blockstate1.isAir(p_185266_1_, blockpos$mutable)) { - BlockState blockstate2 = p_185266_1_.func_180495_p(blockpos); -- if (blockstate2.func_185904_a() == Material.field_151586_h && blockstate2.func_177229_b(FlowingFluidBlock.field_176367_b) == 0 && blockstate.func_196955_c(p_185266_1_, blockpos) && p_185266_1_.func_226663_a_(blockstate, blockpos, ISelectionContext.func_216377_a())) { -+ boolean isFull = blockstate2.func_177230_c() == Blocks.field_150355_j && blockstate2.func_177229_b(FlowingFluidBlock.field_176367_b) == 0; //TODO: Forge, modded waters? -+ if (blockstate2.func_185904_a() == Material.field_151586_h && isFull && blockstate.func_196955_c(p_185266_1_, blockpos) && p_185266_1_.func_226663_a_(blockstate, blockpos, ISelectionContext.func_216377_a()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_185266_0_, net.minecraftforge.common.util.BlockSnapshot.create(p_185266_1_.func_234923_W_(), p_185266_1_, blockpos), net.minecraft.util.Direction.UP)) { - p_185266_1_.func_175656_a(blockpos, blockstate); - p_185266_1_.func_205220_G_().func_205360_a(blockpos, Blocks.field_185778_de, MathHelper.func_76136_a(p_185266_0_.func_70681_au(), 60, 120)); + BlockState blockstate2 = p_185266_1_.getBlockState(blockpos); +- if (blockstate2.getMaterial() == Material.WATER && blockstate2.getValue(FlowingFluidBlock.LEVEL) == 0 && blockstate.canSurvive(p_185266_1_, blockpos) && p_185266_1_.isUnobstructed(blockstate, blockpos, ISelectionContext.empty())) { ++ boolean isFull = blockstate2.getBlock() == Blocks.WATER && blockstate2.getValue(FlowingFluidBlock.LEVEL) == 0; //TODO: Forge, modded waters? ++ if (blockstate2.getMaterial() == Material.WATER && isFull && blockstate.canSurvive(p_185266_1_, blockpos) && p_185266_1_.isUnobstructed(blockstate, blockpos, ISelectionContext.empty()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_185266_0_, net.minecraftforge.common.util.BlockSnapshot.create(p_185266_1_.dimension(), p_185266_1_, blockpos), net.minecraft.util.Direction.UP)) { + p_185266_1_.setBlockAndUpdate(blockpos, blockstate); + p_185266_1_.getBlockTicks().scheduleTick(blockpos, Blocks.FROSTED_ICE, MathHelper.nextInt(p_185266_0_.getRandom(), 60, 120)); } diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 0be7959407..ec1766f94e 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -6,39 +6,39 @@ -public abstract class Entity implements INameable, ICommandSource { +public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity { - protected static final Logger field_184243_a = LogManager.getLogger(); - protected static final AtomicInteger field_213331_b = new AtomicInteger(); - private static final List field_190535_b = Collections.emptyList(); - private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - private static double field_70155_l = 1.0D; + protected static final Logger LOGGER = LogManager.getLogger(); + protected static final AtomicInteger ENTITY_COUNTER = new AtomicInteger(); + private static final List EMPTY_LIST = Collections.emptyList(); + private static final AxisAlignedBB INITIAL_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + private static double viewScale = 1.0D; + @Deprecated // Forge: Use the getter to allow overriding in mods - private final EntityType field_200606_g; - private int field_145783_c = field_213331_b.incrementAndGet(); - public boolean field_70156_m; + private final EntityType type; + private int id = ENTITY_COUNTER.incrementAndGet(); + public boolean blocksBuilding; @@ -140,6 +_,7 @@ - public boolean field_70124_G; - public boolean field_70133_I; - protected Vector3d field_213328_B = Vector3d.field_186680_a; + public boolean verticalCollision; + public boolean hurtMarked; + protected Vector3d stuckSpeedMultiplier = Vector3d.ZERO; + @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information. - public boolean field_70128_L; - public float field_70141_P; - public float field_70140_Q; + public boolean removed; + public float walkDistO; + public float walkDist; @@ -195,6 +_,7 @@ - private float field_213326_aJ; + private float eyeHeight; public Entity(EntityType p_i48580_1_, World p_i48580_2_) { + super(Entity.class); - this.field_200606_g = p_i48580_1_; - this.field_70170_p = p_i48580_2_; - this.field_213325_aI = p_i48580_1_.func_220334_j(); + this.type = p_i48580_1_; + this.level = p_i48580_2_; + this.dimensions = p_i48580_1_.getDimensions(); @@ -211,7 +_,11 @@ - this.field_70180_af.func_187214_a(field_189655_aD, false); - this.field_70180_af.func_187214_a(field_213330_X, Pose.STANDING); - this.func_70088_a(); -- this.field_213326_aJ = this.func_213316_a(Pose.STANDING, this.field_213325_aI); -+ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, Pose.STANDING, this.field_213325_aI, this.func_213316_a(Pose.STANDING, this.field_213325_aI)); -+ this.field_213325_aI = sizeEvent.getNewSize(); -+ this.field_213326_aJ = sizeEvent.getNewEyeHeight(); + this.entityData.define(DATA_NO_GRAVITY, false); + this.entityData.define(DATA_POSE, Pose.STANDING); + this.defineSynchedData(); +- this.eyeHeight = this.getEyeHeight(Pose.STANDING, this.dimensions); ++ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.getEyeHeight(Pose.STANDING, this.dimensions)); ++ this.dimensions = sizeEvent.getNewSize(); ++ this.eyeHeight = sizeEvent.getNewEyeHeight(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); + this.gatherCapabilities(); } @@ -47,216 +47,216 @@ @@ -317,7 +_,13 @@ } - public void func_70106_y() { + public void remove() { + this.remove(false); + } + + public void remove(boolean keepData) { - this.field_70128_L = true; + this.removed = true; + if (!keepData) + this.invalidateCaps(); } - public void func_213301_b(Pose p_213301_1_) { + public void setPose(Pose p_213301_1_) { @@ -560,7 +_,7 @@ - this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vector3d)) * 0.6D); - this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D); -- if (this.field_82151_R > this.field_70150_b && !blockstate.func_196958_f()) { -+ if (this.field_82151_R > this.field_70150_b && !blockstate.isAir(this.field_70170_p, blockpos)) { - this.field_70150_b = this.func_203009_ad(); - if (this.func_70090_H()) { - Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this; + this.walkDist = (float)((double)this.walkDist + (double)MathHelper.sqrt(getHorizontalDistanceSqr(vector3d)) * 0.6D); + this.moveDist = (float)((double)this.moveDist + (double)MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D); +- if (this.moveDist > this.nextStep && !blockstate.isAir()) { ++ if (this.moveDist > this.nextStep && !blockstate.isAir(this.level, blockpos)) { + this.nextStep = this.nextStep(); + if (this.isInWater()) { + Entity entity = this.isVehicle() && this.getControllingPassenger() != null ? this.getControllingPassenger() : this; @@ -575,7 +_,7 @@ } else { - this.func_180429_a(blockpos, blockstate); + this.playStepSound(blockpos, blockstate); } -- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.func_196958_f()) { -+ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.isAir(this.field_70170_p, blockpos)) { - this.field_191959_ay = this.func_191954_d(this.field_82151_R); +- } else if (this.moveDist > this.nextFlap && this.makeFlySound() && blockstate.isAir()) { ++ } else if (this.moveDist > this.nextFlap && this.makeFlySound() && blockstate.isAir(this.level, blockpos)) { + this.nextFlap = this.playFlySound(this.moveDist); } } @@ -591,8 +_,9 @@ - float f2 = this.func_225515_ai_(); - this.func_213317_d(this.func_213322_ci().func_216372_d((double)f2, 1.0D, (double)f2)); -- if (this.field_70170_p.func_234939_c_(this.func_174813_aQ().func_186664_h(0.001D)).noneMatch((p_233572_0_) -> { -- return p_233572_0_.func_235714_a_(BlockTags.field_232872_am_) || p_233572_0_.func_203425_a(Blocks.field_150353_l); -+ if (BlockPos.func_239581_a_(this.func_174813_aQ().func_186664_h(0.001D)).noneMatch((p_233572_0_) -> { -+ BlockState state = field_70170_p.func_180495_p(p_233572_0_); -+ return state.func_235714_a_(BlockTags.field_232872_am_) || state.func_203425_a(Blocks.field_150353_l) || state.isBurning(field_70170_p, p_233572_0_); - }) && this.field_190534_ay <= 0) { - this.func_241209_g_(-this.func_190531_bD()); + float f2 = this.getBlockSpeedFactor(); + this.setDeltaMovement(this.getDeltaMovement().multiply((double)f2, 1.0D, (double)f2)); +- if (this.level.getBlockStatesIfLoaded(this.getBoundingBox().deflate(0.001D)).noneMatch((p_233572_0_) -> { +- return p_233572_0_.is(BlockTags.FIRE) || p_233572_0_.is(Blocks.LAVA); ++ if (BlockPos.betweenClosedStream(this.getBoundingBox().deflate(0.001D)).noneMatch((p_233572_0_) -> { ++ BlockState state = level.getBlockState(p_233572_0_); ++ return state.is(BlockTags.FIRE) || state.is(Blocks.LAVA) || state.isBurning(level, p_233572_0_); + }) && this.remainingFireTicks <= 0) { + this.setRemainingFireTicks(-this.getFireImmuneTicks()); } @@ -611,11 +_,10 @@ - int j = MathHelper.func_76128_c(this.field_233557_ao_.field_72448_b - (double)0.2F); - int k = MathHelper.func_76128_c(this.field_233557_ao_.field_72449_c); + int j = MathHelper.floor(this.position.y - (double)0.2F); + int k = MathHelper.floor(this.position.z); BlockPos blockpos = new BlockPos(i, j, k); -- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f()) { -+ if (this.field_70170_p.func_175623_d(blockpos)) { - BlockPos blockpos1 = blockpos.func_177977_b(); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos1); -- Block block = blockstate.func_177230_c(); -- if (block.func_203417_a(BlockTags.field_219748_G) || block.func_203417_a(BlockTags.field_219757_z) || block instanceof FenceGateBlock) { -+ if (blockstate.collisionExtendsVertically(this.field_70170_p, blockpos1, this)) { +- if (this.level.getBlockState(blockpos).isAir()) { ++ if (this.level.isEmptyBlock(blockpos)) { + BlockPos blockpos1 = blockpos.below(); + BlockState blockstate = this.level.getBlockState(blockpos1); +- Block block = blockstate.getBlock(); +- if (block.is(BlockTags.FENCES) || block.is(BlockTags.WALLS) || block instanceof FenceGateBlock) { ++ if (blockstate.collisionExtendsVertically(this.level, blockpos1, this)) { return blockpos1; } } @@ -801,6 +_,7 @@ - public void func_174829_m() { - AxisAlignedBB axisalignedbb = this.func_174813_aQ(); - this.func_226288_n_((axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D, axisalignedbb.field_72338_b, (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D); -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + public void setLocationFromBoundingbox() { + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + this.setPosRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D); ++ if (this.isAddedToWorld() && !this.level.isClientSide && level instanceof ServerWorld) ((ServerWorld)this.level).updateChunkPos(this); // Forge - Process chunk registration after moving. } - protected SoundEvent func_184184_Z() { + protected SoundEvent getSwimSound() { @@ -849,7 +_,7 @@ - protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { - if (!p_180429_2_.func_185904_a().func_76224_d()) { - BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); -- SoundType soundtype = blockstate.func_203425_a(Blocks.field_150433_aE) ? blockstate.func_215695_r() : p_180429_2_.func_215695_r(); -+ SoundType soundtype = blockstate.func_203425_a(Blocks.field_150433_aE) ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); - this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); + protected void playStepSound(BlockPos p_180429_1_, BlockState p_180429_2_) { + if (!p_180429_2_.getMaterial().isLiquid()) { + BlockState blockstate = this.level.getBlockState(p_180429_1_.above()); +- SoundType soundtype = blockstate.is(Blocks.SNOW) ? blockstate.getSoundType() : p_180429_2_.getSoundType(); ++ SoundType soundtype = blockstate.is(Blocks.SNOW) ? blockstate.getSoundType(level, p_180429_1_, this) : p_180429_2_.getSoundType(level, p_180429_1_, this); + this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch()); } } @@ -1056,9 +_,10 @@ - int k = MathHelper.func_76128_c(this.func_226281_cx_()); + int k = MathHelper.floor(this.getZ()); BlockPos blockpos = new BlockPos(i, j, k); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -+ if(!blockstate.addRunningEffects(field_70170_p, blockpos, this)) - if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { - Vector3d vector3d = this.func_213322_ci(); -- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vector3d.field_72450_a * -4.0D, 1.5D, vector3d.field_72449_c * -4.0D); -+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.func_226277_ct_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + (this.field_70146_Z.nextDouble() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vector3d.field_72450_a * -4.0D, 1.5D, vector3d.field_72449_c * -4.0D); + BlockState blockstate = this.level.getBlockState(blockpos); ++ if(!blockstate.addRunningEffects(level, blockpos, this)) + if (blockstate.getRenderShape() != BlockRenderType.INVISIBLE) { + Vector3d vector3d = this.getDeltaMovement(); +- this.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate), this.getX() + (this.random.nextDouble() - 0.5D) * (double)this.dimensions.width, this.getY() + 0.1D, this.getZ() + (this.random.nextDouble() - 0.5D) * (double)this.dimensions.width, vector3d.x * -4.0D, 1.5D, vector3d.z * -4.0D); ++ this.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate).setPos(blockpos), this.getX() + (this.random.nextDouble() - 0.5D) * (double)this.dimensions.width, this.getY() + 0.1D, this.getZ() + (this.random.nextDouble() - 0.5D) * (double)this.dimensions.width, vector3d.x * -4.0D, 1.5D, vector3d.z * -4.0D); } } @@ -1377,6 +_,7 @@ - if (this.field_184238_ar) { - p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); + if (this.glowing) { + p_189511_1_.putBoolean("Glowing", this.glowing); } -+ p_189511_1_.func_74757_a("CanUpdate", canUpdate); ++ p_189511_1_.putBoolean("CanUpdate", canUpdate); - if (!this.field_184236_aF.isEmpty()) { + if (!this.tags.isEmpty()) { ListNBT listnbt = new ListNBT(); @@ -1388,6 +_,10 @@ - p_189511_1_.func_218657_a("Tags", listnbt); + p_189511_1_.put("Tags", listnbt); } + CompoundNBT caps = serializeCaps(); -+ if (caps != null) p_189511_1_.func_218657_a("ForgeCaps", caps); -+ if (persistentData != null) p_189511_1_.func_218657_a("ForgeData", persistentData); ++ if (caps != null) p_189511_1_.put("ForgeCaps", caps); ++ if (persistentData != null) p_189511_1_.put("ForgeData", persistentData); + - this.func_213281_b(p_189511_1_); - if (this.func_184207_aI()) { + this.addAdditionalSaveData(p_189511_1_); + if (this.isVehicle()) { ListNBT listnbt1 = new ListNBT(); @@ -1458,6 +_,9 @@ - this.func_174810_b(p_70020_1_.func_74767_n("Silent")); - this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); - this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); -+ if (p_70020_1_.func_150297_b("ForgeData", 10)) persistentData = p_70020_1_.func_74775_l("ForgeData"); -+ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate")); -+ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps")); - if (p_70020_1_.func_150297_b("Tags", 9)) { - this.field_184236_aF.clear(); - ListNBT listnbt3 = p_70020_1_.func_150295_c("Tags", 8); + this.setSilent(p_70020_1_.getBoolean("Silent")); + this.setNoGravity(p_70020_1_.getBoolean("NoGravity")); + this.setGlowing(p_70020_1_.getBoolean("Glowing")); ++ if (p_70020_1_.contains("ForgeData", 10)) persistentData = p_70020_1_.getCompound("ForgeData"); ++ if (p_70020_1_.contains("CanUpdate", 99)) this.canUpdate(p_70020_1_.getBoolean("CanUpdate")); ++ if (p_70020_1_.contains("ForgeCaps", 10)) deserializeCaps(p_70020_1_.getCompound("ForgeCaps")); + if (p_70020_1_.contains("Tags", 9)) { + this.tags.clear(); + ListNBT listnbt3 = p_70020_1_.getList("Tags", 8); @@ -1546,6 +_,8 @@ } else { - ItemEntity itementity = new ItemEntity(this.field_70170_p, this.func_226277_ct_(), this.func_226278_cu_() + (double)p_70099_2_, this.func_226281_cx_(), p_70099_1_); - itementity.func_174869_p(); + ItemEntity itementity = new ItemEntity(this.level, this.getX(), this.getY() + (double)p_70099_2_, this.getZ(), p_70099_1_); + itementity.setDefaultPickUpDelay(); + if (captureDrops() != null) captureDrops().add(itementity); + else - this.field_70170_p.func_217376_c(itementity); + this.level.addFreshEntity(itementity); return itementity; } @@ -1582,6 +_,7 @@ - public void func_70098_U() { - this.func_213317_d(Vector3d.field_186680_a); + public void rideTick() { + this.setDeltaMovement(Vector3d.ZERO); + if (canUpdate()) - this.func_70071_h_(); - if (this.func_184218_aH()) { - this.func_184187_bx().func_184232_k(this); + this.tick(); + if (this.isPassenger()) { + this.getVehicle().positionRider(this); @@ -1627,6 +_,7 @@ } } + if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; - if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { - if (this.func_184218_aH()) { - this.func_184210_p(); + if (p_184205_2_ || this.canRide(p_184205_1_) && p_184205_1_.canAddPassenger(this)) { + if (this.isPassenger()) { + this.stopRiding(); @@ -1659,6 +_,7 @@ - public void func_233575_bb_() { - if (this.field_184239_as != null) { - Entity entity = this.field_184239_as; + public void removeVehicle() { + if (this.vehicle != null) { + Entity entity = this.vehicle; + if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; - this.field_184239_as = null; - entity.func_184225_p(this); + this.vehicle = null; + entity.removePassenger(this); } @@ -1816,6 +_,7 @@ - return !this.func_184188_bt().isEmpty(); + return !this.getPassengers().isEmpty(); } + @Deprecated //Forge: Use rider sensitive version - public boolean func_205710_ba() { + public boolean rideableUnderWater() { return true; } @@ -1948,7 +_,7 @@ - this.func_70015_d(8); + this.setSecondsOnFire(8); } -- this.func_70097_a(DamageSource.field_180137_b, 5.0F); -+ this.func_70097_a(DamageSource.field_180137_b, p_241841_2_.getDamage()); +- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F); ++ this.hurt(DamageSource.LIGHTNING_BOLT, p_241841_2_.getDamage()); } - public void func_203002_i(boolean p_203002_1_) { + public void onAboveBubbleCol(boolean p_203002_1_) { @@ -2032,7 +_,7 @@ } - protected ITextComponent func_225513_by_() { -- return this.field_200606_g.func_212546_e(); -+ return this.func_200600_R().func_212546_e(); // Forge: Use getter to allow overriding by mods + protected ITextComponent getTypeName() { +- return this.type.getDescription(); ++ return this.getType().getDescription(); // Forge: Use getter to allow overriding by mods } - public boolean func_70028_i(Entity p_70028_1_) { + public boolean is(Entity p_70028_1_) { @@ -2087,14 +_,19 @@ @Nullable - public Entity func_241206_a_(ServerWorld p_241206_1_) { -+ return this.changeDimension(p_241206_1_, p_241206_1_.func_85176_s()); + public Entity changeDimension(ServerWorld p_241206_1_) { ++ return this.changeDimension(p_241206_1_, p_241206_1_.getPortalForcer()); + } + @Nullable + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - if (this.field_70170_p instanceof ServerWorld && !this.field_70128_L) { - this.field_70170_p.func_217381_Z().func_76320_a("changeDimension"); - this.func_213319_R(); - this.field_70170_p.func_217381_Z().func_76320_a("reposition"); -- PortalInfo portalinfo = this.func_241829_a(p_241206_1_); -+ PortalInfo portalinfo = teleporter.getPortalInfo(this, p_241206_1_, this::func_241829_a); + if (this.level instanceof ServerWorld && !this.removed) { + this.level.getProfiler().push("changeDimension"); + this.unRide(); + this.level.getProfiler().push("reposition"); +- PortalInfo portalinfo = this.findDimensionEntryPoint(p_241206_1_); ++ PortalInfo portalinfo = teleporter.getPortalInfo(this, p_241206_1_, this::findDimensionEntryPoint); if (portalinfo == null) { return null; } else { -+ Entity transportedEntity = teleporter.placeEntity(this, (ServerWorld) this.field_70170_p, p_241206_1_, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic - this.field_70170_p.func_217381_Z().func_219895_b("reloading"); - Entity entity = this.func_200600_R().func_200721_a(p_241206_1_); ++ Entity transportedEntity = teleporter.placeEntity(this, (ServerWorld) this.level, p_241206_1_, this.yRot, spawnPortal -> { //Forge: Start vanilla logic + this.level.getProfiler().popPush("reloading"); + Entity entity = this.getType().create(p_241206_1_); if (entity != null) { @@ -2102,17 +_,19 @@ - entity.func_70012_b(portalinfo.field_222505_a.field_72450_a, portalinfo.field_222505_a.field_72448_b, portalinfo.field_222505_a.field_72449_c, portalinfo.field_242960_c, entity.field_70125_A); - entity.func_213317_d(portalinfo.field_222506_b); - p_241206_1_.func_217460_e(entity); -- if (p_241206_1_.func_234923_W_() == World.field_234920_i_) { -+ if (spawnPortal && p_241206_1_.func_234923_W_() == World.field_234920_i_) { - ServerWorld.func_241121_a_(p_241206_1_); + entity.moveTo(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z, portalinfo.yRot, entity.xRot); + entity.setDeltaMovement(portalinfo.speed); + p_241206_1_.addFromAnotherDimension(entity); +- if (p_241206_1_.dimension() == World.END) { ++ if (spawnPortal && p_241206_1_.dimension() == World.END) { + ServerWorld.makeObsidianPlatform(p_241206_1_); } } + return entity; + }); //Forge: End vanilla logic - this.func_241204_bJ_(); - this.field_70170_p.func_217381_Z().func_76319_b(); - ((ServerWorld)this.field_70170_p).func_82742_i(); - p_241206_1_.func_82742_i(); - this.field_70170_p.func_217381_Z().func_76319_b(); + this.removeAfterChangingDimensions(); + this.level.getProfiler().pop(); + ((ServerWorld)this.level).resetEmptyTime(); + p_241206_1_.resetEmptyTime(); + this.level.getProfiler().pop(); - return entity; + return transportedEntity; } @@ -266,76 +266,76 @@ vector3d = new Vector3d(0.5D, 0.0D, 0.0D); } -- return PortalSize.func_242963_a(p_241829_1_, p_242275_2_, direction$axis, vector3d, this.func_213305_a(this.func_213283_Z()), this.func_213322_ci(), this.field_70177_z, this.field_70125_A); -+ return PortalSize.func_242963_a(p_241829_1_, p_242275_2_, direction$axis, vector3d, this.getDimensionsForge(this.func_213283_Z()), this.func_213322_ci(), this.field_70177_z, this.field_70125_A); +- return PortalSize.createPortalInfo(p_241829_1_, p_242275_2_, direction$axis, vector3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.yRot, this.xRot); ++ return PortalSize.createPortalInfo(p_241829_1_, p_242275_2_, direction$axis, vector3d, this.getDimensionsForge(this.getPose()), this.getDeltaMovement(), this.yRot, this.xRot); }).orElse((PortalInfo)null); } } else { @@ -2170,7 +_,7 @@ } - protected Vector3d func_241839_a(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_) { -- return PortalSize.func_242973_a(p_241839_2_, p_241839_1_, this.func_213303_ch(), this.func_213305_a(this.func_213283_Z())); -+ return PortalSize.func_242973_a(p_241839_2_, p_241839_1_, this.func_213303_ch(), this.getDimensionsForge(this.func_213283_Z())); + protected Vector3d getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_) { +- return PortalSize.getRelativePosition(p_241839_2_, p_241839_1_, this.position(), this.getDimensions(this.getPose())); ++ return PortalSize.getRelativePosition(p_241839_2_, p_241839_1_, this.position(), this.getDimensionsForge(this.getPose())); } - protected Optional func_241830_a(ServerWorld p_241830_1_, BlockPos p_241830_2_, boolean p_241830_3_) { + protected Optional getExitPortal(ServerWorld p_241830_1_, BlockPos p_241830_2_, boolean p_241830_3_) { @@ -2321,8 +_,10 @@ - EntitySize entitysize = this.field_213325_aI; - Pose pose = this.func_213283_Z(); - EntitySize entitysize1 = this.func_213305_a(pose); -+ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, pose, entitysize, entitysize1, this.func_213316_a(pose, entitysize1)); + EntitySize entitysize = this.dimensions; + Pose pose = this.getPose(); + EntitySize entitysize1 = this.getDimensions(pose); ++ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, pose, entitysize, entitysize1, this.getEyeHeight(pose, entitysize1)); + entitysize1 = sizeEvent.getNewSize(); - this.field_213325_aI = entitysize1; -- this.field_213326_aJ = this.func_213316_a(pose, entitysize1); -+ this.field_213326_aJ = sizeEvent.getNewEyeHeight(); - if (entitysize1.field_220315_a < entitysize.field_220315_a) { - double d0 = (double)entitysize1.field_220315_a / 2.0D; - this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0)); + this.dimensions = entitysize1; +- this.eyeHeight = this.getEyeHeight(pose, entitysize1); ++ this.eyeHeight = sizeEvent.getNewEyeHeight(); + if (entitysize1.width < entitysize.width) { + double d0 = (double)entitysize1.width / 2.0D; + this.setBoundingBox(new AxisAlignedBB(this.getX() - d0, this.getY(), this.getZ() - d0, this.getX() + d0, this.getY() + (double)entitysize1.height, this.getZ() + d0)); @@ -2363,7 +_,7 @@ } - protected AxisAlignedBB func_213321_d(Pose p_213321_1_) { -- EntitySize entitysize = this.func_213305_a(p_213321_1_); + protected AxisAlignedBB getBoundingBoxForPose(Pose p_213321_1_) { +- EntitySize entitysize = this.getDimensions(p_213321_1_); + EntitySize entitysize = this.getDimensionsForge(p_213321_1_); - float f = entitysize.field_220315_a / 2.0F; - Vector3d vector3d = new Vector3d(this.func_226277_ct_() - (double)f, this.func_226278_cu_(), this.func_226281_cx_() - (double)f); - Vector3d vector3d1 = new Vector3d(this.func_226277_ct_() + (double)f, this.func_226278_cu_() + (double)entitysize.field_220316_b, this.func_226281_cx_() + (double)f); + float f = entitysize.width / 2.0F; + Vector3d vector3d = new Vector3d(this.getX() - (double)f, this.getY(), this.getZ() - (double)f); + Vector3d vector3d1 = new Vector3d(this.getX() + (double)f, this.getY() + (double)entitysize.height, this.getZ() + (double)f); @@ -2374,13 +_,17 @@ - this.field_70121_D = p_174826_1_; + this.bb = p_174826_1_; } + /** + * @deprecated Can be overridden but call {@link #getEyeHeightForge(Pose, EntitySize)} instead. + */ + @Deprecated - protected float func_213316_a(Pose p_213316_1_, EntitySize p_213316_2_) { - return p_213316_2_.field_220316_b * 0.85F; + protected float getEyeHeight(Pose p_213316_1_, EntitySize p_213316_2_) { + return p_213316_2_.height * 0.85F; } @OnlyIn(Dist.CLIENT) - public float func_213307_e(Pose p_213307_1_) { -- return this.func_213316_a(p_213307_1_, this.func_213305_a(p_213307_1_)); + public float getEyeHeight(Pose p_213307_1_) { +- return this.getEyeHeight(p_213307_1_, this.getDimensions(p_213307_1_)); + return this.getEyeHeightForge(p_213307_1_, this.getDimensionsForge(p_213307_1_)); } - public final float func_70047_e() { + public final float getEyeHeight() { @@ -2720,6 +_,10 @@ - public abstract IPacket func_213297_N(); + public abstract IPacket getAddEntityPacket(); + /** + * @deprecated Can be overridden but call {@link #getDimensionsForge(Pose)} instead. + */ + @Deprecated - public EntitySize func_213305_a(Pose p_213305_1_) { - return this.field_200606_g.func_220334_j(); + public EntitySize getDimensions(Pose p_213305_1_) { + return this.type.getDimensions(); } @@ -2796,6 +_,7 @@ - this.field_233555_aA_ = true; + this.movedSinceLastChunkCheck = true; } -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && !this.field_70128_L) this.field_70170_p.func_212866_a_((int) Math.floor(p_226288_1_) >> 4, (int) Math.floor(p_226288_5_) >> 4); // Forge - ensure target chunk is loaded. ++ if (this.isAddedToWorld() && !this.level.isClientSide && !this.removed) this.level.getChunk((int) Math.floor(p_226288_1_) >> 4, (int) Math.floor(p_226288_5_) >> 4); // Forge - ensure target chunk is loaded. } @@ -376,10 +376,10 @@ + } + @Override + public boolean canTrample(BlockState state, BlockPos pos, float fallDistance) { -+ return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F ++ return level.random.nextFloat() < fallDistance - 0.5F + && this instanceof LivingEntity -+ && (this instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this)) -+ && this.func_213311_cf() * this.func_213311_cf() * this.func_213302_cg() > 0.512F; ++ && (this instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, this)) ++ && this.getBbWidth() * this.getBbWidth() * this.getBbHeight() > 0.512F; + } + + /** @@ -400,7 +400,7 @@ + + @Override + public void revive() { -+ this.field_70128_L = false; ++ this.removed = false; + this.reviveCaps(); + } + @@ -409,6 +409,6 @@ + * Accessor method for {@link #getEyeHeight(Pose, EntitySize)} + */ + public float getEyeHeightAccess(Pose pose, EntitySize size) { -+ return this.func_213316_a(pose, size); ++ return this.getEyeHeight(pose, size); } } diff --git a/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch index 28beae1fc6..e70f7ca7db 100644 --- a/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch @@ -13,15 +13,15 @@ WATER_AMBIENT("water_ambient", 20, true, false, 64), MISC("misc", -1, true, true, 128); -- public static final Codec field_233667_g_ = IStringSerializable.func_233023_a_(EntityClassification::values, EntityClassification::func_233670_a_); -+ public static final Codec field_233667_g_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(EntityClassification::values, EntityClassification::func_233670_a_); - private static final Map field_220364_f = Arrays.stream(values()).collect(Collectors.toMap(EntityClassification::func_220363_a, (p_220362_0_) -> { +- public static final Codec CODEC = IStringSerializable.fromEnum(EntityClassification::values, EntityClassification::byName); ++ public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(EntityClassification::values, EntityClassification::byName); + private static final Map BY_NAME = Arrays.stream(values()).collect(Collectors.toMap(EntityClassification::getName, (p_220362_0_) -> { return p_220362_0_; })); @@ -55,6 +_,16 @@ - public boolean func_82705_e() { - return this.field_82707_i; + public boolean isPersistent() { + return this.isPersistent; + } + + public static EntityClassification create(String name, String id, int maxNumberOfCreatureIn, boolean isPeacefulCreatureIn, boolean isAnimalIn, int despawnDistance) { @@ -31,7 +31,7 @@ + @Override + @Deprecated + public void init() { -+ field_220364_f.put(this.func_220363_a(), this); ++ BY_NAME.put(this.getName(), this); } - public int func_233671_f_() { + public int getDespawnDistance() { diff --git a/patches/minecraft/net/minecraft/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/entity/EntityType.java.patch index 69e9c0d5af..5a47465c27 100644 --- a/patches/minecraft/net/minecraft/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityType.java.patch @@ -6,21 +6,21 @@ -public class EntityType { +public class EntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final Logger field_200731_aJ = LogManager.getLogger(); - public static final EntityType field_200788_b = func_200712_a("area_effect_cloud", EntityType.Builder.func_220322_a(AreaEffectCloudEntity::new, EntityClassification.MISC).func_220320_c().func_220321_a(6.0F, 0.5F).func_233606_a_(10).func_233608_b_(Integer.MAX_VALUE)); - public static final EntityType field_200789_c = func_200712_a("armor_stand", EntityType.Builder.func_220322_a(ArmorStandEntity::new, EntityClassification.MISC).func_220321_a(0.5F, 1.975F).func_233606_a_(10)); + private static final Logger LOGGER = LogManager.getLogger(); + public static final EntityType AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityType.Builder.of(AreaEffectCloudEntity::new, EntityClassification.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE)); + public static final EntityType ARMOR_STAND = register("armor_stand", EntityType.Builder.of(ArmorStandEntity::new, EntityClassification.MISC).sized(0.5F, 1.975F).clientTrackingRange(10)); @@ -270,6 +_,12 @@ - private ResourceLocation field_220358_bg; - private final EntitySize field_220359_bi; + private ResourceLocation lootTable; + private final EntitySize dimensions; + private final java.util.function.Predicate> velocityUpdateSupplier; + private final java.util.function.ToIntFunction> trackingRangeSupplier; + private final java.util.function.ToIntFunction> updateIntervalSupplier; + private final java.util.function.BiFunction customClientFactory; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.EntityTypeTags::func_219762_a); ++ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.EntityTypeTags::getAllTags); + - private static EntityType func_200712_a(String p_200712_0_, EntityType.Builder p_200712_1_) { - return Registry.func_218325_a(Registry.field_212629_r, p_200712_0_, p_200712_1_.func_206830_a(p_200712_0_)); + private static EntityType register(String p_200712_0_, EntityType.Builder p_200712_1_) { + return Registry.register(Registry.ENTITY_TYPE, p_200712_0_, p_200712_1_.build(p_200712_0_)); } @@ -283,6 +_,9 @@ } @@ -29,13 +29,13 @@ + this(p_i231489_1_, p_i231489_2_, p_i231489_3_, p_i231489_4_, p_i231489_5_, p_i231489_6_, p_i231489_7_, p_i231489_8_, p_i231489_9_, p_i231489_10_, EntityType::defaultVelocitySupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier, null); + } + public EntityType(EntityType.IFactory p_i231489_1_, EntityClassification p_i231489_2_, boolean p_i231489_3_, boolean p_i231489_4_, boolean p_i231489_5_, boolean p_i231489_6_, ImmutableSet p_i231489_7_, EntitySize p_i231489_8_, int p_i231489_9_, int p_i231489_10_, final java.util.function.Predicate> velocityUpdateSupplier, final java.util.function.ToIntFunction> trackingRangeSupplier, final java.util.function.ToIntFunction> updateIntervalSupplier, final java.util.function.BiFunction customClientFactory) { - this.field_200732_aK = p_i231489_1_; - this.field_220355_ba = p_i231489_2_; - this.field_225438_be = p_i231489_6_; + this.factory = p_i231489_1_; + this.category = p_i231489_2_; + this.canSpawnFarFromPlayer = p_i231489_6_; @@ -293,6 +_,10 @@ - this.field_220359_bi = p_i231489_8_; - this.field_233594_bl_ = p_i231489_9_; - this.field_233595_bm_ = p_i231489_10_; + this.dimensions = p_i231489_8_; + this.clientTrackingRange = p_i231489_9_; + this.updateInterval = p_i231489_10_; + this.velocityUpdateSupplier = velocityUpdateSupplier; + this.trackingRangeSupplier = trackingRangeSupplier; + this.updateIntervalSupplier = updateIntervalSupplier; @@ -44,43 +44,43 @@ @Nullable @@ -304,6 +_,7 @@ - public T func_220342_a(ServerWorld p_220342_1_, @Nullable CompoundNBT p_220342_2_, @Nullable ITextComponent p_220342_3_, @Nullable PlayerEntity p_220342_4_, BlockPos p_220342_5_, SpawnReason p_220342_6_, boolean p_220342_7_, boolean p_220342_8_) { - T t = this.func_220349_b(p_220342_1_, p_220342_2_, p_220342_3_, p_220342_4_, p_220342_5_, p_220342_6_, p_220342_7_, p_220342_8_); + public T spawn(ServerWorld p_220342_1_, @Nullable CompoundNBT p_220342_2_, @Nullable ITextComponent p_220342_3_, @Nullable PlayerEntity p_220342_4_, BlockPos p_220342_5_, SpawnReason p_220342_6_, boolean p_220342_7_, boolean p_220342_8_) { + T t = this.create(p_220342_1_, p_220342_2_, p_220342_3_, p_220342_4_, p_220342_5_, p_220342_6_, p_220342_7_, p_220342_8_); if (t != null) { -+ if (t instanceof net.minecraft.entity.MobEntity && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((net.minecraft.entity.MobEntity) t, p_220342_1_, p_220342_5_.func_177958_n(), p_220342_5_.func_177956_o(), p_220342_5_.func_177952_p(), null, p_220342_6_)) return null; - p_220342_1_.func_242417_l(t); ++ if (t instanceof net.minecraft.entity.MobEntity && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((net.minecraft.entity.MobEntity) t, p_220342_1_, p_220342_5_.getX(), p_220342_5_.getY(), p_220342_5_.getZ(), null, p_220342_6_)) return null; + p_220342_1_.addFreshEntityWithPassengers(t); } @@ -504,14 +_,23 @@ } - public int func_233602_m_() { + public int clientTrackingRange() { + return trackingRangeSupplier.applyAsInt(this); + } + private int defaultTrackingRangeSupplier() { - return this.field_233594_bl_; + return this.clientTrackingRange; } - public int func_220332_l() { + public int updateInterval() { + return updateIntervalSupplier.applyAsInt(this); + } + private int defaultUpdateIntervalSupplier() { - return this.field_233595_bm_; + return this.updateInterval; } - public boolean func_220340_m() { + public boolean trackDeltas() { + return velocityUpdateSupplier.test(this); + } + private boolean defaultVelocitySupplier() { - return this != field_200729_aH && this != field_200770_J && this != field_200760_az && this != field_200791_e && this != field_200766_F && this != field_200768_H && this != field_200782_V && this != field_200801_o && this != field_200805_s; + return this != PLAYER && this != LLAMA_SPIT && this != WITHER && this != BAT && this != ITEM_FRAME && this != LEASH_KNOT && this != PAINTING && this != END_CRYSTAL && this != EVOKER_FANGS; } @@ -519,6 +_,19 @@ - return p_220341_1_.func_230235_a_(this); + return p_220341_1_.contains(this); } + public T customClientSpawn(net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity packet, World world) { -+ if (customClientFactory == null) return this.func_200721_a(world); ++ if (customClientFactory == null) return this.create(world); + return customClientFactory.apply(packet, world); + } + @@ -93,11 +93,11 @@ + } + public static class Builder { - private final EntityType.IFactory field_200709_a; - private final EntityClassification field_220324_b; + private final EntityType.IFactory factory; + private final EntityClassification category; @@ -531,6 +_,11 @@ - private int field_233605_i_ = 3; - private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F); + private int updateInterval = 3; + private EntitySize dimensions = EntitySize.scalable(0.6F, 1.8F); + private java.util.function.Predicate> velocityUpdateSupplier = EntityType::defaultVelocitySupplier; + private java.util.function.ToIntFunction> trackingRangeSupplier = EntityType::defaultTrackingRangeSupplier; @@ -105,8 +105,8 @@ + private java.util.function.BiFunction customClientFactory; + private Builder(EntityType.IFactory p_i50479_1_, EntityClassification p_i50479_2_) { - this.field_200709_a = p_i50479_1_; - this.field_220324_b = p_i50479_2_; + this.factory = p_i50479_1_; + this.category = p_i50479_2_; @@ -587,12 +_,36 @@ return this; } @@ -135,13 +135,13 @@ + return this; + } + - public EntityType func_206830_a(String p_206830_1_) { - if (this.field_200710_b) { - Util.func_240976_a_(TypeReferences.field_211298_n, p_206830_1_); + public EntityType build(String p_206830_1_) { + if (this.serialize) { + Util.fetchChoiceType(TypeReferences.ENTITY_TREE, p_206830_1_); } -- return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, this.field_225436_f, this.field_233603_c_, this.field_220326_f, this.field_233604_h_, this.field_233605_i_); -+ return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, this.field_225436_f, this.field_233603_c_, this.field_220326_f, this.field_233604_h_, this.field_233605_i_, velocityUpdateSupplier, trackingRangeSupplier, updateIntervalSupplier, customClientFactory); +- return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions, this.clientTrackingRange, this.updateInterval); ++ return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions, this.clientTrackingRange, this.updateInterval, velocityUpdateSupplier, trackingRangeSupplier, updateIntervalSupplier, customClientFactory); } } diff --git a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch index bebdcc7724..c5645dbd93 100644 --- a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/entity/FlyingEntity.java +++ b/net/minecraft/entity/FlyingEntity.java @@ -27,15 +_,16 @@ - this.func_213315_a(MoverType.SELF, this.func_213322_ci()); - this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D)); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.5D)); } else { -+ BlockPos ground = new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()); ++ BlockPos ground = new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ()); float f = 0.91F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F; -+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F; + if (this.onGround) { +- f = this.level.getBlockState(new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ())).getBlock().getFriction() * 0.91F; ++ f = this.level.getBlockState(ground).getSlipperiness(this.level, ground, this) * 0.91F; } float f1 = 0.16277137F / (f * f * f); f = 0.91F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F; -+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F; + if (this.onGround) { +- f = this.level.getBlockState(new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ())).getBlock().getFriction() * 0.91F; ++ f = this.level.getBlockState(ground).getSlipperiness(this.level, ground, this) * 0.91F; } - this.func_213309_a(this.field_70122_E ? 0.1F * f1 : 0.02F, p_213352_1_); + this.moveRelative(this.onGround ? 0.1F * f1 : 0.02F, p_213352_1_); diff --git a/patches/minecraft/net/minecraft/entity/ICrossbowUser.java.patch b/patches/minecraft/net/minecraft/entity/ICrossbowUser.java.patch index 5c75034132..daefc1e6c8 100644 --- a/patches/minecraft/net/minecraft/entity/ICrossbowUser.java.patch +++ b/patches/minecraft/net/minecraft/entity/ICrossbowUser.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/entity/ICrossbowUser.java +++ b/net/minecraft/entity/ICrossbowUser.java @@ -24,9 +_,9 @@ - void func_230283_U__(); + void onCrossbowAttackPerformed(); - default void func_234281_b_(LivingEntity p_234281_1_, float p_234281_2_) { -- Hand hand = ProjectileHelper.func_221274_a(p_234281_1_, Items.field_222114_py); + default void performCrossbowAttack(LivingEntity p_234281_1_, float p_234281_2_) { +- Hand hand = ProjectileHelper.getWeaponHoldingHand(p_234281_1_, Items.CROSSBOW); + Hand hand = ProjectileHelper.getWeaponHoldingHand(p_234281_1_, item -> item instanceof CrossbowItem); - ItemStack itemstack = p_234281_1_.func_184586_b(hand); -- if (p_234281_1_.func_233631_a_(Items.field_222114_py)) { -+ if (p_234281_1_.func_233634_a_(item -> item instanceof CrossbowItem)) { - CrossbowItem.func_220014_a(p_234281_1_.field_70170_p, p_234281_1_, hand, itemstack, p_234281_2_, (float)(14 - p_234281_1_.field_70170_p.func_175659_aa().func_151525_a() * 4)); + ItemStack itemstack = p_234281_1_.getItemInHand(hand); +- if (p_234281_1_.isHolding(Items.CROSSBOW)) { ++ if (p_234281_1_.isHolding(item -> item instanceof CrossbowItem)) { + CrossbowItem.performShooting(p_234281_1_.level, p_234281_1_, hand, itemstack, p_234281_2_, (float)(14 - p_234281_1_.level.getDifficulty().getId() * 4)); } diff --git a/patches/minecraft/net/minecraft/entity/IShearable.java.patch b/patches/minecraft/net/minecraft/entity/IShearable.java.patch index 892f08b095..cda206fa68 100644 --- a/patches/minecraft/net/minecraft/entity/IShearable.java.patch +++ b/patches/minecraft/net/minecraft/entity/IShearable.java.patch @@ -7,8 +7,8 @@ +@Deprecated // Forge: Use IForgeShearable public interface IShearable { + @Deprecated // Forge: Use IForgeShearable - void func_230263_a_(SoundCategory p_230263_1_); + void shear(SoundCategory p_230263_1_); + @Deprecated // Forge: Use IForgeShearable - boolean func_230262_K__(); + boolean readyForShearing(); } diff --git a/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch index 1f9fcb112f..bf72e487cb 100644 --- a/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch @@ -2,34 +2,34 @@ +++ b/net/minecraft/entity/LivingEntity.java @@ -117,7 +_,9 @@ public abstract class LivingEntity extends Entity { - private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); - private static final UUID field_233625_c_ = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); + private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); + private static final UUID SPEED_MODIFIER_SOUL_SPEED_UUID = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); + private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); - private static final AttributeModifier field_110157_c = new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL); + private static final AttributeModifier SPEED_MODIFIER_SPRINTING = new AttributeModifier(SPEED_MODIFIER_SPRINTING_UUID, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL); + private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 - protected static final DataParameter field_184621_as = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187191_a); - private static final DataParameter field_184632_c = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187193_c); - private static final DataParameter field_184633_f = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b); + protected static final DataParameter DATA_LIVING_ENTITY_FLAGS = EntityDataManager.defineId(LivingEntity.class, DataSerializers.BYTE); + private static final DataParameter DATA_HEALTH_ID = EntityDataManager.defineId(LivingEntity.class, DataSerializers.FLOAT); + private static final DataParameter DATA_EFFECT_COLOR_ID = EntityDataManager.defineId(LivingEntity.class, DataSerializers.INT); @@ -245,7 +_,7 @@ } - public static AttributeModifierMap.MutableAttribute func_233639_cI_() { -- return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_); -+ return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_).func_233814_a_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_233814_a_(net.minecraftforge.common.ForgeMod.NAMETAG_DISTANCE.get()).func_233814_a_(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); + public static AttributeModifierMap.MutableAttribute createLivingAttributes() { +- return AttributeModifierMap.builder().add(Attributes.MAX_HEALTH).add(Attributes.KNOCKBACK_RESISTANCE).add(Attributes.MOVEMENT_SPEED).add(Attributes.ARMOR).add(Attributes.ARMOR_TOUGHNESS); ++ return AttributeModifierMap.builder().add(Attributes.MAX_HEALTH).add(Attributes.KNOCKBACK_RESISTANCE).add(Attributes.MOVEMENT_SPEED).add(Attributes.ARMOR).add(Attributes.ARMOR_TOUGHNESS).add(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).add(net.minecraftforge.common.ForgeMod.NAMETAG_DISTANCE.get()).add(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); } - protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { + protected void checkFallDamage(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { @@ -260,10 +_,11 @@ - if (!this.field_70170_p.field_72995_K && this.field_70143_R > 3.0F && p_184231_3_) { - float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F); -- if (!p_184231_4_.func_196958_f()) { -+ if (!p_184231_4_.isAir(field_70170_p, p_184231_5_)) { + if (!this.level.isClientSide && this.fallDistance > 3.0F && p_184231_3_) { + float f = (float)MathHelper.ceil(this.fallDistance - 3.0F); +- if (!p_184231_4_.isAir()) { ++ if (!p_184231_4_.isAir(level, p_184231_5_)) { double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); -- ((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); -+ if (!p_184231_4_.addLandingEffects((ServerWorld)this.field_70170_p, p_184231_5_, p_184231_4_, this, i)) -+ ((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_).setPos(p_184231_5_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); +- ((ServerWorld)this.level).sendParticles(new BlockParticleData(ParticleTypes.BLOCK, p_184231_4_), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); ++ if (!p_184231_4_.addLandingEffects((ServerWorld)this.level, p_184231_5_, p_184231_4_, this, i)) ++ ((ServerWorld)this.level).sendParticles(new BlockParticleData(ParticleTypes.BLOCK, p_184231_4_).setPos(p_184231_5_), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); } } @@ -37,40 +37,40 @@ } } -- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().func_205710_ba()) { -+ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().canBeRiddenInWater(this)) { - this.func_184210_p(); +- if (!this.level.isClientSide && this.isPassenger() && this.getVehicle() != null && !this.getVehicle().rideableUnderWater()) { ++ if (!this.level.isClientSide && this.isPassenger() && this.getVehicle() != null && !this.getVehicle().canBeRiddenInWater(this)) { + this.stopRiding(); } - } else if (this.func_70086_ai() < this.func_205010_bg()) { + } else if (this.getAirSupply() < this.getMaxAirSupply()) { @@ -475,7 +_,7 @@ - protected void func_70609_aI() { - ++this.field_70725_aQ; - if (this.field_70725_aQ == 20) { -- this.func_70106_y(); + protected void tickDeath() { + ++this.deathTime; + if (this.deathTime == 20) { +- this.remove(); + this.remove(this instanceof net.minecraft.entity.player.ServerPlayerEntity); //Forge keep data until we revive player for(int i = 0; i < 20; ++i) { - double d0 = this.field_70146_Z.nextGaussian() * 0.02D; + double d0 = this.random.nextGaussian() * 0.02D; @@ -668,7 +_,7 @@ - if (!effectinstance.func_76455_a(this, () -> { - this.func_70695_b(effectinstance, true); + if (!effectinstance.tick(this, () -> { + this.onEffectUpdated(effectinstance, true); })) { -- if (!this.field_70170_p.field_72995_K) { -+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) { +- if (!this.level.isClientSide) { ++ if (!this.level.isClientSide && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) { iterator.remove(); - this.func_70688_c(effectinstance); + this.onEffectRemoved(effectinstance); } @@ -717,8 +_,10 @@ - this.func_82142_c(false); + this.setInvisible(false); } else { - Collection collection = this.field_70713_bf.values(); -- this.field_70180_af.func_187227_b(field_184634_g, func_184593_a(collection)); -- this.field_70180_af.func_187227_b(field_184633_f, PotionUtils.func_185181_a(collection)); -+ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection); + Collection collection = this.activeEffects.values(); +- this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(collection)); +- this.entityData.set(DATA_EFFECT_COLOR_ID, PotionUtils.getColor(collection)); ++ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.getColor(collection), areAllEffectsAmbient(collection), collection); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden()); -+ this.field_70180_af.func_187227_b(field_184633_f, event.getColor()); - this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); ++ this.entityData.set(DATA_EFFECT_AMBIENCE_ID, event.areParticlesHidden()); ++ this.entityData.set(DATA_EFFECT_COLOR_ID, event.getColor()); + this.setInvisible(this.hasEffect(Effects.INVISIBILITY)); } @@ -747,7 +_,7 @@ @@ -86,95 +86,95 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { -- this.func_70688_c(iterator.next()); +- this.onEffectRemoved(iterator.next()); + EffectInstance effect = iterator.next(); + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) continue; -+ this.func_70688_c(effect); ++ this.onEffectRemoved(effect); iterator.remove(); } @@ -812,6 +_,7 @@ return false; } else { - EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); + EffectInstance effectinstance = this.activeEffects.get(p_195064_1_.getEffect()); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent(this, effectinstance, p_195064_1_)); if (effectinstance == null) { - this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_); - this.func_70670_a(p_195064_1_); + this.activeEffects.put(p_195064_1_.getEffect(), p_195064_1_); + this.onEffectAdded(p_195064_1_); @@ -826,6 +_,9 @@ } - public boolean func_70687_e(EffectInstance p_70687_1_) { + public boolean canBeAffected(EffectInstance p_70687_1_) { + net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; - if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) { - Effect effect = p_70687_1_.func_188419_a(); - if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) { + if (this.getMobType() == CreatureAttribute.UNDEAD) { + Effect effect = p_70687_1_.getEffect(); + if (effect == Effects.REGENERATION || effect == Effects.POISON) { @@ -859,6 +_,7 @@ } - public boolean func_195063_d(Effect p_195063_1_) { + public boolean removeEffect(Effect p_195063_1_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, p_195063_1_))) return false; - EffectInstance effectinstance = this.func_184596_c(p_195063_1_); + EffectInstance effectinstance = this.removeEffectNoUpdate(p_195063_1_); if (effectinstance != null) { - this.func_70688_c(effectinstance); + this.onEffectRemoved(effectinstance); @@ -895,6 +_,8 @@ } - public void func_70691_i(float p_70691_1_) { + public void heal(float p_70691_1_) { + p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_); + if (p_70691_1_ <= 0) return; - float f = this.func_110143_aJ(); + float f = this.getHealth(); if (f > 0.0F) { - this.func_70606_j(f + p_70691_1_); + this.setHealth(f + p_70691_1_); @@ -915,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { + if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; - if (this.func_180431_b(p_70097_1_)) { + if (this.isInvulnerableTo(p_70097_1_)) { return false; - } else if (this.field_70170_p.field_72995_K) { + } else if (this.level.isClientSide) { @@ -981,8 +_,8 @@ if (entity1 instanceof PlayerEntity) { - this.field_70718_bc = 100; - this.field_70717_bb = (PlayerEntity)entity1; + this.lastHurtByPlayerTime = 100; + this.lastHurtByPlayer = (PlayerEntity)entity1; - } else if (entity1 instanceof WolfEntity) { - WolfEntity wolfentity = (WolfEntity)entity1; + } else if (entity1 instanceof net.minecraft.entity.passive.TameableEntity) { + net.minecraft.entity.passive.TameableEntity wolfentity = (net.minecraft.entity.passive.TameableEntity)entity1; - if (wolfentity.func_70909_n()) { - this.field_70718_bc = 100; - LivingEntity livingentity = wolfentity.func_70902_q(); + if (wolfentity.isTame()) { + this.lastHurtByPlayerTime = 100; + LivingEntity livingentity = wolfentity.getOwner(); @@ -1165,6 +_,7 @@ } - public void func_70645_a(DamageSource p_70645_1_) { + public void die(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - if (!this.field_70128_L && !this.field_70729_aU) { - Entity entity = p_70645_1_.func_76346_g(); - LivingEntity livingentity = this.func_94060_bK(); + if (!this.removed && !this.dead) { + Entity entity = p_70645_1_.getEntity(); + LivingEntity livingentity = this.getKillCredit(); @@ -1196,10 +_,10 @@ - if (!this.field_70170_p.field_72995_K) { + if (!this.level.isClientSide) { boolean flag = false; if (p_226298_1_ instanceof WitherEntity) { -- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - BlockPos blockpos = this.func_233580_cy_(); - BlockState blockstate = Blocks.field_222388_bz.func_176223_P(); -- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) { -+ if (this.field_70170_p.func_175623_d(blockpos) && blockstate.func_196955_c(this.field_70170_p, blockpos)) { - this.field_70170_p.func_180501_a(blockpos, blockstate, 3); +- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { + 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; } @@ -1216,12 +_,9 @@ - protected void func_213345_d(DamageSource p_213345_1_) { - Entity entity = p_213345_1_.func_76346_g(); + protected void dropAllDeathLoot(DamageSource p_213345_1_) { + Entity entity = p_213345_1_.getEntity(); - int i; - if (entity instanceof PlayerEntity) { -- i = EnchantmentHelper.func_185283_h((LivingEntity)entity); +- i = EnchantmentHelper.getMobLooting((LivingEntity)entity); - } else { - i = 0; - } @@ -182,65 +182,65 @@ + int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_213345_1_); + this.captureDrops(new java.util.ArrayList<>()); - boolean flag = this.field_70718_bc > 0; - if (this.func_230282_cS_() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) { + boolean flag = this.lastHurtByPlayerTime > 0; + if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -1231,6 +_,10 @@ - this.func_213337_cE(); - this.func_226294_cV_(); + this.dropEquipment(); + this.dropExperience(); + + Collection drops = captureDrops(null); -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_213345_1_, drops, i, field_70718_bc > 0)) -+ drops.forEach(e -> field_70170_p.func_217376_c(e)); ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_213345_1_, drops, i, lastHurtByPlayerTime > 0)) ++ drops.forEach(e -> level.addFreshEntity(e)); } - protected void func_213337_cE() { + protected void dropEquipment() { @@ -1240,6 +_,7 @@ - if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) { - int i = this.func_70693_a(this.field_70717_bb); + if (!this.level.isClientSide && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) { + int i = this.getExperienceReward(this.lastHurtByPlayer); -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i); ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.lastHurtByPlayer, i); while(i > 0) { - int j = ExperienceOrbEntity.func_70527_a(i); + int j = ExperienceOrbEntity.getExperienceValue(i); i -= j; @@ -1260,7 +_,8 @@ - ResourceLocation resourcelocation = this.func_213346_cF(); - LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation); - LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_); -- loottable.func_216120_b(lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d), this::func_199701_a_); -+ LootContext ctx = lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d); -+ loottable.func_216113_a(ctx).forEach(this::func_199701_a_); + ResourceLocation resourcelocation = this.getLootTable(); + LootTable loottable = this.level.getServer().getLootTables().get(resourcelocation); + LootContext.Builder lootcontext$builder = this.createLootContext(p_213354_2_, p_213354_1_); +- loottable.getRandomItems(lootcontext$builder.create(LootParameterSets.ENTITY), this::spawnAtLocation); ++ LootContext ctx = lootcontext$builder.create(LootParameterSets.ENTITY); ++ loottable.getRandomItems(ctx).forEach(this::spawnAtLocation); } - protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) { + protected LootContext.Builder createLootContext(boolean p_213363_1_, DamageSource p_213363_2_) { @@ -1273,6 +_,11 @@ } - public void func_233627_a_(float p_233627_1_, double p_233627_2_, double p_233627_4_) { + public void knockback(float p_233627_1_, double p_233627_2_, double p_233627_4_) { + net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_233627_1_, p_233627_2_, p_233627_4_); + if(event.isCanceled()) return; + p_233627_1_ = event.getStrength(); + p_233627_2_ = event.getRatioX(); + p_233627_4_ = event.getRatioZ(); - p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.func_233637_b_(Attributes.field_233820_c_))); + p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE))); if (!(p_233627_1_ <= 0.0F)) { - this.field_70160_al = true; + this.hasImpulse = true; @@ -1322,16 +_,9 @@ } else { - BlockPos blockpos = this.func_233580_cy_(); - BlockState blockstate = this.func_213339_cH(); -- Block block = blockstate.func_177230_c(); -- if (block.func_203417_a(BlockTags.field_232878_as_)) { -- this.field_233624_bE_ = Optional.of(blockpos); + BlockPos blockpos = this.blockPosition(); + BlockState blockstate = this.getFeetBlockState(); +- Block block = blockstate.getBlock(); +- if (block.is(BlockTags.CLIMBABLE)) { +- this.lastClimbablePos = Optional.of(blockpos); - return true; -- } else if (block instanceof TrapDoorBlock && this.func_184604_a(blockpos, blockstate)) { -- this.field_233624_bE_ = Optional.of(blockpos); +- } else if (block instanceof TrapDoorBlock && this.trapdoorUsableAsLadder(blockpos, blockstate)) { +- this.lastClimbablePos = Optional.of(blockpos); - return true; - } else { - return false; - } -+ Optional ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadderPos(blockstate, field_70170_p, blockpos, this); -+ if (ladderPos.isPresent()) this.field_233624_bE_ = ladderPos; ++ Optional ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadderPos(blockstate, level, blockpos, this); ++ if (ladderPos.isPresent()) this.lastClimbablePos = ladderPos; + return ladderPos.isPresent(); } } @@ -248,263 +248,263 @@ @@ -1355,6 +_,11 @@ } - public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { + public boolean causeFallDamage(float p_225503_1_, float p_225503_2_) { + float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_225503_1_, p_225503_2_); + if (ret == null) return false; + p_225503_1_ = ret[0]; + p_225503_2_ = ret[1]; + - boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_); - int i = this.func_225508_e_(p_225503_1_, p_225503_2_); + boolean flag = super.causeFallDamage(p_225503_1_, p_225503_2_); + int i = this.calculateFallDamage(p_225503_1_, p_225503_2_); if (i > 0) { @@ -1378,9 +_,10 @@ - int i = MathHelper.func_76128_c(this.func_226277_ct_()); - int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); - int k = MathHelper.func_76128_c(this.func_226281_cx_()); -- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); -- if (!blockstate.func_196958_f()) { -- SoundType soundtype = blockstate.func_215695_r(); + int i = MathHelper.floor(this.getX()); + int j = MathHelper.floor(this.getY() - (double)0.2F); + int k = MathHelper.floor(this.getZ()); +- BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k)); +- if (!blockstate.isAir()) { +- SoundType soundtype = blockstate.getSoundType(); + BlockPos pos = new BlockPos(i, j, k); -+ BlockState blockstate = this.field_70170_p.func_180495_p(pos); -+ if (!blockstate.isAir(this.field_70170_p, pos)) { -+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this); - this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); ++ BlockState blockstate = this.level.getBlockState(pos); ++ if (!blockstate.isAir(this.level, pos)) { ++ SoundType soundtype = blockstate.getSoundType(level, pos, this); + this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F); } @@ -1448,6 +_,8 @@ - protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { - if (!this.func_180431_b(p_70665_1_)) { + protected void actuallyHurt(DamageSource p_70665_1_, float p_70665_2_) { + if (!this.isInvulnerableTo(p_70665_1_)) { + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; - p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); - p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); - float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); + p_70665_2_ = this.getDamageAfterArmorAbsorb(p_70665_1_, p_70665_2_); + p_70665_2_ = this.getDamageAfterMagicAbsorb(p_70665_1_, p_70665_2_); + float f2 = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F); @@ -1457,10 +_,11 @@ - ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F)); + ((ServerPlayerEntity)p_70665_1_.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f * 10.0F)); } + f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, f2); if (f2 != 0.0F) { - float f1 = this.func_110143_aJ(); -- this.func_70606_j(f1 - f2); - this.func_110142_aN().func_94547_a(p_70665_1_, f1, f2); -+ this.func_70606_j(f1 - f2); // Forge: moved to fix MC-121048 - this.func_110149_m(this.func_110139_bj() - f2); + float f1 = this.getHealth(); +- this.setHealth(f1 - f2); + this.getCombatTracker().recordDamage(p_70665_1_, f1, f2); ++ this.setHealth(f1 - f2); // Forge: moved to fix MC-121048 + this.setAbsorptionAmount(this.getAbsorptionAmount() - f2); } } @@ -1514,6 +_,8 @@ } - public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) { -+ ItemStack stack = this.func_184586_b(p_226292_1_); -+ if (!stack.func_190926_b() && stack.onEntitySwing(this)) return; - if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { - this.field_110158_av = -1; - this.field_82175_bq = true; + public void swing(Hand p_226292_1_, boolean p_226292_2_) { ++ ItemStack stack = this.getItemInHand(p_226292_1_); ++ if (!stack.isEmpty() && stack.onEntitySwing(this)) return; + if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) { + this.swingTime = -1; + this.swinging = true; @@ -1848,15 +_,16 @@ } - this.field_70160_al = true; + this.hasImpulse = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } @OnlyIn(Dist.CLIENT) - protected void func_203010_cG() { -- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D)); -+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F * this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e(), 0.0D)); + protected void goDownInWater() { +- this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)-0.04F, 0.0D)); ++ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)-0.04F * this.getAttribute(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).getValue(), 0.0D)); } - protected void func_180466_bG(ITag p_180466_1_) { -- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D)); -+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e(), 0.0D)); + protected void jumpInLiquid(ITag p_180466_1_) { +- this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F, 0.0D)); ++ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F * this.getAttribute(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).getValue(), 0.0D)); } - protected float func_189749_co() { + protected float getWaterSlowDown() { @@ -1870,11 +_,15 @@ - public void func_213352_e(Vector3d p_213352_1_) { - if (this.func_70613_aW() || this.func_184186_bw()) { + public void travel(Vector3d p_213352_1_) { + if (this.isEffectiveAi() || this.isControlledByLocalInstance()) { double d0 = 0.08D; -+ ModifiableAttributeInstance gravity = this.func_110148_a(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); - boolean flag = this.func_213322_ci().field_72448_b <= 0.0D; - if (flag && this.func_70644_a(Effects.field_204839_B)) { ++ ModifiableAttributeInstance gravity = this.getAttribute(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); + boolean flag = this.getDeltaMovement().y <= 0.0D; + if (flag && this.hasEffect(Effects.SLOW_FALLING)) { - d0 = 0.01D; -+ if (!gravity.func_180374_a(SLOW_FALLING)) gravity.func_233767_b_(SLOW_FALLING); - this.field_70143_R = 0.0F; -+ } else if (gravity.func_180374_a(SLOW_FALLING)) { -+ gravity.func_111124_b(SLOW_FALLING); ++ if (!gravity.hasModifier(SLOW_FALLING)) gravity.addTransientModifier(SLOW_FALLING); + this.fallDistance = 0.0F; ++ } else if (gravity.hasModifier(SLOW_FALLING)) { ++ gravity.removeModifier(SLOW_FALLING); } -+ d0 = gravity.func_111126_e(); ++ d0 = gravity.getValue(); - FluidState fluidstate = this.field_70170_p.func_204610_c(this.func_233580_cy_()); - if (this.func_70090_H() && this.func_241208_cS_() && !this.func_230285_a_(fluidstate.func_206886_c())) { + FluidState fluidstate = this.level.getFluidState(this.blockPosition()); + if (this.isInWater() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate.getType())) { @@ -1899,6 +_,7 @@ f5 = 0.96F; } -+ f6 *= (float)this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e(); - this.func_213309_a(f6, p_213352_1_); - this.func_213315_a(MoverType.SELF, this.func_213322_ci()); - Vector3d vector3d6 = this.func_213322_ci(); ++ f6 *= (float)this.getAttribute(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).getValue(); + this.moveRelative(f6, p_213352_1_); + this.move(MoverType.SELF, this.getDeltaMovement()); + Vector3d vector3d6 = this.getDeltaMovement(); @@ -1977,7 +_,7 @@ } } else { - BlockPos blockpos = this.func_226270_aj_(); -- float f3 = this.field_70170_p.func_180495_p(blockpos).func_177230_c().func_208618_m(); -+ float f3 = this.field_70170_p.func_180495_p(this.func_226270_aj_()).getSlipperiness(field_70170_p, this.func_226270_aj_(), this); - float f4 = this.field_70122_E ? f3 * 0.91F : 0.91F; - Vector3d vector3d5 = this.func_233633_a_(p_213352_1_, f3); - double d2 = vector3d5.field_72448_b; + BlockPos blockpos = this.getBlockPosBelowThatAffectsMyMovement(); +- float f3 = this.level.getBlockState(blockpos).getBlock().getFriction(); ++ float f3 = this.level.getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getSlipperiness(level, this.getBlockPosBelowThatAffectsMyMovement(), this); + float f4 = this.onGround ? f3 * 0.91F : 0.91F; + Vector3d vector3d5 = this.handleRelativeFrictionAndCalculateMovement(p_213352_1_, f3); + double d2 = vector3d5.y; @@ -2049,7 +_,7 @@ - double d0 = MathHelper.func_151237_a(p_213362_1_.field_72450_a, (double)-0.15F, (double)0.15F); - double d1 = MathHelper.func_151237_a(p_213362_1_.field_72449_c, (double)-0.15F, (double)0.15F); - double d2 = Math.max(p_213362_1_.field_72448_b, (double)-0.15F); -- if (d2 < 0.0D && !this.func_213339_cH().func_203425_a(Blocks.field_222420_lI) && this.func_230491_ea_() && this instanceof PlayerEntity) { -+ if (d2 < 0.0D && !this.func_213339_cH().isScaffolding(this) && this.func_230491_ea_() && this instanceof PlayerEntity) { + double d0 = MathHelper.clamp(p_213362_1_.x, (double)-0.15F, (double)0.15F); + double d1 = MathHelper.clamp(p_213362_1_.z, (double)-0.15F, (double)0.15F); + double d2 = Math.max(p_213362_1_.y, (double)-0.15F); +- if (d2 < 0.0D && !this.getFeetBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof PlayerEntity) { ++ if (d2 < 0.0D && !this.getFeetBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof PlayerEntity) { d2 = 0.0D; } @@ -2077,6 +_,7 @@ } - public void func_70071_h_() { + public void tick() { + if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.func_70071_h_(); - this.func_184608_ct(); - this.func_205014_p(); + super.tick(); + this.updatingUsingItem(); + this.updateSwimAmount(); @@ -2232,6 +_,7 @@ - ItemStack itemstack1 = this.func_184582_a(equipmentslottype); - if (!ItemStack.func_77989_b(itemstack1, itemstack)) { + ItemStack itemstack1 = this.getItemBySlot(equipmentslottype); + if (!ItemStack.matches(itemstack1, itemstack)) { + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1)); if (map == null) { map = Maps.newEnumMap(EquipmentSlotType.class); } @@ -2436,6 +_,8 @@ - boolean flag = this.func_70083_f(7); - if (flag && !this.field_70122_E && !this.func_184218_aH() && !this.func_70644_a(Effects.field_188424_y)) { - ItemStack itemstack = this.func_184582_a(EquipmentSlotType.CHEST); -+ flag = itemstack.canElytraFly(this) && itemstack.elytraFlightTick(this, this.field_184629_bo); + boolean flag = this.getSharedFlag(7); + if (flag && !this.onGround && !this.isPassenger() && !this.hasEffect(Effects.LEVITATION)) { + ItemStack itemstack = this.getItemBySlot(EquipmentSlotType.CHEST); ++ flag = itemstack.canElytraFly(this) && itemstack.elytraFlightTick(this, this.fallFlyTicks); + if (false) //Forge: Moved to ElytraItem - if (itemstack.func_77973_b() == Items.field_185160_cR && ElytraItem.func_185069_d(itemstack)) { + if (itemstack.getItem() == Items.ELYTRA && ElytraItem.isFlyEnabled(itemstack)) { flag = true; - if (!this.field_70170_p.field_72995_K && (this.field_184629_bo + 1) % 20 == 0) { + if (!this.level.isClientSide && (this.fallFlyTicks + 1) % 20 == 0) { @@ -2581,6 +_,7 @@ - public boolean func_70685_l(Entity p_70685_1_) { - Vector3d vector3d = new Vector3d(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); - Vector3d vector3d1 = new Vector3d(p_70685_1_.func_226277_ct_(), p_70685_1_.func_226280_cw_(), p_70685_1_.func_226281_cx_()); -+ if (p_70685_1_.field_70170_p != this.field_70170_p || vector3d1.func_72436_e(vector3d) > 128.0D * 128.0D) return false; //Forge Backport MC-209819 - return this.field_70170_p.func_217299_a(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, this)).func_216346_c() == RayTraceResult.Type.MISS; + public boolean canSee(Entity p_70685_1_) { + Vector3d vector3d = new Vector3d(this.getX(), this.getEyeY(), this.getZ()); + Vector3d vector3d1 = new Vector3d(p_70685_1_.getX(), p_70685_1_.getEyeY(), p_70685_1_.getZ()); ++ if (p_70685_1_.level != this.level || vector3d1.distanceToSqr(vector3d) > 128.0D * 128.0D) return false; //Forge Backport MC-209819 + return this.level.clip(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, this)).getType() == RayTraceResult.Type.MISS; } @@ -2668,8 +_,16 @@ - private void func_184608_ct() { - if (this.func_184587_cr()) { -- if (ItemStack.func_185132_d(this.func_184586_b(this.func_184600_cs()), this.field_184627_bm)) { -- this.field_184627_bm = this.func_184586_b(this.func_184600_cs()); -+ ItemStack itemStack = this.func_184586_b(this.func_184600_cs()); -+ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.field_184627_bm, itemStack)) this.field_184627_bm = itemStack; -+ if (itemStack == this.field_184627_bm) { + private void updatingUsingItem() { + if (this.isUsingItem()) { +- if (ItemStack.isSameIgnoreDurability(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { +- this.useItem = this.getItemInHand(this.getUsedItemHand()); ++ ItemStack itemStack = this.getItemInHand(this.getUsedItemHand()); ++ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.useItem, itemStack)) this.useItem = itemStack; ++ if (itemStack == this.useItem) { + -+ if (!this.field_184627_bm.func_190926_b()) { -+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn); -+ if (field_184628_bn > 0) -+ field_184627_bm.onUsingTick(this, field_184628_bn); ++ if (!this.useItem.isEmpty()) { ++ useItemRemaining = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, useItem, useItemRemaining); ++ if (useItemRemaining > 0) ++ useItem.onUsingTick(this, useItemRemaining); + } + - this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv()); - if (this.func_226299_p_()) { - this.func_226293_b_(this.field_184627_bm, 5); + this.useItem.onUseTick(this.level, this, this.getUseItemRemainingTicks()); + if (this.shouldTriggerItemUseEffects()) { + this.triggerItemUseEffects(this.useItem, 5); @@ -2717,8 +_,10 @@ - public void func_184598_c(Hand p_184598_1_) { - ItemStack itemstack = this.func_184586_b(p_184598_1_); - if (!itemstack.func_190926_b() && !this.func_184587_cr()) { -+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m()); + public void startUsingItem(Hand p_184598_1_) { + ItemStack itemstack = this.getItemInHand(p_184598_1_); + if (!itemstack.isEmpty() && !this.isUsingItem()) { ++ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getUseDuration()); + if (duration <= 0) return; - this.field_184627_bm = itemstack; -- this.field_184628_bn = itemstack.func_77988_m(); -+ this.field_184628_bn = duration; - if (!this.field_70170_p.field_72995_K) { - this.func_204802_c(1, true); - this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND); + this.useItem = itemstack; +- this.useItemRemaining = itemstack.getUseDuration(); ++ this.useItemRemaining = duration; + if (!this.level.isClientSide) { + this.setLivingEntityFlag(1, true); + this.setLivingEntityFlag(2, p_184598_1_ == Hand.OFF_HAND); @@ -2778,6 +_,9 @@ - vector3d1 = vector3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); - vector3d1 = vector3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); - vector3d1 = vector3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); -+ if (this.field_70170_p instanceof ServerWorld) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant -+ ((ServerWorld)this.field_70170_p).func_195598_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, 1, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c, 0.0D); + vector3d1 = vector3d1.xRot(-this.xRot * ((float)Math.PI / 180F)); + vector3d1 = vector3d1.yRot(-this.yRot * ((float)Math.PI / 180F)); + vector3d1 = vector3d1.add(this.getX(), this.getEyeY(), this.getZ()); ++ if (this.level instanceof ServerWorld) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant ++ ((ServerWorld)this.level).sendParticles(new ItemParticleData(ParticleTypes.ITEM, p_195062_1_), vector3d1.x, vector3d1.y, vector3d1.z, 1, vector3d.x, vector3d.y + 0.05D, vector3d.z, 0.0D); + else - this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c); + this.level.addParticle(new ItemParticleData(ParticleTypes.ITEM, p_195062_1_), vector3d1.x, vector3d1.y, vector3d1.z, vector3d.x, vector3d.y + 0.05D, vector3d.z); } @@ -2790,7 +_,8 @@ } else { - if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { - this.func_226293_b_(this.field_184627_bm, 16); -- ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this); -+ ItemStack copy = this.field_184627_bm.func_77946_l(); -+ ItemStack itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, func_184605_cv(), this.field_184627_bm.func_77950_b(this.field_70170_p, this)); - if (itemstack != this.field_184627_bm) { - this.func_184611_a(hand, itemstack); + if (!this.useItem.isEmpty() && this.isUsingItem()) { + this.triggerItemUseEffects(this.useItem, 16); +- ItemStack itemstack = this.useItem.finishUsingItem(this.level, this); ++ ItemStack copy = this.useItem.copy(); ++ ItemStack itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, getUseItemRemainingTicks(), this.useItem.finishUsingItem(this.level, this)); + if (itemstack != this.useItem) { + this.setItemInHand(hand, itemstack); } @@ -2815,7 +_,11 @@ - public void func_184597_cx() { - if (!this.field_184627_bm.func_190926_b()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) { -+ ItemStack copy = this instanceof PlayerEntity ? field_184627_bm.func_77946_l() : null; - this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); -+ if (copy != null && field_184627_bm.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((PlayerEntity)this, copy, func_184600_cs()); + public void releaseUsingItem() { + if (!this.useItem.isEmpty()) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, useItem, this.getUseItemRemainingTicks())) { ++ ItemStack copy = this instanceof PlayerEntity ? useItem.copy() : null; + this.useItem.releaseUsing(this.level, this, this.getUseItemRemainingTicks()); ++ if (copy != null && useItem.isEmpty()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((PlayerEntity)this, copy, getUsedItemHand()); + } - if (this.field_184627_bm.func_222122_m()) { - this.func_184608_ct(); + if (this.useItem.useOnRelease()) { + this.updatingUsingItem(); } @@ -2964,8 +_,8 @@ } - BlockState blockstate = this.field_70170_p.func_180495_p(p_213342_1_); -- if (blockstate.func_177230_c() instanceof BedBlock) { -- this.field_70170_p.func_180501_a(p_213342_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(true)), 3); -+ if (blockstate.isBed(field_70170_p, p_213342_1_, this)) { -+ blockstate.setBedOccupied(field_70170_p, p_213342_1_, this, true); + BlockState blockstate = this.level.getBlockState(p_213342_1_); +- if (blockstate.getBlock() instanceof BedBlock) { +- this.level.setBlock(p_213342_1_, blockstate.setValue(BedBlock.OCCUPIED, Boolean.valueOf(true)), 3); ++ if (blockstate.isBed(level, p_213342_1_, this)) { ++ blockstate.setBedOccupied(level, p_213342_1_, this, true); } - this.func_213301_b(Pose.SLEEPING); + this.setPose(Pose.SLEEPING); @@ -2981,15 +_,15 @@ - private boolean func_213359_p() { - return this.func_213374_dv().map((p_241350_1_) -> { -- return this.field_70170_p.func_180495_p(p_241350_1_).func_177230_c() instanceof BedBlock; + private boolean checkBedExists() { + return this.getSleepingPos().map((p_241350_1_) -> { +- return this.level.getBlockState(p_241350_1_).getBlock() instanceof BedBlock; + return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_241350_1_); }).orElse(false); } - public void func_213366_dy() { - this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_241348_1_) -> { - BlockState blockstate = this.field_70170_p.func_180495_p(p_241348_1_); -- if (blockstate.func_177230_c() instanceof BedBlock) { -- this.field_70170_p.func_180501_a(p_241348_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3); -+ if (blockstate.isBed(field_70170_p, p_241348_1_, this)) { -+ blockstate.setBedOccupied(field_70170_p, p_241348_1_, this, false); - Vector3d vector3d1 = BedBlock.func_242652_a(this.func_200600_R(), this.field_70170_p, p_241348_1_, this.field_70177_z).orElseGet(() -> { - BlockPos blockpos = p_241348_1_.func_177984_a(); - return new Vector3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D); + public void stopSleeping() { + this.getSleepingPos().filter(this.level::hasChunkAt).ifPresent((p_241348_1_) -> { + BlockState blockstate = this.level.getBlockState(p_241348_1_); +- if (blockstate.getBlock() instanceof BedBlock) { +- this.level.setBlock(p_241348_1_, blockstate.setValue(BedBlock.OCCUPIED, Boolean.valueOf(false)), 3); ++ if (blockstate.isBed(level, p_241348_1_, this)) { ++ blockstate.setBedOccupied(level, p_241348_1_, this, false); + Vector3d vector3d1 = BedBlock.findStandUpPosition(this.getType(), this.level, p_241348_1_, this.yRot).orElseGet(() -> { + BlockPos blockpos = p_241348_1_.above(); + return new Vector3d((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.1D, (double)blockpos.getZ() + 0.5D); @@ -3012,7 +_,9 @@ @OnlyIn(Dist.CLIENT) - public Direction func_213376_dz() { - BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); -- return blockpos != null ? BedBlock.func_220174_a(this.field_70170_p, blockpos) : null; + public Direction getBedOrientation() { + BlockPos blockpos = this.getSleepingPos().orElse((BlockPos)null); +- return blockpos != null ? BedBlock.getBedOrientation(this.level, blockpos) : null; + if (blockpos == null) return Direction.UP; -+ BlockState state = this.field_70170_p.func_180495_p(blockpos); -+ return !state.isBed(field_70170_p, blockpos, this) ? Direction.UP : state.getBedDirection(field_70170_p, blockpos); ++ BlockState state = this.level.getBlockState(blockpos); ++ return !state.isBed(level, blockpos, this) ? Direction.UP : state.getBedDirection(level, blockpos); } - public boolean func_70094_T() { + public boolean isInWall() { @@ -3080,6 +_,58 @@ - public void func_213334_d(Hand p_213334_1_) { - this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); + public void broadcastBreakEvent(Hand p_213334_1_) { + this.broadcastBreakEvent(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); + } + + /* ==== FORGE START ==== */ @@ -513,17 +513,17 @@ + * @param curativeItem The itemstack we are using to cure potion effects + */ + public boolean curePotionEffects(ItemStack curativeItem) { -+ if (this.field_70170_p.field_72995_K) ++ if (this.level.isClientSide) + return false; + boolean ret = false; -+ Iterator itr = this.field_70713_bf.values().iterator(); ++ Iterator itr = this.activeEffects.values().iterator(); + while (itr.hasNext()) { + EffectInstance effect = itr.next(); + if (effect.isCurativeItem(curativeItem) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) { -+ this.func_70688_c(effect); ++ this.onEffectRemoved(effect); + itr.remove(); + ret = true; -+ this.field_70752_e = true; ++ this.effectsDirty = true; + } + } + return ret; @@ -544,10 +544,10 @@ + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { -+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == null) return handlers[2].cast(); -+ else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast(); -+ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast(); ++ else if (facing.getAxis().isVertical()) return handlers[0].cast(); ++ else if (facing.getAxis().isHorizontal()) return handlers[1].cast(); + } + return super.getCapability(capability, facing); + } diff --git a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch index 802b557c05..81e7645632 100644 --- a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch @@ -2,50 +2,50 @@ +++ b/net/minecraft/entity/MobEntity.java @@ -198,6 +_,7 @@ - public void func_70624_b(@Nullable LivingEntity p_70624_1_) { - this.field_70696_bz = p_70624_1_; + public void setTarget(@Nullable LivingEntity p_70624_1_) { + this.target = p_70624_1_; + net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); } - public boolean func_213358_a(EntityType p_213358_1_) { + public boolean canAttackType(EntityType p_213358_1_) { @@ -486,7 +_,7 @@ - public void func_70636_d() { - super.func_70636_d(); - this.field_70170_p.func_217381_Z().func_76320_a("looting"); -- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - for(ItemEntity itementity : this.field_70170_p.func_217357_a(ItemEntity.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { - if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s() && this.func_230293_i_(itementity.func_92059_d())) { - this.func_175445_a(itementity); + public void aiStep() { + super.aiStep(); + this.level.getProfiler().push("looting"); +- if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { + for(ItemEntity itementity : this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(1.0D, 0.0D, 1.0D))) { + if (!itementity.removed && !itementity.getItem().isEmpty() && !itementity.hasPickUpDelay() && this.wantsToPickUp(itementity.getItem())) { + this.pickUpItem(itementity); @@ -639,6 +_,14 @@ - this.func_70106_y(); - } else if (!this.func_104002_bU() && !this.func_213392_I()) { - Entity entity = this.field_70170_p.func_217362_a(this, -1.0D); + this.remove(); + } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { + Entity entity = this.level.getNearestPlayer(this, -1.0D); + net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this); + if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ field_70708_bq = 0; ++ noActionTime = 0; + entity = null; + } else if (result == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { -+ this.func_70106_y(); ++ this.remove(); + entity = null; + } if (entity != null) { - double d0 = entity.func_70068_e(this); - int i = this.func_200600_R().func_220339_d().func_233671_f_(); + double d0 = entity.distanceToSqr(this); + int i = this.getType().getCategory().getDespawnDistance(); @@ -879,6 +_,8 @@ } - public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) { + public static EquipmentSlotType getEquipmentSlotForItem(ItemStack p_184640_0_) { + final EquipmentSlotType slot = p_184640_0_.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 - Item item = p_184640_0_.func_77973_b(); - if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) { + Item item = p_184640_0_.getItem(); + if (item != Blocks.CARVED_PUMPKIN.asItem() && (!(item instanceof BlockItem) || !(((BlockItem)item).getBlock() instanceof AbstractSkullBlock))) { if (item instanceof ArmorItem) { @@ -886,7 +_,7 @@ - } else if (item == Items.field_185160_cR) { + } else if (item == Items.ELYTRA) { return EquipmentSlotType.CHEST; } else { -- return item == Items.field_185159_cQ ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; +- return item == Items.SHIELD ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; + return p_184640_0_.isShield(null) ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; } } else { diff --git a/patches/minecraft/net/minecraft/entity/ai/attributes/Attribute.java.patch b/patches/minecraft/net/minecraft/entity/ai/attributes/Attribute.java.patch index 3042cce5c6..6840468f69 100644 --- a/patches/minecraft/net/minecraft/entity/ai/attributes/Attribute.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/attributes/Attribute.java.patch @@ -5,6 +5,6 @@ -public class Attribute { +public class Attribute extends net.minecraftforge.registries.ForgeRegistryEntry { - private final double field_233750_a_; - private boolean field_233751_b_; - private final String field_233752_c_; + private final double defaultValue; + private boolean syncable; + private final String descriptionId; diff --git a/patches/minecraft/net/minecraft/entity/ai/attributes/AttributeModifierMap.java.patch b/patches/minecraft/net/minecraft/entity/ai/attributes/AttributeModifierMap.java.patch index 38956c2b48..65271f192a 100644 --- a/patches/minecraft/net/minecraft/entity/ai/attributes/AttributeModifierMap.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/attributes/AttributeModifierMap.java.patch @@ -2,32 +2,32 @@ +++ b/net/minecraft/entity/ai/attributes/AttributeModifierMap.java @@ -69,6 +_,22 @@ public static class MutableAttribute { - private final Map field_233811_a_ = Maps.newHashMap(); - private boolean field_233812_b_; + private final Map builder = Maps.newHashMap(); + private boolean instanceFrozen; + private final java.util.List others = new java.util.ArrayList<>(); + + public MutableAttribute() { } + + public MutableAttribute(AttributeModifierMap attributeMap) { -+ this.field_233811_a_.putAll(attributeMap.field_233802_a_); ++ this.builder.putAll(attributeMap.instances); + } + + public void combine(MutableAttribute other) { -+ this.field_233811_a_.putAll(other.field_233811_a_); ++ this.builder.putAll(other.builder); + others.add(other); + } + + public boolean hasAttribute(Attribute attribute) { -+ return this.field_233811_a_.containsKey(attribute); ++ return this.builder.containsKey(attribute); + } - private ModifiableAttributeInstance func_233817_b_(Attribute p_233817_1_) { + private ModifiableAttributeInstance create(Attribute p_233817_1_) { ModifiableAttributeInstance modifiableattributeinstance = new ModifiableAttributeInstance(p_233817_1_, (p_233816_2_) -> { @@ -93,6 +_,7 @@ - public AttributeModifierMap func_233813_a_() { - this.field_233812_b_ = true; -+ others.forEach(o -> o.field_233812_b_ = true); - return new AttributeModifierMap(this.field_233811_a_); + public AttributeModifierMap build() { + this.instanceFrozen = true; ++ others.forEach(o -> o.instanceFrozen = true); + return new AttributeModifierMap(this.builder); } } diff --git a/patches/minecraft/net/minecraft/entity/ai/attributes/GlobalEntityTypeAttributes.java.patch b/patches/minecraft/net/minecraft/entity/ai/attributes/GlobalEntityTypeAttributes.java.patch index 492ca2c665..48bcc76f37 100644 --- a/patches/minecraft/net/minecraft/entity/ai/attributes/GlobalEntityTypeAttributes.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/attributes/GlobalEntityTypeAttributes.java.patch @@ -2,8 +2,8 @@ +++ b/net/minecraft/entity/ai/attributes/GlobalEntityTypeAttributes.java @@ -72,13 +_,22 @@ public class GlobalEntityTypeAttributes { - private static final Logger field_233832_a_ = LogManager.getLogger(); - private static final Map, AttributeModifierMap> field_233833_b_ = ImmutableMap., AttributeModifierMap>builder().put(EntityType.field_200789_c, LivingEntity.func_233639_cI_().func_233813_a_()).put(EntityType.field_200791_e, BatEntity.func_234175_m_().func_233813_a_()).put(EntityType.field_226289_e_, BeeEntity.func_234182_eX_().func_233813_a_()).put(EntityType.field_200792_f, BlazeEntity.func_234276_m_().func_233813_a_()).put(EntityType.field_220360_g, CatEntity.func_234184_eY_().func_233813_a_()).put(EntityType.field_200794_h, CaveSpiderEntity.func_234277_m_().func_233813_a_()).put(EntityType.field_200795_i, ChickenEntity.func_234187_eI_().func_233813_a_()).put(EntityType.field_203780_j, AbstractFishEntity.func_234176_m_().func_233813_a_()).put(EntityType.field_200796_j, CowEntity.func_234188_eI_().func_233813_a_()).put(EntityType.field_200797_k, CreeperEntity.func_234278_m_().func_233813_a_()).put(EntityType.field_205137_n, DolphinEntity.func_234190_eK_().func_233813_a_()).put(EntityType.field_200798_l, AbstractChestedHorseEntity.func_234234_eJ_().func_233813_a_()).put(EntityType.field_204724_o, ZombieEntity.func_234342_eQ_().func_233813_a_()).put(EntityType.field_200800_n, ElderGuardianEntity.func_234283_m_().func_233813_a_()).put(EntityType.field_200803_q, EndermanEntity.func_234287_m_().func_233813_a_()).put(EntityType.field_200804_r, EndermiteEntity.func_234288_m_().func_233813_a_()).put(EntityType.field_200802_p, EnderDragonEntity.func_234257_m_().func_233813_a_()).put(EntityType.field_200806_t, EvokerEntity.func_234289_eI_().func_233813_a_()).put(EntityType.field_220356_B, FoxEntity.func_234192_eI_().func_233813_a_()).put(EntityType.field_200811_y, GhastEntity.func_234290_eH_().func_233813_a_()).put(EntityType.field_200812_z, GiantEntity.func_234291_m_().func_233813_a_()).put(EntityType.field_200761_A, GuardianEntity.func_234292_eK_().func_233813_a_()).put(EntityType.field_233588_G_, HoglinEntity.func_234362_eI_().func_233813_a_()).put(EntityType.field_200762_B, AbstractHorseEntity.func_234237_fg_().func_233813_a_()).put(EntityType.field_200763_C, ZombieEntity.func_234342_eQ_().func_233813_a_()).put(EntityType.field_200764_D, IllusionerEntity.func_234293_eI_().func_233813_a_()).put(EntityType.field_200757_aw, IronGolemEntity.func_234200_m_().func_233813_a_()).put(EntityType.field_200769_I, LlamaEntity.func_234244_fu_().func_233813_a_()).put(EntityType.field_200771_K, MagmaCubeEntity.func_234294_m_().func_233813_a_()).put(EntityType.field_200780_T, CowEntity.func_234188_eI_().func_233813_a_()).put(EntityType.field_200779_S, AbstractChestedHorseEntity.func_234234_eJ_().func_233813_a_()).put(EntityType.field_200781_U, OcelotEntity.func_234201_eI_().func_233813_a_()).put(EntityType.field_220353_aa, PandaEntity.func_234204_eW_().func_233813_a_()).put(EntityType.field_200783_W, ParrotEntity.func_234213_eS_().func_233813_a_()).put(EntityType.field_203097_aH, MonsterEntity.func_234295_eP_().func_233813_a_()).put(EntityType.field_200784_X, PigEntity.func_234215_eI_().func_233813_a_()).put(EntityType.field_233591_ai_, PiglinEntity.func_234420_eI_().func_233813_a_()).put(EntityType.field_242287_aj, PiglinBruteEntity.func_242344_eS().func_233813_a_()).put(EntityType.field_220350_aJ, PillagerEntity.func_234296_eI_().func_233813_a_()).put(EntityType.field_200729_aH, PlayerEntity.func_234570_el_().func_233813_a_()).put(EntityType.field_200786_Z, PolarBearEntity.func_234219_eI_().func_233813_a_()).put(EntityType.field_203779_Z, AbstractFishEntity.func_234176_m_().func_233813_a_()).put(EntityType.field_200736_ab, RabbitEntity.func_234224_eJ_().func_233813_a_()).put(EntityType.field_220352_aU, RavagerEntity.func_234297_m_().func_233813_a_()).put(EntityType.field_203778_ae, AbstractFishEntity.func_234176_m_().func_233813_a_()).put(EntityType.field_200737_ac, SheepEntity.func_234225_eI_().func_233813_a_()).put(EntityType.field_200738_ad, ShulkerEntity.func_234300_m_().func_233813_a_()).put(EntityType.field_200740_af, SilverfishEntity.func_234301_m_().func_233813_a_()).put(EntityType.field_200741_ag, AbstractSkeletonEntity.func_234275_m_().func_233813_a_()).put(EntityType.field_200742_ah, SkeletonHorseEntity.func_234250_eJ_().func_233813_a_()).put(EntityType.field_200743_ai, MonsterEntity.func_234295_eP_().func_233813_a_()).put(EntityType.field_200745_ak, SnowGolemEntity.func_234226_m_().func_233813_a_()).put(EntityType.field_200748_an, SpiderEntity.func_234305_eI_().func_233813_a_()).put(EntityType.field_200749_ao, SquidEntity.func_234227_m_().func_233813_a_()).put(EntityType.field_200750_ap, AbstractSkeletonEntity.func_234275_m_().func_233813_a_()).put(EntityType.field_233589_aE_, StriderEntity.func_234317_eK_().func_233813_a_()).put(EntityType.field_220354_ax, LlamaEntity.func_234244_fu_().func_233813_a_()).put(EntityType.field_204262_at, AbstractFishEntity.func_234176_m_().func_233813_a_()).put(EntityType.field_203099_aq, TurtleEntity.func_234228_eK_().func_233813_a_()).put(EntityType.field_200755_au, VexEntity.func_234321_m_().func_233813_a_()).put(EntityType.field_200756_av, VillagerEntity.func_234551_eU_().func_233813_a_()).put(EntityType.field_200758_ax, VindicatorEntity.func_234322_eI_().func_233813_a_()).put(EntityType.field_220351_aK, MobEntity.func_233666_p_().func_233813_a_()).put(EntityType.field_200759_ay, WitchEntity.func_234323_eI_().func_233813_a_()).put(EntityType.field_200760_az, WitherEntity.func_234258_eI_().func_233813_a_()).put(EntityType.field_200722_aA, AbstractSkeletonEntity.func_234275_m_().func_233813_a_()).put(EntityType.field_200724_aC, WolfEntity.func_234233_eS_().func_233813_a_()).put(EntityType.field_233590_aW_, ZoglinEntity.func_234339_m_().func_233813_a_()).put(EntityType.field_200725_aD, ZombieEntity.func_234342_eQ_().func_233813_a_()).put(EntityType.field_200726_aE, ZombieHorseEntity.func_234256_eJ_().func_233813_a_()).put(EntityType.field_200727_aF, ZombieEntity.func_234342_eQ_().func_233813_a_()).put(EntityType.field_233592_ba_, ZombifiedPiglinEntity.func_234352_eU_().func_233813_a_()).build(); + private static final Logger LOGGER = LogManager.getLogger(); + private static final Map, AttributeModifierMap> SUPPLIERS = ImmutableMap., AttributeModifierMap>builder().put(EntityType.ARMOR_STAND, LivingEntity.createLivingAttributes().build()).put(EntityType.BAT, BatEntity.createAttributes().build()).put(EntityType.BEE, BeeEntity.createAttributes().build()).put(EntityType.BLAZE, BlazeEntity.createAttributes().build()).put(EntityType.CAT, CatEntity.createAttributes().build()).put(EntityType.CAVE_SPIDER, CaveSpiderEntity.createCaveSpider().build()).put(EntityType.CHICKEN, ChickenEntity.createAttributes().build()).put(EntityType.COD, AbstractFishEntity.createAttributes().build()).put(EntityType.COW, CowEntity.createAttributes().build()).put(EntityType.CREEPER, CreeperEntity.createAttributes().build()).put(EntityType.DOLPHIN, DolphinEntity.createAttributes().build()).put(EntityType.DONKEY, AbstractChestedHorseEntity.createBaseChestedHorseAttributes().build()).put(EntityType.DROWNED, ZombieEntity.createAttributes().build()).put(EntityType.ELDER_GUARDIAN, ElderGuardianEntity.createAttributes().build()).put(EntityType.ENDERMAN, EndermanEntity.createAttributes().build()).put(EntityType.ENDERMITE, EndermiteEntity.createAttributes().build()).put(EntityType.ENDER_DRAGON, EnderDragonEntity.createAttributes().build()).put(EntityType.EVOKER, EvokerEntity.createAttributes().build()).put(EntityType.FOX, FoxEntity.createAttributes().build()).put(EntityType.GHAST, GhastEntity.createAttributes().build()).put(EntityType.GIANT, GiantEntity.createAttributes().build()).put(EntityType.GUARDIAN, GuardianEntity.createAttributes().build()).put(EntityType.HOGLIN, HoglinEntity.createAttributes().build()).put(EntityType.HORSE, AbstractHorseEntity.createBaseHorseAttributes().build()).put(EntityType.HUSK, ZombieEntity.createAttributes().build()).put(EntityType.ILLUSIONER, IllusionerEntity.createAttributes().build()).put(EntityType.IRON_GOLEM, IronGolemEntity.createAttributes().build()).put(EntityType.LLAMA, LlamaEntity.createAttributes().build()).put(EntityType.MAGMA_CUBE, MagmaCubeEntity.createAttributes().build()).put(EntityType.MOOSHROOM, CowEntity.createAttributes().build()).put(EntityType.MULE, AbstractChestedHorseEntity.createBaseChestedHorseAttributes().build()).put(EntityType.OCELOT, OcelotEntity.createAttributes().build()).put(EntityType.PANDA, PandaEntity.createAttributes().build()).put(EntityType.PARROT, ParrotEntity.createAttributes().build()).put(EntityType.PHANTOM, MonsterEntity.createMonsterAttributes().build()).put(EntityType.PIG, PigEntity.createAttributes().build()).put(EntityType.PIGLIN, PiglinEntity.createAttributes().build()).put(EntityType.PIGLIN_BRUTE, PiglinBruteEntity.createAttributes().build()).put(EntityType.PILLAGER, PillagerEntity.createAttributes().build()).put(EntityType.PLAYER, PlayerEntity.createAttributes().build()).put(EntityType.POLAR_BEAR, PolarBearEntity.createAttributes().build()).put(EntityType.PUFFERFISH, AbstractFishEntity.createAttributes().build()).put(EntityType.RABBIT, RabbitEntity.createAttributes().build()).put(EntityType.RAVAGER, RavagerEntity.createAttributes().build()).put(EntityType.SALMON, AbstractFishEntity.createAttributes().build()).put(EntityType.SHEEP, SheepEntity.createAttributes().build()).put(EntityType.SHULKER, ShulkerEntity.createAttributes().build()).put(EntityType.SILVERFISH, SilverfishEntity.createAttributes().build()).put(EntityType.SKELETON, AbstractSkeletonEntity.createAttributes().build()).put(EntityType.SKELETON_HORSE, SkeletonHorseEntity.createAttributes().build()).put(EntityType.SLIME, MonsterEntity.createMonsterAttributes().build()).put(EntityType.SNOW_GOLEM, SnowGolemEntity.createAttributes().build()).put(EntityType.SPIDER, SpiderEntity.createAttributes().build()).put(EntityType.SQUID, SquidEntity.createAttributes().build()).put(EntityType.STRAY, AbstractSkeletonEntity.createAttributes().build()).put(EntityType.STRIDER, StriderEntity.createAttributes().build()).put(EntityType.TRADER_LLAMA, LlamaEntity.createAttributes().build()).put(EntityType.TROPICAL_FISH, AbstractFishEntity.createAttributes().build()).put(EntityType.TURTLE, TurtleEntity.createAttributes().build()).put(EntityType.VEX, VexEntity.createAttributes().build()).put(EntityType.VILLAGER, VillagerEntity.createAttributes().build()).put(EntityType.VINDICATOR, VindicatorEntity.createAttributes().build()).put(EntityType.WANDERING_TRADER, MobEntity.createMobAttributes().build()).put(EntityType.WITCH, WitchEntity.createAttributes().build()).put(EntityType.WITHER, WitherEntity.createAttributes().build()).put(EntityType.WITHER_SKELETON, AbstractSkeletonEntity.createAttributes().build()).put(EntityType.WOLF, WolfEntity.createAttributes().build()).put(EntityType.ZOGLIN, ZoglinEntity.createAttributes().build()).put(EntityType.ZOMBIE, ZombieEntity.createAttributes().build()).put(EntityType.ZOMBIE_HORSE, ZombieHorseEntity.createAttributes().build()).put(EntityType.ZOMBIE_VILLAGER, ZombieEntity.createAttributes().build()).put(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglinEntity.createAttributes().build()).build(); + @Deprecated // Remove in 1.17 + private static final Map, AttributeModifierMap> FORGE_ATTRIBUTES = net.minecraftforge.common.ForgeHooks.getAttributesView(); + @@ -13,15 +13,15 @@ + return net.minecraftforge.common.ForgeHooks.putAttributesOld(type, map); + } - public static AttributeModifierMap func_233835_a_(EntityType p_233835_0_) { -- return field_233833_b_.get(p_233835_0_); + public static AttributeModifierMap getSupplier(EntityType p_233835_0_) { +- return SUPPLIERS.get(p_233835_0_); + AttributeModifierMap map = FORGE_ATTRIBUTES.get(p_233835_0_); -+ return map != null ? map : field_233833_b_.get(p_233835_0_); ++ return map != null ? map : SUPPLIERS.get(p_233835_0_); } - public static boolean func_233837_b_(EntityType p_233837_0_) { -- return field_233833_b_.containsKey(p_233837_0_); -+ return field_233833_b_.containsKey(p_233837_0_) || FORGE_ATTRIBUTES.containsKey(p_233837_0_); + public static boolean hasSupplier(EntityType p_233837_0_) { +- return SUPPLIERS.containsKey(p_233837_0_); ++ return SUPPLIERS.containsKey(p_233837_0_) || FORGE_ATTRIBUTES.containsKey(p_233837_0_); } - public static void func_233834_a_() { + public static void validate() { diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch index 89f2f6ad11..f0d411073f 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/memory/MemoryModuleType.java.patch @@ -6,6 +6,6 @@ -public class MemoryModuleType { +public class MemoryModuleType extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final MemoryModuleType field_220940_a = func_223541_a("dummy"); - public static final MemoryModuleType field_220941_b = func_234108_a_("home", GlobalPos.field_239645_a_); - public static final MemoryModuleType field_220942_c = func_234108_a_("job_site", GlobalPos.field_239645_a_); + public static final MemoryModuleType DUMMY = register("dummy"); + public static final MemoryModuleType HOME = register("home", GlobalPos.CODEC); + public static final MemoryModuleType JOB_SITE = register("job_site", GlobalPos.CODEC); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch index de3e2c57cd..c3e307215a 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Activity.java.patch @@ -6,6 +6,6 @@ -public class Activity { +public class Activity extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Activity field_221365_a = func_221363_a("core"); - public static final Activity field_221366_b = func_221363_a("idle"); - public static final Activity field_221367_c = func_221363_a("work"); + public static final Activity CORE = register("core"); + public static final Activity IDLE = register("idle"); + public static final Activity WORK = register("work"); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch index 384dc76096..9091c35492 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/schedule/Schedule.java.patch @@ -6,6 +6,6 @@ -public class Schedule { +public class Schedule extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Schedule field_221383_a = func_221380_a("empty").func_221402_a(0, Activity.field_221366_b).func_221404_a(); - public static final Schedule field_221384_b = func_221380_a("simple").func_221402_a(5000, Activity.field_221367_c).func_221402_a(11000, Activity.field_221369_e).func_221404_a(); - public static final Schedule field_221385_c = func_221380_a("villager_baby").func_221402_a(10, Activity.field_221366_b).func_221402_a(3000, Activity.field_221368_d).func_221402_a(6000, Activity.field_221366_b).func_221402_a(10000, Activity.field_221368_d).func_221402_a(12000, Activity.field_221369_e).func_221404_a(); + public static final Schedule EMPTY = register("empty").changeActivityAt(0, Activity.IDLE).build(); + public static final Schedule SIMPLE = register("simple").changeActivityAt(5000, Activity.WORK).changeActivityAt(11000, Activity.REST).build(); + public static final Schedule VILLAGER_BABY = register("villager_baby").changeActivityAt(10, Activity.IDLE).changeActivityAt(3000, Activity.PLAY).changeActivityAt(6000, Activity.IDLE).changeActivityAt(10000, Activity.PLAY).changeActivityAt(12000, Activity.REST).build(); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch index 8280c61ac4..db331f727f 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/sensor/SensorType.java.patch @@ -6,6 +6,6 @@ -public class SensorType> { +public class SensorType> extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final SensorType field_220997_a = func_220996_a("dummy", DummySensor::new); - public static final SensorType field_234129_b_ = func_220996_a("nearest_items", WantedItemsSensor::new); - public static final SensorType field_220998_b = func_220996_a("nearest_living_entities", NearestLivingEntitiesSensor::new); + public static final SensorType DUMMY = register("dummy", DummySensor::new); + public static final SensorType NEAREST_ITEMS = register("nearest_items", WantedItemsSensor::new); + public static final SensorType NEAREST_LIVING_ENTITIES = register("nearest_living_entities", NearestLivingEntitiesSensor::new); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch index 68130768a3..c2c4850e28 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch @@ -3,19 +3,19 @@ @@ -37,7 +_,7 @@ } - protected boolean func_212832_a_(ServerWorld p_212832_1_, VillagerEntity p_212832_2_) { -- if (!p_212832_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) { + protected boolean checkExtraStartConditions(ServerWorld p_212832_1_, VillagerEntity p_212832_2_) { +- if (!p_212832_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212832_1_, p_212832_2_)) { return false; - } else if (p_212832_2_.func_213700_eh().func_221130_b() != VillagerProfession.field_221156_f) { + } else if (p_212832_2_.getVillagerData().getProfession() != VillagerProfession.FARMER) { return false; @@ -117,6 +_,11 @@ - } else if (itemstack.func_77973_b() == Items.field_185163_cU) { - p_212833_1_.func_180501_a(this.field_220422_a, Blocks.field_185773_cZ.func_176223_P(), 3); + } else if (itemstack.getItem() == Items.BEETROOT_SEEDS) { + p_212833_1_.setBlock(this.aboveFarmlandPos, Blocks.BEETROOTS.defaultBlockState(), 3); flag = true; -+ } else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) { -+ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(p_212833_1_, field_220422_a) == net.minecraftforge.common.PlantType.CROP) { -+ p_212833_1_.func_180501_a(field_220422_a, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(p_212833_1_, field_220422_a), 3); ++ } else if (itemstack.getItem() instanceof net.minecraftforge.common.IPlantable) { ++ if (((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlantType(p_212833_1_, aboveFarmlandPos) == net.minecraftforge.common.PlantType.CROP) { ++ p_212833_1_.setBlock(aboveFarmlandPos, ((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlant(p_212833_1_, aboveFarmlandPos), 3); + flag = true; + } } diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/task/ShootTargetTask.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/task/ShootTargetTask.java.patch index a46ebf6d71..0e6ea2113e 100644 --- a/patches/minecraft/net/minecraft/entity/ai/brain/task/ShootTargetTask.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/brain/task/ShootTargetTask.java.patch @@ -2,37 +2,37 @@ +++ b/net/minecraft/entity/ai/brain/task/ShootTargetTask.java @@ -24,7 +_,7 @@ - protected boolean func_212832_a_(ServerWorld p_212832_1_, E p_212832_2_) { - LivingEntity livingentity = func_233887_a_(p_212832_2_); -- return p_212832_2_.func_233631_a_(Items.field_222114_py) && BrainUtil.func_233876_c_(p_212832_2_, livingentity) && BrainUtil.func_233869_a_(p_212832_2_, livingentity, 0); -+ return p_212832_2_.func_233634_a_(item -> item instanceof CrossbowItem) && BrainUtil.func_233876_c_(p_212832_2_, livingentity) && BrainUtil.func_233869_a_(p_212832_2_, livingentity, 0); + protected boolean checkExtraStartConditions(ServerWorld p_212832_1_, E p_212832_2_) { + LivingEntity livingentity = getAttackTarget(p_212832_2_); +- return p_212832_2_.isHolding(Items.CROSSBOW) && BrainUtil.canSee(p_212832_2_, livingentity) && BrainUtil.isWithinAttackRange(p_212832_2_, livingentity, 0); ++ return p_212832_2_.isHolding(item -> item instanceof CrossbowItem) && BrainUtil.canSee(p_212832_2_, livingentity) && BrainUtil.isWithinAttackRange(p_212832_2_, livingentity, 0); } - protected boolean func_212834_g_(ServerWorld p_212834_1_, E p_212834_2_, long p_212834_3_) { + protected boolean canStillUse(ServerWorld p_212834_1_, E p_212834_2_, long p_212834_3_) { @@ -42,7 +_,7 @@ - p_212835_2_.func_184602_cy(); + p_212835_2_.stopUsingItem(); } -- if (p_212835_2_.func_233631_a_(Items.field_222114_py)) { -+ if (p_212835_2_.func_233634_a_(item -> item instanceof CrossbowItem)) { - p_212835_2_.func_213671_a(false); - CrossbowItem.func_220011_a(p_212835_2_.func_184607_cu(), false); +- if (p_212835_2_.isHolding(Items.CROSSBOW)) { ++ if (p_212835_2_.isHolding(item -> item instanceof CrossbowItem)) { + p_212835_2_.setChargingCrossbow(false); + CrossbowItem.setCharged(p_212835_2_.getUseItem(), false); } @@ -51,7 +_,7 @@ - private void func_233888_a_(E p_233888_1_, LivingEntity p_233888_2_) { - if (this.field_233886_c_ == ShootTargetTask.Status.UNCHARGED) { -- p_233888_1_.func_184598_c(ProjectileHelper.func_221274_a(p_233888_1_, Items.field_222114_py)); -+ p_233888_1_.func_184598_c(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, item -> item instanceof CrossbowItem)); - this.field_233886_c_ = ShootTargetTask.Status.CHARGING; - p_233888_1_.func_213671_a(true); - } else if (this.field_233886_c_ == ShootTargetTask.Status.CHARGING) { + private void crossbowAttack(E p_233888_1_, LivingEntity p_233888_2_) { + if (this.crossbowState == ShootTargetTask.Status.UNCHARGED) { +- p_233888_1_.startUsingItem(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, Items.CROSSBOW)); ++ p_233888_1_.startUsingItem(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, item -> item instanceof CrossbowItem)); + this.crossbowState = ShootTargetTask.Status.CHARGING; + p_233888_1_.setChargingCrossbow(true); + } else if (this.crossbowState == ShootTargetTask.Status.CHARGING) { @@ -74,7 +_,7 @@ } - } else if (this.field_233886_c_ == ShootTargetTask.Status.READY_TO_ATTACK) { - p_233888_1_.func_82196_d(p_233888_2_, 1.0F); -- ItemStack itemstack1 = p_233888_1_.func_184586_b(ProjectileHelper.func_221274_a(p_233888_1_, Items.field_222114_py)); -+ ItemStack itemstack1 = p_233888_1_.func_184586_b(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, item -> item instanceof CrossbowItem)); - CrossbowItem.func_220011_a(itemstack1, false); - this.field_233886_c_ = ShootTargetTask.Status.UNCHARGED; + } else if (this.crossbowState == ShootTargetTask.Status.READY_TO_ATTACK) { + p_233888_1_.performRangedAttack(p_233888_2_, 1.0F); +- ItemStack itemstack1 = p_233888_1_.getItemInHand(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, Items.CROSSBOW)); ++ ItemStack itemstack1 = p_233888_1_.getItemInHand(ProjectileHelper.getWeaponHoldingHand(p_233888_1_, item -> item instanceof CrossbowItem)); + CrossbowItem.setCharged(itemstack1, false); + this.crossbowState = ShootTargetTask.Status.UNCHARGED; } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch index 54789a6b2a..70bdd503bd 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch @@ -3,9 +3,9 @@ @@ -32,7 +_,7 @@ } - public boolean func_75250_a() { -- if (!this.field_203118_g.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_203118_g.field_70170_p, this.field_179494_b, this.field_203118_g)) { + public boolean canUse() { +- if (!this.removerMob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.removerMob.level, this.blockPos, this.removerMob)) { return false; - } else if (this.field_179496_a > 0) { - --this.field_179496_a; + } else if (this.nextStartTick > 0) { + --this.nextStartTick; diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch index 5fd9a00631..ddb0c69c34 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/ai/goal/BreakDoorGoal.java +++ b/net/minecraft/entity/ai/goal/BreakDoorGoal.java @@ -29,7 +_,7 @@ - public boolean func_75250_a() { - if (!super.func_75250_a()) { + public boolean canUse() { + if (!super.canUse()) { return false; -- } else if (!this.field_75356_a.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ } else if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_75356_a.field_70170_p, this.field_179507_b, this.field_75356_a)) { +- } else if (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ } else if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.mob.level, this.doorPos, this.mob)) { return false; } else { - return this.func_220696_a(this.field_75356_a.field_70170_p.func_175659_aa()) && !this.func_195922_f(); + return this.isValidDifficulty(this.mob.level.getDifficulty()) && !this.isOpen(); diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch index e29be99b32..99e0b11496 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/entity/ai/goal/EatGrassGoal.java +++ b/net/minecraft/entity/ai/goal/EatGrassGoal.java @@ -59,7 +_,7 @@ - if (this.field_151502_a == 4) { - BlockPos blockpos = this.field_151500_b.func_233580_cy_(); - if (field_179505_b.test(this.field_151501_c.func_180495_p(blockpos))) { -- if (this.field_151501_c.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { - this.field_151501_c.func_175655_b(blockpos, false); + if (this.eatAnimationTick == 4) { + BlockPos blockpos = this.mob.blockPosition(); + if (IS_TALL_GRASS.test(this.level.getBlockState(blockpos))) { +- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this.mob)) { + this.level.destroyBlock(blockpos, false); } @@ -67,7 +_,7 @@ } else { - BlockPos blockpos1 = blockpos.func_177977_b(); - if (this.field_151501_c.func_180495_p(blockpos1).func_203425_a(Blocks.field_196658_i)) { -- if (this.field_151501_c.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { - this.field_151501_c.func_217379_c(2001, blockpos1, Block.func_196246_j(Blocks.field_196658_i.func_176223_P())); - this.field_151501_c.func_180501_a(blockpos1, Blocks.field_150346_d.func_176223_P(), 2); + BlockPos blockpos1 = blockpos.below(); + if (this.level.getBlockState(blockpos1).is(Blocks.GRASS_BLOCK)) { +- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this.mob)) { + this.level.levelEvent(2001, blockpos1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); + this.level.setBlock(blockpos1, Blocks.DIRT.defaultBlockState(), 2); } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch index 3b3982b173..e6e6d83843 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch @@ -1,39 +1,39 @@ --- a/net/minecraft/entity/ai/goal/MeleeAttackGoal.java +++ b/net/minecraft/entity/ai/goal/MeleeAttackGoal.java @@ -20,6 +_,8 @@ - private int field_234037_i_; - private final int field_188493_g = 20; - private long field_220720_k; + private int ticksUntilNextAttack; + private final int attackInterval = 20; + private long lastCanUseCheck; + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; public MeleeAttackGoal(CreatureEntity p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) { - this.field_75441_b = p_i1636_1_; + this.mob = p_i1636_1_; @@ -40,6 +_,15 @@ - } else if (!livingentity.func_70089_S()) { + } else if (!livingentity.isAlive()) { return false; } else { + if (canPenalize) { -+ if (--this.field_75445_i <= 0) { -+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(livingentity, 0); -+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ return this.field_75438_g != null; ++ 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.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(livingentity, 0); - if (this.field_75438_g != null) { + this.path = this.mob.getNavigation().createPath(livingentity, 0); + if (this.path != null) { return true; @@ -92,6 +_,18 @@ - this.field_151495_j = livingentity.func_226278_cu_(); - this.field_151496_k = livingentity.func_226281_cx_(); - this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); + this.pathedTargetY = livingentity.getY(); + this.pathedTargetZ = livingentity.getZ(); + this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); + if (this.canPenalize) { -+ this.field_75445_i += failedPathFindingPenalty; -+ if (this.field_75441_b.func_70661_as().func_75505_d() != null) { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); -+ if (finalPathPoint != null && livingentity.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) ++ this.ticksUntilNextPathRecalculation += failedPathFindingPenalty; ++ if (this.mob.getNavigation().getPath() != null) { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.mob.getNavigation().getPath().getEndNode(); ++ if (finalPathPoint != null && livingentity.distanceToSqr(finalPathPoint.x, finalPathPoint.y, finalPathPoint.z) < 1) + failedPathFindingPenalty = 0; + else + failedPathFindingPenalty += 10; @@ -42,5 +42,5 @@ + } + } if (d0 > 1024.0D) { - this.field_75445_i += 10; + this.ticksUntilNextPathRecalculation += 10; } else if (d0 > 256.0D) { diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch index 0b60b1a185..fbe6e7c170 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -3,18 +3,18 @@ @@ -36,7 +_,7 @@ } - protected boolean func_188498_f() { -- return this.field_188499_a.func_233631_a_(Items.field_151031_f); -+ return this.field_188499_a.func_233634_a_(item -> item instanceof BowItem); + protected boolean isHoldingBow() { +- return this.mob.isHolding(Items.BOW); ++ return this.mob.isHolding(item -> item instanceof BowItem); } - public boolean func_75253_b() { + public boolean canContinueToUse() { @@ -117,7 +_,7 @@ } } - } else if (--this.field_188503_e <= 0 && this.field_188504_f >= -60) { -- this.field_188499_a.func_184598_c(ProjectileHelper.func_221274_a(this.field_188499_a, Items.field_151031_f)); -+ this.field_188499_a.func_184598_c(ProjectileHelper.getWeaponHoldingHand(this.field_188499_a, item -> item instanceof BowItem)); + } else if (--this.attackTime <= 0 && this.seeTime >= -60) { +- this.mob.startUsingItem(ProjectileHelper.getWeaponHoldingHand(this.mob, Items.BOW)); ++ this.mob.startUsingItem(ProjectileHelper.getWeaponHoldingHand(this.mob, item -> item instanceof BowItem)); } } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/RangedCrossbowAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RangedCrossbowAttackGoal.java.patch index e4ab4aa729..d9b3da7b4a 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/RangedCrossbowAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RangedCrossbowAttackGoal.java.patch @@ -3,27 +3,27 @@ @@ -33,7 +_,7 @@ } - private boolean func_220745_g() { -- return this.field_220748_a.func_233631_a_(Items.field_222114_py); -+ return this.field_220748_a.func_233634_a_(item -> item instanceof CrossbowItem); + private boolean isHoldingCrossbow() { +- return this.mob.isHolding(Items.CROSSBOW); ++ return this.mob.isHolding(item -> item instanceof CrossbowItem); } - public boolean func_75253_b() { + public boolean canContinueToUse() { @@ -88,7 +_,7 @@ - this.field_220748_a.func_70671_ap().func_75651_a(livingentity, 30.0F, 30.0F); - if (this.field_220749_b == RangedCrossbowAttackGoal.CrossbowState.UNCHARGED) { + this.mob.getLookControl().setLookAt(livingentity, 30.0F, 30.0F); + if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.UNCHARGED) { if (!flag2) { -- this.field_220748_a.func_184598_c(ProjectileHelper.func_221274_a(this.field_220748_a, Items.field_222114_py)); -+ this.field_220748_a.func_184598_c(ProjectileHelper.getWeaponHoldingHand(this.field_220748_a, item -> item instanceof CrossbowItem)); - this.field_220749_b = RangedCrossbowAttackGoal.CrossbowState.CHARGING; - this.field_220748_a.func_213671_a(true); +- this.mob.startUsingItem(ProjectileHelper.getWeaponHoldingHand(this.mob, Items.CROSSBOW)); ++ this.mob.startUsingItem(ProjectileHelper.getWeaponHoldingHand(this.mob, item -> item instanceof CrossbowItem)); + this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.CHARGING; + this.mob.setChargingCrossbow(true); } @@ -112,7 +_,7 @@ } - } else if (this.field_220749_b == RangedCrossbowAttackGoal.CrossbowState.READY_TO_ATTACK && flag) { - this.field_220748_a.func_82196_d(livingentity, 1.0F); -- ItemStack itemstack1 = this.field_220748_a.func_184586_b(ProjectileHelper.func_221274_a(this.field_220748_a, Items.field_222114_py)); -+ ItemStack itemstack1 = this.field_220748_a.func_184586_b(ProjectileHelper.getWeaponHoldingHand(this.field_220748_a, item -> item instanceof CrossbowItem)); - CrossbowItem.func_220011_a(itemstack1, false); - this.field_220749_b = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; + } else if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.READY_TO_ATTACK && flag) { + this.mob.performRangedAttack(livingentity, 1.0F); +- ItemStack itemstack1 = this.mob.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this.mob, Items.CROSSBOW)); ++ ItemStack itemstack1 = this.mob.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this.mob, item -> item instanceof CrossbowItem)); + CrossbowItem.setCharged(itemstack1, false); + this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch index 228c1c6f12..d1aefe52a7 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java @@ -54,7 +_,7 @@ if (entity instanceof PlayerEntity) { - int i = this.field_111180_a.func_110252_cg(); - int j = this.field_111180_a.func_190676_dC(); -- if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i) { -+ if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(field_111180_a, (PlayerEntity)entity)) { - this.field_111180_a.func_110263_g((PlayerEntity)entity); + 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, (PlayerEntity)entity)) { + this.horse.tameWithName((PlayerEntity)entity); return; } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal.java.patch index de3d151304..b3457e0970 100644 --- a/patches/minecraft/net/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal.java.patch @@ -2,21 +2,21 @@ +++ b/net/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal.java @@ -28,6 +_,10 @@ - public void func_75246_d() { - ServerWorld serverworld = (ServerWorld)this.field_188516_a.field_70170_p; + public void tick() { + ServerWorld serverworld = (ServerWorld)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) -+ serverworld.func_73046_m().func_212871_a_(new net.minecraft.util.concurrent.TickDelayedTask(serverworld.func_73046_m().func_71259_af(), () -> { -+ if (!this.field_188516_a.func_70089_S()) return; - DifficultyInstance difficultyinstance = serverworld.func_175649_E(this.field_188516_a.func_233580_cy_()); - this.field_188516_a.func_190691_p(false); - this.field_188516_a.func_110234_j(true); ++ serverworld.getServer().tell(new net.minecraft.util.concurrent.TickDelayedTask(serverworld.getServer().getTickCount(), () -> { ++ if (!this.horse.isAlive()) return; + DifficultyInstance difficultyinstance = serverworld.getCurrentDifficultyAt(this.horse.blockPosition()); + this.horse.setTrap(false); + this.horse.setTamed(true); @@ -47,7 +_,7 @@ - abstracthorseentity.func_70024_g(this.field_188516_a.func_70681_au().nextGaussian() * 0.5D, 0.0D, this.field_188516_a.func_70681_au().nextGaussian() * 0.5D); - serverworld.func_242417_l(abstracthorseentity); + abstracthorseentity.push(this.horse.getRandom().nextGaussian() * 0.5D, 0.0D, this.horse.getRandom().nextGaussian() * 0.5D); + serverworld.addFreshEntityWithPassengers(abstracthorseentity); } - + })); } - private AbstractHorseEntity func_188515_a(DifficultyInstance p_188515_1_) { + private AbstractHorseEntity createHorse(DifficultyInstance p_188515_1_) { diff --git a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch index 10f2ff820c..ac11fbadb9 100644 --- a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/entity/boss/WitherEntity.java +++ b/net/minecraft/entity/boss/WitherEntity.java @@ -213,7 +_,7 @@ - if (this.func_82212_n() > 0) { - int j1 = this.func_82212_n() - 1; + if (this.getInvulnerableTicks() > 0) { + int j1 = this.getInvulnerableTicks() - 1; if (j1 <= 0) { -- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; -+ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; - this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_(), 7.0F, false, explosion$mode); - if (!this.func_174814_R()) { - this.field_70170_p.func_175669_a(1023, this.func_233580_cy_(), 0); +- Explosion.Mode explosion$mode = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion$mode); + if (!this.isSilent()) { + this.level.globalLevelEvent(1023, this.blockPosition(), 0); @@ -290,7 +_,7 @@ - if (this.field_82222_j > 0) { - --this.field_82222_j; -- if (this.field_82222_j == 0 && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - int i1 = MathHelper.func_76128_c(this.func_226278_cu_()); - int l1 = MathHelper.func_76128_c(this.func_226277_ct_()); - int i2 = MathHelper.func_76128_c(this.func_226281_cx_()); + if (this.destroyBlocksTick > 0) { + --this.destroyBlocksTick; +- if (this.destroyBlocksTick == 0 && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (this.destroyBlocksTick == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { + int i1 = MathHelper.floor(this.getY()); + int l1 = MathHelper.floor(this.getX()); + int i2 = MathHelper.floor(this.getZ()); @@ -304,7 +_,7 @@ int l = i2 + l2; BlockPos blockpos = new BlockPos(i3, k, l); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (func_181033_a(blockstate)) { -+ if (blockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = this.field_70170_p.func_225521_a_(blockpos, true, this) || flag; + BlockState blockstate = this.level.getBlockState(blockpos); +- if (canDestroy(blockstate)) { ++ if (blockstate.canEntityDestroy(this.level, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag = this.level.destroyBlock(blockpos, true, this) || flag; } } @@ -325,6 +_,7 @@ @@ -32,6 +32,6 @@ } + @Deprecated //Forge: DO NOT USE use BlockState.canEntityDestroy - public static boolean func_181033_a(BlockState p_181033_0_) { - return !p_181033_0_.func_196958_f() && !BlockTags.field_219755_X.func_230235_a_(p_181033_0_.func_177230_c()); + public static boolean canDestroy(BlockState p_181033_0_) { + return !p_181033_0_.isAir() && !BlockTags.WITHER_IMMUNE.contains(p_181033_0_.getBlock()); } diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch index b9eb9f2fc0..b5551c3634 100644 --- a/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch @@ -3,32 +3,32 @@ @@ -104,6 +_,14 @@ } - this.field_184677_bJ = new PhaseManager(this); -+ this.func_145769_d(field_213331_b.getAndAdd(this.field_70977_g.length + 1) + 1); // Forge: Fix MC-158205: Make sure part ids are successors of parent mob id + this.phaseManager = new PhaseManager(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 func_145769_d(int p_145769_1_) { -+ super.func_145769_d(p_145769_1_); -+ for(int i = 0; i < this.field_70977_g.length; ++i) // Forge: Fix MC-158205: Set part ids to successors of parent mob id -+ this.field_70977_g[i].func_145769_d(p_145769_1_ + i + 1); ++ public void setId(int p_145769_1_) { ++ super.setId(p_145769_1_); ++ 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_145769_1_ + i + 1); } - public static AttributeModifierMap.MutableAttribute func_234257_m_() { + public static AttributeModifierMap.MutableAttribute createAttributes() { @@ -408,8 +_,8 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); - Block block = blockstate.func_177230_c(); -- if (!blockstate.func_196958_f() && blockstate.func_185904_a() != Material.field_151581_o) { -- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) && !BlockTags.field_219754_W.func_230235_a_(block)) { -+ if (!blockstate.isAir(this.field_70170_p, blockpos) && blockstate.func_185904_a() != Material.field_151581_o) { -+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_70170_p, blockpos, this) && !BlockTags.field_219754_W.func_230235_a_(block)) { - flag1 = this.field_70170_p.func_217377_a(blockpos, false) || flag1; + BlockState blockstate = this.level.getBlockState(blockpos); + Block block = blockstate.getBlock(); +- if (!blockstate.isAir() && blockstate.getMaterial() != Material.FIRE) { +- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !BlockTags.DRAGON_IMMUNE.contains(block)) { ++ if (!blockstate.isAir(this.level, blockpos) && blockstate.getMaterial() != Material.FIRE) { ++ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.level, blockpos, this) && !BlockTags.DRAGON_IMMUNE.contains(block)) { + flag1 = this.level.removeBlock(blockpos, false) || flag1; } else { flag = true; @@ -841,5 +_,15 @@ - public boolean func_184222_aU() { + public boolean canChangeDimensions() { return false; + } + @@ -39,6 +39,6 @@ + + @Override + public net.minecraftforge.entity.PartEntity[] getParts() { -+ return this.field_70977_g; ++ return this.subEntities; } } diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonPartEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonPartEntity.java.patch index 075ddd6c98..81de6c3c72 100644 --- a/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonPartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonPartEntity.java.patch @@ -6,13 +6,13 @@ -public class EnderDragonPartEntity extends Entity { +public class EnderDragonPartEntity extends net.minecraftforge.entity.PartEntity { - public final EnderDragonEntity field_213852_b; - public final String field_213853_c; - private final EntitySize field_213854_d; + public final EnderDragonEntity parentMob; + public final String name; + private final EntitySize size; public EnderDragonPartEntity(EnderDragonEntity p_i50232_1_, String p_i50232_2_, float p_i50232_3_, float p_i50232_4_) { -- super(p_i50232_1_.func_200600_R(), p_i50232_1_.field_70170_p); +- super(p_i50232_1_.getType(), p_i50232_1_.level); + super(p_i50232_1_); - this.field_213854_d = EntitySize.func_220314_b(p_i50232_3_, p_i50232_4_); - this.func_213323_x_(); - this.field_213852_b = p_i50232_1_; + this.size = EntitySize.scalable(p_i50232_3_, p_i50232_4_); + this.refreshDimensions(); + this.parentMob = p_i50232_1_; diff --git a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch index cc17ac45e0..e61f93239e 100644 --- a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/entity/effect/LightningBoltEntity.java +++ b/net/minecraft/entity/effect/LightningBoltEntity.java @@ -30,6 +_,7 @@ - private boolean field_184529_d; + private boolean visualOnly; @Nullable - private ServerPlayerEntity field_204810_e; + private ServerPlayerEntity cause; + private float damage = 5.0F; public LightningBoltEntity(EntityType p_i231491_1_, World p_i231491_2_) { super(p_i231491_1_, p_i231491_2_); @@ -51,6 +_,14 @@ - this.field_204810_e = p_204809_1_; + this.cause = p_204809_1_; } + public void setDamage(float damage){ @@ -20,14 +20,14 @@ + return this.damage; + } + - public void func_70071_h_() { - super.func_70071_h_(); - if (this.field_70262_b == 2) { + public void tick() { + super.tick(); + if (this.life == 2) { @@ -83,6 +_,7 @@ - List list = this.field_70170_p.func_175674_a(this, new AxisAlignedBB(this.func_226277_ct_() - 3.0D, this.func_226278_cu_() - 3.0D, this.func_226281_cx_() - 3.0D, this.func_226277_ct_() + 3.0D, this.func_226278_cu_() + 6.0D + 3.0D, this.func_226281_cx_() + 3.0D), Entity::func_70089_S); + List list = this.level.getEntities(this, new AxisAlignedBB(this.getX() - 3.0D, this.getY() - 3.0D, this.getZ() - 3.0D, this.getX() + 3.0D, this.getY() + 6.0D + 3.0D, this.getZ() + 3.0D), Entity::isAlive); for(Entity entity : list) { + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) - entity.func_241841_a((ServerWorld)this.field_70170_p, this); + entity.thunderHit((ServerWorld)this.level, this); } diff --git a/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch index caab0abc23..54b041cc2c 100644 --- a/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/item/ArmorStandEntity.java +++ b/net/minecraft/entity/item/ArmorStandEntity.java @@ -60,7 +_,7 @@ - public static final DataParameter field_184806_f = EntityDataManager.func_187226_a(ArmorStandEntity.class, DataSerializers.field_187199_i); - public static final DataParameter field_184807_g = EntityDataManager.func_187226_a(ArmorStandEntity.class, DataSerializers.field_187199_i); - private static final Predicate field_184798_bv = (p_200617_0_) -> { -- return p_200617_0_ instanceof AbstractMinecartEntity && ((AbstractMinecartEntity)p_200617_0_).func_184264_v() == AbstractMinecartEntity.Type.RIDEABLE; + public static final DataParameter DATA_LEFT_LEG_POSE = EntityDataManager.defineId(ArmorStandEntity.class, DataSerializers.ROTATIONS); + public static final DataParameter DATA_RIGHT_LEG_POSE = EntityDataManager.defineId(ArmorStandEntity.class, DataSerializers.ROTATIONS); + private static final Predicate RIDABLE_MINECARTS = (p_200617_0_) -> { +- return p_200617_0_ instanceof AbstractMinecartEntity && ((AbstractMinecartEntity)p_200617_0_).getMinecartType() == AbstractMinecartEntity.Type.RIDEABLE; + return p_200617_0_ instanceof AbstractMinecartEntity && ((AbstractMinecartEntity)p_200617_0_).canBeRidden(); }; - private final NonNullList field_184799_bw = NonNullList.func_191197_a(2, ItemStack.field_190927_a); - private final NonNullList field_184800_bx = NonNullList.func_191197_a(4, ItemStack.field_190927_a); + private final NonNullList handItems = NonNullList.withSize(2, ItemStack.EMPTY); + private final NonNullList armorItems = NonNullList.withSize(4, ItemStack.EMPTY); diff --git a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch index 8c81273185..31e5c136f0 100644 --- a/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/entity/item/BoatEntity.java +++ b/net/minecraft/entity/item/BoatEntity.java @@ -468,7 +_,7 @@ - blockpos$mutable.func_181079_c(l1, k2, i2); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$mutable); - if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$mutable).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.field_223238_i_)) { -- f += blockstate.func_177230_c().func_208618_m(); -+ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$mutable, this); + blockpos$mutable.set(l1, k2, i2); + BlockState blockstate = this.level.getBlockState(blockpos$mutable); + if (!(blockstate.getBlock() instanceof LilyPadBlock) && VoxelShapes.joinIsNotEmpty(blockstate.getCollisionShape(this.level, blockpos$mutable).move((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.AND)) { +- f += blockstate.getBlock().getFriction(); ++ f += blockstate.getSlipperiness(this.level, blockpos$mutable, this); ++k1; } } @@ -815,6 +_,16 @@ - public boolean func_204231_K() { - return this.field_184469_aF == BoatEntity.Status.UNDER_WATER || this.field_184469_aF == BoatEntity.Status.UNDER_FLOWING_WATER; + public boolean isUnderWater() { + return this.status == BoatEntity.Status.UNDER_WATER || this.status == BoatEntity.Status.UNDER_FLOWING_WATER; + } + + // Forge: Fix MC-119811 by instantly completing lerp on board + @Override -+ protected void func_184200_o(Entity passenger) { -+ super.func_184200_o(passenger); -+ if (this.func_184186_bw() && this.field_184476_at > 0) { -+ this.field_184476_at = 0; -+ this.func_70080_a(this.field_70281_h, this.field_184477_av, this.field_184478_aw, (float)this.field_70273_g, (float)this.field_184479_ay); ++ protected void addPassenger(Entity passenger) { ++ super.addPassenger(passenger); ++ if (this.isControlledByLocalInstance() && this.lerpSteps > 0) { ++ this.lerpSteps = 0; ++ this.absMoveTo(this.lerpX, this.lerpY, this.lerpZ, (float)this.lerpYRot, (float)this.lerpXRot); + } } diff --git a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch index ec67b5bfec..dfc3f55c0a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -3,37 +3,37 @@ @@ -55,6 +_,8 @@ if (entity instanceof ServerPlayerEntity) { ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)entity; - if (serverplayerentity.field_71135_a.func_147298_b().func_150724_d() && serverplayerentity.field_70170_p == this.field_70170_p && !serverplayerentity.func_70608_bn()) { -+ net.minecraftforge.event.entity.living.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayerentity, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this, 5.0F); + if (serverplayerentity.connection.getConnection().isConnected() && serverplayerentity.level == this.level && !serverplayerentity.isSleeping()) { ++ net.minecraftforge.event.entity.living.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayerentity, this.getX(), this.getY(), this.getZ(), this, 5.0F); + if (!event.isCanceled()) { // Don't indent to lower patch size - if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223601_d)) { - EndermiteEntity endermiteentity = EntityType.field_200804_r.func_200721_a(this.field_70170_p); - endermiteentity.func_175496_a(true); + if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { + EndermiteEntity endermiteentity = EntityType.ENDERMITE.create(this.level); + endermiteentity.setPlayerSpawned(true); @@ -66,9 +_,10 @@ - entity.func_184210_p(); + entity.stopRiding(); } -- entity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); -+ entity.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ()); - entity.field_70143_R = 0.0F; -- entity.func_70097_a(DamageSource.field_76379_h, 5.0F); -+ entity.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage()); +- entity.teleportTo(this.getX(), this.getY(), this.getZ()); ++ entity.teleportTo(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + entity.fallDistance = 0.0F; +- entity.hurt(DamageSource.FALL, 5.0F); ++ entity.hurt(DamageSource.FALL, event.getAttackDamage()); + } //Forge: End } } else if (entity != null) { - entity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_()); + entity.teleportTo(this.getX(), this.getY(), this.getZ()); @@ -91,12 +_,12 @@ } @Nullable -- public Entity func_241206_a_(ServerWorld p_241206_1_) { +- public Entity changeDimension(ServerWorld p_241206_1_) { + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - Entity entity = this.func_234616_v_(); - if (entity != null && entity.field_70170_p.func_234923_W_() != p_241206_1_.func_234923_W_()) { - this.func_212361_a((Entity)null); + Entity entity = this.getOwner(); + if (entity != null && entity.level.dimension() != p_241206_1_.dimension()) { + this.setOwner((Entity)null); } -- return super.func_241206_a_(p_241206_1_); +- return super.changeDimension(p_241206_1_); + return super.changeDimension(p_241206_1_, teleporter); } } diff --git a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch index 0d078dbb4c..bd6bca7d1f 100644 --- a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch @@ -1,36 +1,36 @@ --- a/net/minecraft/entity/item/ExperienceOrbEntity.java +++ b/net/minecraft/entity/item/ExperienceOrbEntity.java @@ -98,7 +_,8 @@ - this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + this.move(MoverType.SELF, this.getDeltaMovement()); float f = 0.98F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.98F; -+ BlockPos pos =new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()); -+ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F; + if (this.onGround) { +- f = this.level.getBlockState(new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ())).getBlock().getFriction() * 0.98F; ++ BlockPos pos =new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ()); ++ f = this.level.getBlockState(pos).getSlipperiness(this.level, pos, this) * 0.98F; } - this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); + this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.98D, (double)f)); @@ -123,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850 - if (this.func_180431_b(p_70097_1_)) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { ++ if (this.level.isClientSide || this.removed) return false; //Forge: Fixes MC-53850 + if (this.isInvulnerableTo(p_70097_1_)) { return false; } else { @@ -151,13 +_,14 @@ - public void func_70100_b_(PlayerEntity p_70100_1_) { - if (!this.field_70170_p.field_72995_K) { - if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { + public void playerTouch(PlayerEntity p_70100_1_) { + if (!this.level.isClientSide) { + if (this.throwTime == 0 && p_70100_1_.takeXpDelay == 0) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerXpEvent.PickupXp(p_70100_1_, this))) return; - p_70100_1_.field_71090_bL = 2; - p_70100_1_.func_71001_a(this, 1); - Entry entry = EnchantmentHelper.func_234844_a_(Enchantments.field_185296_A, p_70100_1_, ItemStack::func_77951_h); + p_70100_1_.takeXpDelay = 2; + p_70100_1_.take(this, 1); + Entry entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, p_70100_1_, ItemStack::isDamaged); if (entry != null) { ItemStack itemstack = entry.getValue(); - if (!itemstack.func_190926_b() && itemstack.func_77951_h()) { -- int i = Math.min(this.func_184514_c(this.field_70530_e), itemstack.func_77952_i()); -+ int i = Math.min((int)(this.field_70530_e * itemstack.getXpRepairRatio()), itemstack.func_77952_i()); - this.field_70530_e -= this.func_184515_b(i); - itemstack.func_196085_b(itemstack.func_77952_i() - i); + if (!itemstack.isEmpty() && itemstack.isDamaged()) { +- int i = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue()); ++ int i = Math.min((int)(this.value * itemstack.getXpRepairRatio()), itemstack.getDamageValue()); + this.value -= this.durabilityToXp(i); + itemstack.setDamageValue(itemstack.getDamageValue() - i); } diff --git a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch index 66f3e0d635..5229ba10e1 100644 --- a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/item/FallingBlockEntity.java +++ b/net/minecraft/entity/item/FallingBlockEntity.java @@ -153,7 +_,7 @@ - ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate, this); + ((FallingBlock)block).onLand(this.level, blockpos1, this.blockState, blockstate, this); } -- if (this.field_145810_d != null && block instanceof ITileEntityProvider) { -+ if (this.field_145810_d != null && this.field_175132_d.hasTileEntity()) { - TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1); +- if (this.blockData != null && block instanceof ITileEntityProvider) { ++ if (this.blockData != null && this.blockState.hasTileEntity()) { + TileEntity tileentity = this.level.getBlockEntity(blockpos1); if (tileentity != null) { - CompoundNBT compoundnbt = tileentity.func_189515_b(new CompoundNBT()); + CompoundNBT compoundnbt = tileentity.save(new CompoundNBT()); diff --git a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch index 24ded1f632..a7d13cb663 100644 --- a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/item/HangingEntity.java @@ -120,6 +_,8 @@ int j1 = (j - 1) / -2; - blockpos$mutable.func_189533_g(blockpos).func_189534_c(direction, k + i1).func_189534_c(Direction.UP, l + j1); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$mutable); -+ if (net.minecraft.block.Block.func_220055_a(this.field_70170_p, blockpos$mutable, this.field_174860_b)) + blockpos$mutable.set(blockpos).move(direction, k + i1).move(Direction.UP, l + j1); + BlockState blockstate = this.level.getBlockState(blockpos$mutable); ++ if (net.minecraft.block.Block.canSupportCenter(this.level, blockpos$mutable, this.direction)) + continue; - if (!blockstate.func_185904_a().func_76220_a() && !RedstoneDiodeBlock.func_185546_B(blockstate)) { + if (!blockstate.getMaterial().isSolid() && !RedstoneDiodeBlock.isDiode(blockstate)) { return false; } diff --git a/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch index f79af27bf2..981bdda000 100644 --- a/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/entity/item/ItemEntity.java +++ b/net/minecraft/entity/item/ItemEntity.java @@ -38,6 +_,10 @@ - private UUID field_145801_f; - private UUID field_145802_g; - public final float field_70290_d; + private UUID thrower; + private UUID owner; + public final float bobOffs; + /** + * The maximum age of this EntityItem. The item is expired once this is reached. + */ @@ -14,114 +14,114 @@ @@ -54,6 +_,7 @@ public ItemEntity(World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) { this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); - this.func_92058_a(p_i1710_8_); -+ this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_)); + this.setItem(p_i1710_8_); ++ this.lifespan = (p_i1710_8_.getItem() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_)); } @OnlyIn(Dist.CLIENT) @@ -74,6 +_,7 @@ } - public void func_70071_h_() { -+ if (func_92059_d().onEntityItemUpdate(this)) return; - if (this.func_92059_d().func_190926_b()) { - this.func_70106_y(); + public void tick() { ++ if (getItem().onEntityItemUpdate(this)) return; + if (this.getItem().isEmpty()) { + this.remove(); } else { @@ -108,7 +_,7 @@ - this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + this.move(MoverType.SELF, this.getDeltaMovement()); float f1 = 0.98F; - if (this.field_70122_E) { -- f1 = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.98F; -+ f1 = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).getSlipperiness(field_70170_p, new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_()), this) * 0.98F; + if (this.onGround) { +- f1 = this.level.getBlockState(new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ())).getBlock().getFriction() * 0.98F; ++ f1 = this.level.getBlockState(new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ())).getSlipperiness(level, new BlockPos(this.getX(), this.getY() - 1.0D, this.getZ()), this) * 0.98F; } - this.func_213317_d(this.func_213322_ci().func_216372_d((double)f1, 0.98D, (double)f1)); + this.setDeltaMovement(this.getDeltaMovement().multiply((double)f1, 0.98D, (double)f1)); @@ -144,7 +_,14 @@ } } -- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) { -+ ItemStack item = this.func_92059_d(); -+ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) { +- if (!this.level.isClientSide && this.age >= 6000) { ++ ItemStack item = this.getItem(); ++ if (!this.level.isClientSide && this.age >= lifespan) { + int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.func_70106_y(); ++ if (hook < 0) this.remove(); + else this.lifespan += hook; + } + -+ if (item.func_190926_b()) { - this.func_70106_y(); ++ if (item.isEmpty()) { + this.remove(); } @@ -202,6 +_,8 @@ return false; - } else if (p_226532_1_.func_77942_o() ^ p_226532_0_.func_77942_o()) { + } else if (p_226532_1_.hasTag() ^ p_226532_0_.hasTag()) { return false; + } else if (!p_226532_0_.areCapsCompatible(p_226532_1_)) { + return false; } else { - return !p_226532_1_.func_77942_o() || p_226532_1_.func_77978_p().equals(p_226532_0_.func_77978_p()); + return !p_226532_1_.hasTag() || p_226532_1_.getTag().equals(p_226532_0_.getTag()); } @@ -235,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850 - if (this.func_180431_b(p_70097_1_)) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { ++ if (this.level.isClientSide || this.removed) return false; //Forge: Fixes MC-53850 + if (this.isInvulnerableTo(p_70097_1_)) { return false; - } else if (!this.func_92059_d().func_190926_b() && this.func_92059_d().func_77973_b() == Items.field_151156_bN && p_70097_1_.func_94541_c()) { + } else if (!this.getItem().isEmpty() && this.getItem().getItem() == Items.NETHER_STAR && p_70097_1_.isExplosion()) { @@ -256,6 +_,7 @@ - p_213281_1_.func_74777_a("Health", (short)this.field_70291_e); - p_213281_1_.func_74777_a("Age", (short)this.field_70292_b); - p_213281_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); -+ p_213281_1_.func_74768_a("Lifespan", lifespan); - if (this.func_200214_m() != null) { - p_213281_1_.func_186854_a("Thrower", this.func_200214_m()); + p_213281_1_.putShort("Health", (short)this.health); + p_213281_1_.putShort("Age", (short)this.age); + p_213281_1_.putShort("PickupDelay", (short)this.pickupDelay); ++ p_213281_1_.putInt("Lifespan", lifespan); + if (this.getThrower() != null) { + p_213281_1_.putUUID("Thrower", this.getThrower()); } @@ -276,6 +_,7 @@ - if (p_70037_1_.func_74764_b("PickupDelay")) { - this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay"); + if (p_70037_1_.contains("PickupDelay")) { + this.pickupDelay = p_70037_1_.getShort("PickupDelay"); } -+ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); ++ if (p_70037_1_.contains("Lifespan")) lifespan = p_70037_1_.getInt("Lifespan"); - if (p_70037_1_.func_186855_b("Owner")) { - this.field_145802_g = p_70037_1_.func_186857_a("Owner"); + if (p_70037_1_.hasUUID("Owner")) { + this.owner = p_70037_1_.getUUID("Owner"); @@ -295,10 +_,18 @@ - public void func_70100_b_(PlayerEntity p_70100_1_) { - if (!this.field_70170_p.field_72995_K) { -+ if (this.field_145804_b > 0) return; - ItemStack itemstack = this.func_92059_d(); - Item item = itemstack.func_77973_b(); - int i = itemstack.func_190916_E(); -- if (this.field_145804_b == 0 && (this.field_145802_g == null || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) { + public void playerTouch(PlayerEntity p_70100_1_) { + 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.owner == null || this.owner.equals(p_70100_1_.getUUID())) && p_70100_1_.inventory.add(itemstack)) { + + int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_); + if (hook < 0) return; + -+ ItemStack copy = itemstack.func_77946_l(); -+ if (this.field_145804_b == 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_110124_au())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) { -+ copy.func_190920_e(copy.func_190916_E() - func_92059_d().func_190916_E()); ++ ItemStack copy = itemstack.copy(); ++ if (this.pickupDelay == 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(p_70100_1_.getUUID())) && (hook == 1 || i <= 0 || p_70100_1_.inventory.add(itemstack))) { ++ copy.setCount(copy.getCount() - getItem().getCount()); + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerItemPickupEvent(p_70100_1_, this, copy); - p_70100_1_.func_71001_a(this, i); - if (itemstack.func_190926_b()) { - this.func_70106_y(); + p_70100_1_.take(this, i); + if (itemstack.isEmpty()) { + this.remove(); @@ -322,8 +_,8 @@ } @Nullable -- public Entity func_241206_a_(ServerWorld p_241206_1_) { -- Entity entity = super.func_241206_a_(p_241206_1_); +- public Entity changeDimension(ServerWorld p_241206_1_) { +- Entity entity = super.changeDimension(p_241206_1_); + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { + Entity entity = super.changeDimension(p_241206_1_, teleporter); - if (!this.field_70170_p.field_72995_K && entity instanceof ItemEntity) { - ((ItemEntity)entity).func_85054_d(); + if (!this.level.isClientSide && entity instanceof ItemEntity) { + ((ItemEntity)entity).mergeWithNeighbours(); } @@ -396,7 +_,7 @@ - public void func_174870_v() { - this.func_174871_r(); -- this.field_70292_b = 5999; -+ this.field_70292_b = func_92059_d().getEntityLifespan(field_70170_p) - 1; + public void makeFakeItem() { + this.setNeverPickUp(); +- this.age = 5999; ++ this.age = getItem().getEntityLifespan(level) - 1; } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch index 4408a50f04..f90f9e3d2a 100644 --- a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/entity/item/LeashKnotEntity.java @@ -45,6 +_,7 @@ - protected void func_174856_o() { - this.func_226288_n_((double)this.field_174861_a.func_177958_n() + 0.5D, (double)this.field_174861_a.func_177956_o() + 0.5D, (double)this.field_174861_a.func_177952_p() + 0.5D); -+ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + protected void recalculateBoundingBox() { + this.setPosRaw((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D); ++ if (this.isAddedToWorld() && this.level instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.level).updateChunkPos(this); // Forge - Process chunk registration after moving. } - public void func_174859_a(Direction p_174859_1_) { + public void setDirection(Direction p_174859_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/PaintingType.java.patch b/patches/minecraft/net/minecraft/entity/item/PaintingType.java.patch index 82b1735919..59f7616f48 100644 --- a/patches/minecraft/net/minecraft/entity/item/PaintingType.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/PaintingType.java.patch @@ -6,6 +6,6 @@ -public class PaintingType { +public class PaintingType extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final PaintingType field_200843_b = func_221119_a("kebab", 16, 16); - public static final PaintingType field_200844_c = func_221119_a("aztec", 16, 16); - public static final PaintingType field_200845_d = func_221119_a("alban", 16, 16); + public static final PaintingType KEBAB = register("kebab", 16, 16); + public static final PaintingType AZTEC = register("aztec", 16, 16); + public static final PaintingType ALBAN = register("alban", 16, 16); diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch index 641082f16d..0e081eadcf 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch @@ -6,28 +6,28 @@ -public abstract class AbstractMinecartEntity extends Entity { +public abstract class AbstractMinecartEntity extends Entity implements net.minecraftforge.common.extensions.IForgeEntityMinecart { - private static final DataParameter field_184265_a = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187192_b); - private static final DataParameter field_184266_b = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187192_b); - private static final DataParameter field_184267_c = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187193_c); + private static final DataParameter DATA_ID_HURT = EntityDataManager.defineId(AbstractMinecartEntity.class, DataSerializers.INT); + private static final DataParameter DATA_ID_HURTDIR = EntityDataManager.defineId(AbstractMinecartEntity.class, DataSerializers.INT); + private static final DataParameter DATA_ID_DAMAGE = EntityDataManager.defineId(AbstractMinecartEntity.class, DataSerializers.FLOAT); @@ -77,6 +_,7 @@ p_226574_0_.put(RailShape.NORTH_WEST, Pair.of(vector3i2, vector3i)); p_226574_0_.put(RailShape.NORTH_EAST, Pair.of(vector3i2, vector3i1)); }); + private static net.minecraftforge.common.IMinecartCollisionHandler COLLISIONS = null; - private int field_70510_h; - private double field_70511_i; - private double field_70509_j; + private int lSteps; + private double lx; + private double ly; @@ -89,6 +_,7 @@ - private double field_70507_ar; + private double lyd; @OnlyIn(Dist.CLIENT) - private double field_70506_as; + private double lzd; + private boolean canBePushed = true; protected AbstractMinecartEntity(EntityType p_i48538_1_, World p_i48538_2_) { super(p_i48538_1_, p_i48538_2_); @@ -103,6 +_,14 @@ - this.field_70167_r = p_i48539_5_; - this.field_70166_s = p_i48539_7_; + this.yo = p_i48539_5_; + this.zo = p_i48539_7_; } + + public net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() { @@ -38,40 +38,40 @@ + COLLISIONS = handler; + } - public static AbstractMinecartEntity func_184263_a(World p_184263_0_, double p_184263_1_, double p_184263_3_, double p_184263_5_, AbstractMinecartEntity.Type p_184263_7_) { + public static AbstractMinecartEntity createMinecart(World p_184263_0_, double p_184263_1_, double p_184263_3_, double p_184263_5_, AbstractMinecartEntity.Type p_184263_7_) { if (p_184263_7_ == AbstractMinecartEntity.Type.CHEST) { @@ -138,7 +_,7 @@ } - public boolean func_70104_M() { + public boolean isPushable() { - return true; + return canBePushed; } - protected Vector3d func_241839_a(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_) { + protected Vector3d getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_) { @@ -307,9 +_,9 @@ BlockPos blockpos = new BlockPos(i, j, k); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (AbstractRailBlock.func_208487_j(blockstate)) { -+ if (canUseRail() && AbstractRailBlock.func_208487_j(blockstate)) { - this.func_180460_a(blockpos, blockstate); -- if (blockstate.func_203425_a(Blocks.field_150408_cc)) { -+ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.func_177230_c()).isActivatorRail()) { - this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M)); + BlockState blockstate = this.level.getBlockState(blockpos); +- if (AbstractRailBlock.isRail(blockstate)) { ++ if (canUseRail() && AbstractRailBlock.isRail(blockstate)) { + this.moveAlongTrack(blockpos, blockstate); +- if (blockstate.is(Blocks.ACTIVATOR_RAIL)) { ++ if (blockstate.getBlock() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.getBlock()).isActivatorRail()) { + this.activateMinecart(i, j, k, blockstate.getValue(PoweredRailBlock.POWERED)); } } else { @@ -334,8 +_,11 @@ } - this.func_70101_b(this.field_70177_z, this.field_70125_A); -- if (this.func_184264_v() == AbstractMinecartEntity.Type.RIDEABLE && func_213296_b(this.func_213322_ci()) > 0.01D) { -- List list = this.field_70170_p.func_175674_a(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F), EntityPredicates.func_200823_a(this)); + this.setRot(this.yRot, this.xRot); +- if (this.getMinecartType() == AbstractMinecartEntity.Type.RIDEABLE && getHorizontalDistanceSqr(this.getDeltaMovement()) > 0.01D) { +- List list = this.level.getEntities(this, this.getBoundingBox().inflate((double)0.2F, 0.0D, (double)0.2F), EntityPredicates.pushableBy(this)); + AxisAlignedBB box; + if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.func_174813_aQ().func_72314_b(0.2F, 0.0D, 0.2F); -+ if (canBeRidden() && func_213296_b(this.func_213322_ci()) > 0.01D) { -+ List list = this.field_70170_p.func_175674_a(this, box, EntityPredicates.func_200823_a(this)); ++ else box = this.getBoundingBox().inflate(0.2F, 0.0D, 0.2F); ++ if (canBeRidden() && getHorizontalDistanceSqr(this.getDeltaMovement()) > 0.01D) { ++ List list = this.level.getEntities(this, box, EntityPredicates.pushableBy(this)); if (!list.isEmpty()) { for(int l = 0; l < list.size(); ++l) { Entity entity1 = list.get(l); @@ -79,70 +79,70 @@ } } } else { -- for(Entity entity : this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F))) { -+ for(Entity entity : this.field_70170_p.func_72839_b(this, box)) { - if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof AbstractMinecartEntity) { - entity.func_70108_f(this); +- for(Entity entity : this.level.getEntities(this, this.getBoundingBox().inflate((double)0.2F, 0.0D, (double)0.2F))) { ++ for(Entity entity : this.level.getEntities(this, box)) { + if (!this.hasPassenger(entity) && entity.isPushable() && entity instanceof AbstractMinecartEntity) { + entity.push(this); } @@ -372,16 +_,23 @@ } - protected void func_180459_n() { -- double d0 = this.func_174898_m(); -+ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); - Vector3d vector3d = this.func_213322_ci(); - this.func_213293_j(MathHelper.func_151237_a(vector3d.field_72450_a, -d0, d0), vector3d.field_72448_b, MathHelper.func_151237_a(vector3d.field_72449_c, -d0, d0)); - if (this.field_70122_E) { - this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D)); + protected void comeOffTrack() { +- double d0 = this.getMaxSpeed(); ++ double d0 = onGround ? this.getMaxSpeed() : getMaxSpeedAirLateral(); + Vector3d vector3d = this.getDeltaMovement(); + this.setDeltaMovement(MathHelper.clamp(vector3d.x, -d0, d0), vector3d.y, MathHelper.clamp(vector3d.z, -d0, d0)); + if (this.onGround) { + this.setDeltaMovement(this.getDeltaMovement().scale(0.5D)); } -+ if (getMaxSpeedAirVertical() > 0 && func_213322_ci().field_72448_b > getMaxSpeedAirVertical()) { -+ if(Math.abs(func_213322_ci().field_72450_a) < 0.3f && Math.abs(func_213322_ci().field_72449_c) < 0.3f) -+ func_213317_d(new Vector3d(func_213322_ci().field_72450_a, 0.15f, func_213322_ci().field_72449_c)); ++ if (getMaxSpeedAirVertical() > 0 && getDeltaMovement().y > getMaxSpeedAirVertical()) { ++ if(Math.abs(getDeltaMovement().x) < 0.3f && Math.abs(getDeltaMovement().z) < 0.3f) ++ setDeltaMovement(new Vector3d(getDeltaMovement().x, 0.15f, getDeltaMovement().z)); + else -+ func_213317_d(new Vector3d(func_213322_ci().field_72450_a, getMaxSpeedAirVertical(), func_213322_ci().field_72449_c)); ++ setDeltaMovement(new Vector3d(getDeltaMovement().x, getMaxSpeedAirVertical(), getDeltaMovement().z)); + } + - this.func_213315_a(MoverType.SELF, this.func_213322_ci()); - if (!this.field_70122_E) { -- this.func_213317_d(this.func_213322_ci().func_186678_a(0.95D)); -+ this.func_213317_d(this.func_213322_ci().func_186678_a(getDragAir())); + this.move(MoverType.SELF, this.getDeltaMovement()); + if (!this.onGround) { +- this.setDeltaMovement(this.getDeltaMovement().scale(0.95D)); ++ this.setDeltaMovement(this.getDeltaMovement().scale(getDragAir())); } } @@ -396,29 +_,29 @@ boolean flag = false; boolean flag1 = false; - AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c(); -- if (abstractrailblock == Blocks.field_196552_aC) { + AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.getBlock(); +- if (abstractrailblock == Blocks.POWERED_RAIL) { + if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock) abstractrailblock).isActivatorRail()) { - flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M); + flag = p_180460_2_.getValue(PoweredRailBlock.POWERED); flag1 = !flag; } double d3 = 0.0078125D; - Vector3d vector3d1 = this.func_213322_ci(); -- RailShape railshape = p_180460_2_.func_177229_b(abstractrailblock.func_176560_l()); -+ RailShape railshape = ((AbstractRailBlock)p_180460_2_.func_177230_c()).getRailDirection(p_180460_2_, this.field_70170_p, p_180460_1_, this); + Vector3d vector3d1 = this.getDeltaMovement(); +- RailShape railshape = p_180460_2_.getValue(abstractrailblock.getShapeProperty()); ++ RailShape railshape = ((AbstractRailBlock)p_180460_2_.getBlock()).getRailDirection(p_180460_2_, this.level, p_180460_1_, this); switch(railshape) { case ASCENDING_EAST: -- this.func_213317_d(vector3d1.func_72441_c(-0.0078125D, 0.0D, 0.0D)); -+ this.func_213317_d(vector3d1.func_72441_c(-1 * getSlopeAdjustment(), 0.0D, 0.0D)); +- this.setDeltaMovement(vector3d1.add(-0.0078125D, 0.0D, 0.0D)); ++ this.setDeltaMovement(vector3d1.add(-1 * getSlopeAdjustment(), 0.0D, 0.0D)); ++d1; break; case ASCENDING_WEST: -- this.func_213317_d(vector3d1.func_72441_c(0.0078125D, 0.0D, 0.0D)); -+ this.func_213317_d(vector3d1.func_72441_c(getSlopeAdjustment(), 0.0D, 0.0D)); +- this.setDeltaMovement(vector3d1.add(0.0078125D, 0.0D, 0.0D)); ++ this.setDeltaMovement(vector3d1.add(getSlopeAdjustment(), 0.0D, 0.0D)); ++d1; break; case ASCENDING_NORTH: -- this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, 0.0078125D)); -+ this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, getSlopeAdjustment())); +- this.setDeltaMovement(vector3d1.add(0.0D, 0.0D, 0.0078125D)); ++ this.setDeltaMovement(vector3d1.add(0.0D, 0.0D, getSlopeAdjustment())); ++d1; break; case ASCENDING_SOUTH: -- this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, -0.0078125D)); -+ this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, -1 * getSlopeAdjustment())); +- this.setDeltaMovement(vector3d1.add(0.0D, 0.0D, -0.0078125D)); ++ this.setDeltaMovement(vector3d1.add(0.0D, 0.0D, -1 * getSlopeAdjustment())); ++d1; } @@ -152,80 +152,80 @@ - if (flag1) { + if (flag1 && shouldDoRailFunctions()) { - double d22 = Math.sqrt(func_213296_b(this.func_213322_ci())); + double d22 = Math.sqrt(getHorizontalDistanceSqr(this.getDeltaMovement())); if (d22 < 0.03D) { - this.func_213317_d(Vector3d.field_186680_a); + this.setDeltaMovement(Vector3d.ZERO); @@ -478,10 +_,7 @@ d0 = d23 + d4 * d14; d2 = d10 + d5 * d14; - this.func_70107_b(d0, d1, d2); -- double d24 = this.func_184207_aI() ? 0.75D : 1.0D; -- double d25 = this.func_174898_m(); -- vector3d1 = this.func_213322_ci(); -- this.func_213315_a(MoverType.SELF, new Vector3d(MathHelper.func_151237_a(d24 * vector3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vector3d1.field_72449_c, -d25, d25))); + this.setPos(d0, d1, d2); +- double d24 = this.isVehicle() ? 0.75D : 1.0D; +- double d25 = this.getMaxSpeed(); +- vector3d1 = this.getDeltaMovement(); +- this.move(MoverType.SELF, new Vector3d(MathHelper.clamp(d24 * vector3d1.x, -d25, d25), 0.0D, MathHelper.clamp(d24 * vector3d1.z, -d25, d25))); + this.moveMinecartOnRail(p_180460_1_); - if (vector3i.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vector3i.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vector3i.func_177952_p()) { - this.func_70107_b(this.func_226277_ct_(), this.func_226278_cu_() + (double)vector3i.func_177956_o(), this.func_226281_cx_()); - } else if (vector3i1.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vector3i1.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vector3i1.func_177952_p()) { + if (vector3i.getY() != 0 && MathHelper.floor(this.getX()) - p_180460_1_.getX() == vector3i.getX() && MathHelper.floor(this.getZ()) - p_180460_1_.getZ() == vector3i.getZ()) { + this.setPos(this.getX(), this.getY() + (double)vector3i.getY(), this.getZ()); + } else if (vector3i1.getY() != 0 && MathHelper.floor(this.getX()) - p_180460_1_.getX() == vector3i1.getX() && MathHelper.floor(this.getZ()) - p_180460_1_.getZ() == vector3i1.getZ()) { @@ -509,7 +_,10 @@ - this.func_213293_j(d26 * (double)(j - p_180460_1_.func_177958_n()), vector3d5.field_72448_b, d26 * (double)(i - p_180460_1_.func_177952_p())); + this.setDeltaMovement(d26 * (double)(j - p_180460_1_.getX()), vector3d5.y, d26 * (double)(i - p_180460_1_.getZ())); } - if (flag) { + if (shouldDoRailFunctions()) -+ ((AbstractRailBlock)p_180460_2_.func_177230_c()).onMinecartPass(p_180460_2_, field_70170_p, p_180460_1_, this); ++ ((AbstractRailBlock)p_180460_2_.getBlock()).onMinecartPass(p_180460_2_, level, p_180460_1_, this); + + if (flag && shouldDoRailFunctions()) { - Vector3d vector3d6 = this.func_213322_ci(); - double d27 = Math.sqrt(func_213296_b(vector3d6)); + Vector3d vector3d6 = this.getDeltaMovement(); + double d27 = Math.sqrt(getHorizontalDistanceSqr(vector3d6)); if (d27 > 0.01D) { @@ -564,7 +_,7 @@ - BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (AbstractRailBlock.func_208487_j(blockstate)) { -- RailShape railshape = blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()); -+ RailShape railshape = ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, this.field_70170_p, new BlockPos(i, j, k), this); + BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k)); + if (AbstractRailBlock.isRail(blockstate)) { +- RailShape railshape = blockstate.getValue(((AbstractRailBlock)blockstate.getBlock()).getShapeProperty()); ++ RailShape railshape = ((AbstractRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level, new BlockPos(i, j, k), this); p_70495_3_ = (double)j; - if (railshape.func_208092_c()) { + if (railshape.isAscending()) { p_70495_3_ = (double)(j + 1); @@ -603,7 +_,7 @@ - BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (AbstractRailBlock.func_208487_j(blockstate)) { -- RailShape railshape = blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()); -+ RailShape railshape = ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, this.field_70170_p, new BlockPos(i, j, k), this); - Pair pair = func_226573_a_(railshape); + BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k)); + if (AbstractRailBlock.isRail(blockstate)) { +- RailShape railshape = blockstate.getValue(((AbstractRailBlock)blockstate.getBlock()).getShapeProperty()); ++ RailShape railshape = ((AbstractRailBlock)blockstate.getBlock()).getRailDirection(blockstate, this.level, new BlockPos(i, j, k), this); + Pair pair = exits(railshape); Vector3i vector3i = pair.getFirst(); Vector3i vector3i1 = pair.getSecond(); @@ -666,6 +_,11 @@ } - public void func_70108_f(Entity p_70108_1_) { + public void push(Entity p_70108_1_) { + //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); + if (getCollisionHandler() != null) { + getCollisionHandler().onEntityCollision(this, p_70108_1_); + return; + } - if (!this.field_70170_p.field_72995_K) { - if (!p_70108_1_.field_70145_X && !this.field_70145_X) { - if (!this.func_184196_w(p_70108_1_)) { + if (!this.level.isClientSide) { + if (!p_70108_1_.noPhysics && !this.noPhysics) { + if (!this.hasPassenger(p_70108_1_)) { @@ -701,11 +_,11 @@ - Vector3d vector3d2 = this.func_213322_ci(); - Vector3d vector3d3 = p_70108_1_.func_213322_ci(); -- if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() == AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() != AbstractMinecartEntity.Type.FURNACE) { + Vector3d vector3d2 = this.getDeltaMovement(); + Vector3d vector3d3 = p_70108_1_.getDeltaMovement(); +- if (((AbstractMinecartEntity)p_70108_1_).getMinecartType() == AbstractMinecartEntity.Type.FURNACE && this.getMinecartType() != AbstractMinecartEntity.Type.FURNACE) { + if (((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && !this.isPoweredCart()) { - this.func_213317_d(vector3d2.func_216372_d(0.2D, 1.0D, 0.2D)); - this.func_70024_g(vector3d3.field_72450_a - d0, 0.0D, vector3d3.field_72449_c - d1); - p_70108_1_.func_213317_d(vector3d3.func_216372_d(0.95D, 1.0D, 0.95D)); -- } else if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() != AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() == AbstractMinecartEntity.Type.FURNACE) { + this.setDeltaMovement(vector3d2.multiply(0.2D, 1.0D, 0.2D)); + this.push(vector3d3.x - d0, 0.0D, vector3d3.z - d1); + p_70108_1_.setDeltaMovement(vector3d3.multiply(0.95D, 1.0D, 0.95D)); +- } else if (((AbstractMinecartEntity)p_70108_1_).getMinecartType() != AbstractMinecartEntity.Type.FURNACE && this.getMinecartType() == AbstractMinecartEntity.Type.FURNACE) { + } else if (!((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && this.isPoweredCart()) { - p_70108_1_.func_213317_d(vector3d3.func_216372_d(0.2D, 1.0D, 0.2D)); - p_70108_1_.func_70024_g(vector3d2.field_72450_a + d0, 0.0D, vector3d2.field_72449_c + d1); - this.func_213317_d(vector3d2.func_216372_d(0.95D, 1.0D, 0.95D)); + p_70108_1_.setDeltaMovement(vector3d3.multiply(0.2D, 1.0D, 0.2D)); + p_70108_1_.push(vector3d2.x + d0, 0.0D, vector3d2.z + d1); + this.setDeltaMovement(vector3d2.multiply(0.95D, 1.0D, 0.95D)); @@ -809,6 +_,40 @@ - public IPacket func_213297_N() { + public IPacket getAddEntityPacket() { return new SSpawnObjectPacket(this); + } + @@ -246,21 +246,21 @@ + @Override public void setDragAir(double value) { dragAir = value; } + @Override + public double getMaxSpeedWithRail() { //Non-default because getMaximumSpeed is protected -+ if (!canUseRail()) return func_174898_m(); ++ if (!canUseRail()) return getMaxSpeed(); + BlockPos pos = this.getCurrentRailPosition(); -+ BlockState state = getMinecart().field_70170_p.func_180495_p(pos); -+ if (!state.func_235714_a_(BlockTags.field_203437_y)) return func_174898_m(); ++ BlockState state = getMinecart().level.getBlockState(pos); ++ if (!state.is(BlockTags.RAILS)) return getMaxSpeed(); + -+ float railMaxSpeed = ((AbstractRailBlock)state.func_177230_c()).getRailMaxSpeed(state, getMinecart().field_70170_p, pos, getMinecart()); ++ float railMaxSpeed = ((AbstractRailBlock)state.getBlock()).getRailMaxSpeed(state, getMinecart().level, pos, getMinecart()); + return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); + } + @Override + public void moveMinecartOnRail(BlockPos pos) { //Non-default because getMaximumSpeed is protected + AbstractMinecartEntity mc = getMinecart(); -+ double d24 = mc.func_184207_aI() ? 0.75D : 1.0D; ++ double d24 = mc.isVehicle() ? 0.75D : 1.0D; + double d25 = mc.getMaxSpeedWithRail(); -+ Vector3d vec3d1 = mc.func_213322_ci(); -+ mc.func_213315_a(MoverType.SELF, new Vector3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25))); ++ Vector3d vec3d1 = mc.getDeltaMovement(); ++ mc.move(MoverType.SELF, new Vector3d(MathHelper.clamp(d24 * vec3d1.x, -d25, d25), 0.0D, MathHelper.clamp(d24 * vec3d1.z, -d25, d25))); } public static enum Type { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java.patch index abdd64a648..9d382f2c83 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java.patch @@ -3,9 +3,9 @@ @@ -73,6 +_,8 @@ } - public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { -+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); -+ if (ret.func_226246_a_()) return ret; - return this.field_145824_a.func_175574_a(p_184230_1_); + public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.interact(p_184230_1_, p_184230_2_); ++ if (ret.consumesAction()) return ret; + return this.commandBlock.usedBy(p_184230_1_); } diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch index 305afe5021..bc13dc4055 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch @@ -4,53 +4,53 @@ } @Nullable -- public Entity func_241206_a_(ServerWorld p_241206_1_) { +- public Entity changeDimension(ServerWorld p_241206_1_) { + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - this.field_94112_b = false; -- return super.func_241206_a_(p_241206_1_); + this.dropEquipment = false; +- return super.changeDimension(p_241206_1_); + return super.changeDimension(p_241206_1_, teleporter); } -- public void func_70106_y() { +- public void remove() { + @Override + public void remove(boolean keepData) { - if (!this.field_70170_p.field_72995_K && this.field_94112_b) { - InventoryHelper.func_180176_a(this.field_70170_p, this, this); + if (!this.level.isClientSide && this.dropEquipment) { + InventoryHelper.dropContents(this.level, this, this); } -- super.func_70106_y(); +- super.remove(); + super.remove(keepData); } - protected void func_213281_b(CompoundNBT p_213281_1_) { + protected void addAdditionalSaveData(CompoundNBT p_213281_1_) { @@ -157,6 +_,8 @@ } - public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { -+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); -+ if (ret.func_226246_a_()) return ret; - p_184230_1_.func_213829_a(this); - if (!p_184230_1_.field_70170_p.field_72995_K) { - PiglinTasks.func_234478_a_(p_184230_1_, true); + public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.interact(p_184230_1_, p_184230_2_); ++ if (ret.consumesAction()) return ret; + p_184230_1_.openMenu(this); + if (!p_184230_1_.level.isClientSide) { + PiglinTasks.angerNearbyPiglins(p_184230_1_, true); @@ -185,6 +_,8 @@ - this.field_184290_c = null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_237457_g_, this.func_213303_ch()).func_216016_a(this.field_184291_d); + this.lootTable = null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.level)).withParameter(LootParameters.ORIGIN, this.position()).withOptionalRandomSeed(this.lootTableSeed); + // Forge: add this entity to loot context, however, currently Vanilla uses 'this' for the player creating the chests. So we take over 'killer_entity' for this. -+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this); ++ lootcontext$builder.withParameter(LootParameters.KILLER_ENTITY, this); if (p_184288_1_ != null) { - lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_216015_a(LootParameters.field_216281_a, p_184288_1_); + lootcontext$builder.withLuck(p_184288_1_.getLuck()).withParameter(LootParameters.THIS_ENTITY, p_184288_1_); } @@ -215,4 +_,23 @@ } - protected abstract Container func_213968_a(int p_213968_1_, PlayerInventory p_213968_2_); + protected abstract Container createMenu(int p_213968_1_, PlayerInventory p_213968_2_); + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.Direction facing) { -+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + return itemHandler.cast(); + return super.getCapability(capability, facing); + } @@ -62,6 +62,6 @@ + } + + public void dropContentsWhenDead(boolean value) { -+ this.field_94112_b = value; ++ this.dropEquipment = value; + } } diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch index 4bf7fa2de5..8b58c48f22 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch @@ -9,15 +9,15 @@ + return 0.2f; + } + - public void func_94095_a(DamageSource p_94095_1_) { - super.func_94095_a(p_94095_1_); - if (!p_94095_1_.func_94541_c() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223604_g)) { + public void destroy(DamageSource p_94095_1_) { + super.destroy(p_94095_1_); + if (!p_94095_1_.isExplosion() && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { @@ -111,6 +_,8 @@ } - public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { -+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); -+ if (ret.func_226246_a_()) return ret; - ItemStack itemstack = p_184230_1_.func_184586_b(p_184230_2_); - if (field_195407_e.test(itemstack) && this.field_94110_c + 3600 <= 32000) { - if (!p_184230_1_.field_71075_bZ.field_75098_d) { + public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.interact(p_184230_1_, p_184230_2_); ++ if (ret.consumesAction()) return ret; + ItemStack itemstack = p_184230_1_.getItemInHand(p_184230_2_); + if (INGREDIENT.test(itemstack) && this.fuel + 3600 <= 32000) { + if (!p_184230_1_.abilities.instabuild) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch index d504b01258..88da3676bb 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch @@ -3,9 +3,9 @@ @@ -16,6 +_,8 @@ } - public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { -+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_); -+ if (ret.func_226246_a_()) return ret; - if (p_184230_1_.func_226563_dT_()) { + public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ ActionResultType ret = super.interact(p_184230_1_, p_184230_2_); ++ if (ret.consumesAction()) return ret; + if (p_184230_1_.isSecondaryUseActive()) { return ActionResultType.PASS; - } else if (this.func_184207_aI()) { + } else if (this.isVehicle()) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch index 3739623ebc..c21c366f1d 100644 --- a/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java @@ -23,6 +_,12 @@ - public BlockPos func_177221_b() { - return SpawnerMinecartEntity.this.func_233580_cy_(); + public BlockPos getPos() { + return SpawnerMinecartEntity.this.blockPosition(); } + + @Override diff --git a/patches/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch index 47ecb8c35b..cca7d76e91 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java.patch @@ -4,11 +4,11 @@ } @Nullable -- public Entity func_241206_a_(ServerWorld p_241206_1_) { +- public Entity changeDimension(ServerWorld p_241206_1_) { + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - this.func_213750_eg(); -- return super.func_241206_a_(p_241206_1_); + this.stopTrading(); +- return super.changeDimension(p_241206_1_); + return super.changeDimension(p_241206_1_, teleporter); } - protected void func_213750_eg() { + protected void stopTrading() { diff --git a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch index a320d2afe1..427a16e39d 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch @@ -2,37 +2,37 @@ +++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java @@ -241,7 +_,7 @@ - public ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) { - ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_); -- if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn()) { -+ if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn() && !p_230254_1_.func_226563_dT_()) { - if (this.func_70631_g_()) { - this.func_213756_es(); - return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K); + public ActionResultType mobInteract(PlayerEntity p_230254_1_, Hand p_230254_2_) { + ItemStack itemstack = p_230254_1_.getItemInHand(p_230254_2_); +- if (itemstack.getItem() != Items.VILLAGER_SPAWN_EGG && this.isAlive() && !this.isTrading() && !this.isSleeping()) { ++ if (itemstack.getItem() != Items.VILLAGER_SPAWN_EGG && this.isAlive() && !this.isTrading() && !this.isSleeping() && !p_230254_1_.isSecondaryUseActive()) { + if (this.isBaby()) { + this.setUnhappy(); + return ActionResultType.sidedSuccess(this.level.isClientSide); @@ -634,7 +_,8 @@ } - protected ITextComponent func_225513_by_() { -- return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + Registry.field_218370_L.func_177774_c(this.func_213700_eh().func_221130_b()).func_110623_a()); -+ net.minecraft.util.ResourceLocation profName = this.func_213700_eh().func_221130_b().getRegistryName(); -+ return new TranslationTextComponent(this.func_200600_R().func_210760_d() + '.' + (!"minecraft".equals(profName.func_110624_b()) ? profName.func_110624_b() + '.' : "") + profName.func_110623_a()); + protected ITextComponent getTypeName() { +- return new TranslationTextComponent(this.getType().getDescriptionId() + '.' + Registry.VILLAGER_PROFESSION.getKey(this.getVillagerData().getProfession()).getPath()); ++ net.minecraft.util.ResourceLocation profName = this.getVillagerData().getProfession().getRegistryName(); ++ return new TranslationTextComponent(this.getType().getDescriptionId() + '.' + (!"minecraft".equals(profName.getNamespace()) ? profName.getNamespace() + '.' : "") + profName.getPath()); } @OnlyIn(Dist.CLIENT) @@ -687,7 +_,7 @@ } - public void func_241841_a(ServerWorld p_241841_1_, LightningBoltEntity p_241841_2_) { -- if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL) { -+ if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_200759_ay, (timer) -> {})) { - field_184243_a.info("Villager {} was struck by lightning {}.", this, p_241841_2_); - WitchEntity witchentity = EntityType.field_200759_ay.func_200721_a(p_241841_1_); - witchentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A); + public void thunderHit(ServerWorld p_241841_1_, LightningBoltEntity p_241841_2_) { +- if (p_241841_1_.getDifficulty() != Difficulty.PEACEFUL) { ++ if (p_241841_1_.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.WITCH, (timer) -> {})) { + LOGGER.info("Villager {} was struck by lightning {}.", this, p_241841_2_); + WitchEntity witchentity = EntityType.WITCH.create(p_241841_1_); + witchentity.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, this.xRot); @@ -699,6 +_,7 @@ } - witchentity.func_110163_bv(); + witchentity.setPersistenceRequired(); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, witchentity); - p_241841_1_.func_242417_l(witchentity); - this.func_242369_fq(); - this.func_70106_y(); + p_241841_1_.addFreshEntityWithPassengers(witchentity); + this.releaseAllPois(); + this.remove(); diff --git a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch index f6888e9c1d..03bb58d062 100644 --- a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerProfession.java.patch @@ -6,6 +6,6 @@ -public class VillagerProfession { +public class VillagerProfession extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final VillagerProfession field_221151_a = func_226556_a_("none", PointOfInterestType.field_221054_b, (SoundEvent)null); - public static final VillagerProfession field_221152_b = func_226556_a_("armorer", PointOfInterestType.field_221055_c, SoundEvents.field_219694_mB); - public static final VillagerProfession field_221153_c = func_226556_a_("butcher", PointOfInterestType.field_221056_d, SoundEvents.field_219695_mC); + public static final VillagerProfession NONE = register("none", PointOfInterestType.UNEMPLOYED, (SoundEvent)null); + public static final VillagerProfession ARMORER = register("armorer", PointOfInterestType.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER); + public static final VillagerProfession BUTCHER = register("butcher", PointOfInterestType.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER); diff --git a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch index 7ddec472b4..ca16aedc26 100644 --- a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/entity/monster/AbstractSkeletonEntity.java +++ b/net/minecraft/entity/monster/AbstractSkeletonEntity.java @@ -154,7 +_,7 @@ - if (this.field_70170_p != null && !this.field_70170_p.field_72995_K) { - this.field_70714_bg.func_85156_a(this.field_85038_e); - this.field_70714_bg.func_85156_a(this.field_85037_d); -- ItemStack itemstack = this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f)); -+ ItemStack itemstack = this.func_184586_b(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem)); - if (itemstack.func_77973_b() == Items.field_151031_f) { + if (this.level != null && !this.level.isClientSide) { + this.goalSelector.removeGoal(this.meleeGoal); + this.goalSelector.removeGoal(this.bowGoal); +- ItemStack itemstack = this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, Items.BOW)); ++ ItemStack itemstack = this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem)); + if (itemstack.getItem() == Items.BOW) { int i = 20; - if (this.field_70170_p.func_175659_aa() != Difficulty.HARD) { + if (this.level.getDifficulty() != Difficulty.HARD) { @@ -171,8 +_,10 @@ } - public void func_82196_d(LivingEntity p_82196_1_, float p_82196_2_) { -- ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f))); -+ ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem))); - AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, p_82196_2_); -+ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) -+ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customArrow(abstractarrowentity); - double d0 = p_82196_1_.func_226277_ct_() - this.func_226277_ct_(); - double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); - double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); + public void performRangedAttack(LivingEntity p_82196_1_, float p_82196_2_) { +- ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, Items.BOW))); ++ ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem))); + AbstractArrowEntity abstractarrowentity = this.getArrow(itemstack, p_82196_2_); ++ if (this.getMainHandItem().getItem() instanceof net.minecraft.item.BowItem) ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.getMainHandItem().getItem()).customArrow(abstractarrowentity); + double d0 = p_82196_1_.getX() - this.getX(); + double d1 = p_82196_1_.getY(0.3333333333333333D) - abstractarrowentity.getY(); + double d2 = p_82196_1_.getZ() - this.getZ(); diff --git a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch index 2144655ba5..82ec54c8c2 100644 --- a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/monster/CreeperEntity.java @@ -216,7 +_,7 @@ - private void func_146077_cc() { - if (!this.field_70170_p.field_72995_K) { -- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; -+ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; - float f = this.func_225509_J__() ? 2.0F : 1.0F; - this.field_70729_aU = true; - this.field_70170_p.func_217385_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_82226_g * f, explosion$mode); + private void explodeCreeper() { + if (!this.level.isClientSide) { +- Explosion.Mode explosion$mode = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + float f = this.isPowered() ? 2.0F : 1.0F; + this.dead = true; + this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float)this.explosionRadius * f, explosion$mode); diff --git a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch index 3026d27854..66d3c2ed61 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch @@ -3,78 +3,78 @@ @@ -98,7 +_,6 @@ } - public void func_70624_b(@Nullable LivingEntity p_70624_1_) { -- super.func_70624_b(p_70624_1_); - ModifiableAttributeInstance modifiableattributeinstance = this.func_110148_a(Attributes.field_233821_d_); + public void setTarget(@Nullable LivingEntity p_70624_1_) { +- super.setTarget(p_70624_1_); + ModifiableAttributeInstance modifiableattributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (p_70624_1_ == null) { - this.field_184721_by = 0; + this.targetChangeTime = 0; @@ -113,6 +_,7 @@ } } -+ super.func_70624_b(p_70624_1_); //Forge: Moved down to allow event handlers to write data manager values. ++ super.setTarget(p_70624_1_); //Forge: Moved down to allow event handlers to write data manager values. } - protected void func_70088_a() { + protected void defineSynchedData() { @@ -181,12 +_,13 @@ } - this.func_195406_b(blockstate); -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); + this.setCarriedBlock(blockstate); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } - private boolean func_70821_d(PlayerEntity p_70821_1_) { - ItemStack itemstack = p_70821_1_.field_71071_by.field_70460_b.get(3); -- if (itemstack.func_77973_b() == Blocks.field_196625_cS.func_199767_j()) { + private boolean isLookingAtMe(PlayerEntity p_70821_1_) { + ItemStack itemstack = p_70821_1_.inventory.armor.get(3); +- if (itemstack.getItem() == Blocks.CARVED_PUMPKIN.asItem()) { + if (itemstack.isEnderMask(p_70821_1_, this)) { return false; } else { - Vector3d vector3d = p_70821_1_.func_70676_i(1.0F).func_72432_b(); + Vector3d vector3d = p_70821_1_.getViewVector(1.0F).normalize(); @@ -265,7 +_,9 @@ - boolean flag = blockstate.func_185904_a().func_76230_c(); - boolean flag1 = blockstate.func_204520_s().func_206884_a(FluidTags.field_206959_a); + boolean flag = blockstate.getMaterial().blocksMotion(); + boolean flag1 = blockstate.getFluidState().is(FluidTags.WATER); if (flag && !flag1) { -- boolean flag2 = this.func_213373_a(p_70825_1_, p_70825_3_, p_70825_5_, true); +- boolean flag2 = this.randomTeleport(p_70825_1_, p_70825_3_, p_70825_5_, true); + net.minecraftforge.event.entity.living.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, p_70825_1_, p_70825_3_, p_70825_5_); + if (event.isCanceled()) return false; -+ boolean flag2 = this.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); - if (flag2 && !this.func_174814_R()) { - this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70169_q, this.field_70167_r, this.field_70166_s, SoundEvents.field_187534_aX, this.func_184176_by(), 1.0F, 1.0F); - this.func_184185_a(SoundEvents.field_187534_aX, 1.0F, 1.0F); ++ boolean flag2 = this.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); + if (flag2 && !this.isSilent()) { + this.level.playSound((PlayerEntity)null, this.xo, this.yo, this.zo, SoundEvents.ENDERMAN_TELEPORT, this.getSoundSource(), 1.0F, 1.0F); + this.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0F, 1.0F); @@ -429,7 +_,7 @@ - public boolean func_75250_a() { - if (this.field_179475_a.func_195405_dq() == null) { + public boolean canUse() { + if (this.enderman.getCarriedBlock() == null) { return false; -- } else if (!this.field_179475_a.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179475_a.field_70170_p, this.field_179475_a)) { +- } else if (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.enderman.level, this.enderman)) { return false; } else { - return this.field_179475_a.func_70681_au().nextInt(2000) == 0; + return this.enderman.getRandom().nextInt(2000) == 0; @@ -449,7 +_,7 @@ - BlockState blockstate2 = this.field_179475_a.func_195405_dq(); + BlockState blockstate2 = this.enderman.getCarriedBlock(); if (blockstate2 != null) { - blockstate2 = Block.func_199770_b(blockstate2, this.field_179475_a.field_70170_p, blockpos); -- if (this.func_220836_a(world, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { -+ if (this.func_220836_a(world, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(field_179475_a, net.minecraftforge.common.util.BlockSnapshot.create(world.func_234923_W_(), world, blockpos1), net.minecraft.util.Direction.UP)) { - world.func_180501_a(blockpos, blockstate2, 3); - this.field_179475_a.func_195406_b((BlockState)null); + blockstate2 = Block.updateFromNeighbourShapes(blockstate2, this.enderman.level, blockpos); +- if (this.canPlaceBlock(world, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { ++ if (this.canPlaceBlock(world, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(enderman, net.minecraftforge.common.util.BlockSnapshot.create(world.dimension(), world, blockpos1), net.minecraft.util.Direction.UP)) { + world.setBlock(blockpos, blockstate2, 3); + this.enderman.setCarriedBlock((BlockState)null); } @@ -458,7 +_,7 @@ } - private boolean func_220836_a(World p_220836_1_, BlockPos p_220836_2_, BlockState p_220836_3_, BlockState p_220836_4_, BlockState p_220836_5_, BlockPos p_220836_6_) { -- return p_220836_4_.func_196958_f() && !p_220836_5_.func_196958_f() && !p_220836_5_.func_203425_a(Blocks.field_150357_h) && p_220836_5_.func_235785_r_(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_) && p_220836_1_.func_72839_b(this.field_179475_a, AxisAlignedBB.func_241549_a_(Vector3d.func_237491_b_(p_220836_2_))).isEmpty(); -+ return p_220836_4_.isAir(p_220836_1_, p_220836_2_) && !p_220836_5_.isAir(p_220836_1_, p_220836_6_) && !p_220836_5_.func_203425_a(Blocks.field_150357_h) && !p_220836_5_.func_235714_a_(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) && p_220836_5_.func_235785_r_(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_) && p_220836_1_.func_72839_b(this.field_179475_a, AxisAlignedBB.func_241549_a_(Vector3d.func_237491_b_(p_220836_2_))).isEmpty(); + private boolean canPlaceBlock(World p_220836_1_, BlockPos p_220836_2_, BlockState p_220836_3_, BlockState p_220836_4_, BlockState p_220836_5_, BlockPos p_220836_6_) { +- return p_220836_4_.isAir() && !p_220836_5_.isAir() && !p_220836_5_.is(Blocks.BEDROCK) && p_220836_5_.isCollisionShapeFullBlock(p_220836_1_, p_220836_6_) && p_220836_3_.canSurvive(p_220836_1_, p_220836_2_) && p_220836_1_.getEntities(this.enderman, AxisAlignedBB.unitCubeFromLowerCorner(Vector3d.atLowerCornerOf(p_220836_2_))).isEmpty(); ++ return p_220836_4_.isAir(p_220836_1_, p_220836_2_) && !p_220836_5_.isAir(p_220836_1_, p_220836_6_) && !p_220836_5_.is(Blocks.BEDROCK) && !p_220836_5_.is(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) && p_220836_5_.isCollisionShapeFullBlock(p_220836_1_, p_220836_6_) && p_220836_3_.canSurvive(p_220836_1_, p_220836_2_) && p_220836_1_.getEntities(this.enderman, AxisAlignedBB.unitCubeFromLowerCorner(Vector3d.atLowerCornerOf(p_220836_2_))).isEmpty(); } } @@ -500,7 +_,7 @@ - public boolean func_75250_a() { - if (this.field_179473_a.func_195405_dq() != null) { + public boolean canUse() { + if (this.enderman.getCarriedBlock() != null) { return false; -- } else if (!this.field_179473_a.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179473_a.field_70170_p, this.field_179473_a)) { +- } else if (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.enderman.level, this.enderman)) { return false; } else { - return this.field_179473_a.func_70681_au().nextInt(20) == 0; + return this.enderman.getRandom().nextInt(20) == 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch index 94297ba162..73a58163ff 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/monster/EvokerEntity.java @@ -280,7 +_,7 @@ return false; - } else if (EvokerEntity.this.field_70173_aa < this.field_193322_d) { + } else if (EvokerEntity.this.tickCount < this.nextAttackTickCount) { return false; -- } else if (!EvokerEntity.this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EvokerEntity.this.field_70170_p, EvokerEntity.this)) { +- } else if (!EvokerEntity.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EvokerEntity.this.level, EvokerEntity.this)) { return false; } else { - List list = EvokerEntity.this.field_70170_p.func_217374_a(SheepEntity.class, this.field_220845_e, EvokerEntity.this, EvokerEntity.this.func_174813_aQ().func_72314_b(16.0D, 4.0D, 16.0D)); + List list = EvokerEntity.this.level.getNearbyEntities(SheepEntity.class, this.wololoTargeting, EvokerEntity.this, EvokerEntity.this.getBoundingBox().inflate(16.0D, 4.0D, 16.0D)); diff --git a/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch index 3e8998c34a..c7c9bdc991 100644 --- a/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/HoglinEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/entity/monster/HoglinEntity.java +++ b/net/minecraft/entity/monster/HoglinEntity.java @@ -117,7 +_,7 @@ - HoglinTasks.func_234377_a_(this); - if (this.func_234364_eK_()) { - ++this.field_234358_by_; -- if (this.field_234358_by_ > 300) { -+ if (this.field_234358_by_ > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_233590_aW_, (timer) -> this.field_234358_by_ = timer)) { - this.func_241412_a_(SoundEvents.field_232715_fE_); - this.func_234360_a_((ServerWorld)this.field_70170_p); + HoglinTasks.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)) { + this.playSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); + this.finishConversion((ServerWorld)this.level); } @@ -212,6 +_,7 @@ - ZoglinEntity zoglinentity = this.func_233656_b_(EntityType.field_233590_aW_, true); + ZoglinEntity zoglinentity = this.convertTo(EntityType.ZOGLIN, true); if (zoglinentity != null) { - zoglinentity.func_195064_c(new EffectInstance(Effects.field_76431_k, 200, 0)); + zoglinentity.addEffect(new EffectInstance(Effects.CONFUSION, 200, 0)); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zoglinentity); } diff --git a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch index 59fce1d051..2e907ff3be 100644 --- a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch @@ -3,12 +3,12 @@ @@ -180,8 +_,10 @@ } - public void func_82196_d(LivingEntity p_82196_1_, float p_82196_2_) { -- ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f))); -+ ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem))); - AbstractArrowEntity abstractarrowentity = ProjectileHelper.func_221272_a(this, itemstack, p_82196_2_); -+ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) -+ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customArrow(abstractarrowentity); - double d0 = p_82196_1_.func_226277_ct_() - this.func_226277_ct_(); - double d1 = p_82196_1_.func_226283_e_(0.3333333333333333D) - abstractarrowentity.func_226278_cu_(); - double d2 = p_82196_1_.func_226281_cx_() - this.func_226281_cx_(); + public void performRangedAttack(LivingEntity p_82196_1_, float p_82196_2_) { +- ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, Items.BOW))); ++ ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileHelper.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.item.BowItem))); + AbstractArrowEntity abstractarrowentity = ProjectileHelper.getMobArrow(this, itemstack, p_82196_2_); ++ if (this.getMainHandItem().getItem() instanceof net.minecraft.item.BowItem) ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.getMainHandItem().getItem()).customArrow(abstractarrowentity); + double d0 = p_82196_1_.getX() - this.getX(); + double d1 = p_82196_1_.getY(0.3333333333333333D) - abstractarrowentity.getY(); + double d2 = p_82196_1_.getZ() - this.getZ(); diff --git a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch index 331816bec0..f40eeb7658 100644 --- a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/entity/monster/MagmaCubeEntity.java +++ b/net/minecraft/entity/monster/MagmaCubeEntity.java @@ -72,6 +_,7 @@ - Vector3d vector3d = this.func_213322_ci(); - this.func_213293_j(vector3d.field_72450_a, (double)(this.func_175134_bD() + (float)this.func_70809_q() * 0.1F), vector3d.field_72449_c); - this.field_70160_al = true; + Vector3d vector3d = this.getDeltaMovement(); + this.setDeltaMovement(vector3d.x, (double)(this.getJumpPower() + (float)this.getSize() * 0.1F), vector3d.z); + this.hasImpulse = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - protected void func_180466_bG(ITag p_180466_1_) { + protected void jumpInLiquid(ITag p_180466_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/PillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/PillagerEntity.java.patch index 5368b225bf..bfb43c93a9 100644 --- a/patches/minecraft/net/minecraft/entity/monster/PillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/PillagerEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/monster/PillagerEntity.java +++ b/net/minecraft/entity/monster/PillagerEntity.java @@ -120,7 +_,7 @@ - public AbstractIllagerEntity.ArmPose func_193077_p() { - if (this.func_213675_dX()) { + public AbstractIllagerEntity.ArmPose getArmPose() { + if (this.isChargingCrossbow()) { return AbstractIllagerEntity.ArmPose.CROSSBOW_CHARGE; -- } else if (this.func_233631_a_(Items.field_222114_py)) { -+ } else if (this.func_233634_a_(item -> item instanceof net.minecraft.item.CrossbowItem)) { +- } else if (this.isHolding(Items.CROSSBOW)) { ++ } else if (this.isHolding(item -> item instanceof net.minecraft.item.CrossbowItem)) { return AbstractIllagerEntity.ArmPose.CROSSBOW_HOLD; } else { - return this.func_213398_dR() ? AbstractIllagerEntity.ArmPose.ATTACKING : AbstractIllagerEntity.ArmPose.NEUTRAL; + return this.isAggressive() ? AbstractIllagerEntity.ArmPose.ATTACKING : AbstractIllagerEntity.ArmPose.NEUTRAL; diff --git a/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch index 726c1ebda5..a20131c1e3 100644 --- a/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/RavagerEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/monster/RavagerEntity.java +++ b/net/minecraft/entity/monster/RavagerEntity.java @@ -134,7 +_,7 @@ - this.func_110148_a(Attributes.field_233821_d_).func_111128_a(MathHelper.func_219803_d(0.1D, d1, d0)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(MathHelper.lerp(0.1D, d1, d0)); } -- if (this.field_70123_F && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (this.field_70123_F && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { +- if (this.horizontalCollision && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (this.horizontalCollision && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { boolean flag = false; - AxisAlignedBB axisalignedbb = this.func_174813_aQ().func_186662_g(0.2D); + AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(0.2D); diff --git a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch index 33a52e268d..6d6aa56254 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch @@ -1,40 +1,40 @@ --- a/net/minecraft/entity/monster/ShulkerEntity.java +++ b/net/minecraft/entity/monster/ShulkerEntity.java @@ -166,7 +_,7 @@ - this.field_184708_bA = 0; - } else if (!this.field_70170_p.field_72995_K) { - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(this.field_70170_p, blockpos)) { - if (blockstate.func_203425_a(Blocks.field_196603_bb)) { - Direction direction = blockstate.func_177229_b(PistonBlock.field_176387_N); - if (this.field_70170_p.func_175623_d(blockpos.func_177972_a(direction))) { + this.clientSideTeleportInterpolation = 0; + } else if (!this.level.isClientSide) { + BlockState blockstate = this.level.getBlockState(blockpos); +- if (!blockstate.isAir()) { ++ if (!blockstate.isAir(this.level, blockpos)) { + if (blockstate.is(Blocks.MOVING_PISTON)) { + Direction direction = blockstate.getValue(PistonBlock.FACING); + if (this.level.isEmptyBlock(blockpos.relative(direction))) { @@ -219,6 +_,7 @@ - this.func_226286_f_((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D); - double d2 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184706_by) * (float)Math.PI) * 0.5D; - double d0 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184705_bx) * (float)Math.PI) * 0.5D; -+ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. - Direction direction2 = this.func_184696_cZ().func_176734_d(); - this.func_174826_a((new AxisAlignedBB(this.func_226277_ct_() - 0.5D, this.func_226278_cu_(), this.func_226281_cx_() - 0.5D, this.func_226277_ct_() + 0.5D, this.func_226278_cu_() + 1.0D, this.func_226281_cx_() + 0.5D)).func_72321_a((double)direction2.func_82601_c() * d2, (double)direction2.func_96559_d() * d2, (double)direction2.func_82599_e() * d2)); + this.setPosAndOldPos((double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D); + double d2 = 0.5D - (double)MathHelper.sin((0.5F + this.currentPeekAmount) * (float)Math.PI) * 0.5D; + double d0 = 0.5D - (double)MathHelper.sin((0.5F + this.currentPeekAmountO) * (float)Math.PI) * 0.5D; ++ if (this.isAddedToWorld() && this.level instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.level).updateChunkPos(this); // Forge - Process chunk registration after moving. + Direction direction2 = this.getAttachFace().getOpposite(); + this.setBoundingBox((new AxisAlignedBB(this.getX() - 0.5D, this.getY(), this.getZ() - 0.5D, this.getX() + 0.5D, this.getY() + 1.0D, this.getZ() + 0.5D)).expandTowards((double)direction2.getStepX() * d2, (double)direction2.getStepY() * d2, (double)direction2.getStepZ() * d2)); double d1 = d2 - d0; @@ -249,6 +_,7 @@ - super.func_70107_b(p_70107_1_, p_70107_3_, p_70107_5_); - if (this.field_70180_af != null && this.field_70173_aa != 0) { - Optional optional = this.field_70180_af.func_187225_a(field_184701_b); -+ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + super.setPos(p_70107_1_, p_70107_3_, p_70107_5_); + if (this.entityData != null && this.tickCount != 0) { + Optional optional = this.entityData.get(DATA_ATTACH_POS_ID); ++ if (this.isAddedToWorld() && this.level instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.level).updateChunkPos(this); // Forge - Process chunk registration after moving. Optional optional1 = Optional.of(new BlockPos(p_70107_1_, p_70107_3_, p_70107_5_)); if (!optional1.equals(optional)) { - this.field_70180_af.func_187227_b(field_184701_b, optional1); + this.entityData.set(DATA_ATTACH_POS_ID, optional1); @@ -282,6 +_,12 @@ - BlockPos blockpos1 = blockpos.func_177982_a(8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17)); - if (blockpos1.func_177956_o() > 0 && this.field_70170_p.func_175623_d(blockpos1) && this.field_70170_p.func_175723_af().func_177746_a(blockpos1) && this.field_70170_p.func_226665_a__(this, new AxisAlignedBB(blockpos1))) { - Direction direction = this.func_234299_g_(blockpos1); + BlockPos blockpos1 = blockpos.offset(8 - this.random.nextInt(17), 8 - this.random.nextInt(17), 8 - this.random.nextInt(17)); + if (blockpos1.getY() > 0 && this.level.isEmptyBlock(blockpos1) && this.level.getWorldBorder().isWithinBounds(blockpos1) && this.level.noCollision(this, new AxisAlignedBB(blockpos1))) { + Direction direction = this.findAttachableFace(blockpos1); + if (direction != null) { -+ net.minecraftforge.event.entity.living.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p()); ++ net.minecraftforge.event.entity.living.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()); + if (event.isCanceled()) direction = null; + blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + } + if (direction != null) { - this.field_70180_af.func_187227_b(field_184700_a, direction); - this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F); + this.entityData.set(DATA_ATTACH_FACE_ID, direction); + this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch index e019c5ef50..9a199e5175 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch @@ -3,18 +3,18 @@ @@ -134,7 +_,7 @@ return false; } else { - Random random = this.field_75457_a.func_70681_au(); -- if (this.field_75457_a.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) && random.nextInt(10) == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75457_a.field_70170_p, this.field_75457_a) && random.nextInt(10) == 0) { - this.field_179483_b = Direction.func_239631_a_(random); - BlockPos blockpos = (new BlockPos(this.field_75457_a.func_226277_ct_(), this.field_75457_a.func_226278_cu_() + 0.5D, this.field_75457_a.func_226281_cx_())).func_177972_a(this.field_179483_b); - BlockState blockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos); + Random random = this.mob.getRandom(); +- if (this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && random.nextInt(10) == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.mob.level, this.mob) && random.nextInt(10) == 0) { + this.selectedDirection = Direction.getRandom(random); + BlockPos blockpos = (new BlockPos(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ())).relative(this.selectedDirection); + BlockState blockstate = this.mob.level.getBlockState(blockpos); @@ -203,7 +_,7 @@ - BlockState blockstate = world.func_180495_p(blockpos1); - Block block = blockstate.func_177230_c(); + BlockState blockstate = world.getBlockState(blockpos1); + Block block = blockstate.getBlock(); if (block instanceof SilverfishBlock) { -- if (world.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this.field_179464_a)) { - world.func_225521_a_(blockpos1, true, this.field_179464_a); +- if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this.silverfish)) { + world.destroyBlock(blockpos1, true, this.silverfish); } else { - world.func_180501_a(blockpos1, ((SilverfishBlock)block).func_196468_d().func_176223_P(), 3); + world.setBlock(blockpos1, ((SilverfishBlock)block).getHostBlock().defaultBlockState(), 3); diff --git a/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch index 688030b0cc..c466e72f3e 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch @@ -1,38 +1,38 @@ --- a/net/minecraft/entity/monster/SlimeEntity.java +++ b/net/minecraft/entity/monster/SlimeEntity.java @@ -127,6 +_,7 @@ - if (this.field_70122_E && !this.field_175452_bi) { - int i = this.func_70809_q(); + if (this.onGround && !this.wasOnGround) { + int i = this.getSize(); + if (spawnCustomParticles()) i = 0; // don't spawn particles if it's handled by the implementation itself for(int j = 0; j < i * 8; ++j) { - float f = this.field_70146_Z.nextFloat() * ((float)Math.PI * 2F); - float f1 = this.field_70146_Z.nextFloat() * 0.5F + 0.5F; + float f = this.random.nextFloat() * ((float)Math.PI * 2F); + float f1 = this.random.nextFloat() * 0.5F + 0.5F; @@ -178,9 +_,10 @@ - return (EntityType)super.func_200600_R(); + return (EntityType)super.getType(); } -- public void func_70106_y() { +- public void remove() { + @Override + public void remove(boolean keepData) { - int i = this.func_70809_q(); -- if (!this.field_70170_p.field_72995_K && i > 1 && this.func_233643_dh_()) { -+ if (!this.field_70170_p.field_72995_K && i > 1 && this.func_233643_dh_() && !this.field_70128_L) { - ITextComponent itextcomponent = this.func_200201_e(); - boolean flag = this.func_175446_cd(); + int i = this.getSize(); +- if (!this.level.isClientSide && i > 1 && this.isDeadOrDying()) { ++ if (!this.level.isClientSide && i > 1 && this.isDeadOrDying() && !this.removed) { + ITextComponent itextcomponent = this.getCustomName(); + boolean flag = this.isNoAi(); float f = (float)i / 4.0F; @@ -204,7 +_,7 @@ } } -- super.func_70106_y(); +- super.remove(); + super.remove(keepData); } - public void func_70108_f(Entity p_70108_1_) { + public void push(Entity p_70108_1_) { @@ -323,6 +_,12 @@ - public EntitySize func_213305_a(Pose p_213305_1_) { - return super.func_213305_a(p_213305_1_).func_220313_a(0.255F * (float)this.func_70809_q()); + public EntitySize getDimensions(Pose p_213305_1_) { + return super.getDimensions(p_213305_1_).scale(0.255F * (float)this.getSize()); } + + /** @@ -42,4 +42,4 @@ + protected boolean spawnCustomParticles() { return false; } static class AttackGoal extends Goal { - private final SlimeEntity field_179466_a; + private final SlimeEntity slime; diff --git a/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch index 5f697312aa..a1b6974e0c 100644 --- a/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch @@ -3,14 +3,14 @@ @@ -118,7 +_,12 @@ } - public boolean func_70687_e(EffectInstance p_70687_1_) { -- return p_70687_1_.func_188419_a() == Effects.field_76436_u ? false : super.func_70687_e(p_70687_1_); -+ if (p_70687_1_.func_188419_a() == Effects.field_76436_u) { + public boolean canBeAffected(EffectInstance p_70687_1_) { +- return p_70687_1_.getEffect() == Effects.POISON ? false : super.canBeAffected(p_70687_1_); ++ if (p_70687_1_.getEffect() == Effects.POISON) { + net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; + } -+ return super.func_70687_e(p_70687_1_); ++ return super.canBeAffected(p_70687_1_); } - public boolean func_70841_p() { + public boolean isClimbing() { diff --git a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch index 5c07fca8bc..d4d80091d7 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch @@ -1,81 +1,81 @@ --- a/net/minecraft/entity/monster/ZombieEntity.java +++ b/net/minecraft/entity/monster/ZombieEntity.java @@ -186,7 +_,8 @@ - if (!this.field_70170_p.field_72995_K && this.func_70089_S() && !this.func_175446_cd()) { - if (this.func_204706_dD()) { - --this.field_204708_bE; -- if (this.field_204708_bE < 0) { + if (!this.level.isClientSide && this.isAlive() && !this.isNoAi()) { + if (this.isUnderWaterConverting()) { + --this.conversionTime; +- if (this.conversionTime < 0) { + -+ if (this.field_204708_bE < 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_204724_o, (timer) -> this.field_204708_bE = timer)) { - this.func_207302_dI(); ++ if (this.conversionTime < 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.DROWNED, (timer) -> this.conversionTime = timer)) { + this.doUnderWaterConversion(); } - } else if (this.func_204703_dA()) { + } else if (this.convertsInWater()) { @@ -248,6 +_,7 @@ if (zombieentity != null) { - zombieentity.func_207304_a(zombieentity.field_70170_p.func_175649_E(zombieentity.func_233580_cy_()).func_180170_c()); - zombieentity.func_146070_a(zombieentity.func_204900_dz() && this.func_146072_bX()); + zombieentity.handleAttributes(zombieentity.level.getCurrentDifficultyAt(zombieentity.blockPosition()).getSpecialMultiplier()); + zombieentity.setCanBreakDoors(zombieentity.supportsBreakDoorGoal() && this.canBreakDoors()); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombieentity); } } @@ -268,11 +_,15 @@ - livingentity = (LivingEntity)p_70097_1_.func_76346_g(); + livingentity = (LivingEntity)p_70097_1_.getEntity(); } -- if (livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_233637_b_(Attributes.field_233829_l_) && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223601_d)) { - int i = MathHelper.func_76128_c(this.func_226277_ct_()); - int j = MathHelper.func_76128_c(this.func_226278_cu_()); - int k = MathHelper.func_76128_c(this.func_226281_cx_()); -- ZombieEntity zombieentity = new ZombieEntity(this.field_70170_p); +- if (livingentity != null && this.level.getDifficulty() == Difficulty.HARD && (double)this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { + int i = MathHelper.floor(this.getX()); + int j = MathHelper.floor(this.getY()); + int k = MathHelper.floor(this.getZ()); +- ZombieEntity zombieentity = new ZombieEntity(this.level); + -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, livingentity, this.func_110148_a(Attributes.field_233829_l_).func_111126_e()); ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, level, i, j, k, livingentity, this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).getValue()); + if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; + if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || -+ livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(Attributes.field_233829_l_).func_111126_e() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223601_d)) { -+ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.field_200725_aD.func_200721_a(this.field_70170_p); ++ livingentity != null && this.level.getDifficulty() == Difficulty.HARD && (double)this.random.nextFloat() < this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).getValue() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { ++ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.ZOMBIE.create(this.level); for(int l = 0; l < 50; ++l) { - int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); + int i1 = i + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1); @@ -284,6 +_,7 @@ - if (WorldEntitySpawner.func_209382_a(entityspawnplacementregistry$placementtype, this.field_70170_p, blockpos, entitytype) && EntitySpawnPlacementRegistry.func_223515_a(entitytype, serverworld, SpawnReason.REINFORCEMENT, blockpos, this.field_70170_p.field_73012_v)) { - zombieentity.func_70107_b((double)i1, (double)j1, (double)k1); - if (!this.field_70170_p.func_217358_a((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_226668_i_(zombieentity) && this.field_70170_p.func_226669_j_(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) { + if (WorldEntitySpawner.isSpawnPositionOk(entityspawnplacementregistry$placementtype, this.level, blockpos, entitytype) && EntitySpawnPlacementRegistry.checkSpawnRules(entitytype, serverworld, SpawnReason.REINFORCEMENT, blockpos, this.level.random)) { + zombieentity.setPos((double)i1, (double)j1, (double)k1); + if (!this.level.hasNearbyAlivePlayer((double)i1, (double)j1, (double)k1, 7.0D) && this.level.isUnobstructed(zombieentity) && this.level.noCollision(zombieentity) && !this.level.containsAnyLiquid(zombieentity.getBoundingBox())) { + if (livingentity != null) - zombieentity.func_70624_b(livingentity); - zombieentity.func_213386_a(serverworld, this.field_70170_p.func_175649_E(zombieentity.func_233580_cy_()), SpawnReason.REINFORCEMENT, (ILivingEntityData)null, (CompoundNBT)null); - serverworld.func_242417_l(zombieentity); + zombieentity.setTarget(livingentity); + zombieentity.finalizeSpawn(serverworld, this.level.getCurrentDifficultyAt(zombieentity.blockPosition()), SpawnReason.REINFORCEMENT, (ILivingEntityData)null, (CompoundNBT)null); + serverworld.addFreshEntityWithPassengers(zombieentity); @@ -369,7 +_,7 @@ - public void func_241847_a(ServerWorld p_241847_1_, LivingEntity p_241847_2_) { - super.func_241847_a(p_241847_1_, p_241847_2_); -- if ((p_241847_1_.func_175659_aa() == Difficulty.NORMAL || p_241847_1_.func_175659_aa() == Difficulty.HARD) && p_241847_2_ instanceof VillagerEntity) { -+ if ((p_241847_1_.func_175659_aa() == Difficulty.NORMAL || p_241847_1_.func_175659_aa() == Difficulty.HARD) && p_241847_2_ instanceof VillagerEntity && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(p_241847_2_, EntityType.field_200727_aF, (timer) -> {})) { - if (p_241847_1_.func_175659_aa() != Difficulty.HARD && this.field_70146_Z.nextBoolean()) { + public void killed(ServerWorld p_241847_1_, LivingEntity p_241847_2_) { + super.killed(p_241847_1_, p_241847_2_); +- if ((p_241847_1_.getDifficulty() == Difficulty.NORMAL || p_241847_1_.getDifficulty() == Difficulty.HARD) && p_241847_2_ instanceof VillagerEntity) { ++ if ((p_241847_1_.getDifficulty() == Difficulty.NORMAL || p_241847_1_.getDifficulty() == Difficulty.HARD) && p_241847_2_ instanceof VillagerEntity && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(p_241847_2_, EntityType.ZOMBIE_VILLAGER, (timer) -> {})) { + if (p_241847_1_.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { return; } @@ -381,6 +_,7 @@ - zombievillagerentity.func_223727_a(villagerentity.func_223722_es().func_234058_a_(NBTDynamicOps.field_210820_a).getValue()); - zombievillagerentity.func_213790_g(villagerentity.func_213706_dY().func_222199_a()); - zombievillagerentity.func_213789_a(villagerentity.func_213708_dV()); + zombievillagerentity.setGossips(villagerentity.getGossips().store(NBTDynamicOps.INSTANCE).getValue()); + zombievillagerentity.setTradeOffers(villagerentity.getOffers().createTag()); + zombievillagerentity.setVillagerXp(villagerentity.getVillagerXp()); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(p_241847_2_, zombievillagerentity); - if (!this.func_174814_R()) { - p_241847_1_.func_217378_a((PlayerEntity)null, 1026, this.func_233580_cy_(), 0); + if (!this.isSilent()) { + p_241847_1_.levelEvent((PlayerEntity)null, 1026, this.blockPosition(), 0); } @@ -448,7 +_,7 @@ } - public static boolean func_241399_a_(Random p_241399_0_) { + public static boolean getSpawnAsBabyOdds(Random p_241399_0_) { - return p_241399_0_.nextFloat() < 0.05F; + return p_241399_0_.nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get(); } - protected void func_207304_a(float p_207304_1_) { + protected void handleAttributes(float p_207304_1_) { @@ -468,7 +_,7 @@ } - protected void func_230291_eT_() { -- this.func_110148_a(Attributes.field_233829_l_).func_111128_a(this.field_70146_Z.nextDouble() * (double)0.1F); -+ this.func_110148_a(Attributes.field_233829_l_).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); + protected void randomizeReinforcementsChance() { +- this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * (double)0.1F); ++ this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); } - public double func_70033_W() { + public double getMyRidingOffset() { diff --git a/patches/minecraft/net/minecraft/entity/monster/ZombieVillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombieVillagerEntity.java.patch index 7d9ba90d3d..1b983a987d 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ZombieVillagerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ZombieVillagerEntity.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/entity/monster/ZombieVillagerEntity.java +++ b/net/minecraft/entity/monster/ZombieVillagerEntity.java @@ -116,7 +_,7 @@ - if (!this.field_70170_p.field_72995_K && this.func_70089_S() && this.func_82230_o()) { - int i = this.func_190735_dq(); - this.field_82234_d -= i; -- if (this.field_82234_d <= 0) { -+ if (this.field_82234_d <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_200756_av, (timer) -> this.field_82234_d = timer)) { - this.func_213791_a((ServerWorld)this.field_70170_p); + if (!this.level.isClientSide && this.isAlive() && this.isConverting()) { + int i = this.getConversionProgress(); + this.villagerConversionTime -= i; +- if (this.villagerConversionTime <= 0) { ++ if (this.villagerConversionTime <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.VILLAGER, (timer) -> this.villagerConversionTime = timer)) { + this.finishConversion((ServerWorld)this.level); } } @@ -218,7 +_,7 @@ - if (!this.func_174814_R()) { - p_213791_1_.func_217378_a((PlayerEntity)null, 1027, this.func_233580_cy_(), 0); + if (!this.isSilent()) { + p_213791_1_.levelEvent((PlayerEntity)null, 1027, this.blockPosition(), 0); } - + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, villagerentity); } - private int func_190735_dq() { + private int getConversionProgress() { diff --git a/patches/minecraft/net/minecraft/entity/monster/ZombifiedPiglinEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombifiedPiglinEntity.java.patch index 1899b89daf..db32e8657d 100644 --- a/patches/minecraft/net/minecraft/entity/monster/ZombifiedPiglinEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/ZombifiedPiglinEntity.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/entity/monster/ZombifiedPiglinEntity.java @@ -173,6 +_,7 @@ - public void func_70037_a(CompoundNBT p_70037_1_) { - super.func_70037_a(p_70037_1_); -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); + public void readAdditionalSaveData(CompoundNBT p_70037_1_) { + super.readAdditionalSaveData(p_70037_1_); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } diff --git a/patches/minecraft/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java.patch index f62c0641a9..ffacc4ad58 100644 --- a/patches/minecraft/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java +++ b/net/minecraft/entity/monster/piglin/AbstractPiglinEntity.java @@ -83,7 +_,7 @@ - this.field_242334_c = 0; + this.timeInOverworld = 0; } -- if (this.field_242334_c > 300) { -+ if (this.field_242334_c > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_233592_ba_, (timer) -> this.field_242334_c = timer)) { - this.func_241848_eP(); - this.func_234416_a_((ServerWorld)this.field_70170_p); +- 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((ServerWorld)this.level); } @@ -98,6 +_,7 @@ - ZombifiedPiglinEntity zombifiedpiglinentity = this.func_233656_b_(EntityType.field_233592_ba_, true); + ZombifiedPiglinEntity zombifiedpiglinentity = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, true); if (zombifiedpiglinentity != null) { - zombifiedpiglinentity.func_195064_c(new EffectInstance(Effects.field_76431_k, 200, 0)); + zombifiedpiglinentity.addEffect(new EffectInstance(Effects.CONFUSION, 200, 0)); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombifiedpiglinentity); } diff --git a/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinEntity.java.patch index 2e2630647f..651f11cf61 100644 --- a/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinEntity.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/entity/monster/piglin/PiglinEntity.java +++ b/net/minecraft/entity/monster/piglin/PiglinEntity.java @@ -265,7 +_,7 @@ - } else if (this.func_234433_eX_()) { + } else if (this.isChargingCrossbow()) { return PiglinAction.CROSSBOW_CHARGE; } else { -- return this.func_213398_dR() && this.func_233631_a_(Items.field_222114_py) ? PiglinAction.CROSSBOW_HOLD : PiglinAction.DEFAULT; -+ return this.func_213398_dR() && this.func_233634_a_(item -> item instanceof net.minecraft.item.CrossbowItem) ? PiglinAction.CROSSBOW_HOLD : PiglinAction.DEFAULT; +- return this.isAggressive() && this.isHolding(Items.CROSSBOW) ? PiglinAction.CROSSBOW_HOLD : PiglinAction.DEFAULT; ++ return this.isAggressive() && this.isHolding(item -> item instanceof net.minecraft.item.CrossbowItem) ? PiglinAction.CROSSBOW_HOLD : PiglinAction.DEFAULT; } } @@ -307,7 +_,7 @@ } - protected void func_234439_n_(ItemStack p_234439_1_) { -- if (p_234439_1_.func_77973_b() == PiglinTasks.field_234444_a_) { + protected void holdInOffHand(ItemStack p_234439_1_) { +- if (p_234439_1_.getItem() == PiglinTasks.BARTERING_ITEM) { + if (p_234439_1_.isPiglinCurrency()) { - this.func_184201_a(EquipmentSlotType.OFFHAND, p_234439_1_); - this.func_233663_d_(EquipmentSlotType.OFFHAND); + this.setItemSlot(EquipmentSlotType.OFFHAND, p_234439_1_); + this.setGuaranteedDrop(EquipmentSlotType.OFFHAND); } else { @@ -317,7 +_,7 @@ } - public boolean func_230293_i_(ItemStack p_230293_1_) { -- return this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) && this.func_98052_bS() && PiglinTasks.func_234474_a_(this, p_230293_1_); -+ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) && this.func_98052_bS() && PiglinTasks.func_234474_a_(this, p_230293_1_); + public boolean wantsToPickUp(ItemStack p_230293_1_) { +- return this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinTasks.wantsToPickup(this, p_230293_1_); ++ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this) && this.canPickUpLoot() && PiglinTasks.wantsToPickup(this, p_230293_1_); } - protected boolean func_234440_o_(ItemStack p_234440_1_) { + protected boolean canReplaceCurrentItem(ItemStack p_234440_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinTasks.java.patch b/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinTasks.java.patch index 27afcaeb04..f49907d310 100644 --- a/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinTasks.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/piglin/PiglinTasks.java.patch @@ -1,37 +1,37 @@ --- a/net/minecraft/entity/monster/piglin/PiglinTasks.java +++ b/net/minecraft/entity/monster/piglin/PiglinTasks.java @@ -232,7 +_,7 @@ - ItemStack itemstack = p_234477_0_.func_184586_b(Hand.OFF_HAND); - p_234477_0_.func_184611_a(Hand.OFF_HAND, ItemStack.field_190927_a); - if (p_234477_0_.func_242337_eM()) { -- boolean flag = func_234492_b_(itemstack.func_77973_b()); + ItemStack itemstack = p_234477_0_.getItemInHand(Hand.OFF_HAND); + p_234477_0_.setItemInHand(Hand.OFF_HAND, ItemStack.EMPTY); + if (p_234477_0_.isAdult()) { +- boolean flag = isBarterCurrency(itemstack.getItem()); + boolean flag = itemstack.isPiglinCurrency(); if (p_234477_1_ && flag) { - func_234475_a_(p_234477_0_, func_234524_k_(p_234477_0_)); + throwItems(p_234477_0_, getBarterResponseItems(p_234477_0_)); } else if (!flag) { @@ -318,7 +_,7 @@ return false; - } else if (func_234453_C_(p_234474_0_) && p_234474_0_.func_213375_cj().func_218191_a(MemoryModuleType.field_234103_o_)) { + } else if (isAdmiringDisabled(p_234474_0_) && p_234474_0_.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) { return false; -- } else if (func_234492_b_(item)) { +- } else if (isBarterCurrency(item)) { + } else if (p_234474_1_.isPiglinCurrency()) { - return func_234455_E_(p_234474_0_); + return isNotHoldingLovedItemInOffHand(p_234474_0_); } else { - boolean flag = p_234474_0_.func_234437_l_(p_234474_1_); + boolean flag = p_234474_0_.canAddToInventory(p_234474_1_); @@ -418,7 +_,7 @@ } - protected static boolean func_234489_b_(PiglinEntity p_234489_0_, ItemStack p_234489_1_) { -- return !func_234453_C_(p_234489_0_) && !func_234451_A_(p_234489_0_) && p_234489_0_.func_242337_eM() && func_234492_b_(p_234489_1_.func_77973_b()); -+ return !func_234453_C_(p_234489_0_) && !func_234451_A_(p_234489_0_) && p_234489_0_.func_242337_eM() && p_234489_1_.isPiglinCurrency(); + protected static boolean canAdmire(PiglinEntity p_234489_0_, ItemStack p_234489_1_) { +- return !isAdmiringDisabled(p_234489_0_) && !isAdmiringItem(p_234489_0_) && p_234489_0_.isAdult() && isBarterCurrency(p_234489_1_.getItem()); ++ return !isAdmiringDisabled(p_234489_0_) && !isAdmiringItem(p_234489_0_) && p_234489_0_.isAdult() && p_234489_1_.isPiglinCurrency(); } - protected static void func_234468_a_(PiglinEntity p_234468_0_, LivingEntity p_234468_1_) { + protected static void wasHurtBy(PiglinEntity p_234468_0_, LivingEntity p_234468_1_) { @@ -519,7 +_,7 @@ - public static boolean func_234460_a_(LivingEntity p_234460_0_) { - for(ItemStack itemstack : p_234460_0_.func_184193_aE()) { - Item item = itemstack.func_77973_b(); -- if (item instanceof ArmorItem && ((ArmorItem)item).func_200880_d() == ArmorMaterial.GOLD) { + public static boolean isWearingGold(LivingEntity p_234460_0_) { + for(ItemStack itemstack : p_234460_0_.getArmorSlots()) { + Item item = itemstack.getItem(); +- if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial() == ArmorMaterial.GOLD) { + if (itemstack.makesPiglinsNeutral(p_234460_0_)) { return true; } @@ -39,9 +39,9 @@ @@ -673,7 +_,7 @@ } - private static boolean func_234494_c_(LivingEntity p_234494_0_) { -- return p_234494_0_.func_233631_a_(Items.field_222114_py); -+ return p_234494_0_.func_233634_a_(item -> item instanceof net.minecraft.item.CrossbowItem); + private static boolean hasCrossbow(LivingEntity p_234494_0_) { +- return p_234494_0_.isHolding(Items.CROSSBOW); ++ return p_234494_0_.isHolding(item -> item instanceof net.minecraft.item.CrossbowItem); } - private static void func_234501_d_(LivingEntity p_234501_0_) { + private static void admireGoldItem(LivingEntity p_234501_0_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/piglin/StartAdmiringItemTask.java.patch b/patches/minecraft/net/minecraft/entity/monster/piglin/StartAdmiringItemTask.java.patch index 851382e656..5c7339a147 100644 --- a/patches/minecraft/net/minecraft/entity/monster/piglin/StartAdmiringItemTask.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/piglin/StartAdmiringItemTask.java.patch @@ -3,9 +3,9 @@ @@ -13,7 +_,7 @@ } - protected boolean func_212832_a_(ServerWorld p_212832_1_, E p_212832_2_) { -- return !p_212832_2_.func_184592_cb().func_190926_b() && p_212832_2_.func_184592_cb().func_77973_b() != Items.field_185159_cQ; -+ return !p_212832_2_.func_184592_cb().func_190926_b() && !p_212832_2_.func_184592_cb().isShield(p_212832_2_); + protected boolean checkExtraStartConditions(ServerWorld p_212832_1_, E p_212832_2_) { +- return !p_212832_2_.getOffhandItem().isEmpty() && p_212832_2_.getOffhandItem().getItem() != Items.SHIELD; ++ return !p_212832_2_.getOffhandItem().isEmpty() && !p_212832_2_.getOffhandItem().isShield(p_212832_2_); } - protected void func_212831_a_(ServerWorld p_212831_1_, E p_212831_2_, long p_212831_3_) { + protected void start(ServerWorld p_212831_1_, E p_212831_2_, long p_212831_3_) { diff --git a/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch index 0d75d1b8d1..1fd75c8c40 100644 --- a/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/AnimalEntity.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/entity/passive/AnimalEntity.java @@ -199,6 +_,17 @@ - public void func_234177_a_(ServerWorld p_234177_1_, AnimalEntity p_234177_2_) { - AgeableEntity ageableentity = this.func_241840_a(p_234177_1_, p_234177_2_); + public void spawnChildFromBreeding(ServerWorld p_234177_1_, AnimalEntity p_234177_2_) { + AgeableEntity ageableentity = this.getBreedOffspring(p_234177_1_, p_234177_2_); + final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(this, p_234177_2_, ageableentity); + final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + ageableentity = event.getChild(); + if (cancelled) { + //Reset the "inLove" state for the animals -+ this.func_70873_a(6000); -+ p_234177_2_.func_70873_a(6000); -+ this.func_70875_t(); -+ p_234177_2_.func_70875_t(); ++ this.setAge(6000); ++ p_234177_2_.setAge(6000); ++ this.resetLove(); ++ p_234177_2_.resetLove(); + return; + } if (ageableentity != null) { - ServerPlayerEntity serverplayerentity = this.func_191993_do(); - if (serverplayerentity == null && p_234177_2_.func_191993_do() != null) { + ServerPlayerEntity serverplayerentity = this.getLoveCause(); + if (serverplayerentity == null && p_234177_2_.getLoveCause() != null) { diff --git a/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch index f913410adf..f79eaed4ae 100644 --- a/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/BeeEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/entity/passive/BeeEntity.java +++ b/net/minecraft/entity/passive/BeeEntity.java @@ -184,6 +_,7 @@ - this.field_226363_bC_ = p_70037_1_.func_74762_e("TicksSincePollination"); - this.field_226364_bD_ = p_70037_1_.func_74762_e("CannotEnterHiveTicks"); - this.field_226365_bE_ = p_70037_1_.func_74762_e("CropsGrownSincePollination"); -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); + this.ticksWithoutNectarSinceExitingHive = p_70037_1_.getInt("TicksSincePollination"); + this.stayOutOfHiveCountdown = p_70037_1_.getInt("CannotEnterHiveTicks"); + this.numCropsGrownSincePollination = p_70037_1_.getInt("CropsGrownSincePollination"); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } @@ -425,7 +_,7 @@ return false; } else { - TileEntity tileentity = this.field_70170_p.func_175625_s(this.field_226369_bI_); -- return tileentity != null && tileentity.func_200662_C() == TileEntityType.field_226985_G_; + TileEntity tileentity = this.level.getBlockEntity(this.hivePos); +- return tileentity != null && tileentity.getType() == TileEntityType.BEEHIVE; + return tileentity instanceof BeehiveTileEntity; } } diff --git a/patches/minecraft/net/minecraft/entity/passive/CatEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/CatEntity.java.patch index 1cb7c4b961..29e018333b 100644 --- a/patches/minecraft/net/minecraft/entity/passive/CatEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/CatEntity.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/passive/CatEntity.java @@ -402,7 +_,7 @@ } - } else if (this.func_70877_b(itemstack)) { - this.func_175505_a(p_230254_1_, itemstack); -- if (this.field_70146_Z.nextInt(3) == 0) { -+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { - this.func_193101_c(p_230254_1_); - this.func_233687_w_(true); - this.field_70170_p.func_72960_a(this, (byte)7); + } else if (this.isFood(itemstack)) { + this.usePlayerItem(p_230254_1_, itemstack); +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.tame(p_230254_1_); + this.setOrderedToSit(true); + this.level.broadcastEntityEvent(this, (byte)7); diff --git a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch index 1863fc14a8..931dbabab7 100644 --- a/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/FoxEntity.java.patch @@ -3,27 +3,27 @@ @@ -761,7 +_,7 @@ } - protected void func_220730_m() { -- if (FoxEntity.this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(FoxEntity.this.field_70170_p, FoxEntity.this)) { - BlockState blockstate = FoxEntity.this.field_70170_p.func_180495_p(this.field_179494_b); - if (blockstate.func_203425_a(Blocks.field_222434_lW)) { - int i = blockstate.func_177229_b(SweetBerryBushBlock.field_220125_a); + protected void onReachedTarget() { +- if (FoxEntity.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(FoxEntity.this.level, FoxEntity.this)) { + BlockState blockstate = FoxEntity.this.level.getBlockState(this.blockPos); + if (blockstate.is(Blocks.SWEET_BERRY_BUSH)) { + int i = blockstate.getValue(SweetBerryBushBlock.AGE); @@ -1001,6 +_,17 @@ - protected void func_75388_i() { - ServerWorld serverworld = (ServerWorld)this.field_75394_a; - FoxEntity foxentity = (FoxEntity)this.field_75390_d.func_241840_a(serverworld, this.field_75391_e); -+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75390_d, field_75391_e, foxentity); + protected void breed() { + ServerWorld serverworld = (ServerWorld)this.level; + FoxEntity foxentity = (FoxEntity)this.animal.getBreedOffspring(serverworld, this.partner); ++ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(animal, partner, foxentity); + final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + foxentity = (FoxEntity) event.getChild(); + if (cancelled) { + //Reset the "inLove" state for the animals -+ this.field_75390_d.func_70873_a(6000); -+ this.field_75391_e.func_70873_a(6000); -+ this.field_75390_d.func_70875_t(); -+ this.field_75391_e.func_70875_t(); ++ this.animal.setAge(6000); ++ this.partner.setAge(6000); ++ this.animal.resetLove(); ++ this.partner.resetLove(); + return; + } if (foxentity != null) { - ServerPlayerEntity serverplayerentity = this.field_75390_d.func_191993_do(); - ServerPlayerEntity serverplayerentity1 = this.field_75391_e.func_191993_do(); + ServerPlayerEntity serverplayerentity = this.animal.getLoveCause(); + ServerPlayerEntity serverplayerentity1 = this.partner.getLoveCause(); diff --git a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch index df48a617e8..40adfb843e 100644 --- a/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/IronGolemEntity.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/entity/passive/IronGolemEntity.java +++ b/net/minecraft/entity/passive/IronGolemEntity.java @@ -120,9 +_,10 @@ - int i = MathHelper.func_76128_c(this.func_226277_ct_()); - int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); - int k = MathHelper.func_76128_c(this.func_226281_cx_()); -- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); -- if (!blockstate.func_196958_f()) { -- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), 4.0D * ((double)this.field_70146_Z.nextFloat() - 0.5D), 0.5D, ((double)this.field_70146_Z.nextFloat() - 0.5D) * 4.0D); + int i = MathHelper.floor(this.getX()); + int j = MathHelper.floor(this.getY() - (double)0.2F); + int k = MathHelper.floor(this.getZ()); +- BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k)); +- if (!blockstate.isAir()) { +- this.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate), this.getX() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), 4.0D * ((double)this.random.nextFloat() - 0.5D), 0.5D, ((double)this.random.nextFloat() - 0.5D) * 4.0D); + BlockPos pos = new BlockPos(i, j, k); -+ BlockState blockstate = this.field_70170_p.func_180495_p(pos); -+ if (!blockstate.isAir(this.field_70170_p, pos)) { -+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(pos), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.func_213311_cf(), 4.0D * ((double)this.field_70146_Z.nextFloat() - 0.5D), 0.5D, ((double)this.field_70146_Z.nextFloat() - 0.5D) * 4.0D); ++ BlockState blockstate = this.level.getBlockState(pos); ++ if (!blockstate.isAir(this.level, pos)) { ++ this.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate).setPos(pos), this.getX() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), 4.0D * ((double)this.random.nextFloat() - 0.5D), 0.5D, ((double)this.random.nextFloat() - 0.5D) * 4.0D); } } @@ -149,6 +_,7 @@ - public void func_70037_a(CompoundNBT p_70037_1_) { - super.func_70037_a(p_70037_1_); - this.func_70849_f(p_70037_1_.func_74767_n("PlayerCreated")); -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); + public void readAdditionalSaveData(CompoundNBT p_70037_1_) { + super.readAdditionalSaveData(p_70037_1_); + this.setPlayerCreated(p_70037_1_.getBoolean("PlayerCreated")); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } diff --git a/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch index 2b7e0b0663..da0572ce2d 100644 --- a/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch @@ -6,18 +6,18 @@ -public class MooshroomEntity extends CowEntity implements IShearable { +public class MooshroomEntity extends CowEntity implements IShearable, net.minecraftforge.common.IForgeShearable { - private static final DataParameter field_213449_bz = EntityDataManager.func_187226_a(MooshroomEntity.class, DataSerializers.field_187194_d); - private Effect field_213450_bA; - private int field_213447_bB; + private static final DataParameter DATA_TYPE = EntityDataManager.defineId(MooshroomEntity.class, DataSerializers.STRING); + private Effect effect; + private int effectDuration; @@ -100,7 +_,7 @@ - this.func_184185_a(soundevent, 1.0F, 1.0F); - return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K); -- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { -+ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { //Forge: Moved to onSheared - this.func_230263_a_(SoundCategory.PLAYERS); - if (!this.field_70170_p.field_72995_K) { - itemstack.func_222118_a(1, p_230254_1_, (p_213442_1_) -> { + this.playSound(soundevent, 1.0F, 1.0F); + return ActionResultType.sidedSuccess(this.level.isClientSide); +- } else if (itemstack.getItem() == Items.SHEARS && this.readyForShearing()) { ++ } else if (false && itemstack.getItem() == Items.SHEARS && this.readyForShearing()) { //Forge: Moved to onSheared + this.shear(SoundCategory.PLAYERS); + if (!this.level.isClientSide) { + itemstack.hurtAndBreak(1, p_230254_1_, (p_213442_1_) -> { @@ -234,6 +_,45 @@ return mooshroomentity$type2; @@ -25,35 +25,35 @@ + + @Override + public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) { -+ return func_230262_K__(); ++ return readyForShearing(); + } + + @javax.annotation.Nonnull + @Override + public java.util.List onSheared(@javax.annotation.Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) { -+ world.func_217384_a(null, this, SoundEvents.field_187784_dt, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); -+ if (!world.func_201670_d()) { -+ ((ServerWorld)this.field_70170_p).func_195598_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 1, 0.0D, 0.0D, 0.0D, 0.0D); -+ this.func_70106_y(); -+ CowEntity cowentity = EntityType.field_200796_j.func_200721_a(this.field_70170_p); -+ cowentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A); -+ cowentity.func_70606_j(this.func_110143_aJ()); -+ cowentity.field_70761_aq = this.field_70761_aq; -+ if (this.func_145818_k_()) { -+ cowentity.func_200203_b(this.func_200201_e()); -+ cowentity.func_174805_g(this.func_174833_aM()); ++ world.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); ++ if (!world.isClientSide()) { ++ ((ServerWorld)this.level).sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D); ++ this.remove(); ++ CowEntity cowentity = EntityType.COW.create(this.level); ++ cowentity.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, this.xRot); ++ cowentity.setHealth(this.getHealth()); ++ cowentity.yBodyRot = this.yBodyRot; ++ if (this.hasCustomName()) { ++ cowentity.setCustomName(this.getCustomName()); ++ cowentity.setCustomNameVisible(this.isCustomNameVisible()); + } + -+ if (this.func_104002_bU()) { -+ cowentity.func_110163_bv(); ++ if (this.isPersistenceRequired()) { ++ cowentity.setPersistenceRequired(); + } + -+ cowentity.func_184224_h(this.func_190530_aW()); -+ this.field_70170_p.func_217376_c(cowentity); ++ cowentity.setInvulnerable(this.isInvulnerable()); ++ this.level.addFreshEntity(cowentity); + + java.util.List items = new java.util.ArrayList<>(); + for (int i = 0; i < 5; ++i) { -+ items.add(new ItemStack(this.func_213444_dV().field_221099_d.func_177230_c())); ++ items.add(new ItemStack(this.getMushroomType().blockState.getBlock())); + } + + return items; @@ -63,4 +63,4 @@ + public static enum Type { - RED("red", Blocks.field_150337_Q.func_176223_P()), + RED("red", Blocks.RED_MUSHROOM.defaultBlockState()), diff --git a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch index 92325163ae..69b7467325 100644 --- a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/passive/OcelotEntity.java +++ b/net/minecraft/entity/passive/OcelotEntity.java @@ -163,7 +_,7 @@ - if ((this.field_70914_e == null || this.field_70914_e.func_75277_f()) && !this.func_213530_dX() && this.func_70877_b(itemstack) && p_230254_1_.func_70068_e(this) < 9.0D) { - this.func_175505_a(p_230254_1_, itemstack); - if (!this.field_70170_p.field_72995_K) { -- if (this.field_70146_Z.nextInt(3) == 0) { -+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { - this.func_213528_r(true); - this.func_213527_s(true); - this.field_70170_p.func_72960_a(this, (byte)41); + if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && p_230254_1_.distanceToSqr(this) < 9.0D) { + this.usePlayerItem(p_230254_1_, itemstack); + if (!this.level.isClientSide) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.setTrusting(true); + this.spawnTrustingParticles(true); + this.level.broadcastEntityEvent(this, (byte)41); diff --git a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch index b3d906b96a..b588218011 100644 --- a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch @@ -3,9 +3,9 @@ @@ -237,7 +_,7 @@ } - if (!this.field_70170_p.field_72995_K) { -- if (this.field_70146_Z.nextInt(10) == 0) { -+ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { - this.func_193101_c(p_230254_1_); - this.field_70170_p.func_72960_a(this, (byte)7); + if (!this.level.isClientSide) { +- if (this.random.nextInt(10) == 0) { ++ if (this.random.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.tame(p_230254_1_); + this.level.broadcastEntityEvent(this, (byte)7); } else { diff --git a/patches/minecraft/net/minecraft/entity/passive/PigEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/PigEntity.java.patch index 67b028fc3a..db8fd5e026 100644 --- a/patches/minecraft/net/minecraft/entity/passive/PigEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/PigEntity.java.patch @@ -3,17 +3,17 @@ @@ -203,7 +_,7 @@ } - public void func_241841_a(ServerWorld p_241841_1_, LightningBoltEntity p_241841_2_) { -- if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL) { -+ if (p_241841_1_.func_175659_aa() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.field_233592_ba_, (timer) -> {})) { - ZombifiedPiglinEntity zombifiedpiglinentity = EntityType.field_233592_ba_.func_200721_a(p_241841_1_); - zombifiedpiglinentity.func_184201_a(EquipmentSlotType.MAINHAND, new ItemStack(Items.field_151010_B)); - zombifiedpiglinentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A); + public void thunderHit(ServerWorld p_241841_1_, LightningBoltEntity p_241841_2_) { +- if (p_241841_1_.getDifficulty() != Difficulty.PEACEFUL) { ++ if (p_241841_1_.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIFIED_PIGLIN, (timer) -> {})) { + ZombifiedPiglinEntity zombifiedpiglinentity = EntityType.ZOMBIFIED_PIGLIN.create(p_241841_1_); + zombifiedpiglinentity.setItemSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); + zombifiedpiglinentity.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, this.xRot); @@ -215,6 +_,7 @@ } - zombifiedpiglinentity.func_110163_bv(); + zombifiedpiglinentity.setPersistenceRequired(); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombifiedpiglinentity); - p_241841_1_.func_217376_c(zombifiedpiglinentity); - this.func_70106_y(); + p_241841_1_.addFreshEntity(zombifiedpiglinentity); + this.remove(); } else { diff --git a/patches/minecraft/net/minecraft/entity/passive/PolarBearEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/PolarBearEntity.java.patch index 22a283dd86..5929185701 100644 --- a/patches/minecraft/net/minecraft/entity/passive/PolarBearEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/PolarBearEntity.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/entity/passive/PolarBearEntity.java @@ -103,6 +_,7 @@ - public void func_70037_a(CompoundNBT p_70037_1_) { - super.func_70037_a(p_70037_1_); -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); + public void readAdditionalSaveData(CompoundNBT p_70037_1_) { + super.readAdditionalSaveData(p_70037_1_); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } diff --git a/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch index 940026f84a..771c604c69 100644 --- a/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/passive/RabbitEntity.java @@ -500,7 +_,7 @@ - public boolean func_75250_a() { - if (this.field_179496_a <= 0) { -- if (!this.field_179500_c.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179500_c.field_70170_p, this.field_179500_c)) { + public boolean canUse() { + if (this.nextStartTick <= 0) { +- if (!this.rabbit.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.rabbit.level, this.rabbit)) { return false; } diff --git a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch index ad28093068..78d0a3555f 100644 --- a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch @@ -6,40 +6,40 @@ -public class SheepEntity extends AnimalEntity implements IShearable { +public class SheepEntity extends AnimalEntity implements IShearable, net.minecraftforge.common.IForgeShearable { - private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(SheepEntity.class, DataSerializers.field_187191_a); - private static final Map field_200206_bz = Util.func_200696_a(Maps.newEnumMap(DyeColor.class), (p_203402_0_) -> { - p_203402_0_.put(DyeColor.WHITE, Blocks.field_196556_aL); + private static final DataParameter DATA_WOOL_ID = EntityDataManager.defineId(SheepEntity.class, DataSerializers.BYTE); + private static final Map ITEM_BY_DYE = Util.make(Maps.newEnumMap(DyeColor.class), (p_203402_0_) -> { + p_203402_0_.put(DyeColor.WHITE, Blocks.WHITE_WOOL); @@ -216,7 +_,7 @@ - public ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) { - ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ) { //Forge: Moved to onSheared - if (!this.field_70170_p.field_72995_K && this.func_230262_K__()) { - this.func_230263_a_(SoundCategory.PLAYERS); - itemstack.func_222118_a(1, p_230254_1_, (p_213613_1_) -> { + public ActionResultType mobInteract(PlayerEntity p_230254_1_, Hand p_230254_2_) { + ItemStack itemstack = p_230254_1_.getItemInHand(p_230254_2_); +- if (itemstack.getItem() == Items.SHEARS) { ++ if (false && itemstack.getItem() == Items.SHEARS) { //Forge: Moved to onSheared + if (!this.level.isClientSide && this.readyForShearing()) { + this.shear(SoundCategory.PLAYERS); + itemstack.hurtAndBreak(1, p_230254_1_, (p_213613_1_) -> { @@ -360,5 +_,27 @@ - protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) { - return 0.95F * p_213348_2_.field_220316_b; + protected float getStandingEyeHeight(Pose p_213348_1_, EntitySize p_213348_2_) { + return 0.95F * p_213348_2_.height; + } + + @Override + public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) { -+ return func_230262_K__(); ++ return readyForShearing(); + } + + @javax.annotation.Nonnull + @Override + public java.util.List onSheared(@Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) { -+ world.func_217384_a(null, this, SoundEvents.field_187763_eJ, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); -+ if (!world.field_72995_K) { -+ this.func_70893_e(true); -+ int i = 1 + this.field_70146_Z.nextInt(3); ++ world.playSound(null, this, SoundEvents.SHEEP_SHEAR, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); ++ if (!world.isClientSide) { ++ this.setSheared(true); ++ int i = 1 + this.random.nextInt(3); + + java.util.List items = new java.util.ArrayList<>(); + for (int j = 0; j < i; ++j) { -+ items.add(new ItemStack(field_200206_bz.get(this.func_175509_cj()))); ++ items.add(new ItemStack(ITEM_BY_DYE.get(this.getColor()))); + } + return items; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch index 29d6ae7e77..07aa3269a0 100644 --- a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch @@ -6,54 +6,54 @@ -public class SnowGolemEntity extends GolemEntity implements IShearable, IRangedAttackMob { +public class SnowGolemEntity extends GolemEntity implements IShearable, IRangedAttackMob, net.minecraftforge.common.IForgeShearable { - private static final DataParameter field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a); + private static final DataParameter DATA_PUMPKIN_ID = EntityDataManager.defineId(SnowGolemEntity.class, DataSerializers.BYTE); public SnowGolemEntity(EntityType p_i50244_1_, World p_i50244_2_) { @@ -93,7 +_,7 @@ - this.func_70097_a(DamageSource.field_76370_b, 1.0F); + this.hurt(DamageSource.ON_FIRE, 1.0F); } -- if (!this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { +- if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { return; } @@ -104,7 +_,7 @@ - j = MathHelper.func_76128_c(this.func_226278_cu_()); - k = MathHelper.func_76128_c(this.func_226281_cx_() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); + j = MathHelper.floor(this.getY()); + k = MathHelper.floor(this.getZ() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(i, j, k); -- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { -+ if (this.field_70170_p.func_175623_d(blockpos) && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { - this.field_70170_p.func_175656_a(blockpos, blockstate); +- if (this.level.getBlockState(blockpos).isAir() && this.level.getBiome(blockpos).getTemperature(blockpos) < 0.8F && blockstate.canSurvive(this.level, blockpos)) { ++ if (this.level.isEmptyBlock(blockpos) && this.level.getBiome(blockpos).getTemperature(blockpos) < 0.8F && blockstate.canSurvive(this.level, blockpos)) { + this.level.setBlockAndUpdate(blockpos, blockstate); } } @@ -130,7 +_,7 @@ - protected ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) { - ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { //Forge: Moved to onSheared - this.func_230263_a_(SoundCategory.PLAYERS); - if (!this.field_70170_p.field_72995_K) { - itemstack.func_222118_a(1, p_230254_1_, (p_213622_1_) -> { + protected ActionResultType mobInteract(PlayerEntity p_230254_1_, Hand p_230254_2_) { + ItemStack itemstack = p_230254_1_.getItemInHand(p_230254_2_); +- if (itemstack.getItem() == Items.SHEARS && this.readyForShearing()) { ++ if (false && itemstack.getItem() == Items.SHEARS && this.readyForShearing()) { //Forge: Moved to onSheared + this.shear(SoundCategory.PLAYERS); + if (!this.level.isClientSide) { + itemstack.hurtAndBreak(1, p_230254_1_, (p_213622_1_) -> { @@ -189,5 +_,21 @@ @OnlyIn(Dist.CLIENT) - public Vector3d func_241205_ce_() { - return new Vector3d(0.0D, (double)(0.75F * this.func_70047_e()), (double)(this.func_213311_cf() * 0.4F)); + public Vector3d getLeashOffset() { + return new Vector3d(0.0D, (double)(0.75F * this.getEyeHeight()), (double)(this.getBbWidth() * 0.4F)); + } + + @Override + public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) { -+ return func_230262_K__(); ++ return readyForShearing(); + } + + @javax.annotation.Nonnull + @Override + public java.util.List onSheared(@Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) { -+ world.func_217384_a(null, this, SoundEvents.field_232843_op_, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); -+ if (!world.func_201670_d()) { -+ func_184747_a(false); -+ return java.util.Collections.singletonList(new ItemStack(Items.field_221689_cG)); ++ world.playSound(null, this, SoundEvents.SNOW_GOLEM_SHEAR, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F); ++ if (!world.isClientSide()) { ++ setPumpkin(false); ++ return java.util.Collections.singletonList(new ItemStack(Items.CARVED_PUMPKIN)); + } + return java.util.Collections.emptyList(); } diff --git a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch index 8ed2119483..4826c5cfc8 100644 --- a/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/entity/passive/WolfEntity.java +++ b/net/minecraft/entity/passive/WolfEntity.java @@ -133,6 +_,7 @@ - this.func_175547_a(DyeColor.func_196056_a(p_70037_1_.func_74762_e("CollarColor"))); + this.setCollarColor(DyeColor.byId(p_70037_1_.getInt("CollarColor"))); } -+ if(!field_70170_p.field_72995_K) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) - this.func_241358_a_((ServerWorld)this.field_70170_p, p_70037_1_); ++ if(!level.isClientSide) //FORGE: allow this entity to be read from nbt on client. (Fixes MC-189565) + this.readPersistentAngerSaveData((ServerWorld)this.level, p_70037_1_); } @@ -347,7 +_,7 @@ - itemstack.func_190918_g(1); + itemstack.shrink(1); } -- if (this.field_70146_Z.nextInt(3) == 0) { -+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { - this.func_193101_c(p_230254_1_); - this.field_70699_by.func_75499_g(); - this.func_70624_b((LivingEntity)null); +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_230254_1_)) { + this.tame(p_230254_1_); + this.navigation.stop(); + this.setTarget((LivingEntity)null); diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch index 3abd48c5de..9e50d815e5 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch @@ -2,43 +2,43 @@ +++ b/net/minecraft/entity/passive/horse/AbstractHorseEntity.java @@ -276,6 +_,7 @@ - this.field_110296_bG.func_110134_a(this); - this.func_230275_fc_(); -+ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG)); + this.inventory.addListener(this); + this.updateContainerEquipment(); ++ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.inventory)); } - protected void func_230275_fc_() { + protected void updateContainerEquipment() { @@ -334,9 +_,9 @@ - protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { - if (!p_180429_2_.func_185904_a().func_76224_d()) { - BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); -- SoundType soundtype = p_180429_2_.func_215695_r(); -+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); - if (blockstate.func_203425_a(Blocks.field_150433_aE)) { -- soundtype = blockstate.func_215695_r(); -+ soundtype = blockstate.getSoundType(field_70170_p, p_180429_1_, this); + protected void playStepSound(BlockPos p_180429_1_, BlockState p_180429_2_) { + if (!p_180429_2_.getMaterial().isLiquid()) { + BlockState blockstate = this.level.getBlockState(p_180429_1_.above()); +- SoundType soundtype = p_180429_2_.getSoundType(); ++ SoundType soundtype = p_180429_2_.getSoundType(level, p_180429_1_, this); + if (blockstate.is(Blocks.SNOW)) { +- soundtype = blockstate.getSoundType(); ++ soundtype = blockstate.getSoundType(level, p_180429_1_, this); } - if (this.func_184207_aI() && this.field_190688_bE) { + if (this.isVehicle() && this.canGallop) { @@ -694,6 +_,7 @@ - this.func_213293_j(vector3d.field_72450_a, d1, vector3d.field_72449_c); - this.func_110255_k(true); - this.field_70160_al = true; + this.setDeltaMovement(vector3d.x, d1, vector3d.z); + this.setIsJumping(true); + this.hasImpulse = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); if (f1 > 0.0F) { - float f2 = MathHelper.func_76126_a(this.field_70177_z * ((float)Math.PI / 180F)); - float f3 = MathHelper.func_76134_b(this.field_70177_z * ((float)Math.PI / 180F)); + float f2 = MathHelper.sin(this.yRot * ((float)Math.PI / 180F)); + float f3 = MathHelper.cos(this.yRot * ((float)Math.PI / 180F)); @@ -1009,5 +_,24 @@ - this.func_230273_eI_(); - return super.func_213386_a(p_213386_1_, p_213386_2_, p_213386_3_, p_213386_4_, p_213386_5_); + this.randomizeAttributes(); + return super.finalizeSpawn(p_213386_1_, p_213386_2_, p_213386_3_, p_213386_4_, p_213386_5_); + } + + private net.minecraftforge.common.util.LazyOptional itemHandler = null; + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.Direction facing) { -+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null) ++ if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null) + return itemHandler.cast(); + return super.getCapability(capability, facing); + } diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch index 13849e8b68..07451c4e85 100644 --- a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/passive/horse/HorseEntity.java +++ b/net/minecraft/entity/passive/horse/HorseEntity.java @@ -139,6 +_,8 @@ - this.func_184185_a(SoundEvents.field_187705_cn, p_190680_1_.func_185843_a() * 0.6F, p_190680_1_.func_185847_b()); + this.playSound(SoundEvents.HORSE_BREATHE, p_190680_1_.getVolume() * 0.6F, p_190680_1_.getPitch()); } -+ ItemStack stack = this.field_110296_bG.func_70301_a(1); -+ if (func_190682_f(stack)) stack.onHorseArmorTick(field_70170_p, this); ++ ItemStack stack = this.inventory.getItem(1); ++ if (isArmor(stack)) stack.onHorseArmorTick(level, this); } - protected SoundEvent func_184639_G() { + protected SoundEvent getAmbientSound() { diff --git a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch index fed74c64d3..a519f22767 100644 --- a/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch @@ -5,85 +5,85 @@ public abstract class PlayerEntity extends LivingEntity { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; - public static final EntitySize field_213835_bs = EntitySize.func_220314_b(0.6F, 1.8F); - private static final Map field_213836_b = ImmutableMap.builder().put(Pose.STANDING, field_213835_bs).put(Pose.SLEEPING, field_213377_as).put(Pose.FALL_FLYING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SWIMMING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SPIN_ATTACK, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.CROUCHING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build(); - private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c); + public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F); + private static final Map POSES = ImmutableMap.builder().put(Pose.STANDING, STANDING_DIMENSIONS).put(Pose.SLEEPING, SLEEPING_DIMENSIONS).put(Pose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(Pose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(Pose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(Pose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(Pose.DYING, EntitySize.fixed(0.2F, 0.2F)).build(); + private static final DataParameter DATA_PLAYER_ABSORPTION_ID = EntityDataManager.defineId(PlayerEntity.class, DataSerializers.FLOAT); @@ -150,6 +_,9 @@ - private final CooldownTracker field_184832_bU = this.func_184815_l(); + private final CooldownTracker cooldowns = this.createItemCooldowns(); @Nullable - public FishingBobberEntity field_71104_cf; + public FishingBobberEntity fishing; + 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 PlayerEntity(World p_i241920_1_, BlockPos p_i241920_2_, float p_i241920_3_, GameProfile p_i241920_4_) { - super(EntityType.field_200729_aH, p_i241920_1_); + super(EntityType.PLAYER, p_i241920_1_); @@ -175,7 +_,7 @@ } - public static AttributeModifierMap.MutableAttribute func_234570_el_() { -- return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_); -+ return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_).func_233814_a_(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_233814_a_(Attributes.field_233824_g_); + public static AttributeModifierMap.MutableAttribute createAttributes() { +- return LivingEntity.createLivingAttributes().add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.MOVEMENT_SPEED, (double)0.1F).add(Attributes.ATTACK_SPEED).add(Attributes.LUCK); ++ return LivingEntity.createLivingAttributes().add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.MOVEMENT_SPEED, (double)0.1F).add(Attributes.ATTACK_SPEED).add(Attributes.LUCK).add(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).add(Attributes.ATTACK_KNOCKBACK); } - protected void func_70088_a() { + protected void defineSynchedData() { @@ -189,6 +_,7 @@ } - public void func_70071_h_() { + public void tick() { + net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPreTick(this); - this.field_70145_X = this.func_175149_v(); - if (this.func_175149_v()) { - this.field_70122_E = false; + this.noPhysics = this.isSpectator(); + if (this.isSpectator()) { + this.onGround = false; @@ -204,7 +_,7 @@ - this.field_71076_b = 100; + this.sleepCounter = 100; } -- if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_72935_r()) { -+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, func_213374_dv())) { - this.func_225652_a_(false, true); +- if (!this.level.isClientSide && this.level.isDay()) { ++ if (!this.level.isClientSide && !net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, getSleepingPos())) { + this.stopSleepInBed(false, true); } - } else if (this.field_71076_b > 0) { + } else if (this.sleepCounter > 0) { @@ -258,6 +_,7 @@ - this.func_203041_m(); - this.field_184832_bU.func_185144_a(); - this.func_213832_dB(); + this.turtleHelmetTick(); + this.cooldowns.tick(); + this.updatePlayerPose(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPostTick(this); } - public boolean func_226563_dT_() { + public boolean isSecondaryUseActive() { @@ -333,6 +_,10 @@ } - protected void func_213832_dB() { + protected void updatePlayerPose() { + if(forcedPose != null) { -+ this.func_213301_b(forcedPose); ++ this.setPose(forcedPose); + return; + } - if (this.func_213298_c(Pose.SWIMMING)) { + if (this.canEnterPose(Pose.SWIMMING)) { Pose pose; - if (this.func_184613_cA()) { + if (this.isFallFlying()) { @@ -550,6 +_,7 @@ } - public void func_70645_a(DamageSource p_70645_1_) { + public void die(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - super.func_70645_a(p_70645_1_); - this.func_226264_Z_(); - if (!this.func_175149_v()) { + super.die(p_70645_1_); + this.reapplyPosition(); + if (!this.isSpectator()) { @@ -603,12 +_,14 @@ } - public boolean func_225609_n_(boolean p_225609_1_) { -- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_225609_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true) != null; -+ ItemStack stack = field_71071_by.func_70448_g(); -+ if (stack.func_190926_b() || !stack.onDroppedByPlayer(this)) return false; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_225609_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), true) != null; + public boolean drop(boolean p_225609_1_) { +- return this.drop(this.inventory.removeItem(this.inventory.selected, p_225609_1_ && !this.inventory.getSelected().isEmpty() ? this.inventory.getSelected().getCount() : 1), false, true) != null; ++ ItemStack stack = inventory.getSelected(); ++ if (stack.isEmpty() || !stack.onDroppedByPlayer(this)) return false; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, this.inventory.removeItem(this.inventory.selected, p_225609_1_ && !this.inventory.getSelected().isEmpty() ? this.inventory.getSelected().getCount() : 1), true) != null; } @Nullable - public ItemEntity func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) { -- return this.func_146097_a(p_71019_1_, false, p_71019_2_); + public ItemEntity drop(ItemStack p_71019_1_, boolean p_71019_2_) { +- return this.drop(p_71019_1_, false, p_71019_2_); + return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, p_71019_2_); } @@ -93,14 +93,14 @@ } + @Deprecated //Use location sensitive version below - public float func_184813_a(BlockState p_184813_1_) { + public float getDestroySpeed(BlockState p_184813_1_) { + return getDigSpeed(p_184813_1_, null); + } + + public float getDigSpeed(BlockState p_184813_1_, @Nullable BlockPos pos) { - float f = this.field_71071_by.func_184438_a(p_184813_1_); + float f = this.inventory.getDestroySpeed(p_184813_1_); if (f > 1.0F) { - int i = EnchantmentHelper.func_185293_e(this); + int i = EnchantmentHelper.getBlockEfficiency(this); @@ -688,11 +_,12 @@ f /= 5.0F; } @@ -109,69 +109,69 @@ return f; } - public boolean func_234569_d_(BlockState p_234569_1_) { -- return !p_234569_1_.func_235783_q_() || this.field_71071_by.func_70448_g().func_150998_b(p_234569_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_234569_1_, !p_234569_1_.func_235783_q_() || this.field_71071_by.func_70448_g().func_150998_b(p_234569_1_)); + public boolean hasCorrectToolForDrops(BlockState p_234569_1_) { +- return !p_234569_1_.requiresCorrectToolForDrops() || this.inventory.getSelected().isCorrectToolForDrops(p_234569_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_234569_1_, !p_234569_1_.requiresCorrectToolForDrops() || this.inventory.getSelected().isCorrectToolForDrops(p_234569_1_)); } - public void func_70037_a(CompoundNBT p_70037_1_) { + public void readAdditionalSaveData(CompoundNBT p_70037_1_) { @@ -767,6 +_,7 @@ } - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { + public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) { + if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_)) return false; - if (this.func_180431_b(p_70097_1_)) { + if (this.isInvulnerableTo(p_70097_1_)) { return false; - } else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) { + } else if (this.abilities.invulnerable && !p_70097_1_.isBypassInvul()) { @@ -798,7 +_,7 @@ - protected void func_190629_c(LivingEntity p_190629_1_) { - super.func_190629_c(p_190629_1_); -- if (p_190629_1_.func_184614_ca().func_77973_b() instanceof AxeItem) { -+ if (p_190629_1_.func_184614_ca().canDisableShield(this.field_184627_bm, this, p_190629_1_)) { - this.func_190777_m(true); + protected void blockUsingShield(LivingEntity p_190629_1_) { + super.blockUsingShield(p_190629_1_); +- if (p_190629_1_.getMainHandItem().getItem() instanceof AxeItem) { ++ if (p_190629_1_.getMainHandItem().canDisableShield(this.useItem, this, p_190629_1_)) { + this.disableShield(true); } @@ -819,7 +_,7 @@ } - protected void func_184590_k(float p_184590_1_) { -- if (this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) { -+ if (this.field_184627_bm.isShield(this)) { - if (!this.field_70170_p.field_72995_K) { - this.func_71029_a(Stats.field_75929_E.func_199076_b(this.field_184627_bm.func_77973_b())); + protected void hurtCurrentlyUsedShield(float p_184590_1_) { +- if (this.useItem.getItem() == Items.SHIELD) { ++ if (this.useItem.isShield(this)) { + if (!this.level.isClientSide) { + this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); } @@ -829,6 +_,7 @@ - Hand hand = this.func_184600_cs(); - this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> { - p_213833_1_.func_213334_d(hand); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, hand); + Hand hand = this.getUsedItemHand(); + this.useItem.hurtAndBreak(i, this, (p_213833_1_) -> { + p_213833_1_.broadcastBreakEvent(hand); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.useItem, hand); }); - if (this.field_184627_bm.func_190926_b()) { + if (this.useItem.isEmpty()) { if (hand == Hand.MAIN_HAND) { @@ -847,10 +_,13 @@ - protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { - if (!this.func_180431_b(p_70665_1_)) { + protected void actuallyHurt(DamageSource p_70665_1_, float p_70665_2_) { + if (!this.isInvulnerableTo(p_70665_1_)) { + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; - p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); - p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); - float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); - this.func_110149_m(this.func_110139_bj() - (p_70665_2_ - f2)); + p_70665_2_ = this.getDamageAfterArmorAbsorb(p_70665_1_, p_70665_2_); + p_70665_2_ = this.getDamageAfterMagicAbsorb(p_70665_1_, p_70665_2_); + float f2 = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (p_70665_2_ - f2)); + f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, f2); float f = p_70665_2_ - f2; if (f > 0.0F && f < 3.4028235E37F) { - this.func_195067_a(Stats.field_212738_J, Math.round(f * 10.0F)); + this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f * 10.0F)); @@ -859,8 +_,8 @@ if (f2 != 0.0F) { - this.func_71020_j(p_70665_1_.func_76345_d()); - float f1 = this.func_110143_aJ(); -- this.func_70606_j(this.func_110143_aJ() - f2); - this.func_110142_aN().func_94547_a(p_70665_1_, f1, f2); -+ this.func_70606_j(f1 - f2); // Forge: moved to fix MC-121048 + this.causeFoodExhaustion(p_70665_1_.getFoodExhaustion()); + float f1 = this.getHealth(); +- this.setHealth(this.getHealth() - f2); + this.getCombatTracker().recordDamage(p_70665_1_, f1, f2); ++ this.setHealth(f1 - f2); // Forge: moved to fix MC-121048 if (f2 < 3.4028235E37F) { - this.func_195067_a(Stats.field_188112_z, Math.round(f2 * 10.0F)); + this.awardStat(Stats.DAMAGE_TAKEN, Math.round(f2 * 10.0F)); } @@ -909,6 +_,8 @@ @@ -179,48 +179,48 @@ } else { + ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_); + if (cancelResult != null) return cancelResult; - ItemStack itemstack = this.func_184586_b(p_190775_2_); - ItemStack itemstack1 = itemstack.func_77946_l(); - ActionResultType actionresulttype = p_190775_1_.func_184230_a(this, p_190775_2_); + ItemStack itemstack = this.getItemInHand(p_190775_2_); + ItemStack itemstack1 = itemstack.copy(); + ActionResultType actionresulttype = p_190775_1_.interact(this, p_190775_2_); @@ -917,6 +_,9 @@ - itemstack.func_190920_e(itemstack1.func_190916_E()); + itemstack.setCount(itemstack1.getCount()); } -+ if (!this.field_71075_bZ.field_75098_d && itemstack.func_190926_b()) { ++ if (!this.abilities.instabuild && itemstack.isEmpty()) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_); + } return actionresulttype; } else { - if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) { + if (!itemstack.isEmpty() && p_190775_1_ instanceof LivingEntity) { @@ -927,6 +_,7 @@ - ActionResultType actionresulttype1 = itemstack.func_111282_a_(this, (LivingEntity)p_190775_1_, p_190775_2_); - if (actionresulttype1.func_226246_a_()) { - if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) { + ActionResultType actionresulttype1 = itemstack.interactLivingEntity(this, (LivingEntity)p_190775_1_, p_190775_2_); + if (actionresulttype1.consumesAction()) { + if (itemstack.isEmpty() && !this.abilities.instabuild) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_); - this.func_184611_a(p_190775_2_, ItemStack.field_190927_a); + this.setItemInHand(p_190775_2_, ItemStack.EMPTY); } @@ -1011,6 +_,7 @@ } - public void func_71059_n(Entity p_71059_1_) { + public void attack(Entity p_71059_1_) { + if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return; - if (p_71059_1_.func_70075_an()) { - if (!p_71059_1_.func_85031_j(this)) { - float f = (float)this.func_233637_b_(Attributes.field_233823_f_); + if (p_71059_1_.isAttackable()) { + if (!p_71059_1_.skipAttackInteraction(this)) { + float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); @@ -1028,7 +_,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = f2 > 0.9F; boolean flag1 = false; - int i = 0; -+ float i = (float)this.func_233637_b_(Attributes.field_233824_g_); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 - i = i + EnchantmentHelper.func_77501_a(this); - if (this.func_70051_ag() && flag) { - this.field_70170_p.func_184148_a((PlayerEntity)null, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), SoundEvents.field_187721_dT, this.func_184176_by(), 1.0F, 1.0F); ++ float i = (float)this.getAttributeValue(Attributes.ATTACK_KNOCKBACK); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 + i = i + EnchantmentHelper.getKnockbackBonus(this); + if (this.isSprinting() && flag) { + this.level.playSound((PlayerEntity)null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); @@ -1038,8 +_,10 @@ - boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity; - flag2 = flag2 && !this.func_70051_ag(); + boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(Effects.BLINDNESS) && !this.isPassenger() && p_71059_1_ instanceof LivingEntity; + flag2 = flag2 && !this.isSprinting(); + net.minecraftforge.event.entity.player.CriticalHitEvent hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_71059_1_, flag2, flag2 ? 1.5F : 1.0F); + flag2 = hitResult != null; if (flag2) { @@ -230,125 +230,125 @@ f = f + f1; @@ -1122,13 +_,15 @@ - EnchantmentHelper.func_151385_b(this, p_71059_1_); - ItemStack itemstack1 = this.func_184614_ca(); + EnchantmentHelper.doPostDamageEffects(this, p_71059_1_); + ItemStack itemstack1 = this.getMainHandItem(); Entity entity = p_71059_1_; - if (p_71059_1_ instanceof EnderDragonPartEntity) { -- entity = ((EnderDragonPartEntity)p_71059_1_).field_213852_b; +- entity = ((EnderDragonPartEntity)p_71059_1_).parentMob; + if (p_71059_1_ instanceof net.minecraftforge.entity.PartEntity) { + entity = ((net.minecraftforge.entity.PartEntity) p_71059_1_).getParent(); } - if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) { -+ ItemStack copy = itemstack1.func_77946_l(); - itemstack1.func_77961_a((LivingEntity)entity, this); - if (itemstack1.func_190926_b()) { + if (!this.level.isClientSide && !itemstack1.isEmpty() && entity instanceof LivingEntity) { ++ ItemStack copy = itemstack1.copy(); + itemstack1.hurtEnemy((LivingEntity)entity, this); + if (itemstack1.isEmpty()) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, Hand.MAIN_HAND); - this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); + this.setItemInHand(Hand.MAIN_HAND, ItemStack.EMPTY); } } @@ -1170,7 +_,7 @@ } - if (this.field_70146_Z.nextFloat() < f) { -- this.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); -+ this.func_184811_cZ().func_185145_a(this.func_184607_cu().func_77973_b(), 100); - this.func_184602_cy(); - this.field_70170_p.func_72960_a(this, (byte)30); + if (this.random.nextFloat() < f) { +- this.getCooldowns().addCooldown(Items.SHIELD, 100); ++ this.getCooldowns().addCooldown(this.getUseItem().getItem(), 100); + this.stopUsingItem(); + this.level.broadcastEntityEvent(this, (byte)30); } @@ -1196,8 +_,9 @@ - public void func_71004_bE() { + public void respawn() { } -- public void func_70106_y() { -- super.func_70106_y(); +- public void remove() { +- super.remove(); + @Override + public void remove(boolean keepData) { + super.remove(keepData); - this.field_71069_bz.func_75134_a(this); - if (this.field_71070_bA != null) { - this.field_71070_bA.func_75134_a(this); + this.inventoryMenu.removed(this); + if (this.containerMenu != null) { + this.containerMenu.removed(this); @@ -1220,6 +_,7 @@ } - public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) { + public void stopSleepInBed(boolean p_225652_1_, boolean p_225652_2_) { + net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_); - super.func_213366_dy(); - if (this.field_70170_p instanceof ServerWorld && p_225652_2_) { - ((ServerWorld)this.field_70170_p).func_72854_c(); + super.stopSleeping(); + if (this.level instanceof ServerWorld && p_225652_2_) { + ((ServerWorld)this.level).updateSleepingPlayerList(); @@ -1245,7 +_,7 @@ - } else if (block instanceof BedBlock && BedBlock.func_235330_a_(p_242374_0_)) { - return BedBlock.func_242652_a(EntityType.field_200729_aH, p_242374_0_, p_242374_1_, p_242374_2_); + } else if (block instanceof BedBlock && BedBlock.canSetSpawn(p_242374_0_)) { + return BedBlock.findStandUpPosition(EntityType.PLAYER, p_242374_0_, p_242374_1_, p_242374_2_); } else if (!p_242374_3_) { - return Optional.empty(); -+ return blockstate.getRespawnPosition(EntityType.field_200729_aH, p_242374_0_, p_242374_1_, p_242374_2_, null); ++ return blockstate.getRespawnPosition(EntityType.PLAYER, p_242374_0_, p_242374_1_, p_242374_2_, null); } else { - boolean flag = block.func_181623_g(); - boolean flag1 = p_242374_0_.func_180495_p(p_242374_1_.func_177984_a()).func_177230_c().func_181623_g(); + boolean flag = block.isPossibleToRespawnInThis(); + boolean flag1 = p_242374_0_.getBlockState(p_242374_1_.above()).getBlock().isPossibleToRespawnInThis(); @@ -1425,6 +_,7 @@ - public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { - if (this.field_71075_bZ.field_75101_c) { + public boolean causeFallDamage(float p_225503_1_, float p_225503_2_) { + if (this.abilities.mayfly) { + net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_225503_1_, p_225503_2_); return false; } else { if (p_225503_1_ >= 2.0F) { @@ -1438,7 +_,7 @@ - public boolean func_226566_ei_() { - if (!this.field_70122_E && !this.func_184613_cA() && !this.func_70090_H() && !this.func_70644_a(Effects.field_188424_y)) { - ItemStack itemstack = this.func_184582_a(EquipmentSlotType.CHEST); -- if (itemstack.func_77973_b() == Items.field_185160_cR && ElytraItem.func_185069_d(itemstack)) { + public boolean tryToStartFallFlying() { + if (!this.onGround && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(Effects.LEVITATION)) { + ItemStack itemstack = this.getItemBySlot(EquipmentSlotType.CHEST); +- if (itemstack.getItem() == Items.ELYTRA && ElytraItem.isFlyEnabled(itemstack)) { + if (itemstack.canElytraFly(this)) { - this.func_226567_ej_(); + this.startFallFlying(); return true; } @@ -1479,6 +_,10 @@ } - public void func_195068_e(int p_195068_1_) { + public void giveExperiencePoints(int p_195068_1_) { + net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange(this, p_195068_1_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + p_195068_1_ = event.getAmount(); + - this.func_85039_t(p_195068_1_); - this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK(); - this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE); + this.increaseScore(p_195068_1_); + this.experienceProgress += (float)p_195068_1_ / (float)this.getXpNeededForNextLevel(); + this.totalExperience = MathHelper.clamp(this.totalExperience + p_195068_1_, 0, Integer.MAX_VALUE); @@ -1507,7 +_,7 @@ } - public void func_192024_a(ItemStack p_192024_1_, int p_192024_2_) { -- this.field_71068_ca -= p_192024_2_; -+ func_82242_a(-p_192024_2_); - if (this.field_71068_ca < 0) { - this.field_71068_ca = 0; - this.field_71106_cc = 0.0F; + public void onEnchantmentPerformed(ItemStack p_192024_1_, int p_192024_2_) { +- this.experienceLevel -= p_192024_2_; ++ giveExperienceLevels(-p_192024_2_); + if (this.experienceLevel < 0) { + this.experienceLevel = 0; + this.experienceProgress = 0.0F; @@ -1518,6 +_,10 @@ } - public void func_82242_a(int p_82242_1_) { + public void giveExperienceLevels(int p_82242_1_) { + net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange(this, p_82242_1_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + p_82242_1_ = event.getLevels(); + - this.field_71068_ca += p_82242_1_; - if (this.field_71068_ca < 0) { - this.field_71068_ca = 0; + this.experienceLevel += p_82242_1_; + if (this.experienceLevel < 0) { + this.experienceLevel = 0; @@ -1708,7 +_,11 @@ } - public ITextComponent func_145748_c_() { -- IFormattableTextComponent iformattabletextcomponent = ScorePlayerTeam.func_237500_a_(this.func_96124_cp(), this.func_200200_C_()); -+ if (this.displayname == null) this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_200200_C_()); + public ITextComponent getDisplayName() { +- IFormattableTextComponent iformattabletextcomponent = ScorePlayerTeam.formatNameForTeam(this.getTeam(), this.getName()); ++ if (this.displayname == null) this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); + IFormattableTextComponent iformattabletextcomponent = new StringTextComponent(""); -+ iformattabletextcomponent = prefixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::func_230529_a_); -+ iformattabletextcomponent = iformattabletextcomponent.func_230529_a_(ScorePlayerTeam.func_237500_a_(this.func_96124_cp(), this.displayname)); -+ iformattabletextcomponent = suffixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::func_230529_a_); - return this.func_208016_c(iformattabletextcomponent); ++ iformattabletextcomponent = prefixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::append); ++ iformattabletextcomponent = iformattabletextcomponent.append(ScorePlayerTeam.formatNameForTeam(this.getTeam(), this.displayname)); ++ iformattabletextcomponent = suffixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::append); + return this.decorateDisplayNameComponent(iformattabletextcomponent); } @@ -1986,5 +_,63 @@ - public ITextComponent func_221259_a() { - return this.field_221260_g; + public ITextComponent getMessage() { + return this.message; } + } + @@ -366,29 +366,29 @@ + * Force the displayed name to refresh, by firing {@link net.minecraftforge.event.entity.player.PlayerEvent.NameFormat}, using the real player name as event parameter. + */ + public void refreshDisplayName() { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_200200_C_()); ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); + } + + private final net.minecraftforge.common.util.LazyOptional + playerMainHandler = net.minecraftforge.common.util.LazyOptional.of( -+ () -> new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by)); ++ () -> new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(inventory)); + + private final net.minecraftforge.common.util.LazyOptional + playerEquipmentHandler = net.minecraftforge.common.util.LazyOptional.of( + () -> new net.minecraftforge.items.wrapper.CombinedInvWrapper( -+ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by), -+ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by))); ++ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(inventory), ++ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(inventory))); + + private final net.minecraftforge.common.util.LazyOptional + playerJoinedHandler = net.minecraftforge.common.util.LazyOptional.of( -+ () -> new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by)); ++ () -> new net.minecraftforge.items.wrapper.PlayerInvWrapper(inventory)); + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { -+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == null) return playerJoinedHandler.cast(); -+ else if (facing.func_176740_k().func_200128_b()) return playerMainHandler.cast(); -+ else if (facing.func_176740_k().func_176722_c()) return playerEquipmentHandler.cast(); ++ else if (facing.getAxis().isVertical()) return playerMainHandler.cast(); ++ else if (facing.getAxis().isHorizontal()) return playerEquipmentHandler.cast(); + } + return super.getCapability(capability, facing); + } diff --git a/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch index 06061c7b6f..08684590ef 100644 --- a/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/entity/player/PlayerInventory.java +++ b/net/minecraft/entity/player/PlayerInventory.java @@ -187,7 +_,8 @@ - int i = p_191973_2_.func_190916_E(); - ItemStack itemstack = this.func_70301_a(p_191973_1_); - if (itemstack.func_190926_b()) { + int i = p_191973_2_.getCount(); + ItemStack itemstack = this.getItem(p_191973_1_); + if (itemstack.isEmpty()) { - itemstack = new ItemStack(item, 0); -+ itemstack = p_191973_2_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ itemstack.func_190920_e(0); - if (p_191973_2_.func_77942_o()) { - itemstack.func_77982_d(p_191973_2_.func_77978_p().func_74737_b()); ++ itemstack = p_191973_2_.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. ++ itemstack.setCount(0); + if (p_191973_2_.hasTag()) { + itemstack.setTag(p_191973_2_.getTag().copy()); } @@ -238,7 +_,7 @@ } } } - -+ field_70460_b.forEach(e -> e.onArmorTick(field_70458_d.field_70170_p, field_70458_d)); ++ armor.forEach(e -> e.onArmorTick(player.level, player)); } - public boolean func_70441_a(ItemStack p_70441_1_) { + public boolean add(ItemStack p_70441_1_) { @@ -287,6 +_,8 @@ } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Adding item to inventory"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Item being added"); -+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_191971_2_.func_77973_b().getRegistryName())); -+ crashreportcategory.func_189529_a("Item Class", () -> p_191971_2_.func_77973_b().getClass().getName()); - crashreportcategory.func_71507_a("Item ID", Item.func_150891_b(p_191971_2_.func_77973_b())); - crashreportcategory.func_71507_a("Item data", p_191971_2_.func_77952_i()); - crashreportcategory.func_189529_a("Item name", () -> { + CrashReport crashreport = CrashReport.forThrowable(throwable, "Adding item to inventory"); + CrashReportCategory crashreportcategory = crashreport.addCategory("Item being added"); ++ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(p_191971_2_.getItem().getRegistryName())); ++ crashreportcategory.setDetail("Item Class", () -> p_191971_2_.getItem().getClass().getName()); + crashreportcategory.setDetail("Item ID", Item.getId(p_191971_2_.getItem())); + crashreportcategory.setDetail("Item data", p_191971_2_.getDamageValue()); + crashreportcategory.setDetail("Item name", () -> { diff --git a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch index 8be7855290..1df38aba32 100644 --- a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -3,157 +3,157 @@ @@ -475,6 +_,7 @@ } - public void func_70645_a(DamageSource p_70645_1_) { + public void die(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223609_l); + boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); if (flag) { - ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); + ITextComponent itextcomponent = this.getCombatTracker().getDeathMessage(); @@ -618,13 +_,14 @@ } @Nullable -- public Entity func_241206_a_(ServerWorld p_241206_1_) { +- public Entity changeDimension(ServerWorld p_241206_1_) { + public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_241206_1_.func_234923_W_())) return null; - this.field_184851_cj = true; - ServerWorld serverworld = this.func_71121_q(); - RegistryKey registrykey = serverworld.func_234923_W_(); -- if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_) { -+ if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_ && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits - this.func_213319_R(); -- this.func_71121_q().func_217434_e(this); -+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom - if (!this.field_71136_j) { - this.field_71136_j = true; - this.field_71135_a.func_147359_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241768_e_, this.field_192040_cp ? 0.0F : 1.0F)); ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_241206_1_.dimension())) return null; + this.isChangingDimension = true; + ServerWorld serverworld = this.getLevel(); + RegistryKey registrykey = serverworld.dimension(); +- if (registrykey == World.END && p_241206_1_.dimension() == World.OVERWORLD) { ++ if (registrykey == World.END && p_241206_1_.dimension() == World.OVERWORLD && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits + this.unRide(); +- this.getLevel().removePlayerImmediately(this); ++ this.getLevel().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom + if (!this.wonGame) { + this.wonGame = true; + this.connection.send(new SChangeGameStatePacket(SChangeGameStatePacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); @@ -638,14 +_,15 @@ - this.field_71135_a.func_147359_a(new SServerDifficultyPacket(iworldinfo.func_176130_y(), iworldinfo.func_176123_z())); - PlayerList playerlist = this.field_71133_b.func_184103_al(); - playerlist.func_187243_f(this); -- serverworld.func_217434_e(this); -- this.field_70128_L = false; -- PortalInfo portalinfo = this.func_241829_a(p_241206_1_); + this.connection.send(new SServerDifficultyPacket(iworldinfo.getDifficulty(), iworldinfo.isDifficultyLocked())); + PlayerList playerlist = this.server.getPlayerList(); + playerlist.sendPlayerPermissionLevel(this); +- serverworld.removePlayerImmediately(this); +- this.removed = false; +- PortalInfo portalinfo = this.findDimensionEntryPoint(p_241206_1_); + serverworld.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call. + this.revive(); -+ PortalInfo portalinfo = teleporter.getPortalInfo(this, p_241206_1_, this::func_241829_a); ++ PortalInfo portalinfo = teleporter.getPortalInfo(this, p_241206_1_, this::findDimensionEntryPoint); if (portalinfo != null) { -+ Entity e = teleporter.placeEntity(this, serverworld, p_241206_1_, this.field_70177_z, spawnPortal -> {//Forge: Start vanilla logic - serverworld.func_217381_Z().func_76320_a("moving"); - if (registrykey == World.field_234918_g_ && p_241206_1_.func_234923_W_() == World.field_234919_h_) { - this.field_193110_cw = this.func_213303_ch(); -- } else if (p_241206_1_.func_234923_W_() == World.field_234920_i_) { -+ } else if (spawnPortal && p_241206_1_.func_234923_W_() == World.field_234920_i_) { - this.func_242110_a(p_241206_1_, new BlockPos(portalinfo.field_222505_a)); ++ Entity e = teleporter.placeEntity(this, serverworld, p_241206_1_, this.yRot, spawnPortal -> {//Forge: Start vanilla logic + serverworld.getProfiler().push("moving"); + if (registrykey == World.OVERWORLD && p_241206_1_.dimension() == World.NETHER) { + this.enteredNetherPosition = this.position(); +- } else if (p_241206_1_.dimension() == World.END) { ++ } else if (spawnPortal && p_241206_1_.dimension() == World.END) { + this.createEndPlatform(p_241206_1_, new BlockPos(portalinfo.pos)); } @@ -657,6 +_,9 @@ - this.func_225653_b_(portalinfo.field_222505_a.field_72450_a, portalinfo.field_222505_a.field_72448_b, portalinfo.field_222505_a.field_72449_c); - serverworld.func_217381_Z().func_76319_b(); - this.func_213846_b(serverworld); + this.moveTo(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z); + serverworld.getProfiler().pop(); + this.triggerDimensionChangeTriggers(serverworld); + return this;//forge: this is part of the ITeleporter patch + });//Forge: End vanilla logic + if (e != this) throw new java.lang.IllegalArgumentException(String.format("Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this)); - this.field_71134_c.func_73080_a(p_241206_1_); - this.field_71135_a.func_147359_a(new SPlayerAbilitiesPacket(this.field_71075_bZ)); - playerlist.func_72354_b(this, p_241206_1_); + this.gameMode.setLevel(p_241206_1_); + this.connection.send(new SPlayerAbilitiesPacket(this.abilities)); + playerlist.sendLevelInfo(this, p_241206_1_); @@ -666,10 +_,12 @@ - this.field_71135_a.func_147359_a(new SPlayEntityEffectPacket(this.func_145782_y(), effectinstance)); + this.connection.send(new SPlayEntityEffectPacket(this.getId(), effectinstance)); } + if (teleporter.playTeleportSound(this, serverworld, p_241206_1_)) - this.field_71135_a.func_147359_a(new SPlaySoundEventPacket(1032, BlockPos.field_177992_a, 0, false)); - this.field_71144_ck = -1; - this.field_71149_ch = -1.0F; - this.field_71146_ci = -1; -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, registrykey, p_241206_1_.func_234923_W_()); + this.connection.send(new SPlaySoundEventPacket(1032, BlockPos.ZERO, 0, false)); + this.lastSentExp = -1; + this.lastSentHealth = -1.0F; + this.lastSentFood = -1; ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, registrykey, p_241206_1_.dimension()); } return this; @@ -743,6 +_,9 @@ } - public Either func_213819_a(BlockPos p_213819_1_) { + public Either startSleepInBed(BlockPos p_213819_1_) { + java.util.Optional optAt = java.util.Optional.of(p_213819_1_); + PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); + if (ret != null) return Either.left(ret); - Direction direction = this.field_70170_p.func_180495_p(p_213819_1_).func_177229_b(HorizontalBlock.field_185512_D); - if (!this.func_70608_bn() && this.func_70089_S()) { - if (!this.field_70170_p.func_230315_m_().func_236043_f_()) { + Direction direction = this.level.getBlockState(p_213819_1_).getValue(HorizontalBlock.FACING); + if (!this.isSleeping() && this.isAlive()) { + if (!this.level.dimensionType().natural()) { @@ -753,7 +_,7 @@ return Either.left(PlayerEntity.SleepResult.OBSTRUCTED); } else { - this.func_242111_a(this.field_70170_p.func_234923_W_(), p_213819_1_, this.field_70177_z, false, true); -- if (this.field_70170_p.func_72935_r()) { + this.setRespawnPosition(this.level.dimension(), p_213819_1_, this.yRot, false, true); +- if (this.level.isDay()) { + if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, optAt)) { return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW); } else { - if (!this.func_184812_l_()) { + if (!this.isCreative()) { @@ -787,6 +_,7 @@ } - private boolean func_241147_a_(BlockPos p_241147_1_, Direction p_241147_2_) { + private boolean bedInRange(BlockPos p_241147_1_, Direction p_241147_2_) { + if (p_241147_2_ == null) return false; - return this.func_241158_g_(p_241147_1_) || this.func_241158_g_(p_241147_1_.func_177972_a(p_241147_2_.func_176734_d())); + return this.isReachableBedBlock(p_241147_1_) || this.isReachableBedBlock(p_241147_1_.relative(p_241147_2_.getOpposite())); } @@ -886,6 +_,7 @@ - this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_())); - container.func_75132_a(this); - this.field_71070_bA = container; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - return OptionalInt.of(this.field_71139_cq); + this.connection.send(new SOpenWindowPacket(container.containerId, container.getType(), p_213829_1_.getDisplayName())); + container.addSlotListener(this); + this.containerMenu = container; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.containerMenu)); + return OptionalInt.of(this.containerCounter); } } @@ -904,6 +_,7 @@ - this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y())); - this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_); - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + this.connection.send(new SOpenHorseWindowPacket(this.containerCounter, p_184826_2_.getContainerSize(), p_184826_1_.getId())); + this.containerMenu = new HorseInventoryContainer(this.containerCounter, this.inventory, p_184826_2_, p_184826_1_); + this.containerMenu.addSlotListener(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.containerMenu)); } - public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) { + public void openItemGui(ItemStack p_184814_1_, Hand p_184814_2_) { @@ -961,6 +_,7 @@ - public void func_71128_l() { - this.field_71070_bA.func_75134_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.field_71070_bA)); - this.field_71070_bA = this.field_71069_bz; + public void doCloseContainer() { + this.containerMenu.removed(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.containerMenu)); + this.containerMenu = this.inventoryMenu; } @@ -1085,6 +_,13 @@ - this.field_193110_cw = p_193104_1_.field_193110_cw; - this.func_192029_h(p_193104_1_.func_192023_dk()); - this.func_192031_i(p_193104_1_.func_192025_dl()); + this.enteredNetherPosition = p_193104_1_.enteredNetherPosition; + this.setShoulderEntityLeft(p_193104_1_.getShoulderEntityLeft()); + this.setShoulderEntityRight(p_193104_1_.getShoulderEntityRight()); + + //Copy over a section of the Entity Data from the old player. + //Allows mods to specify data that persists after players respawn. + CompoundNBT old = p_193104_1_.getPersistentData(); -+ if (old.func_74764_b(PERSISTED_NBT_TAG)) -+ getPersistentData().func_218657_a(PERSISTED_NBT_TAG, old.func_74781_a(PERSISTED_NBT_TAG)); ++ if (old.contains(PERSISTED_NBT_TAG)) ++ getPersistentData().put(PERSISTED_NBT_TAG, old.get(PERSISTED_NBT_TAG)); + net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_193104_1_, !p_193104_2_); } - protected void func_70670_a(EffectInstance p_70670_1_) { + protected void onEffectAdded(EffectInstance p_70670_1_) { @@ -1143,6 +_,7 @@ } - public void func_71033_a(GameType p_71033_1_) { -+ if (!net.minecraftforge.common.ForgeHooks.onChangeGameMode(this, this.field_71134_c.func_73081_b(), p_71033_1_)) return; - this.field_71134_c.func_73076_a(p_71033_1_); - this.field_71135_a.func_147359_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241767_d_, (float)p_71033_1_.func_77148_a())); + public void setGameMode(GameType p_71033_1_) { ++ if (!net.minecraftforge.common.ForgeHooks.onChangeGameMode(this, this.gameMode.getGameModeForPlayer(), p_71033_1_)) return; + this.gameMode.setGameModeForPlayer(p_71033_1_); + this.connection.send(new SChangeGameStatePacket(SChangeGameStatePacket.CHANGE_GAME_MODE, (float)p_71033_1_.getId())); if (p_71033_1_ == GameType.SPECTATOR) { @@ -1191,6 +_,7 @@ - this.field_71140_co = p_147100_1_.func_149520_f(); - this.func_184212_Q().func_187227_b(field_184827_bp, (byte)p_147100_1_.func_149521_d()); - this.func_184212_Q().func_187227_b(field_184828_bq, (byte)(p_147100_1_.func_186991_f() == HandSide.LEFT ? 0 : 1)); -+ this.language = p_147100_1_.func_149524_c(); + this.canChatColor = p_147100_1_.getChatColors(); + this.getEntityData().set(DATA_PLAYER_MODE_CUSTOMISATION, (byte)p_147100_1_.getModelCustomisation()); + this.getEntityData().set(DATA_PLAYER_MAIN_HAND, (byte)(p_147100_1_.getMainHand() == HandSide.LEFT ? 0 : 1)); ++ this.language = p_147100_1_.getLanguage(); } - public ChatVisibility func_147096_v() { + public ChatVisibility getChatVisibility() { @@ -1276,7 +_,11 @@ @Nullable - public ITextComponent func_175396_E() { + public ITextComponent getTabListDisplayName() { - return null; + if (!this.hasTabListName) { + this.tabListDisplayName = net.minecraftforge.event.ForgeEventFactory.getPlayerTabListDisplayName(this); @@ -162,40 +162,40 @@ + return this.tabListDisplayName; } - public void func_184609_a(Hand p_184609_1_) { + public void swing(Hand p_184609_1_) { @@ -1301,14 +_,14 @@ - this.func_184210_p(); - if (p_200619_1_ == this.field_70170_p) { - this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); + this.stopRiding(); + if (p_200619_1_ == this.level) { + this.connection.teleport(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); - } else { -+ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.func_234923_W_())) { - ServerWorld serverworld = this.func_71121_q(); - IWorldInfo iworldinfo = p_200619_1_.func_72912_H(); - this.field_71135_a.func_147359_a(new SRespawnPacket(p_200619_1_.func_230315_m_(), p_200619_1_.func_234923_W_(), BiomeManager.func_235200_a_(p_200619_1_.func_72905_C()), this.field_71134_c.func_73081_b(), this.field_71134_c.func_241815_c_(), p_200619_1_.func_234925_Z_(), p_200619_1_.func_241109_A_(), true)); - this.field_71135_a.func_147359_a(new SServerDifficultyPacket(iworldinfo.func_176130_y(), iworldinfo.func_176123_z())); - this.field_71133_b.func_184103_al().func_187243_f(this); -- serverworld.func_217434_e(this); -- this.field_70128_L = false; ++ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.dimension())) { + ServerWorld serverworld = this.getLevel(); + IWorldInfo iworldinfo = p_200619_1_.getLevelData(); + this.connection.send(new SRespawnPacket(p_200619_1_.dimensionType(), p_200619_1_.dimension(), BiomeManager.obfuscateSeed(p_200619_1_.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), p_200619_1_.isDebug(), p_200619_1_.isFlat(), true)); + this.connection.send(new SServerDifficultyPacket(iworldinfo.getDifficulty(), iworldinfo.isDifficultyLocked())); + this.server.getPlayerList().sendPlayerPermissionLevel(this); +- serverworld.removePlayerImmediately(this); +- this.removed = false; + serverworld.removePlayer(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later. + this.revive(); - this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); - this.func_70029_a(p_200619_1_); - p_200619_1_.func_217446_a(this); + this.moveTo(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); + this.setLevel(p_200619_1_); + p_200619_1_.addDuringCommandTeleport(this); @@ -1317,6 +_,7 @@ - this.field_71134_c.func_73080_a(p_200619_1_); - this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_); - this.field_71133_b.func_184103_al().func_72385_f(this); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, serverworld.func_234923_W_(), p_200619_1_.func_234923_W_()); + this.gameMode.setLevel(p_200619_1_); + this.server.getPlayerList().sendLevelInfo(this, p_200619_1_); + this.server.getPlayerList().sendAllPlayerInfo(this); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, serverworld.dimension(), p_200619_1_.dimension()); } } @@ -1339,6 +_,7 @@ } - public void func_242111_a(RegistryKey p_242111_1_, @Nullable BlockPos p_242111_2_, float p_242111_3_, boolean p_242111_4_, boolean p_242111_5_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_242111_2_ == null ? World.field_234918_g_ : p_242111_1_, p_242111_2_, p_242111_4_)) return; + public void setRespawnPosition(RegistryKey p_242111_1_, @Nullable BlockPos p_242111_2_, float p_242111_3_, boolean p_242111_4_, boolean p_242111_5_) { ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_242111_2_ == null ? World.OVERWORLD : p_242111_1_, p_242111_2_, p_242111_4_)) return; if (p_242111_2_ != null) { - boolean flag = p_242111_2_.equals(this.field_241138_cr_) && p_242111_1_.equals(this.field_241137_cq_); + boolean flag = p_242111_2_.equals(this.respawnPosition) && p_242111_1_.equals(this.respawnDimension); if (p_242111_5_ && !flag) { @@ -1391,6 +_,8 @@ if (itementity == null) { @@ -203,8 +203,8 @@ } else { + if (captureDrops() != null) captureDrops().add(itementity); + else - this.field_70170_p.func_217376_c(itementity); - ItemStack itemstack = itementity.func_92059_d(); + this.level.addFreshEntity(itementity); + ItemStack itemstack = itementity.getItem(); if (p_146097_3_) { @@ -1402,6 +_,29 @@ } @@ -232,7 +232,7 @@ + ITextComponent oldName = this.tabListDisplayName; + this.tabListDisplayName = net.minecraftforge.event.ForgeEventFactory.getPlayerTabListDisplayName(this); + if (!java.util.Objects.equals(oldName, this.tabListDisplayName)) { -+ this.func_184102_h().func_184103_al().func_148540_a(new net.minecraft.network.play.server.SPlayerListItemPacket(net.minecraft.network.play.server.SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME, this)); ++ this.getServer().getPlayerList().broadcastAll(new net.minecraft.network.play.server.SPlayerListItemPacket(net.minecraft.network.play.server.SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME, this)); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch index 0673d08cbf..144ed59f09 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch @@ -2,19 +2,19 @@ +++ b/net/minecraft/entity/projectile/AbstractArrowEntity.java @@ -130,7 +_,7 @@ - BlockPos blockpos = this.func_233580_cy_(); - BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); -- if (!blockstate.func_196958_f() && !flag) { -+ if (!blockstate.isAir(this.field_70170_p, blockpos) && !flag) { - VoxelShape voxelshape = blockstate.func_196952_d(this.field_70170_p, blockpos); - if (!voxelshape.func_197766_b()) { - Vector3d vector3d1 = this.func_213303_ch(); + BlockPos blockpos = this.blockPosition(); + BlockState blockstate = this.level.getBlockState(blockpos); +- if (!blockstate.isAir() && !flag) { ++ if (!blockstate.isAir(this.level, blockpos) && !flag) { + VoxelShape voxelshape = blockstate.getCollisionShape(this.level, blockpos); + if (!voxelshape.isEmpty()) { + Vector3d vector3d1 = this.position(); @@ -184,7 +_,7 @@ } } - if (raytraceresult != null && !flag) { -+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); - this.field_70160_al = true; ++ if (raytraceresult != null && raytraceresult.getType() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.onHit(raytraceresult); + this.hasImpulse = true; } diff --git a/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch index b74745ae7a..3864cea49d 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch @@ -3,9 +3,9 @@ @@ -68,7 +_,7 @@ } - RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_); -- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { -+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); + RayTraceResult raytraceresult = ProjectileHelper.getHitResult(this, this::canHitEntity); +- if (raytraceresult.getType() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.getType() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.onHit(raytraceresult); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch index 6c0a59a6d9..d3123db18e 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/FireballEntity.java +++ b/net/minecraft/entity/projectile/FireballEntity.java @@ -32,7 +_,7 @@ - protected void func_70227_a(RayTraceResult p_70227_1_) { - super.func_70227_a(p_70227_1_); - if (!this.field_70170_p.field_72995_K) { -- boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b); -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.func_234616_v_()); - this.field_70170_p.func_217398_a((Entity)null, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); - this.func_70106_y(); + protected void onHit(RayTraceResult p_70227_1_) { + super.onHit(p_70227_1_); + if (!this.level.isClientSide) { +- boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this.getOwner()); + this.level.explode((Entity)null, this.getX(), this.getY(), this.getZ(), (float)this.explosionPower, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); + this.remove(); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/FireworkRocketEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FireworkRocketEntity.java.patch index 984c43e959..c7892ff29e 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FireworkRocketEntity.java.patch @@ -5,12 +5,12 @@ } + @Override -+ protected void func_70227_a(RayTraceResult result) { -+ if (result.func_216346_c() == RayTraceResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, result)) { -+ super.func_70227_a(result); ++ protected void onHit(RayTraceResult result) { ++ if (result.getType() == RayTraceResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, result)) { ++ super.onHit(result); + } + } + - private void func_213893_k() { - this.field_70170_p.func_72960_a(this, (byte)17); - this.func_191510_k(); + private void explode() { + this.level.broadcastEntityEvent(this, (byte)17); + this.dealExplosionDamage(); diff --git a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch index a8bd1667fa..6a86d498bf 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch @@ -2,59 +2,59 @@ +++ b/net/minecraft/entity/projectile/FishingBobberEntity.java @@ -245,7 +_,7 @@ - private void func_190624_r() { - RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_); -- this.func_70227_a(raytraceresult); -+ if (raytraceresult.func_216346_c() == RayTraceResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) this.func_70227_a(raytraceresult); + private void checkCollision() { + RayTraceResult raytraceresult = ProjectileHelper.getHitResult(this, this::canHitEntity); +- this.onHit(raytraceresult); ++ if (raytraceresult.getType() == RayTraceResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) this.onHit(raytraceresult); } - protected boolean func_230298_a_(Entity p_230298_1_) { + protected boolean canHitEntity(Entity p_230298_1_) { @@ -300,7 +_,7 @@ - double d1 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); - double d2 = this.func_226281_cx_() + (double)(f2 * (float)this.field_146038_az * 0.1F); - BlockState blockstate = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)); -- if (blockstate.func_203425_a(Blocks.field_150355_j)) { -+ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - if (this.field_70146_Z.nextFloat() < 0.15F) { - serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); + double d1 = (double)((float)MathHelper.floor(this.getY()) + 1.0F); + double d2 = this.getZ() + (double)(f2 * (float)this.timeUntilHooked * 0.1F); + BlockState blockstate = serverworld.getBlockState(new BlockPos(d0, d1 - 1.0D, d2)); +- if (blockstate.is(Blocks.WATER)) { ++ if (serverworld.getBlockState(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).getMaterial() == net.minecraft.block.material.Material.WATER) { + if (this.random.nextFloat() < 0.15F) { + serverworld.sendParticles(ParticleTypes.BUBBLE, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); } @@ -336,7 +_,7 @@ - double d5 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F); - double d6 = this.func_226281_cx_() + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); - BlockState blockstate1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)); -- if (blockstate1.func_203425_a(Blocks.field_150355_j)) { -+ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); + double d5 = (double)((float)MathHelper.floor(this.getY()) + 1.0F); + double d6 = this.getZ() + (double)(MathHelper.cos(f6) * f7 * 0.1F); + BlockState blockstate1 = serverworld.getBlockState(new BlockPos(d4, d5 - 1.0D, d6)); +- if (blockstate1.is(Blocks.WATER)) { ++ if (serverworld.getBlockState(new BlockPos(d4, d5 - 1.0D, d6)).getMaterial() == net.minecraft.block.material.Material.WATER) { + serverworld.sendParticles(ParticleTypes.SPLASH, d4, d5, d6, 2 + this.random.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); } } @@ -407,6 +_,7 @@ - PlayerEntity playerentity = this.func_234606_i_(); - if (!this.field_70170_p.field_72995_K && playerentity != null) { + PlayerEntity playerentity = this.getPlayerOwner(); + if (!this.level.isClientSide && playerentity != null) { int i = 0; + net.minecraftforge.event.entity.player.ItemFishedEvent event = null; - if (this.field_146043_c != null) { - this.func_184527_k(); - CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)playerentity, p_146034_1_, this, Collections.emptyList()); + if (this.hookedIn != null) { + this.bringInHookedEntity(); + CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayerEntity)playerentity, p_146034_1_, this, Collections.emptyList()); @@ -414,8 +_,15 @@ - i = this.field_146043_c instanceof ItemEntity ? 3 : 5; - } else if (this.field_146045_ax > 0) { - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_237457_g_, this.func_213303_ch()).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216015_a(LootParameters.field_216281_a, this).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + playerentity.func_184817_da()); -+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.func_234616_v_()).func_216015_a(LootParameters.field_216281_a, this); - LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTables.field_186387_al); - List list = loottable.func_216113_a(lootcontext$builder.func_216022_a(LootParameterSets.field_216262_c)); -+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_70122_E ? 2 : 1, this); + i = this.hookedIn instanceof ItemEntity ? 3 : 5; + } else if (this.nibble > 0) { + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.level)).withParameter(LootParameters.ORIGIN, this.position()).withParameter(LootParameters.TOOL, p_146034_1_).withParameter(LootParameters.THIS_ENTITY, this).withRandom(this.random).withLuck((float)this.luck + playerentity.getLuck()); ++ lootcontext$builder.withParameter(LootParameters.KILLER_ENTITY, this.getOwner()).withParameter(LootParameters.THIS_ENTITY, this); + LootTable loottable = this.level.getServer().getLootTables().get(LootTables.FISHING); + List list = loottable.getRandomItems(lootcontext$builder.create(LootParameterSets.FISHING)); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.onGround ? 2 : 1, this); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { -+ this.func_70106_y(); ++ this.remove(); + return event.getRodDamage(); + } - CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)playerentity, p_146034_1_, this, list); + CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayerEntity)playerentity, p_146034_1_, this, list); for(ItemStack itemstack : list) { @@ -440,7 +_,7 @@ } - this.func_70106_y(); + this.remove(); - return i; + return event == null ? i : event.getRodDamage(); } else { @@ -64,11 +64,11 @@ return false; } -- public void func_70106_y() { -- super.func_70106_y(); +- public void remove() { +- super.remove(); + @Override + public void remove(boolean keepData) { + super.remove(keepData); - PlayerEntity playerentity = this.func_234606_i_(); + PlayerEntity playerentity = this.getPlayerOwner(); if (playerentity != null) { - playerentity.field_71104_cf = null; + playerentity.fishing = null; diff --git a/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch index 2796a5f539..998c1b9e6c 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/LlamaSpitEntity.java +++ b/net/minecraft/entity/projectile/LlamaSpitEntity.java @@ -46,7 +_,7 @@ - super.func_70071_h_(); - Vector3d vector3d = this.func_213322_ci(); - RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_); + super.tick(); + Vector3d vector3d = this.getDeltaMovement(); + RayTraceResult raytraceresult = ProjectileHelper.getHitResult(this, this::canHitEntity); - if (raytraceresult != null) { -+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); ++ if (raytraceresult != null && raytraceresult.getType() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.onHit(raytraceresult); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch index 2305e72540..2d0decf994 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ProjectileHelper.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/entity/projectile/ProjectileHelper.java @@ -60,7 +_,7 @@ Vector3d vector3d1 = optional.get(); - double d1 = p_221273_1_.func_72436_e(vector3d1); + double d1 = p_221273_1_.distanceToSqr(vector3d1); if (d1 < d0 || d0 == 0.0D) { -- if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv()) { -+ if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv() && !entity1.canRiderInteract()) { +- if (entity1.getRootVehicle() == p_221273_0_.getRootVehicle()) { ++ if (entity1.getRootVehicle() == p_221273_0_.getRootVehicle() && !entity1.canRiderInteract()) { if (d0 == 0.0D) { entity = entity1; vector3d = vector3d1; @@ -14,13 +14,13 @@ } + @Deprecated // Forge: Use the version below that takes in a Predicate instead of an Item - public static Hand func_221274_a(LivingEntity p_221274_0_, Item p_221274_1_) { - return p_221274_0_.func_184614_ca().func_77973_b() == p_221274_1_ ? Hand.MAIN_HAND : Hand.OFF_HAND; + public static Hand getWeaponHoldingHand(LivingEntity p_221274_0_, Item p_221274_1_) { + return p_221274_0_.getMainHandItem().getItem() == p_221274_1_ ? Hand.MAIN_HAND : Hand.OFF_HAND; + } + + public static Hand getWeaponHoldingHand(LivingEntity livingEntity, Predicate itemPredicate) + { -+ return itemPredicate.test(livingEntity.func_184614_ca().func_77973_b()) ? Hand.MAIN_HAND : Hand.OFF_HAND; ++ return itemPredicate.test(livingEntity.getMainHandItem().getItem()) ? Hand.MAIN_HAND : Hand.OFF_HAND; } - public static AbstractArrowEntity func_221272_a(LivingEntity p_221272_0_, ItemStack p_221272_1_, float p_221272_2_) { + public static AbstractArrowEntity getMobArrow(LivingEntity p_221272_0_, ItemStack p_221272_1_, float p_221272_2_) { diff --git a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch index c66ab3fc9b..f9f838c9ec 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch @@ -3,9 +3,9 @@ @@ -213,7 +_,7 @@ } - RayTraceResult raytraceresult = ProjectileHelper.func_234618_a_(this, this::func_230298_a_); -- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { -+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); + RayTraceResult raytraceresult = ProjectileHelper.getHitResult(this, this::canHitEntity); +- if (raytraceresult.getType() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.getType() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.onHit(raytraceresult); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch index 8bf349562f..df206a7a33 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/entity/projectile/SmallFireballEntity.java +++ b/net/minecraft/entity/projectile/SmallFireballEntity.java @@ -49,7 +_,7 @@ - super.func_230299_a_(p_230299_1_); - if (!this.field_70170_p.field_72995_K) { - Entity entity = this.func_234616_v_(); -- if (entity == null || !(entity instanceof MobEntity) || this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) { -+ if (entity == null || !(entity instanceof MobEntity) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.getEntity())) { - BlockPos blockpos = p_230299_1_.func_216350_a().func_177972_a(p_230299_1_.func_216354_b()); - if (this.field_70170_p.func_175623_d(blockpos)) { - this.field_70170_p.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(this.field_70170_p, blockpos)); + super.onHitBlock(p_230299_1_); + if (!this.level.isClientSide) { + Entity entity = this.getOwner(); +- if (entity == null || !(entity instanceof MobEntity) || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { ++ if (entity == null || !(entity instanceof MobEntity) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this.getEntity())) { + BlockPos blockpos = p_230299_1_.getBlockPos().relative(p_230299_1_.getDirection()); + if (this.level.isEmptyBlock(blockpos)) { + this.level.setBlockAndUpdate(blockpos, AbstractFireBlock.getState(this.level, blockpos)); diff --git a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch index 523023ab00..e3e7f224ae 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch @@ -4,8 +4,8 @@ } } -- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag) { -+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); +- if (raytraceresult.getType() != RayTraceResult.Type.MISS && !flag) { ++ if (raytraceresult.getType() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.onHit(raytraceresult); } diff --git a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch index 18f799c607..4fd223674b 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch @@ -3,18 +3,18 @@ @@ -48,7 +_,7 @@ } - public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, FluidState p_180428_5_, float p_180428_6_) { -- return this.func_82342_d() && WitherEntity.func_181033_a(p_180428_4_) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; -+ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; + public float getBlockExplosionResistance(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, FluidState p_180428_5_, float p_180428_6_) { +- return this.isDangerous() && WitherEntity.canDestroy(p_180428_4_) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; ++ return this.isDangerous() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; } - protected void func_213868_a(EntityRayTraceResult p_213868_1_) { + protected void onHitEntity(EntityRayTraceResult p_213868_1_) { @@ -90,7 +_,7 @@ - protected void func_70227_a(RayTraceResult p_70227_1_) { - super.func_70227_a(p_70227_1_); - if (!this.field_70170_p.field_72995_K) { -- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; -+ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.func_234616_v_()) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; - this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 1.0F, false, explosion$mode); - this.func_70106_y(); + protected void onHit(RayTraceResult p_70227_1_) { + super.onHit(p_70227_1_); + if (!this.level.isClientSide) { +- Explosion.Mode explosion$mode = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this.getOwner()) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, explosion$mode); + this.remove(); } diff --git a/patches/minecraft/net/minecraft/fluid/FlowingFluid.java.patch b/patches/minecraft/net/minecraft/fluid/FlowingFluid.java.patch index d286905959..2bb941cd83 100644 --- a/patches/minecraft/net/minecraft/fluid/FlowingFluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/FlowingFluid.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/fluid/FlowingFluid.java +++ b/net/minecraft/fluid/FlowingFluid.java @@ -159,7 +_,7 @@ - BlockState blockstate = p_205576_1_.func_180495_p(blockpos); - FluidState fluidstate = blockstate.func_204520_s(); - if (fluidstate.func_206886_c().func_207187_a(this) && this.func_212751_a(direction, p_205576_1_, p_205576_2_, p_205576_3_, blockpos, blockstate)) { -- if (fluidstate.func_206889_d()) { -+ if (fluidstate.func_206889_d() && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(p_205576_1_, blockpos, blockstate, this.func_205579_d())) { + BlockState blockstate = p_205576_1_.getBlockState(blockpos); + FluidState fluidstate = blockstate.getFluidState(); + if (fluidstate.getType().isSame(this) && this.canPassThroughWall(direction, p_205576_1_, p_205576_2_, p_205576_3_, blockpos, blockstate)) { +- if (fluidstate.isSource()) { ++ if (fluidstate.isSource() && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(p_205576_1_, blockpos, blockstate, this.canConvertToSource())) { ++j; } @@ -13,8 +13,8 @@ } } -- if (this.func_205579_d() && j >= 2) { +- if (this.canConvertToSource() && j >= 2) { + if (j >= 2) { - BlockState blockstate1 = p_205576_1_.func_180495_p(p_205576_2_.func_177977_b()); - FluidState fluidstate1 = blockstate1.func_204520_s(); - if (blockstate1.func_185904_a().func_76220_a() || this.func_211758_g(fluidstate1)) { + BlockState blockstate1 = p_205576_1_.getBlockState(p_205576_2_.below()); + FluidState fluidstate1 = blockstate1.getFluidState(); + if (blockstate1.getMaterial().isSolid() || this.isSourceBlockOfThisType(fluidstate1)) { diff --git a/patches/minecraft/net/minecraft/fluid/Fluid.java.patch b/patches/minecraft/net/minecraft/fluid/Fluid.java.patch index deb579db9d..b15fa6e4ff 100644 --- a/patches/minecraft/net/minecraft/fluid/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/Fluid.java.patch @@ -6,15 +6,15 @@ -public abstract class Fluid { +public abstract class Fluid extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeFluid { - public static final ObjectIntIdentityMap field_207201_d = new ObjectIntIdentityMap<>(); - protected final StateContainer field_207202_e; - private FluidState field_207200_b; + public static final ObjectIntIdentityMap FLUID_STATE_REGISTRY = new ObjectIntIdentityMap<>(); + protected final StateContainer stateDefinition; + private FluidState defaultFluidState; @@ -98,4 +_,26 @@ } - public abstract VoxelShape func_215664_b(FluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_); + public abstract VoxelShape getShape(FluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_); + -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::func_226157_a_); ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::getAllTags); + @Override + public java.util.Set getTags() { + return reverseTags.getTagNames(); diff --git a/patches/minecraft/net/minecraft/fluid/FluidState.java.patch b/patches/minecraft/net/minecraft/fluid/FluidState.java.patch index 7b81d2f34c..8c847b0932 100644 --- a/patches/minecraft/net/minecraft/fluid/FluidState.java.patch +++ b/patches/minecraft/net/minecraft/fluid/FluidState.java.patch @@ -6,14 +6,14 @@ -public final class FluidState extends StateHolder { +public final class FluidState extends StateHolder implements net.minecraftforge.common.extensions.IForgeFluidState { - public static final Codec field_237213_a_ = func_235897_a_(Registry.field_212619_h, Fluid::func_207188_f).stable(); + public static final Codec CODEC = codec(Registry.FLUID, Fluid::defaultFluidState).stable(); public FluidState(Fluid p_i232145_1_, ImmutableMap, Comparable> p_i232145_2_, MapCodec p_i232145_3_) { @@ -101,6 +_,7 @@ - return this.func_206886_c().func_207185_a(p_206884_1_); + return this.getType().is(p_206884_1_); } + @Deprecated //Forge: Use more sensitive version - public float func_210200_l() { - return this.func_206886_c().func_210195_d(); + public float getExplosionResistance() { + return this.getType().getExplosionResistance(); } diff --git a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch index 71718f79bf..5875e58087 100644 --- a/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/LavaFluid.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/fluid/LavaFluid.java +++ b/net/minecraft/fluid/LavaFluid.java @@ -71,7 +_,7 @@ - BlockState blockstate = p_207186_1_.func_180495_p(blockpos); - if (blockstate.func_196958_f()) { - if (this.func_176369_e(p_207186_1_, blockpos)) { -- p_207186_1_.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(p_207186_1_, blockpos)); -+ p_207186_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.field_150480_ab.func_176223_P())); + BlockState blockstate = p_207186_1_.getBlockState(blockpos); + if (blockstate.isAir()) { + if (this.hasFlammableNeighbours(p_207186_1_, blockpos)) { +- p_207186_1_.setBlockAndUpdate(blockpos, AbstractFireBlock.getState(p_207186_1_, blockpos)); ++ p_207186_1_.setBlockAndUpdate(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.FIRE.defaultBlockState())); return; } - } else if (blockstate.func_185904_a().func_76230_c()) { + } else if (blockstate.getMaterial().blocksMotion()) { @@ -85,8 +_,8 @@ return; } -- if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) { -- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), AbstractFireBlock.func_235326_a_(p_207186_1_, blockpos1)); -+ if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.isFlammable(p_207186_1_, blockpos1, Direction.UP)) { -+ p_207186_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.func_177984_a(), p_207186_2_, Blocks.field_150480_ab.func_176223_P())); +- if (p_207186_1_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_207186_1_, blockpos1)) { +- p_207186_1_.setBlockAndUpdate(blockpos1.above(), AbstractFireBlock.getState(p_207186_1_, blockpos1)); ++ if (p_207186_1_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_207186_1_, blockpos1, Direction.UP)) { ++ p_207186_1_.setBlockAndUpdate(blockpos1.above(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.above(), p_207186_2_, Blocks.FIRE.defaultBlockState())); } } } @@ -96,7 +_,7 @@ - private boolean func_176369_e(IWorldReader p_176369_1_, BlockPos p_176369_2_) { + private boolean hasFlammableNeighbours(IWorldReader p_176369_1_, BlockPos p_176369_2_) { for(Direction direction : Direction.values()) { -- if (this.func_176368_m(p_176369_1_, p_176369_2_.func_177972_a(direction))) { -+ if (this.isFlammable(p_176369_1_, p_176369_2_.func_177972_a(direction), direction.func_176734_d())) { +- if (this.isFlammable(p_176369_1_, p_176369_2_.relative(direction))) { ++ if (this.isFlammable(p_176369_1_, p_176369_2_.relative(direction), direction.getOpposite())) { return true; } } @@ -35,23 +35,23 @@ + /** @deprecated Forge: use {@link LavaFluid#isFlammable(IWorldReader,BlockPos,Direction)} instead */ + @Deprecated - private boolean func_176368_m(IWorldReader p_176368_1_, BlockPos p_176368_2_) { - return p_176368_2_.func_177956_o() >= 0 && p_176368_2_.func_177956_o() < 256 && !p_176368_1_.func_175667_e(p_176368_2_) ? false : p_176368_1_.func_180495_p(p_176368_2_).func_185904_a().func_76217_h(); + private boolean isFlammable(IWorldReader p_176368_1_, BlockPos p_176368_2_) { + return p_176368_2_.getY() >= 0 && p_176368_2_.getY() < 256 && !p_176368_1_.hasChunkAt(p_176368_2_) ? false : p_176368_1_.getBlockState(p_176368_2_).getMaterial().isFlammable(); } + private boolean isFlammable(IWorldReader world, BlockPos pos, Direction face) { -+ return pos.func_177956_o() >= 0 && pos.func_177956_o() < 256 && !world.func_175667_e(pos) ? false : world.func_180495_p(pos).isFlammable(world, pos, face); ++ return pos.getY() >= 0 && pos.getY() < 256 && !world.hasChunkAt(pos) ? false : world.getBlockState(pos).isFlammable(world, pos, face); + } + @Nullable @OnlyIn(Dist.CLIENT) - public IParticleData func_204521_c() { + public IParticleData getDripParticle() { @@ -164,7 +_,7 @@ - FluidState fluidstate = p_205574_1_.func_204610_c(p_205574_2_); - if (this.func_207185_a(FluidTags.field_206960_b) && fluidstate.func_206884_a(FluidTags.field_206959_a)) { - if (p_205574_3_.func_177230_c() instanceof FlowingFluidBlock) { -- p_205574_1_.func_180501_a(p_205574_2_, Blocks.field_150348_b.func_176223_P(), 3); -+ p_205574_1_.func_180501_a(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.field_150348_b.func_176223_P()), 3); + FluidState fluidstate = p_205574_1_.getFluidState(p_205574_2_); + if (this.is(FluidTags.LAVA) && fluidstate.is(FluidTags.WATER)) { + if (p_205574_3_.getBlock() instanceof FlowingFluidBlock) { +- p_205574_1_.setBlock(p_205574_2_, Blocks.STONE.defaultBlockState(), 3); ++ p_205574_1_.setBlock(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.STONE.defaultBlockState()), 3); } - this.func_205581_a(p_205574_1_, p_205574_2_); + this.fizz(p_205574_1_, p_205574_2_); diff --git a/patches/minecraft/net/minecraft/fluid/WaterFluid.java.patch b/patches/minecraft/net/minecraft/fluid/WaterFluid.java.patch index a6db9d5e5e..525a6503b3 100644 --- a/patches/minecraft/net/minecraft/fluid/WaterFluid.java.patch +++ b/patches/minecraft/net/minecraft/fluid/WaterFluid.java.patch @@ -3,9 +3,9 @@ @@ -60,7 +_,7 @@ } - protected void func_205580_a(IWorld p_205580_1_, BlockPos p_205580_2_, BlockState p_205580_3_) { -- TileEntity tileentity = p_205580_3_.func_177230_c().func_235695_q_() ? p_205580_1_.func_175625_s(p_205580_2_) : null; -+ TileEntity tileentity = p_205580_3_.hasTileEntity() ? p_205580_1_.func_175625_s(p_205580_2_) : null; - Block.func_220059_a(p_205580_3_, p_205580_1_, p_205580_2_, tileentity); + protected void beforeDestroyingBlock(IWorld p_205580_1_, BlockPos p_205580_2_, BlockState p_205580_3_) { +- TileEntity tileentity = p_205580_3_.getBlock().isEntityBlock() ? p_205580_1_.getBlockEntity(p_205580_2_) : null; ++ TileEntity tileentity = p_205580_3_.hasTileEntity() ? p_205580_1_.getBlockEntity(p_205580_2_) : null; + Block.dropResources(p_205580_3_, p_205580_1_, p_205580_2_, tileentity); } diff --git a/patches/minecraft/net/minecraft/inventory/container/AbstractFurnaceContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/AbstractFurnaceContainer.java.patch index 19c9211b93..4fbbe2691c 100644 --- a/patches/minecraft/net/minecraft/inventory/container/AbstractFurnaceContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/AbstractFurnaceContainer.java.patch @@ -3,9 +3,9 @@ @@ -150,7 +_,7 @@ } - protected boolean func_217058_b(ItemStack p_217058_1_) { -- return AbstractFurnaceTileEntity.func_213991_b(p_217058_1_); -+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_217058_1_, this.field_217065_f) > 0; + protected boolean isFuel(ItemStack p_217058_1_) { +- return AbstractFurnaceTileEntity.isFuel(p_217058_1_); ++ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_217058_1_, this.recipeType) > 0; } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch index c0c592d0c8..9f36c3656a 100644 --- a/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch @@ -3,13 +3,13 @@ @@ -87,10 +_,8 @@ } - slot.func_75220_a(itemstack1, itemstack); -- } else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.func_190916_E() == 1) { -- if (!this.func_75135_a(itemstack1, 0, 1, false)) { -- return ItemStack.field_190927_a; + slot.onQuickCraft(itemstack1, itemstack); +- } else if (!this.paymentSlot.hasItem() && this.paymentSlot.mayPlace(itemstack1) && itemstack1.getCount() == 1) { +- if (!this.moveItemStackTo(itemstack1, 0, 1, false)) { +- return ItemStack.EMPTY; - } -+ } else if (this.func_75135_a(itemstack1, 0, 1, false)) { //Forge Fix Shift Clicking in beacons with stacks larger then 1. -+ return ItemStack.field_190927_a; ++ } else if (this.moveItemStackTo(itemstack1, 0, 1, false)) { //Forge Fix Shift Clicking in beacons with stacks larger then 1. ++ return ItemStack.EMPTY; } else if (p_82846_2_ >= 1 && p_82846_2_ < 28) { - if (!this.func_75135_a(itemstack1, 28, 37, false)) { - return ItemStack.field_190927_a; + if (!this.moveItemStackTo(itemstack1, 28, 37, false)) { + return ItemStack.EMPTY; diff --git a/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch index 2fca0ebca5..c9b424d170 100644 --- a/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch @@ -3,26 +3,26 @@ @@ -143,7 +_,7 @@ } - public boolean func_75214_a(ItemStack p_75214_1_) { -- return PotionBrewing.func_185205_a(p_75214_1_); + public boolean mayPlace(ItemStack p_75214_1_) { +- return PotionBrewing.isIngredient(p_75214_1_); + return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); } - public int func_75219_a() { + public int getMaxStackSize() { @@ -167,6 +_,7 @@ - public ItemStack func_190901_a(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { - Potion potion = PotionUtils.func_185191_c(p_190901_2_); + public ItemStack onTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { + Potion potion = PotionUtils.getPotion(p_190901_2_); if (p_190901_1_ instanceof ServerPlayerEntity) { + net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(p_190901_1_, p_190901_2_); - CriteriaTriggers.field_192130_j.func_192173_a((ServerPlayerEntity)p_190901_1_, potion); + CriteriaTriggers.BREWED_POTION.trigger((ServerPlayerEntity)p_190901_1_, potion); } @@ -175,8 +_,7 @@ } - public static boolean func_75243_a_(ItemStack p_75243_0_) { -- Item item = p_75243_0_.func_77973_b(); -- return item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo; + public static boolean mayPlaceItem(ItemStack p_75243_0_) { +- Item item = p_75243_0_.getItem(); +- return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE; + return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); } } diff --git a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch index 203131ecb0..bc0c2d6a83 100644 --- a/patches/minecraft/net/minecraft/inventory/container/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch @@ -1,43 +1,43 @@ --- a/net/minecraft/inventory/container/Container.java +++ b/net/minecraft/inventory/container/Container.java @@ -120,9 +_,11 @@ - ItemStack itemstack = this.field_75151_b.get(i).func_75211_c(); - ItemStack itemstack1 = this.field_75153_a.get(i); - if (!ItemStack.func_77989_b(itemstack1, itemstack)) { + ItemStack itemstack = this.slots.get(i).getItem(); + ItemStack itemstack1 = this.lastSlots.get(i); + if (!ItemStack.matches(itemstack1, itemstack)) { + boolean clientStackChanged = !itemstack1.equals(itemstack, true); - ItemStack itemstack2 = itemstack.func_77946_l(); - this.field_75153_a.set(i, itemstack2); + ItemStack itemstack2 = itemstack.copy(); + this.lastSlots.set(i, itemstack2); + if (clientStackChanged) - for(IContainerListener icontainerlistener : this.field_75149_d) { - icontainerlistener.func_71111_a(this, i, itemstack2); + for(IContainerListener icontainerlistener : this.containerListeners) { + icontainerlistener.slotChanged(this, i, itemstack2); } @@ -500,14 +_,15 @@ - ItemStack itemstack = slot.func_75211_c(); - if (!itemstack.func_190926_b() && func_195929_a(p_75135_1_, itemstack)) { - int j = itemstack.func_190916_E() + p_75135_1_.func_190916_E(); -- if (j <= p_75135_1_.func_77976_d()) { -+ int maxSize = Math.min(slot.func_75219_a(), p_75135_1_.func_77976_d()); + ItemStack itemstack = slot.getItem(); + if (!itemstack.isEmpty() && consideredTheSameItem(p_75135_1_, itemstack)) { + int j = itemstack.getCount() + p_75135_1_.getCount(); +- if (j <= p_75135_1_.getMaxStackSize()) { ++ int maxSize = Math.min(slot.getMaxStackSize(), p_75135_1_.getMaxStackSize()); + if (j <= maxSize) { - p_75135_1_.func_190920_e(0); - itemstack.func_190920_e(j); - slot.func_75218_e(); + p_75135_1_.setCount(0); + itemstack.setCount(j); + slot.setChanged(); flag = true; -- } else if (itemstack.func_190916_E() < p_75135_1_.func_77976_d()) { -- p_75135_1_.func_190918_g(p_75135_1_.func_77976_d() - itemstack.func_190916_E()); -- itemstack.func_190920_e(p_75135_1_.func_77976_d()); -+ } else if (itemstack.func_190916_E() < maxSize) { -+ p_75135_1_.func_190918_g(maxSize - itemstack.func_190916_E()); -+ itemstack.func_190920_e(maxSize); - slot.func_75218_e(); +- } else if (itemstack.getCount() < p_75135_1_.getMaxStackSize()) { +- p_75135_1_.shrink(p_75135_1_.getMaxStackSize() - itemstack.getCount()); +- itemstack.setCount(p_75135_1_.getMaxStackSize()); ++ } else if (itemstack.getCount() < maxSize) { ++ p_75135_1_.shrink(maxSize - itemstack.getCount()); ++ itemstack.setCount(maxSize); + slot.setChanged(); flag = true; } @@ -608,7 +_,7 @@ - p_94525_2_.func_190920_e(1); + p_94525_2_.setCount(1); break; case 2: -- p_94525_2_.func_190920_e(p_94525_2_.func_77973_b().func_77639_j()); -+ p_94525_2_.func_190920_e(p_94525_2_.func_77976_d()); +- p_94525_2_.setCount(p_94525_2_.getItem().getMaxStackSize()); ++ p_94525_2_.setCount(p_94525_2_.getMaxStackSize()); } - p_94525_2_.func_190917_f(p_94525_3_); + p_94525_2_.grow(p_94525_3_); diff --git a/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch b/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch index 006a2c89cb..ff711e541b 100644 --- a/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/ContainerType.java.patch @@ -6,21 +6,21 @@ -public class ContainerType { +public class ContainerType extends net.minecraftforge.registries.ForgeRegistryEntry> implements net.minecraftforge.common.extensions.IForgeContainerType { - public static final ContainerType field_221507_a = func_221505_a("generic_9x1", ChestContainer::func_216986_a); - public static final ContainerType field_221508_b = func_221505_a("generic_9x2", ChestContainer::func_216987_b); - public static final ContainerType field_221509_c = func_221505_a("generic_9x3", ChestContainer::func_216988_c); + public static final ContainerType GENERIC_9x1 = register("generic_9x1", ChestContainer::oneRow); + public static final ContainerType GENERIC_9x2 = register("generic_9x2", ChestContainer::twoRows); + public static final ContainerType GENERIC_9x3 = register("generic_9x3", ChestContainer::threeRows); @@ -45,6 +_,14 @@ @OnlyIn(Dist.CLIENT) - public T func_221506_a(int p_221506_1_, PlayerInventory p_221506_2_) { - return this.field_221530_x.create(p_221506_1_, p_221506_2_); + public T create(int p_221506_1_, PlayerInventory p_221506_2_) { + return this.constructor.create(p_221506_1_, p_221506_2_); + } + + @Override + public T create(int windowId, PlayerInventory playerInv, net.minecraft.network.PacketBuffer extraData) { -+ if (this.field_221530_x instanceof net.minecraftforge.fml.network.IContainerFactory) { -+ return ((net.minecraftforge.fml.network.IContainerFactory) this.field_221530_x).create(windowId, playerInv, extraData); ++ if (this.constructor instanceof net.minecraftforge.fml.network.IContainerFactory) { ++ return ((net.minecraftforge.fml.network.IContainerFactory) this.constructor).create(windowId, playerInv, extraData); + } -+ return func_221506_a(windowId, playerInv); ++ return create(windowId, playerInv); } public interface IFactory { diff --git a/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch b/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch index 776bc764f9..3bd92936b7 100644 --- a/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/inventory/container/CraftingResultSlot.java +++ b/net/minecraft/inventory/container/CraftingResultSlot.java @@ -43,6 +_,7 @@ - protected void func_75208_c(ItemStack p_75208_1_) { - if (this.field_75237_g > 0) { - p_75208_1_.func_77980_a(this.field_75238_b.field_70170_p, this.field_75238_b, this.field_75237_g); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75239_a); + protected void checkTakeAchievements(ItemStack p_75208_1_) { + if (this.removeCount > 0) { + p_75208_1_.onCraftedBy(this.player.level, this.player, this.removeCount); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.player, p_75208_1_, this.craftSlots); } - if (this.field_75224_c instanceof IRecipeHolder) { + if (this.container instanceof IRecipeHolder) { @@ -54,8 +_,9 @@ - public ItemStack func_190901_a(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { - this.func_75208_c(p_190901_2_); + public ItemStack onTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { + this.checkTakeAchievements(p_190901_2_); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_190901_1_); - NonNullList nonnulllist = p_190901_1_.field_70170_p.func_199532_z().func_215369_c(IRecipeType.field_222149_a, this.field_75239_a, p_190901_1_.field_70170_p); + NonNullList nonnulllist = p_190901_1_.level.getRecipeManager().getRemainingItemsFor(IRecipeType.CRAFTING, this.craftSlots, p_190901_1_.level); - + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for(int i = 0; i < nonnulllist.size(); ++i) { - ItemStack itemstack = this.field_75239_a.func_70301_a(i); + ItemStack itemstack = this.craftSlots.getItem(i); ItemStack itemstack1 = nonnulllist.get(i); diff --git a/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch index 02e21577f6..e4d900e357 100644 --- a/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch @@ -2,77 +2,77 @@ +++ b/net/minecraft/inventory/container/EnchantmentContainer.java @@ -56,7 +_,7 @@ }); - this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { - public boolean func_75214_a(ItemStack p_75214_1_) { -- return p_75214_1_.func_77973_b() == Items.field_196128_bn; -+ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_230235_a_(p_75214_1_.func_77973_b()); + this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { + public boolean mayPlace(ItemStack p_75214_1_) { +- return p_75214_1_.getItem() == Items.LAPIS_LAZULI; ++ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.contains(p_75214_1_.getItem()); } }); @@ -82,40 +_,28 @@ - this.func_216958_a(IntReferenceHolder.func_221497_a(this.field_185002_i, 2)); + this.addDataSlot(IntReferenceHolder.shared(this.levelClue, 2)); } + private float getPower(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) { -+ return world.func_180495_p(pos).getEnchantPowerBonus(world, pos); ++ return world.getBlockState(pos).getEnchantPowerBonus(world, pos); + } + - public void func_75130_a(IInventory p_75130_1_) { - if (p_75130_1_ == this.field_75168_e) { - ItemStack itemstack = p_75130_1_.func_70301_a(0); - if (!itemstack.func_190926_b() && itemstack.func_77956_u()) { - this.field_217006_g.func_221486_a((p_217002_2_, p_217002_3_) -> { + public void slotsChanged(IInventory p_75130_1_) { + if (p_75130_1_ == this.enchantSlots) { + ItemStack itemstack = p_75130_1_.getItem(0); + if (!itemstack.isEmpty() && itemstack.isEnchantable()) { + this.access.execute((p_217002_2_, p_217002_3_) -> { - int j = 0; + int power = 0; for(int k = -1; k <= 1; ++k) { for(int l = -1; l <= 1; ++l) { - if ((k != 0 || l != 0) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 0, k)) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 1, k))) { -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k * 2)).func_203425_a(Blocks.field_150342_X)) { + if ((k != 0 || l != 0) && p_217002_2_.isEmptyBlock(p_217002_3_.offset(l, 0, k)) && p_217002_2_.isEmptyBlock(p_217002_3_.offset(l, 1, k))) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l * 2, 0, k * 2)).is(Blocks.BOOKSHELF)) { - ++j; - } - -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k * 2)).func_203425_a(Blocks.field_150342_X)) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l * 2, 1, k * 2)).is(Blocks.BOOKSHELF)) { - ++j; - } -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k * 2)); -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l * 2, 0, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l * 2, 1, k * 2)); if (l != 0 && k != 0) { -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k)).func_203425_a(Blocks.field_150342_X)) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l * 2, 0, k)).is(Blocks.BOOKSHELF)) { - ++j; - } - -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k)).func_203425_a(Blocks.field_150342_X)) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l * 2, 1, k)).is(Blocks.BOOKSHELF)) { - ++j; - } - -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 0, k * 2)).func_203425_a(Blocks.field_150342_X)) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l, 0, k * 2)).is(Blocks.BOOKSHELF)) { - ++j; - } - -- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 1, k * 2)).func_203425_a(Blocks.field_150342_X)) { +- if (p_217002_2_.getBlockState(p_217002_3_.offset(l, 1, k * 2)).is(Blocks.BOOKSHELF)) { - ++j; - } -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k)); -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k)); -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 0, k * 2)); -+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 1, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l * 2, 0, k)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l * 2, 1, k)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l, 0, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.offset(l, 1, k * 2)); } } } @@ -124,12 +_,13 @@ - this.field_75169_l.setSeed((long)this.field_178149_f.func_221495_b()); + this.random.setSeed((long)this.enchantmentSeed.get()); for(int i1 = 0; i1 < 3; ++i1) { -- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, j, itemstack); -+ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); - this.field_185001_h[i1] = -1; - this.field_185002_i[i1] = -1; - if (this.field_75167_g[i1] < i1 + 1) { - this.field_75167_g[i1] = 0; +- this.costs[i1] = EnchantmentHelper.getEnchantmentCost(this.random, i1, j, itemstack); ++ this.costs[i1] = EnchantmentHelper.getEnchantmentCost(this.random, i1, (int)power, itemstack); + this.enchantClue[i1] = -1; + this.levelClue[i1] = -1; + if (this.costs[i1] < i1 + 1) { + this.costs[i1] = 0; } -+ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_217002_2_, p_217002_3_, i1, (int)power, itemstack, field_75167_g[i1]); ++ this.costs[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_217002_2_, p_217002_3_, i1, (int)power, itemstack, costs[i1]); } for(int j1 = 0; j1 < 3; ++j1) { diff --git a/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch b/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch index 5bdac36112..ffc2b84a29 100644 --- a/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch @@ -3,7 +3,7 @@ @@ -44,5 +_,6 @@ } - this.field_75228_b = 0; -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerSmeltedEvent(this.field_75229_a, p_75208_1_); + this.removeCount = 0; ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerSmeltedEvent(this.player, p_75208_1_); } } diff --git a/patches/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch index aa98eda958..121c1c69c3 100644 --- a/patches/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/GrindstoneContainer.java.patch @@ -3,19 +3,19 @@ @@ -141,12 +_,13 @@ } - Item item = itemstack.func_77973_b(); -- int k = item.func_77612_l() - itemstack.func_77952_i(); -- int l = item.func_77612_l() - itemstack1.func_77952_i(); -- int i1 = k + l + item.func_77612_l() * 5 / 100; -- i = Math.max(item.func_77612_l() - i1, 0); -+ int k = itemstack.func_77958_k() - itemstack.func_77952_i(); -+ int l = itemstack.func_77958_k() - itemstack1.func_77952_i(); -+ int i1 = k + l + itemstack.func_77958_k() * 5 / 100; -+ i = Math.max(itemstack.func_77958_k() - i1, 0); - itemstack2 = this.func_217011_b(itemstack, itemstack1); -- if (!itemstack2.func_77984_f()) { -+ if (!itemstack2.isRepairable()) i = itemstack.func_77952_i(); -+ if (!itemstack2.func_77984_f() || !itemstack2.isRepairable()) { - if (!ItemStack.func_77989_b(itemstack, itemstack1)) { - this.field_217013_c.func_70299_a(0, ItemStack.field_190927_a); - this.func_75142_b(); + Item item = itemstack.getItem(); +- int k = item.getMaxDamage() - itemstack.getDamageValue(); +- int l = item.getMaxDamage() - itemstack1.getDamageValue(); +- int i1 = k + l + item.getMaxDamage() * 5 / 100; +- i = Math.max(item.getMaxDamage() - i1, 0); ++ int k = itemstack.getMaxDamage() - itemstack.getDamageValue(); ++ int l = itemstack.getMaxDamage() - itemstack1.getDamageValue(); ++ int i1 = k + l + itemstack.getMaxDamage() * 5 / 100; ++ i = Math.max(itemstack.getMaxDamage() - i1, 0); + itemstack2 = this.mergeEnchants(itemstack, itemstack1); +- if (!itemstack2.isDamageableItem()) { ++ if (!itemstack2.isRepairable()) i = itemstack.getDamageValue(); ++ if (!itemstack2.isDamageableItem() || !itemstack2.isRepairable()) { + if (!ItemStack.matches(itemstack, itemstack1)) { + this.resultSlots.setItem(0, ItemStack.EMPTY); + this.broadcastChanges(); diff --git a/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch index 2e6f887221..3e182fe50f 100644 --- a/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch @@ -3,9 +3,9 @@ @@ -51,7 +_,7 @@ } - public boolean func_75214_a(ItemStack p_75214_1_) { -- return equipmentslottype == MobEntity.func_184640_d(p_75214_1_); -+ return p_75214_1_.canEquip(equipmentslottype, field_82862_h); + public boolean mayPlace(ItemStack p_75214_1_) { +- return equipmentslottype == MobEntity.getEquipmentSlotForItem(p_75214_1_); ++ return p_75214_1_.canEquip(equipmentslottype, owner); } - public boolean func_82869_a(PlayerEntity p_82869_1_) { + public boolean mayPickup(PlayerEntity p_82869_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch index a9a43056c4..89613a63d0 100644 --- a/patches/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/RecipeBookContainer.java.patch @@ -2,12 +2,12 @@ +++ b/net/minecraft/inventory/container/RecipeBookContainer.java @@ -33,6 +_,10 @@ @OnlyIn(Dist.CLIENT) - public abstract int func_203721_h(); + public abstract int getSize(); + public java.util.List getRecipeBookCategories() { -+ return net.minecraft.client.util.RecipeBookCategories.func_243236_a(this.func_241850_m()); ++ return net.minecraft.client.util.RecipeBookCategories.getCategories(this.getRecipeBookType()); + } + @OnlyIn(Dist.CLIENT) - public abstract RecipeBookCategory func_241850_m(); + public abstract RecipeBookCategory getRecipeBookType(); } diff --git a/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch index dfaf29eeb3..5c77cd6cb0 100644 --- a/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch @@ -1,51 +1,51 @@ --- a/net/minecraft/inventory/container/RepairContainer.java +++ b/net/minecraft/inventory/container/RepairContainer.java @@ -48,6 +_,8 @@ - p_230301_1_.func_82242_a(-this.field_82854_e.func_221495_b()); + p_230301_1_.giveExperienceLevels(-this.cost.get()); } -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_230301_1_, p_230301_2_, RepairContainer.this.field_234643_d_.func_70301_a(0), RepairContainer.this.field_234643_d_.func_70301_a(1)); ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_230301_1_, p_230301_2_, RepairContainer.this.inputSlots.getItem(0), RepairContainer.this.inputSlots.getItem(1)); + - this.field_234643_d_.func_70299_a(0, ItemStack.field_190927_a); - if (this.field_82856_l > 0) { - ItemStack itemstack = this.field_234643_d_.func_70301_a(1); + this.inputSlots.setItem(0, ItemStack.EMPTY); + if (this.repairItemCountCost > 0) { + ItemStack itemstack = this.inputSlots.getItem(1); @@ -64,7 +_,7 @@ - this.field_82854_e.func_221494_a(0); - this.field_234644_e_.func_221486_a((p_234633_1_, p_234633_2_) -> { - BlockState blockstate = p_234633_1_.func_180495_p(p_234633_2_); -- if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < 0.12F) { -+ if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < breakChance) { - BlockState blockstate1 = AnvilBlock.func_196433_f(blockstate); + this.cost.set(0); + this.access.execute((p_234633_1_, p_234633_2_) -> { + BlockState blockstate = p_234633_1_.getBlockState(p_234633_2_); +- if (!p_230301_1_.abilities.instabuild && blockstate.is(BlockTags.ANVIL) && p_230301_1_.getRandom().nextFloat() < 0.12F) { ++ if (!p_230301_1_.abilities.instabuild && blockstate.is(BlockTags.ANVIL) && p_230301_1_.getRandom().nextFloat() < breakChance) { + BlockState blockstate1 = AnvilBlock.damage(blockstate); if (blockstate1 == null) { - p_234633_1_.func_217377_a(p_234633_2_, false); + p_234633_1_.removeBlock(p_234633_2_, false); @@ -96,8 +_,11 @@ - Map map = EnchantmentHelper.func_82781_a(itemstack1); - j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A()); - this.field_82856_l = 0; + Map map = EnchantmentHelper.getEnchantments(itemstack1); + j = j + itemstack.getBaseRepairCost() + (itemstack2.isEmpty() ? 0 : itemstack2.getBaseRepairCost()); + this.repairItemCountCost = 0; + boolean flag = false; + - if (!itemstack2.func_190926_b()) { -- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !EnchantedBookItem.func_92110_g(itemstack2).isEmpty(); -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_234642_c_, field_82857_m, j, this.field_234645_f_)) return; -+ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !EnchantedBookItem.func_92110_g(itemstack2).isEmpty(); - if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) { - int l2 = Math.min(itemstack1.func_77952_i(), itemstack1.func_77958_k() / 4); + if (!itemstack2.isEmpty()) { +- boolean flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, resultSlots, itemName, j, this.player)) return; ++ flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); + if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) { + int l2 = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4); if (l2 <= 0) { @@ -214,6 +_,7 @@ i += k; - itemstack1.func_200302_a(new StringTextComponent(this.field_82857_m)); + itemstack1.setHoverName(new StringTextComponent(this.itemName)); } -+ if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.field_190927_a; ++ if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.EMPTY; - this.field_82854_e.func_221494_a(j + i); + this.cost.set(j + i); if (i <= 0) { @@ -268,5 +_,9 @@ @OnlyIn(Dist.CLIENT) - public int func_216976_f() { - return this.field_82854_e.func_221495_b(); + public int getCost() { + return this.cost.get(); + } + + public void setMaximumCost(int value) { -+ this.field_82854_e.func_221494_a(value); ++ this.cost.set(value); } } diff --git a/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch index f59906d78b..1e226b8a03 100644 --- a/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch @@ -3,15 +3,15 @@ @@ -77,7 +_,7 @@ @Nullable @OnlyIn(Dist.CLIENT) - public Pair func_225517_c_() { + public Pair getNoItemIcon() { - return null; + return backgroundPair; } - public ItemStack func_75209_a(int p_75209_1_) { + public ItemStack remove(int p_75209_1_) { @@ -91,5 +_,37 @@ @OnlyIn(Dist.CLIENT) - public boolean func_111238_b() { + public boolean isActive() { return true; + } + @@ -22,7 +22,7 @@ + * @return Index in associated inventory for this slot. + */ + public int getSlotIndex() { -+ return field_75225_a; ++ return slot; + } + + /** @@ -31,7 +31,7 @@ + * @return true if the other slot is in the same inventory + */ + public boolean isSameInventory(Slot other) { -+ return this.field_75224_c == other.field_75224_c; ++ return this.container == other.container; + } + + private Pair backgroundPair; diff --git a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch index 3233ca862b..055b21dc1f 100644 --- a/patches/minecraft/net/minecraft/item/ArmorItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/item/ArmorItem.java +++ b/net/minecraft/item/ArmorItem.java @@ -69,7 +_,7 @@ - UUID uuid = field_185084_n[p_i48534_2_.func_188454_b()]; - builder.put(Attributes.field_233826_i_, new AttributeModifier(uuid, "Armor modifier", (double)this.field_77879_b, AttributeModifier.Operation.ADDITION)); - builder.put(Attributes.field_233827_j_, new AttributeModifier(uuid, "Armor toughness", (double)this.field_189415_e, AttributeModifier.Operation.ADDITION)); + UUID uuid = ARMOR_MODIFIER_UUID_PER_SLOT[p_i48534_2_.getIndex()]; + builder.put(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", (double)this.defense, AttributeModifier.Operation.ADDITION)); + builder.put(Attributes.ARMOR_TOUGHNESS, new AttributeModifier(uuid, "Armor toughness", (double)this.toughness, AttributeModifier.Operation.ADDITION)); - if (p_i48534_1_ == ArmorMaterial.NETHERITE) { -+ if (this.field_234655_c_ > 0) { - builder.put(Attributes.field_233820_c_, new AttributeModifier(uuid, "Armor knockback resistance", (double)this.field_234655_c_, AttributeModifier.Operation.ADDITION)); ++ if (this.knockbackResistance > 0) { + builder.put(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(uuid, "Armor knockback resistance", (double)this.knockbackResistance, AttributeModifier.Operation.ADDITION)); } diff --git a/patches/minecraft/net/minecraft/item/ArrowItem.java.patch b/patches/minecraft/net/minecraft/item/ArrowItem.java.patch index fd842aed71..6f974c2e91 100644 --- a/patches/minecraft/net/minecraft/item/ArrowItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ArrowItem.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/item/ArrowItem.java +++ b/net/minecraft/item/ArrowItem.java @@ -15,4 +_,9 @@ - arrowentity.func_184555_a(p_200887_2_); + arrowentity.setEffectsFromItem(p_200887_2_); return arrowentity; } + + public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.entity.player.PlayerEntity player) { -+ int enchant = net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185312_x, bow); ++ int enchant = net.minecraft.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.enchantment.Enchantments.INFINITY_ARROWS, bow); + return enchant <= 0 ? false : this.getClass() == ArrowItem.class; + } } diff --git a/patches/minecraft/net/minecraft/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/item/AxeItem.java.patch index 21dc3f76e0..24db8947ac 100644 --- a/patches/minecraft/net/minecraft/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/AxeItem.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/item/AxeItem.java +++ b/net/minecraft/item/AxeItem.java @@ -22,7 +_,7 @@ - protected static final Map field_203176_a = (new Builder()).put(Blocks.field_196626_Q, Blocks.field_209389_ab).put(Blocks.field_196617_K, Blocks.field_203204_R).put(Blocks.field_196639_V, Blocks.field_209394_ag).put(Blocks.field_196623_P, Blocks.field_203209_W).put(Blocks.field_196637_U, Blocks.field_209393_af).put(Blocks.field_196621_O, Blocks.field_203208_V).put(Blocks.field_196631_S, Blocks.field_209391_ad).put(Blocks.field_196619_M, Blocks.field_203206_T).put(Blocks.field_196634_T, Blocks.field_209392_ae).put(Blocks.field_196620_N, Blocks.field_203207_U).put(Blocks.field_196629_R, Blocks.field_209390_ac).put(Blocks.field_196618_L, Blocks.field_203205_S).put(Blocks.field_235368_mh_, Blocks.field_235369_mi_).put(Blocks.field_235370_mj_, Blocks.field_235371_mk_).put(Blocks.field_235377_mq_, Blocks.field_235378_mr_).put(Blocks.field_235379_ms_, Blocks.field_235380_mt_).build(); + protected static final Map STRIPABLES = (new Builder()).put(Blocks.OAK_WOOD, Blocks.STRIPPED_OAK_WOOD).put(Blocks.OAK_LOG, Blocks.STRIPPED_OAK_LOG).put(Blocks.DARK_OAK_WOOD, Blocks.STRIPPED_DARK_OAK_WOOD).put(Blocks.DARK_OAK_LOG, Blocks.STRIPPED_DARK_OAK_LOG).put(Blocks.ACACIA_WOOD, Blocks.STRIPPED_ACACIA_WOOD).put(Blocks.ACACIA_LOG, Blocks.STRIPPED_ACACIA_LOG).put(Blocks.BIRCH_WOOD, Blocks.STRIPPED_BIRCH_WOOD).put(Blocks.BIRCH_LOG, Blocks.STRIPPED_BIRCH_LOG).put(Blocks.JUNGLE_WOOD, Blocks.STRIPPED_JUNGLE_WOOD).put(Blocks.JUNGLE_LOG, Blocks.STRIPPED_JUNGLE_LOG).put(Blocks.SPRUCE_WOOD, Blocks.STRIPPED_SPRUCE_WOOD).put(Blocks.SPRUCE_LOG, Blocks.STRIPPED_SPRUCE_LOG).put(Blocks.WARPED_STEM, Blocks.STRIPPED_WARPED_STEM).put(Blocks.WARPED_HYPHAE, Blocks.STRIPPED_WARPED_HYPHAE).put(Blocks.CRIMSON_STEM, Blocks.STRIPPED_CRIMSON_STEM).put(Blocks.CRIMSON_HYPHAE, Blocks.STRIPPED_CRIMSON_HYPHAE).build(); public AxeItem(IItemTier p_i48530_1_, float p_i48530_2_, float p_i48530_3_, Item.Properties p_i48530_4_) { -- super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_d_, p_i48530_4_); -+ super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_d_, p_i48530_4_.addToolType(net.minecraftforge.common.ToolType.AXE, p_i48530_1_.func_200925_d())); +- super(p_i48530_2_, p_i48530_3_, p_i48530_1_, OTHER_DIGGABLE_BLOCKS, p_i48530_4_); ++ super(p_i48530_2_, p_i48530_3_, p_i48530_1_, OTHER_DIGGABLE_BLOCKS, p_i48530_4_.addToolType(net.minecraftforge.common.ToolType.AXE, p_i48530_1_.getLevel())); } - public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { + public float getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_) { @@ -34,12 +_,12 @@ - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); - BlockState blockstate = world.func_180495_p(blockpos); -- Block block = field_203176_a.get(blockstate.func_177230_c()); -+ BlockState block = blockstate.getToolModifiedState(world, blockpos, p_195939_1_.func_195999_j(), p_195939_1_.func_195996_i(), net.minecraftforge.common.ToolType.AXE); + World world = p_195939_1_.getLevel(); + BlockPos blockpos = p_195939_1_.getClickedPos(); + BlockState blockstate = world.getBlockState(blockpos); +- Block block = STRIPABLES.get(blockstate.getBlock()); ++ BlockState block = blockstate.getToolModifiedState(world, blockpos, p_195939_1_.getPlayer(), p_195939_1_.getItemInHand(), net.minecraftforge.common.ToolType.AXE); if (block != null) { - PlayerEntity playerentity = p_195939_1_.func_195999_j(); - world.func_184133_a(playerentity, blockpos, SoundEvents.field_203255_y, SoundCategory.BLOCKS, 1.0F, 1.0F); - if (!world.field_72995_K) { -- world.func_180501_a(blockpos, block.func_176223_P().func_206870_a(RotatedPillarBlock.field_176298_M, blockstate.func_177229_b(RotatedPillarBlock.field_176298_M)), 11); -+ world.func_180501_a(blockpos, block, 11); + PlayerEntity playerentity = p_195939_1_.getPlayer(); + world.playSound(playerentity, blockpos, SoundEvents.AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); + if (!world.isClientSide) { +- world.setBlock(blockpos, block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, blockstate.getValue(RotatedPillarBlock.AXIS)), 11); ++ world.setBlock(blockpos, block, 11); if (playerentity != null) { - p_195939_1_.func_195996_i().func_222118_a(1, playerentity, (p_220040_1_) -> { - p_220040_1_.func_213334_d(p_195939_1_.func_221531_n()); + p_195939_1_.getItemInHand().hurtAndBreak(1, playerentity, (p_220040_1_) -> { + p_220040_1_.broadcastBreakEvent(p_195939_1_.getHand()); @@ -51,5 +_,11 @@ } else { return ActionResultType.PASS; @@ -32,7 +32,7 @@ + + @javax.annotation.Nullable + public static BlockState getAxeStrippingState(BlockState originalState) { -+ Block block = field_203176_a.get(originalState.func_177230_c()); -+ return block != null ? block.func_176223_P().func_206870_a(RotatedPillarBlock.field_176298_M, originalState.func_177229_b(RotatedPillarBlock.field_176298_M)) : null; ++ Block block = STRIPABLES.get(originalState.getBlock()); ++ return block != null ? block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, originalState.getValue(RotatedPillarBlock.AXIS)) : null; } } diff --git a/patches/minecraft/net/minecraft/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/item/BlockItem.java.patch index 2348e787f2..5758970b80 100644 --- a/patches/minecraft/net/minecraft/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BlockItem.java.patch @@ -4,46 +4,46 @@ } } -- SoundType soundtype = blockstate1.func_215695_r(); -- world.func_184133_a(playerentity, blockpos, this.func_219983_a(blockstate1), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); -+ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j()); -+ world.func_184133_a(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.func_195999_j()), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); - if (playerentity == null || !playerentity.field_71075_bZ.field_75098_d) { - itemstack.func_190918_g(1); +- SoundType soundtype = blockstate1.getSoundType(); +- world.playSound(playerentity, blockpos, this.getPlaceSound(blockstate1), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); ++ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.getPlayer()); ++ world.playSound(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.getPlayer()), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); + if (playerentity == null || !playerentity.abilities.instabuild) { + itemstack.shrink(1); } @@ -81,10 +_,16 @@ } } + @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) } - protected SoundEvent func_219983_a(BlockState p_219983_1_) { - return p_219983_1_.func_215695_r().func_185841_e(); + protected SoundEvent getPlaceSound(BlockState p_219983_1_) { + return p_219983_1_.getSoundType().getPlaceSound(); } + //Forge: Sensitive version of BlockItem#getPlaceSound + protected SoundEvent getPlaceSound(BlockState state, World world, BlockPos pos, PlayerEntity entity) { -+ return state.getSoundType(world, pos, entity).func_185841_e(); ++ return state.getSoundType(world, pos, entity).getPlaceSound(); + } + @Nullable - public BlockItemUseContext func_219984_b(BlockItemUseContext p_219984_1_) { + public BlockItemUseContext updatePlacementContext(BlockItemUseContext p_219984_1_) { return p_219984_1_; @@ -192,10 +_,18 @@ } - public Block func_179223_d() { + public Block getBlock() { + return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get(); + } + + private Block getBlockRaw() { - return this.field_150939_a; + return this.block; } - public void func_195946_a(Map p_195946_1_, Item p_195946_2_) { - p_195946_1_.put(this.func_179223_d(), p_195946_2_); + public void registerBlocks(Map p_195946_1_, Item p_195946_2_) { + p_195946_1_.put(this.getBlock(), p_195946_2_); + } + + public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { -+ blockToItemMap.remove(this.func_179223_d()); ++ blockToItemMap.remove(this.getBlock()); } } diff --git a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch index 23b72c81a3..ab2e342416 100644 --- a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch @@ -1,38 +1,38 @@ --- a/net/minecraft/item/BoneMealItem.java +++ b/net/minecraft/item/BoneMealItem.java @@ -30,7 +_,7 @@ - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); - BlockPos blockpos1 = blockpos.func_177972_a(p_195939_1_.func_196000_l()); -- if (func_195966_a(p_195939_1_.func_195996_i(), world, blockpos)) { -+ if (applyBonemeal(p_195939_1_.func_195996_i(), world, blockpos, p_195939_1_.func_195999_j())) { - if (!world.field_72995_K) { - world.func_217379_c(2005, blockpos, 0); + World world = p_195939_1_.getLevel(); + BlockPos blockpos = p_195939_1_.getClickedPos(); + BlockPos blockpos1 = blockpos.relative(p_195939_1_.getClickedFace()); +- if (growCrop(p_195939_1_.getItemInHand(), world, blockpos)) { ++ if (applyBonemeal(p_195939_1_.getItemInHand(), world, blockpos, p_195939_1_.getPlayer())) { + if (!world.isClientSide) { + world.levelEvent(2005, blockpos, 0); } @@ -51,8 +_,17 @@ } } + @Deprecated //Forge: Use Player/Hand version - public static boolean func_195966_a(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_) { + public static boolean growCrop(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_) { + if (p_195966_1_ instanceof net.minecraft.world.server.ServerWorld) + return applyBonemeal(p_195966_0_, p_195966_1_, p_195966_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.server.ServerWorld)p_195966_1_)); + return false; + } + + public static boolean applyBonemeal(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_, net.minecraft.entity.player.PlayerEntity player) { - BlockState blockstate = p_195966_1_.func_180495_p(p_195966_2_); + BlockState blockstate = p_195966_1_.getBlockState(p_195966_2_); + int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_195966_1_, p_195966_2_, blockstate, p_195966_0_); + if (hook != 0) return hook > 0; - if (blockstate.func_177230_c() instanceof IGrowable) { - IGrowable igrowable = (IGrowable)blockstate.func_177230_c(); - if (igrowable.func_176473_a(p_195966_1_, p_195966_2_, blockstate, p_195966_1_.field_72995_K)) { + if (blockstate.getBlock() instanceof IGrowable) { + IGrowable igrowable = (IGrowable)blockstate.getBlock(); + if (igrowable.isValidBonemealTarget(p_195966_1_, p_195966_2_, blockstate, p_195966_1_.isClientSide)) { @@ -128,7 +_,7 @@ } - BlockState blockstate = p_195965_0_.func_180495_p(p_195965_1_); -- if (!blockstate.func_196958_f()) { + BlockState blockstate = p_195965_0_.getBlockState(p_195965_1_); +- if (!blockstate.isAir()) { + if (!blockstate.isAir(p_195965_0_, p_195965_1_)) { double d0 = 0.5D; double d1; - if (blockstate.func_203425_a(Blocks.field_150355_j)) { + if (blockstate.is(Blocks.WATER)) { diff --git a/patches/minecraft/net/minecraft/item/BowItem.java.patch b/patches/minecraft/net/minecraft/item/BowItem.java.patch index 086c9c57ac..5faa9d1d5b 100644 --- a/patches/minecraft/net/minecraft/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BowItem.java.patch @@ -2,49 +2,49 @@ +++ b/net/minecraft/item/BowItem.java @@ -24,18 +_,23 @@ PlayerEntity playerentity = (PlayerEntity)p_77615_3_; - boolean flag = playerentity.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantments.field_185312_x, p_77615_1_) > 0; - ItemStack itemstack = playerentity.func_213356_f(p_77615_1_); + boolean flag = playerentity.abilities.instabuild || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY_ARROWS, p_77615_1_) > 0; + ItemStack itemstack = playerentity.getProjectile(p_77615_1_); + -+ int i = this.func_77626_a(p_77615_1_) - p_77615_4_; -+ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_77615_1_, p_77615_2_, playerentity, i, !itemstack.func_190926_b() || flag); ++ int i = this.getUseDuration(p_77615_1_) - p_77615_4_; ++ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_77615_1_, p_77615_2_, playerentity, i, !itemstack.isEmpty() || flag); + if (i < 0) return; + - if (!itemstack.func_190926_b() || flag) { - if (itemstack.func_190926_b()) { - itemstack = new ItemStack(Items.field_151032_g); + if (!itemstack.isEmpty() || flag) { + if (itemstack.isEmpty()) { + itemstack = new ItemStack(Items.ARROW); } -- int i = this.func_77626_a(p_77615_1_) - p_77615_4_; - float f = func_185059_b(i); +- int i = this.getUseDuration(p_77615_1_) - p_77615_4_; + float f = getPowerForTime(i); if (!((double)f < 0.1D)) { -- boolean flag1 = flag && itemstack.func_77973_b() == Items.field_151032_g; -+ boolean flag1 = playerentity.field_71075_bZ.field_75098_d || (itemstack.func_77973_b() instanceof ArrowItem && ((ArrowItem)itemstack.func_77973_b()).isInfinite(itemstack, p_77615_1_, playerentity)); - if (!p_77615_2_.field_72995_K) { - ArrowItem arrowitem = (ArrowItem)(itemstack.func_77973_b() instanceof ArrowItem ? itemstack.func_77973_b() : Items.field_151032_g); - AbstractArrowEntity abstractarrowentity = arrowitem.func_200887_a(p_77615_2_, itemstack, playerentity); +- boolean flag1 = flag && itemstack.getItem() == Items.ARROW; ++ boolean flag1 = playerentity.abilities.instabuild || (itemstack.getItem() instanceof ArrowItem && ((ArrowItem)itemstack.getItem()).isInfinite(itemstack, p_77615_1_, playerentity)); + if (!p_77615_2_.isClientSide) { + ArrowItem arrowitem = (ArrowItem)(itemstack.getItem() instanceof ArrowItem ? itemstack.getItem() : Items.ARROW); + AbstractArrowEntity abstractarrowentity = arrowitem.createArrow(p_77615_2_, itemstack, playerentity); + abstractarrowentity = customArrow(abstractarrowentity); - abstractarrowentity.func_234612_a_(playerentity, playerentity.field_70125_A, playerentity.field_70177_z, 0.0F, f * 3.0F, 1.0F); + abstractarrowentity.shootFromRotation(playerentity, playerentity.xRot, playerentity.yRot, 0.0F, f * 3.0F, 1.0F); if (f == 1.0F) { - abstractarrowentity.func_70243_d(true); + abstractarrowentity.setCritArrow(true); @@ -100,6 +_,10 @@ - public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { - ItemStack itemstack = p_77659_2_.func_184586_b(p_77659_3_); - boolean flag = !p_77659_2_.func_213356_f(itemstack).func_190926_b(); + public ActionResult use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { + ItemStack itemstack = p_77659_2_.getItemInHand(p_77659_3_); + boolean flag = !p_77659_2_.getProjectile(itemstack).isEmpty(); + + ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, p_77659_1_, p_77659_2_, p_77659_3_, flag); + if (ret != null) return ret; + - if (!p_77659_2_.field_71075_bZ.field_75098_d && !flag) { - return ActionResult.func_226251_d_(itemstack); + if (!p_77659_2_.abilities.instabuild && !flag) { + return ActionResult.fail(itemstack); } else { @@ -110,6 +_,10 @@ - public Predicate func_220004_b() { - return field_220007_a; + public Predicate getAllSupportedProjectiles() { + return ARROW_ONLY; + } + + public AbstractArrowEntity customArrow(AbstractArrowEntity arrow) { + return arrow; } - public int func_230305_d_() { + public int getDefaultProjectileRange() { diff --git a/patches/minecraft/net/minecraft/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/item/BucketItem.java.patch index b352028d79..3bf6771f35 100644 --- a/patches/minecraft/net/minecraft/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/BucketItem.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/item/BucketItem.java @@ -32,14 +_,28 @@ public class BucketItem extends Item { - private final Fluid field_77876_a; + private final Fluid content; + // Forge: Use the other constructor that takes a Supplier + @Deprecated public BucketItem(Fluid p_i49025_1_, Item.Properties p_i49025_2_) { super(p_i49025_2_); - this.field_77876_a = p_i49025_1_; + this.content = p_i49025_1_; + this.fluidSupplier = p_i49025_1_.delegate; + } + @@ -17,56 +17,56 @@ + */ + public BucketItem(java.util.function.Supplier supplier, Item.Properties builder) { + super(builder); -+ this.field_77876_a = null; ++ this.content = null; + this.fluidSupplier = supplier; } - public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { - ItemStack itemstack = p_77659_2_.func_184586_b(p_77659_3_); - RayTraceResult raytraceresult = func_219968_a(p_77659_1_, p_77659_2_, this.field_77876_a == Fluids.field_204541_a ? RayTraceContext.FluidMode.SOURCE_ONLY : RayTraceContext.FluidMode.NONE); + public ActionResult use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { + ItemStack itemstack = p_77659_2_.getItemInHand(p_77659_3_); + RayTraceResult raytraceresult = getPlayerPOVHitResult(p_77659_1_, p_77659_2_, this.content == Fluids.EMPTY ? RayTraceContext.FluidMode.SOURCE_ONLY : RayTraceContext.FluidMode.NONE); + ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_2_, p_77659_1_, itemstack, raytraceresult); + if (ret != null) return ret; - if (raytraceresult.func_216346_c() == RayTraceResult.Type.MISS) { - return ActionResult.func_226250_c_(itemstack); - } else if (raytraceresult.func_216346_c() != RayTraceResult.Type.BLOCK) { + if (raytraceresult.getType() == RayTraceResult.Type.MISS) { + return ActionResult.pass(itemstack); + } else if (raytraceresult.getType() != RayTraceResult.Type.BLOCK) { @@ -56,7 +_,10 @@ - Fluid fluid = ((IBucketPickupHandler)blockstate1.func_177230_c()).func_204508_a(p_77659_1_, blockpos, blockstate1); - if (fluid != Fluids.field_204541_a) { - p_77659_2_.func_71029_a(Stats.field_75929_E.func_199076_b(this)); -- p_77659_2_.func_184185_a(fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M, 1.0F, 1.0F); + Fluid fluid = ((IBucketPickupHandler)blockstate1.getBlock()).takeLiquid(p_77659_1_, blockpos, blockstate1); + if (fluid != Fluids.EMPTY) { + p_77659_2_.awardStat(Stats.ITEM_USED.get(this)); +- p_77659_2_.playSound(fluid.is(FluidTags.LAVA) ? SoundEvents.BUCKET_FILL_LAVA : SoundEvents.BUCKET_FILL, 1.0F, 1.0F); + -+ SoundEvent soundevent = this.field_77876_a.getAttributes().getFillSound(); -+ if (soundevent == null) soundevent = fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M; -+ p_77659_2_.func_184185_a(soundevent, 1.0F, 1.0F); - ItemStack itemstack1 = DrinkHelper.func_242398_a(itemstack, p_77659_2_, new ItemStack(fluid.func_204524_b())); - if (!p_77659_1_.field_72995_K) { - CriteriaTriggers.field_204813_j.func_204817_a((ServerPlayerEntity)p_77659_2_, new ItemStack(fluid.func_204524_b())); ++ SoundEvent soundevent = this.content.getAttributes().getFillSound(); ++ if (soundevent == null) soundevent = fluid.is(FluidTags.LAVA) ? SoundEvents.BUCKET_FILL_LAVA : SoundEvents.BUCKET_FILL; ++ p_77659_2_.playSound(soundevent, 1.0F, 1.0F); + ItemStack itemstack1 = DrinkHelper.createFilledResult(itemstack, p_77659_2_, new ItemStack(fluid.getBucket())); + if (!p_77659_1_.isClientSide) { + CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayerEntity)p_77659_2_, new ItemStack(fluid.getBucket())); @@ -69,7 +_,7 @@ - return ActionResult.func_226251_d_(itemstack); + return ActionResult.fail(itemstack); } else { - BlockState blockstate = p_77659_1_.func_180495_p(blockpos); -- BlockPos blockpos2 = blockstate.func_177230_c() instanceof ILiquidContainer && this.field_77876_a == Fluids.field_204546_a ? blockpos : blockpos1; + BlockState blockstate = p_77659_1_.getBlockState(blockpos); +- BlockPos blockpos2 = blockstate.getBlock() instanceof ILiquidContainer && this.content == Fluids.WATER ? blockpos : blockpos1; + BlockPos blockpos2 = canBlockContainFluid(p_77659_1_, blockpos, blockstate) ? blockpos : blockpos1; - if (this.func_180616_a(p_77659_2_, p_77659_1_, blockpos2, blockraytraceresult)) { - this.func_203792_a(p_77659_1_, itemstack, blockpos2); + if (this.emptyBucket(p_77659_2_, p_77659_1_, blockpos2, blockraytraceresult)) { + this.checkExtraContent(p_77659_1_, itemstack, blockpos2); if (p_77659_2_ instanceof ServerPlayerEntity) { @@ -117,7 +_,7 @@ } return true; -- } else if (block instanceof ILiquidContainer && this.field_77876_a == Fluids.field_204546_a) { -+ } else if (block instanceof ILiquidContainer && ((ILiquidContainer)block).func_204510_a(p_180616_2_,p_180616_3_,blockstate,field_77876_a)) { - ((ILiquidContainer)block).func_204509_a(p_180616_2_, p_180616_3_, blockstate, ((FlowingFluid)this.field_77876_a).func_207204_a(false)); - this.func_203791_b(p_180616_1_, p_180616_2_, p_180616_3_); +- } else if (block instanceof ILiquidContainer && this.content == Fluids.WATER) { ++ } else if (block instanceof ILiquidContainer && ((ILiquidContainer)block).canPlaceLiquid(p_180616_2_,p_180616_3_,blockstate,content)) { + ((ILiquidContainer)block).placeLiquid(p_180616_2_, p_180616_3_, blockstate, ((FlowingFluid)this.content).getSource(false)); + this.playEmptySound(p_180616_1_, p_180616_2_, p_180616_3_); return true; @@ -137,7 +_,24 @@ } - protected void func_203791_b(@Nullable PlayerEntity p_203791_1_, IWorld p_203791_2_, BlockPos p_203791_3_) { -- SoundEvent soundevent = this.field_77876_a.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187627_L : SoundEvents.field_187624_K; -+ SoundEvent soundevent = this.field_77876_a.getAttributes().getEmptySound(); -+ if(soundevent == null) soundevent = this.field_77876_a.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187627_L : SoundEvents.field_187624_K; - p_203791_2_.func_184133_a(p_203791_1_, p_203791_3_, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); + protected void playEmptySound(@Nullable PlayerEntity p_203791_1_, IWorld p_203791_2_, BlockPos p_203791_3_) { +- SoundEvent soundevent = this.content.is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY; ++ SoundEvent soundevent = this.content.getAttributes().getEmptySound(); ++ if(soundevent == null) soundevent = this.content.is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY; + p_203791_2_.playSound(p_203791_1_, p_203791_3_, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + + @Override @@ -82,6 +82,6 @@ + + private boolean canBlockContainFluid(World worldIn, BlockPos posIn, BlockState blockstate) + { -+ return blockstate.func_177230_c() instanceof ILiquidContainer && ((ILiquidContainer)blockstate.func_177230_c()).func_204510_a(worldIn, posIn, blockstate, this.field_77876_a); ++ return blockstate.getBlock() instanceof ILiquidContainer && ((ILiquidContainer)blockstate.getBlock()).canPlaceLiquid(worldIn, posIn, blockstate, this.content); } } diff --git a/patches/minecraft/net/minecraft/item/ChorusFruitItem.java.patch b/patches/minecraft/net/minecraft/item/ChorusFruitItem.java.patch index 8ee9db06ba..b0a23b597f 100644 --- a/patches/minecraft/net/minecraft/item/ChorusFruitItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ChorusFruitItem.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/item/ChorusFruitItem.java +++ b/net/minecraft/item/ChorusFruitItem.java @@ -29,7 +_,9 @@ - p_77654_3_.func_184210_p(); + p_77654_3_.stopRiding(); } -- if (p_77654_3_.func_213373_a(d3, d4, d5, true)) { +- if (p_77654_3_.randomTeleport(d3, d4, d5, true)) { + net.minecraftforge.event.entity.living.EntityTeleportEvent.ChorusFruit event = net.minecraftforge.event.ForgeEventFactory.onChorusFruitTeleport(p_77654_3_, d3, d4, d5); + if (event.isCanceled()) return itemstack; -+ if (p_77654_3_.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) { - SoundEvent soundevent = p_77654_3_ instanceof FoxEntity ? SoundEvents.field_232710_ez_ : SoundEvents.field_187544_ad; - p_77654_2_.func_184148_a((PlayerEntity)null, d0, d1, d2, soundevent, SoundCategory.PLAYERS, 1.0F, 1.0F); - p_77654_3_.func_184185_a(soundevent, 1.0F, 1.0F); ++ if (p_77654_3_.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) { + SoundEvent soundevent = p_77654_3_ instanceof FoxEntity ? SoundEvents.FOX_TELEPORT : SoundEvents.CHORUS_FRUIT_TELEPORT; + p_77654_2_.playSound((PlayerEntity)null, d0, d1, d2, soundevent, SoundCategory.PLAYERS, 1.0F, 1.0F); + p_77654_3_.playSound(soundevent, 1.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/item/DyeColor.java.patch index 0d66c222ed..c6f49ac9fe 100644 --- a/patches/minecraft/net/minecraft/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/item/DyeColor.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/item/DyeColor.java +++ b/net/minecraft/item/DyeColor.java @@ -41,6 +_,7 @@ - private final int field_196066_w; - private final float[] field_193352_x; - private final int field_196067_y; + private final int textureDiffuseColorBGR; + private final float[] textureDiffuseColors; + private final int fireworkColor; + private final net.minecraftforge.common.Tags.IOptionalNamedTag tag; - private final int field_218390_z; + private final int textColor; private DyeColor(int p_i50049_3_, String p_i50049_4_, int p_i50049_5_, MaterialColor p_i50049_6_, int p_i50049_7_, int p_i50049_8_) { @@ -53,6 +_,7 @@ int j = (p_i50049_5_ & '\uff00') >> 8; int k = (p_i50049_5_ & 255) >> 0; - this.field_196066_w = k << 16 | j << 8 | i << 0; + this.textureDiffuseColorBGR = k << 16 | j << 8 | i << 0; + this.tag = net.minecraft.tags.ItemTags.createOptional(new net.minecraft.util.ResourceLocation("forge", "dyes/" + p_i50049_4_)); - this.field_193352_x = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; - this.field_196067_y = p_i50049_7_; + this.textureDiffuseColors = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; + this.fireworkColor = p_i50049_7_; } @@ -110,5 +_,26 @@ - public String func_176610_l() { - return this.field_176785_v; + public String getSerializedName() { + return this.name; + } + + public int getColorValue() { -+ return field_193351_w; ++ return textureDiffuseColor; + } + + public net.minecraftforge.common.Tags.IOptionalNamedTag getTag() { @@ -32,11 +32,11 @@ + + @Nullable + public static DyeColor getColor(ItemStack stack) { -+ if (stack.func_77973_b() instanceof DyeItem) -+ return ((DyeItem)stack.func_77973_b()).func_195962_g(); ++ if (stack.getItem() instanceof DyeItem) ++ return ((DyeItem)stack.getItem()).getDyeColor(); + -+ for (DyeColor color : field_196062_q) { -+ if (stack.func_77973_b().func_206844_a(color.getTag())) ++ for (DyeColor color : BY_ID) { ++ if (stack.getItem().is(color.getTag())) + return color; + } + diff --git a/patches/minecraft/net/minecraft/item/ElytraItem.java.patch b/patches/minecraft/net/minecraft/item/ElytraItem.java.patch index 0962ccf458..0a3d91dfa3 100644 --- a/patches/minecraft/net/minecraft/item/ElytraItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ElytraItem.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/item/ElytraItem.java +++ b/net/minecraft/item/ElytraItem.java @@ -35,4 +_,17 @@ - return ActionResult.func_226251_d_(itemstack); + return ActionResult.fail(itemstack); } } + + @Override + public boolean canElytraFly(ItemStack stack, net.minecraft.entity.LivingEntity entity) { -+ return ElytraItem.func_185069_d(stack); ++ return ElytraItem.isFlyEnabled(stack); + } + + @Override + public boolean elytraFlightTick(ItemStack stack, net.minecraft.entity.LivingEntity entity, int flightTicks) { -+ if (!entity.field_70170_p.field_72995_K && (flightTicks + 1) % 20 == 0) { -+ stack.func_222118_a(1, entity, e -> e.func_213361_c(net.minecraft.inventory.EquipmentSlotType.CHEST)); ++ if (!entity.level.isClientSide && (flightTicks + 1) % 20 == 0) { ++ stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(net.minecraft.inventory.EquipmentSlotType.CHEST)); + } + return true; + } diff --git a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch index 9356ddf469..3fc396f1a4 100644 --- a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch +++ b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch @@ -3,9 +3,9 @@ @@ -52,6 +_,16 @@ @Nullable - public static MapData func_195950_a(ItemStack p_195950_0_, World p_195950_1_) { + public static MapData getOrCreateSavedData(ItemStack p_195950_0_, World p_195950_1_) { + // FORGE: Add instance method for mods to override -+ Item map = p_195950_0_.func_77973_b(); ++ Item map = p_195950_0_.getItem(); + if (map instanceof FilledMapItem) { + return ((FilledMapItem)map).getCustomMapData(p_195950_0_, p_195950_1_); + } @@ -14,6 +14,6 @@ + + @Nullable + protected MapData getCustomMapData(ItemStack p_195950_0_, World p_195950_1_) { - MapData mapdata = func_219994_a(p_195950_0_, p_195950_1_); + MapData mapdata = getSavedData(p_195950_0_, p_195950_1_); if (mapdata == null && p_195950_1_ instanceof ServerWorld) { - mapdata = func_195951_a(p_195950_0_, p_195950_1_, p_195950_1_.func_72912_H().func_76079_c(), p_195950_1_.func_72912_H().func_76074_e(), 3, false, false, p_195950_1_.func_234923_W_()); + mapdata = createAndStoreSavedData(p_195950_0_, p_195950_1_, p_195950_1_.getLevelData().getXSpawn(), p_195950_1_.getLevelData().getZSpawn(), 3, false, false, p_195950_1_.dimension()); diff --git a/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch b/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch index 7f8aaaa63a..97e1191092 100644 --- a/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/FishBucketItem.java.patch @@ -2,22 +2,22 @@ +++ b/net/minecraft/item/FishBucketItem.java @@ -27,9 +_,17 @@ public class FishBucketItem extends BucketItem { - private final EntityType field_203794_a; + private final EntityType type; + @Deprecated public FishBucketItem(EntityType p_i49022_1_, Fluid p_i49022_2_, Item.Properties p_i49022_3_) { super(p_i49022_2_, p_i49022_3_); - this.field_203794_a = p_i49022_1_; + this.type = p_i49022_1_; + this.fishTypeSupplier = () -> p_i49022_1_; + } + + public FishBucketItem(java.util.function.Supplier> fishTypeIn, java.util.function.Supplier p_i49022_2_, Item.Properties builder) { + super(p_i49022_2_, builder); -+ this.field_203794_a = null; ++ this.type = null; + this.fishTypeSupplier = fishTypeIn; } - public void func_203792_a(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) { + public void checkExtraContent(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) { @@ -79,5 +_,10 @@ } } diff --git a/patches/minecraft/net/minecraft/item/Food.java.patch b/patches/minecraft/net/minecraft/item/Food.java.patch index 85ae4920cb..4d29b74957 100644 --- a/patches/minecraft/net/minecraft/item/Food.java.patch +++ b/patches/minecraft/net/minecraft/item/Food.java.patch @@ -1,72 +1,72 @@ --- a/net/minecraft/item/Food.java +++ b/net/minecraft/item/Food.java @@ -11,15 +_,26 @@ - private final boolean field_221472_c; - private final boolean field_221473_d; - private final boolean field_221474_e; -- private final List> field_221475_f; + private final boolean isMeat; + private final boolean canAlwaysEat; + private final boolean fastFood; +- private final List> effects; - -+ private final List, Float>> field_221475_f; ++ private final List, Float>> effects; + + private Food(Food.Builder builder) { -+ this.field_221470_a = builder.field_221458_a; -+ this.field_221471_b = builder.field_221459_b; -+ this.field_221472_c = builder.field_221460_c; -+ this.field_221473_d = builder.field_221461_d; -+ this.field_221474_e = builder.field_221462_e; -+ this.field_221475_f = builder.field_221463_f; ++ this.nutrition = builder.nutrition; ++ this.saturationModifier = builder.saturationModifier; ++ this.isMeat = builder.isMeat; ++ this.canAlwaysEat = builder.canAlwaysEat; ++ this.fastFood = builder.fastFood; ++ this.effects = builder.effects; + } + + // Forge: Use builder method instead + @Deprecated private Food(int p_i50106_1_, float p_i50106_2_, boolean p_i50106_3_, boolean p_i50106_4_, boolean p_i50106_5_, List> p_i50106_6_) { - this.field_221470_a = p_i50106_1_; - this.field_221471_b = p_i50106_2_; - this.field_221472_c = p_i50106_3_; - this.field_221473_d = p_i50106_4_; - this.field_221474_e = p_i50106_5_; -- this.field_221475_f = p_i50106_6_; -+ this.field_221475_f = p_i50106_6_.stream().map(pair -> Pair., Float>of(pair::getFirst, pair.getSecond())).collect(java.util.stream.Collectors.toList()); + this.nutrition = p_i50106_1_; + this.saturationModifier = p_i50106_2_; + this.isMeat = p_i50106_3_; + this.canAlwaysEat = p_i50106_4_; + this.fastFood = p_i50106_5_; +- this.effects = p_i50106_6_; ++ this.effects = p_i50106_6_.stream().map(pair -> Pair., Float>of(pair::getFirst, pair.getSecond())).collect(java.util.stream.Collectors.toList()); } - public int func_221466_a() { + public int getNutrition() { @@ -43,7 +_,7 @@ } - public List> func_221464_f() { -- return this.field_221475_f; -+ return this.field_221475_f.stream().map(pair -> Pair.of(pair.getFirst() != null ? pair.getFirst().get() : null, pair.getSecond())).collect(java.util.stream.Collectors.toList()); + public List> getEffects() { +- return this.effects; ++ return this.effects.stream().map(pair -> Pair.of(pair.getFirst() != null ? pair.getFirst().get() : null, pair.getSecond())).collect(java.util.stream.Collectors.toList()); } public static class Builder { @@ -52,7 +_,7 @@ - private boolean field_221460_c; - private boolean field_221461_d; - private boolean field_221462_e; -- private final List> field_221463_f = Lists.newArrayList(); -+ private final List, Float>> field_221463_f = Lists.newArrayList(); + private boolean isMeat; + private boolean canAlwaysEat; + private boolean fastFood; +- private final List> effects = Lists.newArrayList(); ++ private final List, Float>> effects = Lists.newArrayList(); - public Food.Builder func_221456_a(int p_221456_1_) { - this.field_221458_a = p_221456_1_; + public Food.Builder nutrition(int p_221456_1_) { + this.nutrition = p_221456_1_; @@ -79,13 +_,20 @@ return this; } + public Food.Builder effect(java.util.function.Supplier effectIn, float probability) { -+ this.field_221463_f.add(Pair.of(effectIn, probability)); ++ this.effects.add(Pair.of(effectIn, probability)); + return this; + } + + // Forge: Use supplier method instead + @Deprecated - public Food.Builder func_221452_a(EffectInstance p_221452_1_, float p_221452_2_) { -- this.field_221463_f.add(Pair.of(p_221452_1_, p_221452_2_)); -+ this.field_221463_f.add(Pair.of(() -> p_221452_1_, p_221452_2_)); + public Food.Builder effect(EffectInstance p_221452_1_, float p_221452_2_) { +- this.effects.add(Pair.of(p_221452_1_, p_221452_2_)); ++ this.effects.add(Pair.of(() -> p_221452_1_, p_221452_2_)); return this; } - public Food func_221453_d() { -- return new Food(this.field_221458_a, this.field_221459_b, this.field_221460_c, this.field_221461_d, this.field_221462_e, this.field_221463_f); + public Food build() { +- return new Food(this.nutrition, this.saturationModifier, this.isMeat, this.canAlwaysEat, this.fastFood, this.effects); + return new Food(this); } } diff --git a/patches/minecraft/net/minecraft/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/item/HoeItem.java.patch index 8a5b881a49..970d1311ca 100644 --- a/patches/minecraft/net/minecraft/item/HoeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/HoeItem.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/item/HoeItem.java +++ b/net/minecraft/item/HoeItem.java @@ -21,14 +_,16 @@ - protected static final Map field_195973_b = Maps.newHashMap(ImmutableMap.of(Blocks.field_196658_i, Blocks.field_150458_ak.func_176223_P(), Blocks.field_185774_da, Blocks.field_150458_ak.func_176223_P(), Blocks.field_150346_d, Blocks.field_150458_ak.func_176223_P(), Blocks.field_196660_k, Blocks.field_150346_d.func_176223_P())); + protected static final Map TILLABLES = Maps.newHashMap(ImmutableMap.of(Blocks.GRASS_BLOCK, Blocks.FARMLAND.defaultBlockState(), Blocks.GRASS_PATH, Blocks.FARMLAND.defaultBlockState(), Blocks.DIRT, Blocks.FARMLAND.defaultBlockState(), Blocks.COARSE_DIRT, Blocks.DIRT.defaultBlockState())); public HoeItem(IItemTier p_i231595_1_, int p_i231595_2_, float p_i231595_3_, Item.Properties p_i231595_4_) { -- super((float)p_i231595_2_, p_i231595_3_, p_i231595_1_, field_234683_c_, p_i231595_4_); -+ super((float)p_i231595_2_, p_i231595_3_, p_i231595_1_, field_234683_c_, p_i231595_4_.addToolType(net.minecraftforge.common.ToolType.HOE, p_i231595_1_.func_200925_d())); +- super((float)p_i231595_2_, p_i231595_3_, p_i231595_1_, DIGGABLES, p_i231595_4_); ++ super((float)p_i231595_2_, p_i231595_3_, p_i231595_1_, DIGGABLES, p_i231595_4_.addToolType(net.minecraftforge.common.ToolType.HOE, p_i231595_1_.getLevel())); } - public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); -- if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { -- BlockState blockstate = field_195973_b.get(world.func_180495_p(blockpos).func_177230_c()); + public ActionResultType useOn(ItemUseContext p_195939_1_) { + World world = p_195939_1_.getLevel(); + BlockPos blockpos = p_195939_1_.getClickedPos(); +- if (p_195939_1_.getClickedFace() != Direction.DOWN && world.getBlockState(blockpos.above()).isAir()) { +- BlockState blockstate = TILLABLES.get(world.getBlockState(blockpos).getBlock()); + int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_195939_1_); + if (hook != 0) return hook > 0 ? ActionResultType.SUCCESS : ActionResultType.FAIL; -+ if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_175623_d(blockpos.func_177984_a())) { -+ BlockState blockstate = world.func_180495_p(blockpos).getToolModifiedState(world, blockpos, p_195939_1_.func_195999_j(), p_195939_1_.func_195996_i(), net.minecraftforge.common.ToolType.HOE); ++ if (p_195939_1_.getClickedFace() != Direction.DOWN && world.isEmptyBlock(blockpos.above())) { ++ BlockState blockstate = world.getBlockState(blockpos).getToolModifiedState(world, blockpos, p_195939_1_.getPlayer(), p_195939_1_.getItemInHand(), net.minecraftforge.common.ToolType.HOE); if (blockstate != null) { - PlayerEntity playerentity = p_195939_1_.func_195999_j(); - world.func_184133_a(playerentity, blockpos, SoundEvents.field_187693_cj, SoundCategory.BLOCKS, 1.0F, 1.0F); + PlayerEntity playerentity = p_195939_1_.getPlayer(); + world.playSound(playerentity, blockpos, SoundEvents.HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -46,5 +_,10 @@ } @@ -28,6 +28,6 @@ + + @javax.annotation.Nullable + public static BlockState getHoeTillingState(BlockState originalState) { -+ return field_195973_b.get(originalState.func_177230_c()); ++ return TILLABLES.get(originalState.getBlock()); } } diff --git a/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch b/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch index 92db15755d..067180bd13 100644 --- a/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch +++ b/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch @@ -3,9 +3,9 @@ @@ -6,17 +_,21 @@ public class HorseArmorItem extends Item { - private final int field_219978_a; -- private final String field_219979_b; -+ private final ResourceLocation field_219979_b; + private final int protection; +- private final String texture; ++ private final ResourceLocation texture; public HorseArmorItem(int p_i50042_1_, String p_i50042_2_, Item.Properties p_i50042_3_) { + this(p_i50042_1_, new ResourceLocation("textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"), p_i50042_3_); @@ -13,15 +13,15 @@ + + public HorseArmorItem(int p_i50042_1_, ResourceLocation texture, Item.Properties p_i50042_3_) { super(p_i50042_3_); - this.field_219978_a = p_i50042_1_; -- this.field_219979_b = "textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"; -+ this.field_219979_b = texture; + this.protection = p_i50042_1_; +- this.texture = "textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"; ++ this.texture = texture; } @OnlyIn(Dist.CLIENT) - public ResourceLocation func_219976_d() { -- return new ResourceLocation(this.field_219979_b); -+ return field_219979_b; + public ResourceLocation getTexture() { +- return new ResourceLocation(this.texture); ++ return texture; } - public int func_219977_e() { + public int getProtection() { diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index c8313ddb88..f82e7b4f63 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -5,90 +5,90 @@ import net.minecraftforge.api.distmarker.OnlyIn; -public class Item implements IItemProvider { -- public static final Map field_179220_a = Maps.newHashMap(); +- public static final Map BY_BLOCK = Maps.newHashMap(); +public class Item extends net.minecraftforge.registries.ForgeRegistryEntry implements IItemProvider, net.minecraftforge.common.extensions.IForgeItem { -+ public static final Map field_179220_a = net.minecraftforge.registries.GameData.getBlockItemMap(); - protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - protected static final UUID field_185050_h = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); - protected static final Random field_77697_d = new Random(); ++ public static final Map BY_BLOCK = net.minecraftforge.registries.GameData.getBlockItemMap(); + protected static final UUID BASE_ATTACK_DAMAGE_UUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + protected static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); + protected static final Random random = new Random(); @@ -77,6 +_,10 @@ - this.field_77777_bU = p_i48487_1_.field_200920_a; - this.field_219974_q = p_i48487_1_.field_221541_f; - this.field_234684_d_ = p_i48487_1_.field_234688_g_; + this.maxStackSize = p_i48487_1_.maxStackSize; + this.foodProperties = p_i48487_1_.foodProperties; + this.isFireResistant = p_i48487_1_.isFireResistant; + this.canRepair = p_i48487_1_.canRepair; + this.toolClasses.putAll(p_i48487_1_.toolClasses); + Object tmp = p_i48487_1_.ister == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.ister); + this.ister = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp; } - public void func_219972_a(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_) { + public void onUseTick(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_) { @@ -120,10 +_,12 @@ - return this.func_219971_r() ? p_77654_3_.func_213357_a(p_77654_2_, p_77654_1_) : p_77654_1_; + return this.isEdible() ? p_77654_3_.eat(p_77654_2_, p_77654_1_) : p_77654_1_; } + @Deprecated // Use ItemStack sensitive version. - public final int func_77639_j() { - return this.field_77777_bU; + public final int getMaxStackSize() { + return this.maxStackSize; } + @Deprecated // Use ItemStack sensitive version. - public final int func_77612_l() { - return this.field_77699_b; + public final int getMaxDamage() { + return this.maxDamage; } @@ -178,10 +_,12 @@ } @Nullable + @Deprecated // Use ItemStack sensitive version. - public final Item func_77668_q() { - return this.field_77700_c; + public final Item getCraftingRemainingItem() { + return this.craftingRemainingItem; } + @Deprecated // Use ItemStack sensitive version. - public boolean func_77634_r() { - return this.field_77700_c != null; + public boolean hasCraftingRemainingItem() { + return this.craftingRemainingItem != null; } @@ -241,7 +_,7 @@ } - public boolean func_77616_k(ItemStack p_77616_1_) { -- return this.func_77639_j() == 1 && this.func_77645_m(); + public boolean isEnchantable(ItemStack p_77616_1_) { +- return this.getMaxStackSize() == 1 && this.canBeDepleted(); + return this.getItemStackLimit(p_77616_1_) == 1 && this.isDamageable(p_77616_1_); } - protected static BlockRayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { + protected static BlockRayTraceResult getPlayerPOVHitResult(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { @@ -254,8 +_,8 @@ - float f5 = MathHelper.func_76126_a(-f * ((float)Math.PI / 180F)); + float f5 = MathHelper.sin(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; - double d0 = 5.0D; -- Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D); -+ double d0 = p_219968_1_.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e();; -+ Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); - return p_219968_0_.func_217299_a(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_)); +- Vector3d vector3d1 = vector3d.add((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D); ++ double d0 = p_219968_1_.getAttribute(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).getValue();; ++ Vector3d vector3d1 = vector3d.add((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); + return p_219968_0_.clip(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_)); } @@ -271,6 +_,7 @@ } - protected boolean func_194125_a(ItemGroup p_194125_1_) { + protected boolean allowdedIn(ItemGroup p_194125_1_) { + if (getCreativeTabs().stream().anyMatch(tab -> tab == p_194125_1_)) return true; - ItemGroup itemgroup = this.func_77640_w(); - return itemgroup != null && (p_194125_1_ == ItemGroup.field_78027_g || p_194125_1_ == itemgroup); + ItemGroup itemgroup = this.getItemCategory(); + return itemgroup != null && (p_194125_1_ == ItemGroup.TAB_SEARCH || p_194125_1_ == itemgroup); } @@ -284,10 +_,44 @@ return false; } + @Deprecated // Use ItemStack sensitive version. - public Multimap func_111205_h(EquipmentSlotType p_111205_1_) { + public Multimap getDefaultAttributeModifiers(EquipmentSlotType p_111205_1_) { return ImmutableMultimap.of(); } + @Nullable + private final java.util.function.Supplier ister; + private final java.util.Map toolClasses = Maps.newHashMap(); -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::func_199903_a); ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::getAllTags); + protected final boolean canRepair; + + @Override @@ -110,7 +110,7 @@ + @Override + public final net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer getItemStackTileEntityRenderer() { + net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = ister != null ? ister.get() : null; -+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a; ++ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.instance; + } + + @Override @@ -118,23 +118,23 @@ + return reverseTags.getTagNames(); + } + - public boolean func_219970_i(ItemStack p_219970_1_) { - return p_219970_1_.func_77973_b() == Items.field_222114_py; + public boolean useOnRelease(ItemStack p_219970_1_) { + return p_219970_1_.getItem() == Items.CROSSBOW; } @@ -333,6 +_,9 @@ - private Rarity field_208104_e = Rarity.COMMON; - private Food field_221541_f; - private boolean field_234688_g_; + private Rarity rarity = Rarity.COMMON; + private Food foodProperties; + private boolean isFireResistant; + private boolean canRepair = true; + private java.util.Map toolClasses = Maps.newHashMap(); + private java.util.function.Supplier> ister; - public Item.Properties func_221540_a(Food p_221540_1_) { - this.field_221541_f = p_221540_1_; + public Item.Properties food(Food p_221540_1_) { + this.foodProperties = p_221540_1_; @@ -375,6 +_,21 @@ - public Item.Properties func_234689_a_() { - this.field_234688_g_ = true; + public Item.Properties fireResistant() { + this.isFireResistant = true; + return this; + } + diff --git a/patches/minecraft/net/minecraft/item/ItemGroup.java.patch b/patches/minecraft/net/minecraft/item/ItemGroup.java.patch index f0ca3d2fdd..797da79c6a 100644 --- a/patches/minecraft/net/minecraft/item/ItemGroup.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemGroup.java.patch @@ -1,50 +1,50 @@ --- a/net/minecraft/item/ItemGroup.java +++ b/net/minecraft/item/ItemGroup.java @@ -101,18 +_,23 @@ - private final String field_78034_o; - private final ITextComponent field_242391_q; - private String field_199784_q; + private final String langId; + private final ITextComponent displayName; + private String recipeFolderName; + @Deprecated - private String field_78043_p = "items.png"; + private String backgroundSuffix = "items.png"; + private net.minecraft.util.ResourceLocation backgroundLocation; - private boolean field_78042_q = true; - private boolean field_78041_r = true; - private EnchantmentType[] field_111230_s = new EnchantmentType[0]; - private ItemStack field_151245_t; + private boolean canScroll = true; + private boolean showTitle = true; + private EnchantmentType[] enchantmentCategories = new EnchantmentType[0]; + private ItemStack iconItemStack; + public ItemGroup(String label) { + this(-1, label); + } + public ItemGroup(int p_i1853_1_, String p_i1853_2_) { -- this.field_78033_n = p_i1853_1_; - this.field_78034_o = p_i1853_2_; - this.field_242391_q = new TranslationTextComponent("itemGroup." + p_i1853_2_); - this.field_151245_t = ItemStack.field_190927_a; -- field_78032_a[p_i1853_1_] = this; -+ this.field_78033_n = addGroupSafe(p_i1853_1_, this); +- this.id = p_i1853_1_; + this.langId = p_i1853_2_; + this.displayName = new TranslationTextComponent("itemGroup." + p_i1853_2_); + this.iconItemStack = ItemStack.EMPTY; +- TABS[p_i1853_1_] = this; ++ this.id = addGroupSafe(p_i1853_1_, this); } @OnlyIn(Dist.CLIENT) @@ -141,16 +_,29 @@ @OnlyIn(Dist.CLIENT) - public abstract ItemStack func_78016_d(); + public abstract ItemStack makeIcon(); + /** + * @deprecated Forge use {@link #getBackgroundImage()} instead + */ @OnlyIn(Dist.CLIENT) + @Deprecated - public String func_78015_f() { - return this.field_78043_p; + public String getBackgroundSuffix() { + return this.backgroundSuffix; } + /** + * @deprecated Forge: use {@link #setBackgroundImage(net.minecraft.util.ResourceLocation)} instead + */ + @Deprecated - public ItemGroup func_78025_a(String p_78025_1_) { - this.field_78043_p = p_78025_1_; + public ItemGroup setBackgroundSuffix(String p_78025_1_) { + this.backgroundSuffix = p_78025_1_; return this; } @@ -53,35 +53,35 @@ + return this; + } + - public ItemGroup func_199783_b(String p_199783_1_) { - this.field_199784_q = p_199783_1_; + public ItemGroup setRecipeFolderName(String p_199783_1_) { + this.recipeFolderName = p_199783_1_; return this; @@ -178,11 +_,13 @@ @OnlyIn(Dist.CLIENT) - public int func_78020_k() { -+ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) % 5; - return this.field_78033_n % 6; + public int getColumn() { ++ if (id > 11) return ((id - 12) % 10) % 5; + return this.id % 6; } @OnlyIn(Dist.CLIENT) - public boolean func_78023_l() { -+ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) < 5; - return this.field_78033_n < 6; + public boolean isTopRow() { ++ if (id > 11) return ((id - 12) % 10) < 5; + return this.id < 6; } @@ -218,5 +_,60 @@ - item.func_150895_a(this, p_78018_1_); + item.fillItemCategory(this, p_78018_1_); } + } + + public int getTabPage() { -+ return field_78033_n < 12 ? 0 : ((field_78033_n - 12) / 10) + 1; ++ return id < 12 ? 0 : ((id - 12) / 10) + 1; + } + + public boolean hasSearchBar() { -+ return field_78033_n == field_78027_g.field_78033_n; ++ return id == TAB_SEARCH.id; + } + + /** @@ -97,7 +97,7 @@ + @OnlyIn(Dist.CLIENT) + public net.minecraft.util.ResourceLocation getBackgroundImage() { + if (backgroundLocation != null) return backgroundLocation; //FORGE: allow custom namespace -+ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.func_78015_f()); ++ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.getBackgroundSuffix()); + } + + private static final net.minecraft.util.ResourceLocation CREATIVE_INVENTORY_TABS = new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); @@ -115,19 +115,19 @@ + } + + public static synchronized int getGroupCountSafe() { -+ return ItemGroup.field_78032_a.length; ++ return ItemGroup.TABS.length; + } + + private static synchronized int addGroupSafe(int index, ItemGroup newGroup) { + if(index == -1) { -+ index = field_78032_a.length; ++ index = TABS.length; + } -+ if (index >= field_78032_a.length) { ++ if (index >= TABS.length) { + ItemGroup[] tmp = new ItemGroup[index + 1]; -+ System.arraycopy(field_78032_a, 0, tmp, 0, field_78032_a.length); -+ field_78032_a = tmp; ++ System.arraycopy(TABS, 0, tmp, 0, TABS.length); ++ TABS = tmp; + } -+ field_78032_a[index] = newGroup; ++ TABS[index] = newGroup; + return index; } } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 9e633a34b4..6cfe036def 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -6,21 +6,21 @@ -public final class ItemStack { +public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { - public static final Codec field_234691_a_ = RecordCodecBuilder.create((p_234698_0_) -> { - return p_234698_0_.group(Registry.field_212630_s.fieldOf("id").forGetter((p_234706_0_) -> { - return p_234706_0_.field_151002_e; + public static final Codec CODEC = RecordCodecBuilder.create((p_234698_0_) -> { + return p_234698_0_.group(Registry.ITEM.fieldOf("id").forGetter((p_234706_0_) -> { + return p_234706_0_.item; @@ -82,6 +_,9 @@ - return Optional.ofNullable(p_234704_0_.field_77990_d); + return Optional.ofNullable(p_234704_0_.tag); })).apply(p_234698_0_, ItemStack::new); }); + private final net.minecraftforge.registries.IRegistryDelegate delegate; + private CompoundNBT capNBT; + - private static final Logger field_199558_c = LogManager.getLogger(); - public static final ItemStack field_190927_a = new ItemStack((Item)null); - public static final DecimalFormat field_111284_a = Util.func_200696_a(new DecimalFormat("#.##"), (p_234699_0_) -> { + private static final Logger LOGGER = LogManager.getLogger(); + public static final ItemStack EMPTY = new ItemStack((Item)null); + public static final DecimalFormat ATTRIBUTE_MODIFIER_FORMAT = Util.make(new DecimalFormat("#.##"), (p_234699_0_) -> { @@ -109,10 +_,15 @@ - p_i231596_3_.ifPresent(this::func_77982_d); + p_i231596_3_.ifPresent(this::setTag); } - public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { @@ -28,13 +28,13 @@ + public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable CompoundNBT capNBT) { + super(ItemStack.class, true); + this.capNBT = capNBT; - this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j(); -+ this.delegate = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j().delegate; - this.field_77994_a = p_i48204_2_; -- if (this.field_151002_e != null && this.field_151002_e.func_77645_m()) { + this.item = p_i48204_1_ == null ? null : p_i48204_1_.asItem(); ++ this.delegate = p_i48204_1_ == null ? null : p_i48204_1_.asItem().delegate; + this.count = p_i48204_2_; +- if (this.item != null && this.item.canBeDepleted()) { + this.forgeInit(); -+ if (this.field_151002_e != null && this.field_151002_e.isDamageable(this)) { - this.func_196085_b(this.func_77952_i()); ++ if (this.item != null && this.item.isDamageable(this)) { + this.setDamageValue(this.getDamageValue()); } @@ -125,14 +_,18 @@ @@ -42,154 +42,154 @@ private ItemStack(CompoundNBT p_i47263_1_) { + super(ItemStack.class, true); -+ this.capNBT = p_i47263_1_.func_74764_b("ForgeCaps") ? p_i47263_1_.func_74775_l("ForgeCaps") : null; ++ this.capNBT = p_i47263_1_.contains("ForgeCaps") ? p_i47263_1_.getCompound("ForgeCaps") : null; + Item rawItem = - this.field_151002_e = Registry.field_212630_s.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id"))); + this.item = Registry.ITEM.get(new ResourceLocation(p_i47263_1_.getString("id"))); + this.delegate = rawItem.delegate; - this.field_77994_a = p_i47263_1_.func_74771_c("Count"); - if (p_i47263_1_.func_150297_b("tag", 10)) { - this.field_77990_d = p_i47263_1_.func_74775_l("tag"); - this.func_77973_b().func_179215_a(p_i47263_1_); + this.count = p_i47263_1_.getByte("Count"); + if (p_i47263_1_.contains("tag", 10)) { + this.tag = p_i47263_1_.getCompound("tag"); + this.getItem().verifyTagAfterLoad(p_i47263_1_); } - -- if (this.func_77973_b().func_77645_m()) { +- if (this.getItem().canBeDepleted()) { + this.forgeInit(); -+ if (this.func_77973_b().isDamageable(this)) { - this.func_196085_b(this.func_77952_i()); ++ if (this.getItem().isDamageable(this)) { + this.setDamageValue(this.getDamageValue()); } @@ -167,10 +_,19 @@ } - public Item func_77973_b() { -- return this.field_190928_g ? Items.field_190931_a : this.field_151002_e; -+ return this.field_190928_g || this.delegate == null ? Items.field_190931_a : this.delegate.get(); + public Item getItem() { +- return this.emptyCacheFlag ? Items.AIR : this.item; ++ return this.emptyCacheFlag || this.delegate == null ? Items.AIR : this.delegate.get(); } - public ActionResultType func_196084_a(ItemUseContext p_196084_1_) { -+ if (!p_196084_1_.func_195991_k().field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(p_196084_1_); -+ return onItemUse(p_196084_1_, (c) -> func_77973_b().func_195939_a(p_196084_1_)); + public ActionResultType useOn(ItemUseContext p_196084_1_) { ++ if (!p_196084_1_.getLevel().isClientSide) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(p_196084_1_); ++ return onItemUse(p_196084_1_, (c) -> getItem().useOn(p_196084_1_)); + } + + public ActionResultType onItemUseFirst(ItemUseContext p_196084_1_) { -+ return onItemUse(p_196084_1_, (c) -> func_77973_b().onItemUseFirst(this, p_196084_1_)); ++ return onItemUse(p_196084_1_, (c) -> getItem().onItemUseFirst(this, p_196084_1_)); + } + + private ActionResultType onItemUse(ItemUseContext p_196084_1_, java.util.function.Function callback) { - PlayerEntity playerentity = p_196084_1_.func_195999_j(); - BlockPos blockpos = p_196084_1_.func_195995_a(); - CachedBlockInfo cachedblockinfo = new CachedBlockInfo(p_196084_1_.func_195991_k(), blockpos, false); + PlayerEntity playerentity = p_196084_1_.getPlayer(); + BlockPos blockpos = p_196084_1_.getClickedPos(); + CachedBlockInfo cachedblockinfo = new CachedBlockInfo(p_196084_1_.getLevel(), blockpos, false); @@ -178,7 +_,7 @@ return ActionResultType.PASS; } else { - Item item = this.func_77973_b(); -- ActionResultType actionresulttype = item.func_195939_a(p_196084_1_); + Item item = this.getItem(); +- ActionResultType actionresulttype = item.useOn(p_196084_1_); + ActionResultType actionresulttype = callback.apply(p_196084_1_); - if (playerentity != null && actionresulttype.func_226246_a_()) { - playerentity.func_71029_a(Stats.field_75929_E.func_199076_b(item)); + if (playerentity != null && actionresulttype.consumesAction()) { + playerentity.awardStat(Stats.ITEM_USED.get(item)); } @@ -206,12 +_,15 @@ - if (this.field_77990_d != null) { - p_77955_1_.func_218657_a("tag", this.field_77990_d.func_74737_b()); + if (this.tag != null) { + p_77955_1_.put("tag", this.tag.copy()); } - + CompoundNBT cnbt = this.serializeCaps(); + if (cnbt != null && !cnbt.isEmpty()) { -+ p_77955_1_.func_218657_a("ForgeCaps", cnbt); ++ p_77955_1_.put("ForgeCaps", cnbt); + } return p_77955_1_; } - public int func_77976_d() { -- return this.func_77973_b().func_77639_j(); -+ return this.func_77973_b().getItemStackLimit(this); + public int getMaxStackSize() { +- return this.getItem().getMaxStackSize(); ++ return this.getItem().getItemStackLimit(this); } - public boolean func_77985_e() { + public boolean isStackable() { @@ -219,7 +_,7 @@ } - public boolean func_77984_f() { -- if (!this.field_190928_g && this.func_77973_b().func_77612_l() > 0) { -+ if (!this.field_190928_g && this.func_77973_b().isDamageable(this)) { - CompoundNBT compoundnbt = this.func_77978_p(); - return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable"); + public boolean isDamageableItem() { +- if (!this.emptyCacheFlag && this.getItem().getMaxDamage() > 0) { ++ if (!this.emptyCacheFlag && this.getItem().isDamageable(this)) { + CompoundNBT compoundnbt = this.getTag(); + return compoundnbt == null || !compoundnbt.getBoolean("Unbreakable"); } else { @@ -228,19 +_,19 @@ } - public boolean func_77951_h() { -- return this.func_77984_f() && this.func_77952_i() > 0; -+ return this.func_77984_f() && func_77973_b().isDamaged(this); + public boolean isDamaged() { +- return this.isDamageableItem() && this.getDamageValue() > 0; ++ return this.isDamageableItem() && getItem().isDamaged(this); } - public int func_77952_i() { -- return this.field_77990_d == null ? 0 : this.field_77990_d.func_74762_e("Damage"); -+ return this.func_77973_b().getDamage(this); + public int getDamageValue() { +- return this.tag == null ? 0 : this.tag.getInt("Damage"); ++ return this.getItem().getDamage(this); } - public void func_196085_b(int p_196085_1_) { -- this.func_196082_o().func_74768_a("Damage", Math.max(0, p_196085_1_)); -+ this.func_77973_b().setDamage(this, p_196085_1_); + public void setDamageValue(int p_196085_1_) { +- this.getOrCreateTag().putInt("Damage", Math.max(0, p_196085_1_)); ++ this.getItem().setDamage(this, p_196085_1_); } - public int func_77958_k() { -- return this.func_77973_b().func_77612_l(); -+ return this.func_77973_b().getMaxDamage(this); + public int getMaxDamage() { +- return this.getItem().getMaxDamage(); ++ return this.getItem().getMaxDamage(this); } - public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { + public boolean hurt(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { @@ -276,6 +_,7 @@ - public void func_222118_a(int p_222118_1_, T p_222118_2_, Consumer p_222118_3_) { - if (!p_222118_2_.field_70170_p.field_72995_K && (!(p_222118_2_ instanceof PlayerEntity) || !((PlayerEntity)p_222118_2_).field_71075_bZ.field_75098_d)) { - if (this.func_77984_f()) { -+ p_222118_1_ = this.func_77973_b().damageItem(this, p_222118_1_, p_222118_2_, p_222118_3_); - if (this.func_96631_a(p_222118_1_, p_222118_2_.func_70681_au(), p_222118_2_ instanceof ServerPlayerEntity ? (ServerPlayerEntity)p_222118_2_ : null)) { + public void hurtAndBreak(int p_222118_1_, T p_222118_2_, Consumer p_222118_3_) { + if (!p_222118_2_.level.isClientSide && (!(p_222118_2_ instanceof PlayerEntity) || !((PlayerEntity)p_222118_2_).abilities.instabuild)) { + if (this.isDamageableItem()) { ++ p_222118_1_ = this.getItem().damageItem(this, p_222118_1_, p_222118_2_, p_222118_3_); + if (this.hurt(p_222118_1_, p_222118_2_.getRandom(), p_222118_2_ instanceof ServerPlayerEntity ? (ServerPlayerEntity)p_222118_2_ : null)) { p_222118_3_.accept(p_222118_2_); - Item item = this.func_77973_b(); + Item item = this.getItem(); @@ -308,7 +_,7 @@ } - public boolean func_150998_b(BlockState p_150998_1_) { -- return this.func_77973_b().func_150897_b(p_150998_1_); -+ return this.func_77973_b().canHarvestBlock(this, p_150998_1_); + public boolean isCorrectToolForDrops(BlockState p_150998_1_) { +- return this.getItem().isCorrectToolForDrops(p_150998_1_); ++ return this.getItem().canHarvestBlock(this, p_150998_1_); } - public ActionResultType func_111282_a_(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { + public ActionResultType interactLivingEntity(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { @@ -319,7 +_,7 @@ - if (this.func_190926_b()) { - return field_190927_a; + if (this.isEmpty()) { + return EMPTY; } else { -- ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a); -+ ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a, this.serializeCaps()); - itemstack.func_190915_d(this.func_190921_D()); - if (this.field_77990_d != null) { - itemstack.field_77990_d = this.field_77990_d.func_74737_b(); +- ItemStack itemstack = new ItemStack(this.getItem(), this.count); ++ ItemStack itemstack = new ItemStack(this.getItem(), this.count, this.serializeCaps()); + itemstack.setPopTime(this.getPopTime()); + if (this.tag != null) { + itemstack.tag = this.tag.copy(); @@ -336,7 +_,7 @@ - if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) { + if (p_77970_0_.tag == null && p_77970_1_.tag != null) { return false; } else { -- return p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d); -+ return (p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d)) && p_77970_0_.areCapsCompatible(p_77970_1_); +- return p_77970_0_.tag == null || p_77970_0_.tag.equals(p_77970_1_.tag); ++ return (p_77970_0_.tag == null || p_77970_0_.tag.equals(p_77970_1_.tag)) && p_77970_0_.areCapsCompatible(p_77970_1_); } } else { return false; @@ -359,7 +_,7 @@ - } else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) { + } else if (this.tag == null && p_77959_1_.tag != null) { return false; } else { -- return this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d); -+ return (this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d)) && this.areCapsCompatible(p_77959_1_); +- return this.tag == null || this.tag.equals(p_77959_1_.tag); ++ return (this.tag == null || this.tag.equals(p_77959_1_.tag)) && this.areCapsCompatible(p_77959_1_); } } @@ -479,7 +_,7 @@ - public void func_77982_d(@Nullable CompoundNBT p_77982_1_) { - this.field_77990_d = p_77982_1_; -- if (this.func_77973_b().func_77645_m()) { -+ if (this.func_77973_b().isDamageable(this)) { - this.func_196085_b(this.func_77952_i()); + public void setTag(@Nullable CompoundNBT p_77982_1_) { + this.tag = p_77982_1_; +- if (this.getItem().canBeDepleted()) { ++ if (this.getItem().isDamageable(this)) { + this.setDamageValue(this.getDamageValue()); } @@ -673,6 +_,7 @@ @@ -204,8 +204,8 @@ } } } else { -- multimap = this.func_77973_b().func_111205_h(p_111283_1_); -+ multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this); +- multimap = this.getItem().getDefaultAttributeModifiers(p_111283_1_); ++ multimap = this.getItem().getAttributeModifiers(p_111283_1_, this); } + multimap = net.minecraftforge.common.ForgeHooks.getAttributeModifiers(this, p_111283_1_, multimap); @@ -214,14 +214,14 @@ @@ -952,6 +_,23 @@ - public boolean func_222117_E() { - return this.func_77973_b().func_219971_r(); + public boolean isEdible() { + return this.getItem().isEdible(); + } + + // FORGE START + public void deserializeNBT(CompoundNBT nbt) { -+ final ItemStack itemStack = ItemStack.func_199557_a(nbt); -+ getStack().func_77982_d(itemStack.func_77978_p()); ++ final ItemStack itemStack = ItemStack.of(nbt); ++ getStack().setTag(itemStack.getTag()); + if (itemStack.capNBT != null) deserializeCaps(itemStack.capNBT); + } + @@ -230,9 +230,9 @@ + */ + private void forgeInit() { + if (this.delegate != null) { -+ this.gatherCapabilities(() -> field_151002_e.initCapabilities(this, this.capNBT)); ++ this.gatherCapabilities(() -> item.initCapabilities(this, this.capNBT)); + if (this.capNBT != null) deserializeCaps(this.capNBT); + } } - public SoundEvent func_226629_F_() { + public SoundEvent getDrinkingSound() { diff --git a/patches/minecraft/net/minecraft/item/Items.java.patch b/patches/minecraft/net/minecraft/item/Items.java.patch index ae9b605329..26639b7269 100644 --- a/patches/minecraft/net/minecraft/item/Items.java.patch +++ b/patches/minecraft/net/minecraft/item/Items.java.patch @@ -6,5 +6,5 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class Items { - public static final Item field_190931_a = func_221546_a(Blocks.field_150350_a, new AirItem(Blocks.field_150350_a, new Item.Properties())); - public static final Item field_221574_b = func_221542_a(Blocks.field_150348_b, ItemGroup.field_78030_b); + public static final Item AIR = registerBlock(Blocks.AIR, new AirItem(Blocks.AIR, new Item.Properties())); + public static final Item STONE = registerBlock(Blocks.STONE, ItemGroup.TAB_BUILDING_BLOCKS); diff --git a/patches/minecraft/net/minecraft/item/MerchantOffer.java.patch b/patches/minecraft/net/minecraft/item/MerchantOffer.java.patch index f65fdb132c..7f674cfcf8 100644 --- a/patches/minecraft/net/minecraft/item/MerchantOffer.java.patch +++ b/patches/minecraft/net/minecraft/item/MerchantOffer.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/item/MerchantOffer.java +++ b/net/minecraft/item/MerchantOffer.java @@ -74,7 +_,7 @@ - int i = this.field_222223_a.func_190916_E(); - ItemStack itemstack = this.field_222223_a.func_77946_l(); - int j = Math.max(0, MathHelper.func_76141_d((float)(i * this.field_222230_h) * this.field_222231_i)); -- itemstack.func_190920_e(MathHelper.func_76125_a(i + j + this.field_222229_g, 1, this.field_222223_a.func_77973_b().func_77639_j())); -+ itemstack.func_190920_e(MathHelper.func_76125_a(i + j + this.field_222229_g, 1, this.field_222223_a.func_77976_d())); + int i = this.baseCostA.getCount(); + ItemStack itemstack = this.baseCostA.copy(); + int j = Math.max(0, MathHelper.floor((float)(i * this.demand) * this.priceMultiplier)); +- itemstack.setCount(MathHelper.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getItem().getMaxStackSize())); ++ itemstack.setCount(MathHelper.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getMaxStackSize())); return itemstack; } @@ -178,7 +_,7 @@ return true; } else { - ItemStack itemstack = p_222201_1_.func_77946_l(); -- if (itemstack.func_77973_b().func_77645_m()) { -+ if (itemstack.func_77973_b().isDamageable(itemstack)) { - itemstack.func_196085_b(itemstack.func_77952_i()); + ItemStack itemstack = p_222201_1_.copy(); +- if (itemstack.getItem().canBeDepleted()) { ++ if (itemstack.getItem().isDamageable(itemstack)) { + itemstack.setDamageValue(itemstack.getDamageValue()); } diff --git a/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch index b6248d2897..78e596700f 100644 --- a/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch @@ -3,27 +3,27 @@ @@ -16,6 +_,8 @@ } - public ItemStack func_77654_b(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_) { -+ if (!p_77654_2_.field_72995_K) p_77654_3_.curePotionEffects(p_77654_1_); // FORGE - move up so stack.shrink does not turn stack into air + public ItemStack finishUsingItem(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_) { ++ if (!p_77654_2_.isClientSide) p_77654_3_.curePotionEffects(p_77654_1_); // FORGE - move up so stack.shrink does not turn stack into air + if (p_77654_3_ instanceof ServerPlayerEntity) { ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)p_77654_3_; - CriteriaTriggers.field_193138_y.func_193148_a(serverplayerentity, p_77654_1_); + CriteriaTriggers.CONSUME_ITEM.trigger(serverplayerentity, p_77654_1_); @@ -26,10 +_,6 @@ - p_77654_1_.func_190918_g(1); + p_77654_1_.shrink(1); } -- if (!p_77654_2_.field_72995_K) { -- p_77654_3_.func_195061_cb(); +- if (!p_77654_2_.isClientSide) { +- p_77654_3_.removeAllEffects(); - } - - return p_77654_1_.func_190926_b() ? new ItemStack(Items.field_151133_ar) : p_77654_1_; + return p_77654_1_.isEmpty() ? new ItemStack(Items.BUCKET) : p_77654_1_; } @@ -43,5 +_,10 @@ - public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { - return DrinkHelper.func_234707_a_(p_77659_1_, p_77659_2_, p_77659_3_); + public ActionResult use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { + return DrinkHelper.useDrink(p_77659_1_, p_77659_2_, p_77659_3_); + } + + @Override diff --git a/patches/minecraft/net/minecraft/item/MinecartItem.java.patch b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch index 06a4f97435..d7cbe2cf2f 100644 --- a/patches/minecraft/net/minecraft/item/MinecartItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/item/MinecartItem.java +++ b/net/minecraft/item/MinecartItem.java @@ -26,7 +_,7 @@ - double d2 = p_82487_1_.func_82616_c() + (double)direction.func_82599_e() * 1.125D; - BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(direction); - BlockState blockstate = world.func_180495_p(blockpos); -- RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; -+ RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; + double d2 = p_82487_1_.z() + (double)direction.getStepZ() * 1.125D; + BlockPos blockpos = p_82487_1_.getPos().relative(direction); + BlockState blockstate = world.getBlockState(blockpos); +- RailShape railshape = blockstate.getBlock() instanceof AbstractRailBlock ? blockstate.getValue(((AbstractRailBlock)blockstate.getBlock()).getShapeProperty()) : RailShape.NORTH_SOUTH; ++ RailShape railshape = blockstate.getBlock() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.getBlock()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; double d3; - if (blockstate.func_235714_a_(BlockTags.field_203437_y)) { - if (railshape.func_208092_c()) { + if (blockstate.is(BlockTags.RAILS)) { + if (railshape.isAscending()) { @@ -79,7 +_,7 @@ } else { - ItemStack itemstack = p_195939_1_.func_195996_i(); - if (!world.field_72995_K) { -- RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; -+ RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; + ItemStack itemstack = p_195939_1_.getItemInHand(); + if (!world.isClientSide) { +- RailShape railshape = blockstate.getBlock() instanceof AbstractRailBlock ? blockstate.getValue(((AbstractRailBlock)blockstate.getBlock()).getShapeProperty()) : RailShape.NORTH_SOUTH; ++ RailShape railshape = blockstate.getBlock() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.getBlock()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; double d0 = 0.0D; - if (railshape.func_208092_c()) { + if (railshape.isAscending()) { d0 = 0.5D; diff --git a/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch b/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch index cb1f977324..60a995c713 100644 --- a/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch +++ b/patches/minecraft/net/minecraft/item/MusicDiscItem.java.patch @@ -5,19 +5,19 @@ public class MusicDiscItem extends Item { + @Deprecated // Forge: refer to WorldRender#playRecord. Modders: there's no need to reflectively modify this map! - private static final Map field_150928_b = Maps.newHashMap(); - private final int field_195977_c; + private static final Map BY_NAME = Maps.newHashMap(); + private final int analogOutput; + @Deprecated // Forge: refer to soundSupplier - private final SoundEvent field_185076_b; + private final SoundEvent sound; + private final java.util.function.Supplier soundSupplier; + @Deprecated // Forge: Use the constructor that takes a supplier instead public MusicDiscItem(int p_i48475_1_, SoundEvent p_i48475_2_, Item.Properties p_i48475_3_) { super(p_i48475_3_); - this.field_195977_c = p_i48475_1_; - this.field_185076_b = p_i48475_2_; - field_150928_b.put(this.field_185076_b, this); -+ this.soundSupplier = this.field_185076_b.delegate; + this.analogOutput = p_i48475_1_; + this.sound = p_i48475_2_; + BY_NAME.put(this.sound, this); ++ this.soundSupplier = this.sound.delegate; + } + + /** @@ -33,17 +33,17 @@ + public MusicDiscItem(int comparatorValue, java.util.function.Supplier soundSupplier, Item.Properties builder) + { + super(builder); -+ this.field_195977_c = comparatorValue; -+ this.field_185076_b = null; ++ this.analogOutput = comparatorValue; ++ this.sound = null; + this.soundSupplier = soundSupplier; } - public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { + public ActionResultType useOn(ItemUseContext p_195939_1_) { @@ -77,6 +_,6 @@ @OnlyIn(Dist.CLIENT) - public SoundEvent func_185075_h() { -- return this.field_185076_b; + public SoundEvent getSound() { +- return this.sound; + return this.soundSupplier.get(); } } diff --git a/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch index e47c4aacad..650f4a4e62 100644 --- a/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch +++ b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/item/PickaxeItem.java +++ b/net/minecraft/item/PickaxeItem.java @@ -11,25 +_,16 @@ - private static final Set field_150915_c = ImmutableSet.of(Blocks.field_150408_cc, Blocks.field_150365_q, Blocks.field_150347_e, Blocks.field_150319_E, Blocks.field_150484_ah, Blocks.field_150482_ag, Blocks.field_196552_aC, Blocks.field_150340_R, Blocks.field_150352_o, Blocks.field_235334_I_, Blocks.field_150432_aD, Blocks.field_150339_S, Blocks.field_150366_p, Blocks.field_150368_y, Blocks.field_150369_x, Blocks.field_150341_Y, Blocks.field_150424_aL, Blocks.field_150403_cj, Blocks.field_205164_gk, Blocks.field_150448_aq, Blocks.field_150450_ax, Blocks.field_150322_A, Blocks.field_196583_aj, Blocks.field_196585_ak, Blocks.field_196798_hA, Blocks.field_196799_hB, Blocks.field_180395_cM, Blocks.field_150348_b, Blocks.field_196650_c, Blocks.field_196652_d, Blocks.field_196654_e, Blocks.field_196655_f, Blocks.field_196656_g, Blocks.field_196657_h, Blocks.field_150333_U, Blocks.field_222401_hJ, Blocks.field_196640_bx, Blocks.field_196643_by, Blocks.field_196646_bz, Blocks.field_196571_bA, Blocks.field_196573_bB, Blocks.field_196575_bC, Blocks.field_196576_bD, Blocks.field_196578_bE, Blocks.field_185771_cX, Blocks.field_196581_bI, Blocks.field_196582_bJ, Blocks.field_196580_bH, Blocks.field_196579_bG, Blocks.field_150430_aB, Blocks.field_150456_au, Blocks.field_222446_lj, Blocks.field_222447_lk, Blocks.field_222448_ll, Blocks.field_222449_lm, Blocks.field_222450_ln, Blocks.field_222451_lo, Blocks.field_222452_lp, Blocks.field_222453_lq, Blocks.field_222454_lr, Blocks.field_222455_ls, Blocks.field_222456_lt, Blocks.field_222457_lu, Blocks.field_222458_lv, Blocks.field_204409_il, Blocks.field_190975_dA, Blocks.field_190988_dw, Blocks.field_190989_dx, Blocks.field_190986_du, Blocks.field_190984_ds, Blocks.field_190990_dy, Blocks.field_190980_do, Blocks.field_196875_ie, Blocks.field_190982_dq, Blocks.field_190979_dn, Blocks.field_190978_dm, Blocks.field_190983_dr, Blocks.field_190987_dv, Blocks.field_190991_dz, Blocks.field_190977_dl, Blocks.field_190981_dp, Blocks.field_150331_J, Blocks.field_150320_F, Blocks.field_150332_K); + private static final Set DIGGABLES = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD); public PickaxeItem(IItemTier p_i48478_1_, int p_i48478_2_, float p_i48478_3_, Item.Properties p_i48478_4_) { -- super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, field_150915_c, p_i48478_4_); -+ super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, field_150915_c, p_i48478_4_.addToolType(net.minecraftforge.common.ToolType.PICKAXE, p_i48478_1_.func_200925_d())); +- super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, DIGGABLES, p_i48478_4_); ++ super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, DIGGABLES, p_i48478_4_.addToolType(net.minecraftforge.common.ToolType.PICKAXE, p_i48478_1_.getLevel())); } - public boolean func_150897_b(BlockState p_150897_1_) { - int i = this.func_200891_e().func_200925_d(); -- if (!p_150897_1_.func_203425_a(Blocks.field_150343_Z) && !p_150897_1_.func_203425_a(Blocks.field_235399_ni_) && !p_150897_1_.func_203425_a(Blocks.field_235397_ng_) && !p_150897_1_.func_203425_a(Blocks.field_235400_nj_) && !p_150897_1_.func_203425_a(Blocks.field_235398_nh_)) { -- if (!p_150897_1_.func_203425_a(Blocks.field_150484_ah) && !p_150897_1_.func_203425_a(Blocks.field_150482_ag) && !p_150897_1_.func_203425_a(Blocks.field_150412_bA) && !p_150897_1_.func_203425_a(Blocks.field_150475_bE) && !p_150897_1_.func_203425_a(Blocks.field_150340_R) && !p_150897_1_.func_203425_a(Blocks.field_150352_o) && !p_150897_1_.func_203425_a(Blocks.field_150450_ax)) { -- if (!p_150897_1_.func_203425_a(Blocks.field_150339_S) && !p_150897_1_.func_203425_a(Blocks.field_150366_p) && !p_150897_1_.func_203425_a(Blocks.field_150368_y) && !p_150897_1_.func_203425_a(Blocks.field_150369_x)) { -- Material material = p_150897_1_.func_185904_a(); -- return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g || p_150897_1_.func_203425_a(Blocks.field_235334_I_); + public boolean isCorrectToolForDrops(BlockState p_150897_1_) { + int i = this.getTier().getLevel(); +- if (!p_150897_1_.is(Blocks.OBSIDIAN) && !p_150897_1_.is(Blocks.CRYING_OBSIDIAN) && !p_150897_1_.is(Blocks.NETHERITE_BLOCK) && !p_150897_1_.is(Blocks.RESPAWN_ANCHOR) && !p_150897_1_.is(Blocks.ANCIENT_DEBRIS)) { +- if (!p_150897_1_.is(Blocks.DIAMOND_BLOCK) && !p_150897_1_.is(Blocks.DIAMOND_ORE) && !p_150897_1_.is(Blocks.EMERALD_ORE) && !p_150897_1_.is(Blocks.EMERALD_BLOCK) && !p_150897_1_.is(Blocks.GOLD_BLOCK) && !p_150897_1_.is(Blocks.GOLD_ORE) && !p_150897_1_.is(Blocks.REDSTONE_ORE)) { +- if (!p_150897_1_.is(Blocks.IRON_BLOCK) && !p_150897_1_.is(Blocks.IRON_ORE) && !p_150897_1_.is(Blocks.LAPIS_BLOCK) && !p_150897_1_.is(Blocks.LAPIS_ORE)) { +- Material material = p_150897_1_.getMaterial(); +- return material == Material.STONE || material == Material.METAL || material == Material.HEAVY_METAL || p_150897_1_.is(Blocks.NETHER_GOLD_ORE); - } else { - return i >= 1; - } @@ -26,8 +26,8 @@ + if (p_150897_1_.getHarvestTool() == net.minecraftforge.common.ToolType.PICKAXE) { + return i >= p_150897_1_.getHarvestLevel(); } -+ Material material = p_150897_1_.func_185904_a(); -+ return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g; ++ Material material = p_150897_1_.getMaterial(); ++ return material == Material.STONE || material == Material.METAL || material == Material.HEAVY_METAL; } - public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { + public float getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_) { diff --git a/patches/minecraft/net/minecraft/item/Rarity.java.patch b/patches/minecraft/net/minecraft/item/Rarity.java.patch index 9565b68918..005116424c 100644 --- a/patches/minecraft/net/minecraft/item/Rarity.java.patch +++ b/patches/minecraft/net/minecraft/item/Rarity.java.patch @@ -12,7 +12,7 @@ @@ -12,5 +_,9 @@ private Rarity(TextFormatting p_i48837_3_) { - this.field_77937_e = p_i48837_3_; + this.color = p_i48837_3_; + } + + public static Rarity create(String name, TextFormatting p_i48837_3_) { diff --git a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch index cb69250577..df866f6160 100644 --- a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch @@ -6,20 +6,20 @@ } + + @Override -+ public net.minecraft.util.ActionResultType func_111207_a(ItemStack stack, net.minecraft.entity.player.PlayerEntity playerIn, LivingEntity entity, net.minecraft.util.Hand hand) { -+ if (entity.field_70170_p.field_72995_K) return net.minecraft.util.ActionResultType.PASS; ++ public net.minecraft.util.ActionResultType interactLivingEntity(ItemStack stack, net.minecraft.entity.player.PlayerEntity playerIn, LivingEntity entity, net.minecraft.util.Hand hand) { ++ if (entity.level.isClientSide) return net.minecraft.util.ActionResultType.PASS; + if (entity instanceof net.minecraftforge.common.IForgeShearable) { + net.minecraftforge.common.IForgeShearable target = (net.minecraftforge.common.IForgeShearable)entity; -+ BlockPos pos = new BlockPos(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_()); -+ if (target.isShearable(stack, entity.field_70170_p, pos)) { -+ java.util.List drops = target.onSheared(playerIn, stack, entity.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185308_t, stack)); ++ BlockPos pos = new BlockPos(entity.getX(), entity.getY(), entity.getZ()); ++ if (target.isShearable(stack, entity.level, pos)) { ++ java.util.List drops = target.onSheared(playerIn, stack, entity.level, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.enchantment.Enchantments.BLOCK_FORTUNE, stack)); + java.util.Random rand = new java.util.Random(); + drops.forEach(d -> { -+ net.minecraft.entity.item.ItemEntity ent = entity.func_70099_a(d, 1.0F); -+ ent.func_213317_d(ent.func_213322_ci().func_72441_c((double)((rand.nextFloat() - rand.nextFloat()) * 0.1F), (double)(rand.nextFloat() * 0.05F), (double)((rand.nextFloat() - rand.nextFloat()) * 0.1F))); ++ net.minecraft.entity.item.ItemEntity ent = entity.spawnAtLocation(d, 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))); + }); -+ stack.func_222118_a(1, entity, e -> e.func_213334_d(hand)); ++ stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(hand)); + } + return net.minecraft.util.ActionResultType.SUCCESS; + } diff --git a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch index c43c54fdbb..d0b52ec627 100644 --- a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/item/ShovelItem.java +++ b/net/minecraft/item/ShovelItem.java @@ -22,7 +_,7 @@ - protected static final Map field_195955_e = Maps.newHashMap(ImmutableMap.of(Blocks.field_196658_i, Blocks.field_185774_da.func_176223_P())); + protected static final Map FLATTENABLES = Maps.newHashMap(ImmutableMap.of(Blocks.GRASS_BLOCK, Blocks.GRASS_PATH.defaultBlockState())); public ShovelItem(IItemTier p_i48469_1_, float p_i48469_2_, float p_i48469_3_, Item.Properties p_i48469_4_) { -- super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_); -+ super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_.addToolType(net.minecraftforge.common.ToolType.SHOVEL, p_i48469_1_.func_200925_d())); +- super(p_i48469_2_, p_i48469_3_, p_i48469_1_, DIGGABLES, p_i48469_4_); ++ super(p_i48469_2_, p_i48469_3_, p_i48469_1_, DIGGABLES, p_i48469_4_.addToolType(net.minecraftforge.common.ToolType.SHOVEL, p_i48469_1_.getLevel())); } - public boolean func_150897_b(BlockState p_150897_1_) { + public boolean isCorrectToolForDrops(BlockState p_150897_1_) { @@ -37,9 +_,9 @@ return ActionResultType.PASS; } else { - PlayerEntity playerentity = p_195939_1_.func_195999_j(); -- BlockState blockstate1 = field_195955_e.get(blockstate.func_177230_c()); -+ BlockState blockstate1 = blockstate.getToolModifiedState(world, blockpos, playerentity, p_195939_1_.func_195996_i(), net.minecraftforge.common.ToolType.SHOVEL); + PlayerEntity playerentity = p_195939_1_.getPlayer(); +- BlockState blockstate1 = FLATTENABLES.get(blockstate.getBlock()); ++ BlockState blockstate1 = blockstate.getToolModifiedState(world, blockpos, playerentity, p_195939_1_.getItemInHand(), net.minecraftforge.common.ToolType.SHOVEL); BlockState blockstate2 = null; -- if (blockstate1 != null && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { -+ if (blockstate1 != null && world.func_175623_d(blockpos.func_177984_a())) { - world.func_184133_a(playerentity, blockpos, SoundEvents.field_187771_eN, SoundCategory.BLOCKS, 1.0F, 1.0F); +- if (blockstate1 != null && world.getBlockState(blockpos.above()).isAir()) { ++ if (blockstate1 != null && world.isEmptyBlock(blockpos.above())) { + world.playSound(playerentity, blockpos, SoundEvents.SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F); blockstate2 = blockstate1; - } else if (blockstate.func_177230_c() instanceof CampfireBlock && blockstate.func_177229_b(CampfireBlock.field_220101_b)) { + } else if (blockstate.getBlock() instanceof CampfireBlock && blockstate.getValue(CampfireBlock.LIT)) { @@ -66,5 +_,10 @@ return ActionResultType.PASS; } @@ -29,6 +29,6 @@ + + @javax.annotation.Nullable + public static BlockState getShovelPathingState(BlockState originalState) { -+ return field_195955_e.get(originalState.func_177230_c()); ++ return FLATTENABLES.get(originalState.getBlock()); } } diff --git a/patches/minecraft/net/minecraft/item/SpawnEggItem.java.patch b/patches/minecraft/net/minecraft/item/SpawnEggItem.java.patch index 22c296d5f8..413cddb129 100644 --- a/patches/minecraft/net/minecraft/item/SpawnEggItem.java.patch +++ b/patches/minecraft/net/minecraft/item/SpawnEggItem.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/item/SpawnEggItem.java +++ b/net/minecraft/item/SpawnEggItem.java @@ -39,11 +_,14 @@ - private final int field_195989_d; - private final EntityType field_200890_d; + private final int color2; + private final EntityType defaultType; + /** @deprecated Forge: Use {@link net.minecraftforge.common.ForgeSpawnEggItem} instead for suppliers */ + @Deprecated public SpawnEggItem(EntityType p_i48465_1_, int p_i48465_2_, int p_i48465_3_, Item.Properties p_i48465_4_) { super(p_i48465_4_); - this.field_200890_d = p_i48465_1_; - this.field_195988_c = p_i48465_2_; - this.field_195989_d = p_i48465_3_; + this.defaultType = p_i48465_1_; + this.color1 = p_i48465_2_; + this.color2 = p_i48465_3_; + if (p_i48465_1_ != null) - field_195987_b.put(p_i48465_1_, this); + BY_ID.put(p_i48465_1_, this); } @@ -124,6 +_,8 @@ - return p_195983_1_ == 0 ? this.field_195988_c : this.field_195989_d; + return p_195983_1_ == 0 ? this.color1 : this.color2; } + /** @deprecated Forge: call {@link net.minecraftforge.common.ForgeSpawnEggItem#fromEntityType(EntityType)} instead */ + @Deprecated @Nullable - public static SpawnEggItem func_200889_b(@Nullable EntityType p_200889_0_) { - return field_195987_b.get(p_200889_0_); + public static SpawnEggItem byId(@Nullable EntityType p_200889_0_) { + return BY_ID.get(p_200889_0_); diff --git a/patches/minecraft/net/minecraft/item/ToolItem.java.patch b/patches/minecraft/net/minecraft/item/ToolItem.java.patch index 3551b3acf9..bd430c20c0 100644 --- a/patches/minecraft/net/minecraft/item/ToolItem.java.patch +++ b/patches/minecraft/net/minecraft/item/ToolItem.java.patch @@ -3,8 +3,8 @@ @@ -33,6 +_,7 @@ } - public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { -+ if (getToolTypes(p_150893_1_).stream().anyMatch(e -> p_150893_2_.isToolEffective(e))) return field_77864_a; - return this.field_150914_c.contains(p_150893_2_.func_177230_c()) ? this.field_77864_a : 1.0F; + public float getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_) { ++ if (getToolTypes(p_150893_1_).stream().anyMatch(e -> p_150893_2_.isToolEffective(e))) return speed; + return this.blocks.contains(p_150893_2_.getBlock()) ? this.speed : 1.0F; } diff --git a/patches/minecraft/net/minecraft/item/WallOrFloorItem.java.patch b/patches/minecraft/net/minecraft/item/WallOrFloorItem.java.patch index 49cfa859e6..b3e7e7d989 100644 --- a/patches/minecraft/net/minecraft/item/WallOrFloorItem.java.patch +++ b/patches/minecraft/net/minecraft/item/WallOrFloorItem.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/item/WallOrFloorItem.java +++ b/net/minecraft/item/WallOrFloorItem.java @@ -41,4 +_,9 @@ - super.func_195946_a(p_195946_1_, p_195946_2_); - p_195946_1_.put(this.field_195947_b, p_195946_2_); + super.registerBlocks(p_195946_1_, p_195946_2_); + p_195946_1_.put(this.wallBlock, p_195946_2_); } + + public void removeFromBlockToItemMap(Map blockToItemMap, Item itemIn) { + super.removeFromBlockToItemMap(blockToItemMap, itemIn); -+ blockToItemMap.remove(this.field_195947_b); ++ blockToItemMap.remove(this.wallBlock); + } } diff --git a/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch index 1b6284a603..5816d0c4ff 100644 --- a/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch @@ -2,12 +2,12 @@ +++ b/net/minecraft/item/crafting/BannerDuplicateRecipe.java @@ -77,8 +_,8 @@ for(int i = 0; i < nonnulllist.size(); ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); - if (!itemstack.func_190926_b()) { -- if (itemstack.func_77973_b().func_77634_r()) { -- nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q())); + ItemStack itemstack = p_179532_1_.getItem(i); + if (!itemstack.isEmpty()) { +- if (itemstack.getItem().hasCraftingRemainingItem()) { +- nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); + if (itemstack.hasContainerItem()) { + nonnulllist.set(i, itemstack.getContainerItem()); - } else if (itemstack.func_77942_o() && BannerTileEntity.func_175113_c(itemstack) > 0) { - ItemStack itemstack1 = itemstack.func_77946_l(); - itemstack1.func_190920_e(1); + } else if (itemstack.hasTag() && BannerTileEntity.getPatternCount(itemstack) > 0) { + ItemStack itemstack1 = itemstack.copy(); + itemstack1.setCount(1); diff --git a/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch index f1d3741cc4..6f98ad953a 100644 --- a/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch @@ -3,11 +3,11 @@ @@ -79,8 +_,8 @@ for(int i = 0; i < nonnulllist.size(); ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); -- if (itemstack.func_77973_b().func_77634_r()) { -- nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q())); + ItemStack itemstack = p_179532_1_.getItem(i); +- if (itemstack.getItem().hasCraftingRemainingItem()) { +- nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); + if (itemstack.hasContainerItem()) { + nonnulllist.set(i, itemstack.getContainerItem()); - } else if (itemstack.func_77973_b() instanceof WrittenBookItem) { - ItemStack itemstack1 = itemstack.func_77946_l(); - itemstack1.func_190920_e(1); + } else if (itemstack.getItem() instanceof WrittenBookItem) { + ItemStack itemstack1 = itemstack.copy(); + itemstack1.setCount(1); diff --git a/patches/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch index d629985363..7131cfd4d0 100644 --- a/patches/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/CookingRecipeSerializer.java.patch @@ -6,25 +6,25 @@ -public class CookingRecipeSerializer implements IRecipeSerializer { +public class CookingRecipeSerializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { - private final int field_222178_t; - private final CookingRecipeSerializer.IFactory field_222179_u; + private final int defaultCookingTime; + private final CookingRecipeSerializer.IFactory factory; @@ -21,11 +_,17 @@ - String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); - JsonElement jsonelement = (JsonElement)(JSONUtils.func_151202_d(p_199425_2_, "ingredient") ? JSONUtils.func_151214_t(p_199425_2_, "ingredient") : JSONUtils.func_152754_s(p_199425_2_, "ingredient")); - Ingredient ingredient = Ingredient.func_199802_a(jsonelement); + String s = JSONUtils.getAsString(p_199425_2_, "group", ""); + JsonElement jsonelement = (JsonElement)(JSONUtils.isArrayNode(p_199425_2_, "ingredient") ? JSONUtils.getAsJsonArray(p_199425_2_, "ingredient") : JSONUtils.getAsJsonObject(p_199425_2_, "ingredient")); + Ingredient ingredient = Ingredient.fromJson(jsonelement); + //Forge: Check if primitive string to keep vanilla or a object which can contain a count field. + if (!p_199425_2_.has("result")) throw new com.google.gson.JsonSyntaxException("Missing result, expected to find a string or object"); + ItemStack itemstack; -+ if (p_199425_2_.get("result").isJsonObject()) itemstack = ShapedRecipe.func_199798_a(JSONUtils.func_152754_s(p_199425_2_, "result")); ++ if (p_199425_2_.get("result").isJsonObject()) itemstack = ShapedRecipe.itemFromJson(JSONUtils.getAsJsonObject(p_199425_2_, "result")); + else { - String s1 = JSONUtils.func_151200_h(p_199425_2_, "result"); + String s1 = JSONUtils.getAsString(p_199425_2_, "result"); ResourceLocation resourcelocation = new ResourceLocation(s1); -- ItemStack itemstack = new ItemStack(Registry.field_212630_s.func_241873_b(resourcelocation).orElseThrow(() -> { -+ itemstack = new ItemStack(Registry.field_212630_s.func_241873_b(resourcelocation).orElseThrow(() -> { +- ItemStack itemstack = new ItemStack(Registry.ITEM.getOptional(resourcelocation).orElseThrow(() -> { ++ itemstack = new ItemStack(Registry.ITEM.getOptional(resourcelocation).orElseThrow(() -> { return new IllegalStateException("Item: " + s1 + " does not exist"); })); + } - float f = JSONUtils.func_151221_a(p_199425_2_, "experience", 0.0F); - int i = JSONUtils.func_151208_a(p_199425_2_, "cookingtime", this.field_222178_t); - return this.field_222179_u.create(p_199425_1_, s, ingredient, itemstack, f, i); + float f = JSONUtils.getAsFloat(p_199425_2_, "experience", 0.0F); + int i = JSONUtils.getAsInt(p_199425_2_, "cookingtime", this.defaultCookingTime); + return this.factory.create(p_199425_1_, s, ingredient, itemstack, f, i); diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch index 0b7a9feeaa..7e83fcc938 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/item/crafting/IRecipe.java +++ b/net/minecraft/item/crafting/IRecipe.java @@ -21,9 +_,9 @@ - NonNullList nonnulllist = NonNullList.func_191197_a(p_179532_1_.func_70302_i_(), ItemStack.field_190927_a); + NonNullList nonnulllist = NonNullList.withSize(p_179532_1_.getContainerSize(), ItemStack.EMPTY); for(int i = 0; i < nonnulllist.size(); ++i) { -- Item item = p_179532_1_.func_70301_a(i).func_77973_b(); -- if (item.func_77634_r()) { -- nonnulllist.set(i, new ItemStack(item.func_77668_q())); -+ ItemStack item = p_179532_1_.func_70301_a(i); +- Item item = p_179532_1_.getItem(i).getItem(); +- if (item.hasCraftingRemainingItem()) { +- nonnulllist.set(i, new ItemStack(item.getCraftingRemainingItem())); ++ ItemStack item = p_179532_1_.getItem(i); + if (item.hasContainerItem()) { + nonnulllist.set(i, item.getContainerItem()); } diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch index ef27dea0a2..f181fb3842 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/item/crafting/IRecipePlacer.java +++ b/net/minecraft/item/crafting/IRecipePlacer.java @@ -7,10 +_,10 @@ - default void func_201501_a(int p_201501_1_, int p_201501_2_, int p_201501_3_, IRecipe p_201501_4_, Iterator p_201501_5_, int p_201501_6_) { + default void placeRecipe(int p_201501_1_, int p_201501_2_, int p_201501_3_, IRecipe p_201501_4_, Iterator p_201501_5_, int p_201501_6_) { int i = p_201501_1_; int j = p_201501_2_; - if (p_201501_4_ instanceof ShapedRecipe) { - ShapedRecipe shapedrecipe = (ShapedRecipe)p_201501_4_; -- i = shapedrecipe.func_192403_f(); -- j = shapedrecipe.func_192404_g(); +- i = shapedrecipe.getWidth(); +- j = shapedrecipe.getHeight(); + if (p_201501_4_ instanceof net.minecraftforge.common.crafting.IShapedRecipe) { + net.minecraftforge.common.crafting.IShapedRecipe shapedrecipe = (net.minecraftforge.common.crafting.IShapedRecipe)p_201501_4_; + i = shapedrecipe.getRecipeWidth(); diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch index 75c16b6924..30ed0ae1ff 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch @@ -6,14 +6,14 @@ -public interface IRecipeSerializer> { +public interface IRecipeSerializer> extends net.minecraftforge.registries.IForgeRegistryEntry> { - IRecipeSerializer field_222157_a = func_222156_a("crafting_shaped", new ShapedRecipe.Serializer()); - IRecipeSerializer field_222158_b = func_222156_a("crafting_shapeless", new ShapelessRecipe.Serializer()); - SpecialRecipeSerializer field_222159_c = func_222156_a("crafting_special_armordye", new SpecialRecipeSerializer<>(ArmorDyeRecipe::new)); + IRecipeSerializer SHAPED_RECIPE = register("crafting_shaped", new ShapedRecipe.Serializer()); + IRecipeSerializer SHAPELESS_RECIPE = register("crafting_shapeless", new ShapelessRecipe.Serializer()); + SpecialRecipeSerializer ARMOR_DYE = register("crafting_special_armordye", new SpecialRecipeSerializer<>(ArmorDyeRecipe::new)); @@ -30,6 +_,7 @@ - T func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_); + T fromJson(ResourceLocation p_199425_1_, JsonObject p_199425_2_); + @javax.annotation.Nullable - T func_199426_a_(ResourceLocation p_199426_1_, PacketBuffer p_199426_2_); + T fromNetwork(ResourceLocation p_199426_1_, PacketBuffer p_199426_2_); - void func_199427_a_(PacketBuffer p_199427_1_, T p_199427_2_); + void toNetwork(PacketBuffer p_199427_1_, T p_199427_2_); diff --git a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch index 1cbd1f824a..c5af934f3e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch @@ -10,43 +10,43 @@ + INSTANCES.stream().filter(e -> e != null).forEach(i -> i.invalidate()); + } + - public static final Ingredient field_193370_a = new Ingredient(Stream.empty()); - private final Ingredient.IItemList[] field_199807_b; - private ItemStack[] field_193371_b; - private IntList field_194140_c; + public static final Ingredient EMPTY = new Ingredient(Stream.empty()); + private final Ingredient.IItemList[] values; + private ItemStack[] itemStacks; + private IntList stackingIds; + private final boolean isSimple; protected Ingredient(Stream p_i49381_1_) { - this.field_199807_b = p_i49381_1_.toArray((p_209360_0_) -> { + this.values = p_i49381_1_.toArray((p_209360_0_) -> { return new Ingredient.IItemList[p_209360_0_]; }); -+ this.isSimple = !net.minecraftforge.fml.DatagenModLoader.isRunningDataGen() && !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().isDamageable(stack))); ++ this.isSimple = !net.minecraftforge.fml.DatagenModLoader.isRunningDataGen() && !Arrays.stream(values).anyMatch(list -> list.getItems().stream().anyMatch(stack -> stack.getItem().isDamageable(stack))); + Ingredient.INSTANCES.add(this); } - public ItemStack[] func_193365_a() { + public ItemStack[] getItems() { @@ -91,6 +_,10 @@ - public final void func_199564_a(PacketBuffer p_199564_1_) { - this.func_199806_d(); + public final void toNetwork(PacketBuffer p_199564_1_) { + this.dissolve(); + if (!this.isVanilla()) { + net.minecraftforge.common.crafting.CraftingHelper.write(p_199564_1_, this); + return; + } - p_199564_1_.func_150787_b(this.field_193371_b.length); + p_199564_1_.writeVarInt(this.itemStacks.length); - for(int i = 0; i < this.field_193371_b.length; ++i) { + for(int i = 0; i < this.itemStacks.length; ++i) { @@ -117,6 +_,25 @@ - return this.field_199807_b.length == 0 && (this.field_193371_b == null || this.field_193371_b.length == 0) && (this.field_194140_c == null || this.field_194140_c.isEmpty()); + return this.values.length == 0 && (this.itemStacks == null || this.itemStacks.length == 0) && (this.stackingIds == null || this.stackingIds.isEmpty()); } + protected void invalidate() { -+ this.field_193371_b = null; -+ this.field_194140_c = null; ++ this.itemStacks = null; ++ this.stackingIds = null; + } + + public boolean isSimple() { -+ return isSimple || this == field_193370_a; ++ return isSimple || this == EMPTY; + } + + private final boolean isVanilla = this.getClass() == Ingredient.class; @@ -59,27 +59,27 @@ + return net.minecraftforge.common.crafting.VanillaIngredientSerializer.INSTANCE; + } + - public static Ingredient func_209357_a(Stream p_209357_0_) { + public static Ingredient fromValues(Stream p_209357_0_) { Ingredient ingredient = new Ingredient(p_209357_0_); - return ingredient.field_199807_b.length == 0 ? field_193370_a : ingredient; + return ingredient.values.length == 0 ? EMPTY : ingredient; @@ -144,6 +_,9 @@ - public static Ingredient func_199566_b(PacketBuffer p_199566_0_) { - int i = p_199566_0_.func_150792_a(); + public static Ingredient fromNetwork(PacketBuffer p_199566_0_) { + int i = p_199566_0_.readVarInt(); + if (i == -1) { -+ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.func_192575_l(), p_199566_0_); ++ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.readResourceLocation(), p_199566_0_); + } - return func_209357_a(Stream.generate(() -> { - return new Ingredient.SingleItemList(p_199566_0_.func_150791_c()); + return fromValues(Stream.generate(() -> { + return new Ingredient.SingleItemList(p_199566_0_.readItem()); }).limit((long)i)); @@ -151,6 +_,8 @@ - public static Ingredient func_199802_a(@Nullable JsonElement p_199802_0_) { + public static Ingredient fromJson(@Nullable JsonElement p_199802_0_) { if (p_199802_0_ != null && !p_199802_0_.isJsonNull()) { + Ingredient ret = net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199802_0_); + if (ret != null) return ret; if (p_199802_0_.isJsonObject()) { - return func_209357_a(Stream.of(func_199803_a(p_199802_0_.getAsJsonObject()))); + return fromValues(Stream.of(valueFromJson(p_199802_0_.getAsJsonObject()))); } else if (p_199802_0_.isJsonArray()) { @@ -192,6 +_,12 @@ } @@ -88,18 +88,18 @@ + //Merges several vanilla Ingredients together. As a quirk of how the json is structured, we can't tell if its a single Ingredient type or multiple so we split per item and re-merge here. + //Only public for internal use, so we can access a private field in here. + public static Ingredient merge(Collection parts) { -+ return func_209357_a(parts.stream().flatMap(i -> Arrays.stream(i.field_199807_b))); ++ return fromValues(parts.stream().flatMap(i -> Arrays.stream(i.values))); + } + public interface IItemList { - Collection func_199799_a(); + Collection getItems(); @@ -230,6 +_,9 @@ list.add(new ItemStack(item)); } + if (list.size() == 0 && !net.minecraftforge.common.ForgeConfig.SERVER.treatEmptyTagsAsAir.get()) { -+ list.add(new ItemStack(net.minecraft.block.Blocks.field_180401_cv).func_200302_a(new net.minecraft.util.text.StringTextComponent("Empty Tag: " + TagCollectionManager.func_242178_a().func_241836_b().func_232975_b_(this.field_199800_a).toString()))); ++ list.add(new ItemStack(net.minecraft.block.Blocks.BARRIER).setHoverName(new net.minecraft.util.text.StringTextComponent("Empty Tag: " + TagCollectionManager.getInstance().getItems().getIdOrThrow(this.tag).toString()))); + } return list; } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch index 43bf8a2d52..d8dcc871da 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch @@ -4,18 +4,18 @@ for(Entry entry : p_212853_1_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); -+ if (resourcelocation.func_110623_a().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. ++ if (resourcelocation.getPath().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. try { + if (entry.getValue().isJsonObject() && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(entry.getValue().getAsJsonObject(), "conditions")) { -+ field_199521_c.debug("Skipping loading recipe {} as it's conditions were not met", resourcelocation); ++ LOGGER.debug("Skipping loading recipe {} as it's conditions were not met", resourcelocation); + continue; + } - IRecipe irecipe = func_215377_a(resourcelocation, JSONUtils.func_151210_l(entry.getValue(), "top element")); + IRecipe irecipe = fromJson(resourcelocation, JSONUtils.convertToJsonObject(entry.getValue(), "top element")); + if (irecipe == null) { -+ field_199521_c.info("Skipping loading recipe {} as it's serializer returned null", resourcelocation); ++ LOGGER.info("Skipping loading recipe {} as it's serializer returned null", resourcelocation); + continue; + } - map.computeIfAbsent(irecipe.func_222127_g(), (p_223391_0_) -> { + map.computeIfAbsent(irecipe.getType(), (p_223391_0_) -> { return ImmutableMap.builder(); }).put(resourcelocation, irecipe); diff --git a/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch index d99a724046..c978533c64 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RepairItemRecipe.java.patch @@ -4,8 +4,8 @@ list.add(itemstack); if (list.size() > 1) { ItemStack itemstack1 = list.get(0); -- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.func_77973_b().func_77645_m()) { -+ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.isRepairable()) { +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted()) { ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable()) { return false; } } @@ -13,26 +13,26 @@ list.add(itemstack); if (list.size() > 1) { ItemStack itemstack1 = list.get(0); -- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.func_77973_b().func_77645_m()) { -+ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.isRepairable()) { - return ItemStack.field_190927_a; +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted()) { ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable()) { + return ItemStack.EMPTY; } } @@ -56,12 +_,12 @@ if (list.size() == 2) { ItemStack itemstack3 = list.get(0); ItemStack itemstack4 = list.get(1); -- if (itemstack3.func_77973_b() == itemstack4.func_77973_b() && itemstack3.func_190916_E() == 1 && itemstack4.func_190916_E() == 1 && itemstack3.func_77973_b().func_77645_m()) { -+ if (itemstack3.func_77973_b() == itemstack4.func_77973_b() && itemstack3.func_190916_E() == 1 && itemstack4.func_190916_E() == 1 && itemstack3.isRepairable()) { - Item item = itemstack3.func_77973_b(); -- int j = item.func_77612_l() - itemstack3.func_77952_i(); -- int k = item.func_77612_l() - itemstack4.func_77952_i(); -- int l = j + k + item.func_77612_l() * 5 / 100; -- int i1 = item.func_77612_l() - l; -+ int j = itemstack3.func_77958_k() - itemstack3.func_77952_i(); -+ int k = itemstack3.func_77958_k() - itemstack4.func_77952_i(); -+ int l = j + k + itemstack3.func_77958_k() * 5 / 100; -+ int i1 = itemstack3.func_77958_k() - l; +- if (itemstack3.getItem() == itemstack4.getItem() && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.getItem().canBeDepleted()) { ++ if (itemstack3.getItem() == itemstack4.getItem() && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.isRepairable()) { + Item item = itemstack3.getItem(); +- int j = item.getMaxDamage() - itemstack3.getDamageValue(); +- int k = item.getMaxDamage() - itemstack4.getDamageValue(); +- int l = j + k + item.getMaxDamage() * 5 / 100; +- int i1 = item.getMaxDamage() - l; ++ int j = itemstack3.getMaxDamage() - itemstack3.getDamageValue(); ++ int k = itemstack3.getMaxDamage() - itemstack4.getDamageValue(); ++ int l = j + k + itemstack3.getMaxDamage() * 5 / 100; ++ int i1 = itemstack3.getMaxDamage() - l; if (i1 < 0) { i1 = 0; } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch index 46aef2bf4e..e2f5e7aa04 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch @@ -19,33 +19,33 @@ + if (MAX_HEIGHT < height) MAX_HEIGHT = height; + } + - private final int field_77576_b; - private final int field_77577_c; - private final NonNullList field_77574_d; + private final int width; + private final int height; + private final NonNullList recipeItems; @@ -109,10 +_,20 @@ - return this.field_77576_b; + return this.width; } + @Override + public int getRecipeWidth() { -+ return func_192403_f(); ++ return getWidth(); + } + - public int func_192404_g() { - return this.field_77577_c; + public int getHeight() { + return this.height; } + @Override + public int getRecipeHeight() { -+ return func_192404_g(); ++ return getHeight(); + } + - private static NonNullList func_192402_a(String[] p_192402_0_, Map p_192402_1_, int p_192402_2_, int p_192402_3_) { - NonNullList nonnulllist = NonNullList.func_191197_a(p_192402_2_ * p_192402_3_, Ingredient.field_193370_a); + private static NonNullList dissolvePattern(String[] p_192402_0_, Map p_192402_1_, int p_192402_2_, int p_192402_3_) { + NonNullList nonnulllist = NonNullList.withSize(p_192402_2_ * p_192402_3_, Ingredient.EMPTY); Set set = Sets.newHashSet(p_192402_1_.keySet()); @@ -192,15 +_,15 @@ - private static String[] func_192407_a(JsonArray p_192407_0_) { + private static String[] patternFromJson(JsonArray p_192407_0_) { String[] astring = new String[p_192407_0_.size()]; - if (astring.length > 3) { - throw new JsonSyntaxException("Invalid pattern: too many rows, 3 is maximum"); @@ -55,7 +55,7 @@ throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed"); } else { for(int i = 0; i < astring.length; ++i) { - String s = JSONUtils.func_151206_a(p_192407_0_.get(i), "pattern[" + i + "]"); + String s = JSONUtils.convertToString(p_192407_0_.get(i), "pattern[" + i + "]"); - if (s.length() > 3) { - throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum"); + if (s.length() > MAX_WIDTH) { @@ -66,7 +66,7 @@ @@ -242,11 +_,12 @@ throw new JsonParseException("Disallowed data tag found"); } else { - int i = JSONUtils.func_151208_a(p_199798_0_, "count", 1); + int i = JSONUtils.getAsInt(p_199798_0_, "count", 1); - return new ItemStack(item, i); + return net.minecraftforge.common.crafting.CraftingHelper.getItemStack(p_199798_0_, true); } @@ -75,6 +75,6 @@ - public static class Serializer implements IRecipeSerializer { + public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shaped"); - public ShapedRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); - Map map = ShapedRecipe.func_192408_a(JSONUtils.func_152754_s(p_199425_2_, "key")); + public ShapedRecipe fromJson(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { + String s = JSONUtils.getAsString(p_199425_2_, "group", ""); + Map map = ShapedRecipe.keyFromJson(JSONUtils.getAsJsonObject(p_199425_2_, "key")); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch index 82815f5b69..306512d68e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch @@ -1,52 +1,52 @@ --- a/net/minecraft/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/item/crafting/ShapelessRecipe.java @@ -17,12 +_,14 @@ - private final String field_194138_c; - private final ItemStack field_77580_a; - private final NonNullList field_77579_b; + private final String group; + private final ItemStack result; + private final NonNullList ingredients; + private final boolean isSimple; public ShapelessRecipe(ResourceLocation p_i48161_1_, String p_i48161_2_, ItemStack p_i48161_3_, NonNullList p_i48161_4_) { - this.field_199562_a = p_i48161_1_; - this.field_194138_c = p_i48161_2_; - this.field_77580_a = p_i48161_3_; - this.field_77579_b = p_i48161_4_; + this.id = p_i48161_1_; + this.group = p_i48161_2_; + this.result = p_i48161_3_; + this.ingredients = p_i48161_4_; + this.isSimple = p_i48161_4_.stream().allMatch(Ingredient::isSimple); } - public ResourceLocation func_199560_c() { + public ResourceLocation getId() { @@ -47,17 +_,20 @@ - public boolean func_77569_a(CraftingInventory p_77569_1_, World p_77569_2_) { + public boolean matches(CraftingInventory p_77569_1_, World p_77569_2_) { RecipeItemHelper recipeitemhelper = new RecipeItemHelper(); + java.util.List inputs = new java.util.ArrayList<>(); int i = 0; - for(int j = 0; j < p_77569_1_.func_70302_i_(); ++j) { - ItemStack itemstack = p_77569_1_.func_70301_a(j); - if (!itemstack.func_190926_b()) { + for(int j = 0; j < p_77569_1_.getContainerSize(); ++j) { + ItemStack itemstack = p_77569_1_.getItem(j); + if (!itemstack.isEmpty()) { ++i; + if (isSimple) - recipeitemhelper.func_221264_a(itemstack, 1); + recipeitemhelper.accountStack(itemstack, 1); + else inputs.add(itemstack); } } -- return i == this.field_77579_b.size() && recipeitemhelper.func_194116_a(this, (IntList)null); -+ return i == this.field_77579_b.size() && (isSimple ? recipeitemhelper.func_194116_a(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.field_77579_b) != null); +- return i == this.ingredients.size() && recipeitemhelper.canCraft(this, (IntList)null); ++ return i == this.ingredients.size() && (isSimple ? recipeitemhelper.canCraft(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.ingredients) != null); } - public ItemStack func_77572_b(CraftingInventory p_77572_1_) { + public ItemStack assemble(CraftingInventory p_77572_1_) { @@ -68,14 +_,15 @@ - return p_194133_1_ * p_194133_2_ >= this.field_77579_b.size(); + return p_194133_1_ * p_194133_2_ >= this.ingredients.size(); } - public static class Serializer implements IRecipeSerializer { + public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shapeless"); - public ShapelessRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); - NonNullList nonnulllist = func_199568_a(JSONUtils.func_151214_t(p_199425_2_, "ingredients")); + public ShapelessRecipe fromJson(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { + String s = JSONUtils.getAsString(p_199425_2_, "group", ""); + NonNullList nonnulllist = itemsFromJson(JSONUtils.getAsJsonArray(p_199425_2_, "ingredients")); if (nonnulllist.isEmpty()) { throw new JsonParseException("No ingredients for shapeless recipe"); - } else if (nonnulllist.size() > 9) { @@ -54,5 +54,5 @@ + } else if (nonnulllist.size() > ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT) { + throw new JsonParseException("Too many ingredients for shapeless recipe the max is " + (ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT)); } else { - ItemStack itemstack = ShapedRecipe.func_199798_a(JSONUtils.func_152754_s(p_199425_2_, "result")); + ItemStack itemstack = ShapedRecipe.itemFromJson(JSONUtils.getAsJsonObject(p_199425_2_, "result")); return new ShapelessRecipe(p_199425_1_, s, itemstack, nonnulllist); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch index 773afbfaf9..a5f46b771e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java +++ b/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java @@ -25,7 +_,7 @@ - if (Block.func_149634_a(itemstack.func_77973_b()) instanceof ShulkerBoxBlock) { + if (Block.byItem(itemstack.getItem()) instanceof ShulkerBoxBlock) { ++i; } else { -- if (!(itemstack.func_77973_b() instanceof DyeItem)) { -+ if (!itemstack.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) { +- if (!(itemstack.getItem() instanceof DyeItem)) { ++ if (!itemstack.getItem().is(net.minecraftforge.common.Tags.Items.DYES)) { return false; } @@ -43,7 +_,7 @@ - public ItemStack func_77572_b(CraftingInventory p_77572_1_) { - ItemStack itemstack = ItemStack.field_190927_a; -- DyeItem dyeitem = (DyeItem)Items.field_222069_lA; + public ItemStack assemble(CraftingInventory p_77572_1_) { + ItemStack itemstack = ItemStack.EMPTY; +- DyeItem dyeitem = (DyeItem)Items.WHITE_DYE; + net.minecraft.item.DyeColor dyecolor = net.minecraft.item.DyeColor.WHITE; - for(int i = 0; i < p_77572_1_.func_70302_i_(); ++i) { - ItemStack itemstack1 = p_77572_1_.func_70301_a(i); + for(int i = 0; i < p_77572_1_.getContainerSize(); ++i) { + ItemStack itemstack1 = p_77572_1_.getItem(i); @@ -51,13 +_,14 @@ - Item item = itemstack1.func_77973_b(); - if (Block.func_149634_a(item) instanceof ShulkerBoxBlock) { + Item item = itemstack1.getItem(); + if (Block.byItem(item) instanceof ShulkerBoxBlock) { itemstack = itemstack1; - } else if (item instanceof DyeItem) { - dyeitem = (DyeItem)item; @@ -31,8 +31,8 @@ } } -- ItemStack itemstack2 = ShulkerBoxBlock.func_190953_b(dyeitem.func_195962_g()); -+ ItemStack itemstack2 = ShulkerBoxBlock.func_190953_b(dyecolor); - if (itemstack.func_77942_o()) { - itemstack2.func_77982_d(itemstack.func_77978_p().func_74737_b()); +- ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyeitem.getDyeColor()); ++ ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyecolor); + if (itemstack.hasTag()) { + itemstack2.setTag(itemstack.getTag().copy()); } diff --git a/patches/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch index 2f630e9743..10377e724e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/SingleItemRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/item/crafting/SingleItemRecipe.java +++ b/net/minecraft/item/crafting/SingleItemRecipe.java @@ -60,7 +_,7 @@ - return this.field_222132_b.func_77946_l(); + return this.result.copy(); } - public static class Serializer implements IRecipeSerializer { + public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { - final SingleItemRecipe.Serializer.IRecipeFactory field_222180_t; + final SingleItemRecipe.Serializer.IRecipeFactory factory; protected Serializer(SingleItemRecipe.Serializer.IRecipeFactory p_i50146_1_) { diff --git a/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch index ab35ff6c53..a5ab4f405a 100644 --- a/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/SmithingRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/item/crafting/SmithingRecipe.java +++ b/net/minecraft/item/crafting/SmithingRecipe.java @@ -65,7 +_,7 @@ - return IRecipeType.field_234827_g_; + return IRecipeType.SMITHING; } - public static class Serializer implements IRecipeSerializer { + public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { - public SmithingRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - Ingredient ingredient = Ingredient.func_199802_a(JSONUtils.func_152754_s(p_199425_2_, "base")); - Ingredient ingredient1 = Ingredient.func_199802_a(JSONUtils.func_152754_s(p_199425_2_, "addition")); + public SmithingRecipe fromJson(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { + Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(p_199425_2_, "base")); + Ingredient ingredient1 = Ingredient.fromJson(JSONUtils.getAsJsonObject(p_199425_2_, "addition")); diff --git a/patches/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch index 7d34609488..9063a42572 100644 --- a/patches/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/SpecialRecipeSerializer.java.patch @@ -6,6 +6,6 @@ -public class SpecialRecipeSerializer> implements IRecipeSerializer { +public class SpecialRecipeSerializer> extends net.minecraftforge.registries.ForgeRegistryEntry> implements IRecipeSerializer { - private final Function field_222176_t; + private final Function constructor; public SpecialRecipeSerializer(Function p_i50024_1_) { diff --git a/patches/minecraft/net/minecraft/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/loot/LootContext.java.patch index 47ef3e7133..517b762e57 100644 --- a/patches/minecraft/net/minecraft/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/loot/LootContext.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/loot/LootContext.java +++ b/net/minecraft/loot/LootContext.java @@ -94,17 +_,47 @@ - return this.field_186499_b; + return this.level; } + // ============================== FORGE START ============================== + public int getLootingModifier() { -+ return net.minecraftforge.common.ForgeHooks.getLootingLevel(func_216031_c(LootParameters.field_216281_a), func_216031_c(LootParameters.field_216284_d), func_216031_c(LootParameters.field_216283_c)); ++ return net.minecraftforge.common.ForgeHooks.getLootingLevel(getParamOrNull(LootParameters.THIS_ENTITY), getParamOrNull(LootParameters.KILLER_ENTITY), getParamOrNull(LootParameters.DAMAGE_SOURCE)); + } + + private ResourceLocation queriedLootTableId; @@ -25,44 +25,44 @@ + // =============================== FORGE END =============================== + public static class Builder { - private final ServerWorld field_186474_a; - private final Map, Object> field_216025_b = Maps.newIdentityHashMap(); - private final Map field_216026_c = Maps.newHashMap(); - private Random field_216027_d; - private float field_186475_b; + private final ServerWorld level; + private final Map, Object> params = Maps.newIdentityHashMap(); + private final Map dynamicDrops = Maps.newHashMap(); + private Random random; + private float luck; + private ResourceLocation queriedLootTableId; // Forge: correctly pass around loot table ID with copy constructor public Builder(ServerWorld p_i46993_1_) { - this.field_186474_a = p_i46993_1_; + this.level = p_i46993_1_; } + public Builder(LootContext context) { -+ this.field_186474_a = context.field_186499_b; -+ this.field_216025_b.putAll(context.field_216036_f); -+ this.field_216026_c.putAll(context.field_216037_g); -+ this.field_216027_d = context.field_216035_a; -+ this.field_186475_b = context.field_186498_a; ++ this.level = context.level; ++ this.params.putAll(context.params); ++ this.dynamicDrops.putAll(context.dynamicDrops); ++ this.random = context.random; ++ this.luck = context.luck; + this.queriedLootTableId = context.queriedLootTableId; + } + - public LootContext.Builder func_216023_a(Random p_216023_1_) { - this.field_216027_d = p_216023_1_; + public LootContext.Builder withRandom(Random p_216023_1_) { + this.random = p_216023_1_; return this; @@ -177,7 +_,7 @@ - public LootContext func_216022_a(LootParameterSet p_216022_1_) { - Set> set = Sets.difference(this.field_216025_b.keySet(), p_216022_1_.func_216276_b()); + public LootContext create(LootParameterSet p_216022_1_) { + Set> set = Sets.difference(this.params.keySet(), p_216022_1_.getAllowed()); - if (!set.isEmpty()) { + if (false && !set.isEmpty()) { // Forge: Allow mods to pass custom loot parameters (not part of the vanilla loot table) to the loot context. throw new IllegalArgumentException("Parameters not allowed in this parameter set: " + set); } else { - Set> set1 = Sets.difference(p_216022_1_.func_216277_a(), this.field_216025_b.keySet()); + Set> set1 = Sets.difference(p_216022_1_.getRequired(), this.params.keySet()); @@ -190,7 +_,7 @@ } - MinecraftServer minecraftserver = this.field_186474_a.func_73046_m(); -- return new LootContext(random, this.field_186475_b, this.field_186474_a, minecraftserver.func_200249_aQ()::func_186521_a, minecraftserver.func_229736_aP_()::func_227517_a_, this.field_216025_b, this.field_216026_c); -+ return new LootContext(random, this.field_186475_b, this.field_186474_a, minecraftserver.func_200249_aQ()::func_186521_a, minecraftserver.func_229736_aP_()::func_227517_a_, this.field_216025_b, this.field_216026_c, this.queriedLootTableId); + MinecraftServer minecraftserver = this.level.getServer(); +- return new LootContext(random, this.luck, this.level, minecraftserver.getLootTables()::get, minecraftserver.getPredicateManager()::get, this.params, this.dynamicDrops); ++ return new LootContext(random, this.luck, this.level, minecraftserver.getLootTables()::get, minecraftserver.getPredicateManager()::get, this.params, this.dynamicDrops, this.queriedLootTableId); } } } diff --git a/patches/minecraft/net/minecraft/loot/LootParameterSets.java.patch b/patches/minecraft/net/minecraft/loot/LootParameterSets.java.patch index 36996187a3..fd16093fe5 100644 --- a/patches/minecraft/net/minecraft/loot/LootParameterSets.java.patch +++ b/patches/minecraft/net/minecraft/loot/LootParameterSets.java.patch @@ -2,17 +2,17 @@ +++ b/net/minecraft/loot/LootParameterSets.java @@ -12,6 +_,7 @@ }); - public static final LootParameterSet field_216261_b = func_216253_a("chest", (p_216259_0_) -> { - p_216259_0_.func_216269_a(LootParameters.field_237457_g_).func_216271_b(LootParameters.field_216281_a); -+ p_216259_0_.func_216271_b(LootParameters.field_216284_d); //Forge: Chest Minecarts can have killers. + public static final LootParameterSet CHEST = register("chest", (p_216259_0_) -> { + p_216259_0_.required(LootParameters.ORIGIN).optional(LootParameters.THIS_ENTITY); ++ p_216259_0_.optional(LootParameters.KILLER_ENTITY); //Forge: Chest Minecarts can have killers. }); - public static final LootParameterSet field_227557_c_ = func_216253_a("command", (p_216250_0_) -> { - p_216250_0_.func_216269_a(LootParameters.field_237457_g_).func_216271_b(LootParameters.field_216281_a); + public static final LootParameterSet COMMAND = register("command", (p_216250_0_) -> { + p_216250_0_.required(LootParameters.ORIGIN).optional(LootParameters.THIS_ENTITY); @@ -21,6 +_,7 @@ }); - public static final LootParameterSet field_216262_c = func_216253_a("fishing", (p_216258_0_) -> { - p_216258_0_.func_216269_a(LootParameters.field_237457_g_).func_216269_a(LootParameters.field_216289_i).func_216271_b(LootParameters.field_216281_a); -+ p_216258_0_.func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216281_a); //Forge: Allow fisher, and bobber + public static final LootParameterSet FISHING = register("fishing", (p_216258_0_) -> { + p_216258_0_.required(LootParameters.ORIGIN).required(LootParameters.TOOL).optional(LootParameters.THIS_ENTITY); ++ p_216258_0_.optional(LootParameters.KILLER_ENTITY).optional(LootParameters.THIS_ENTITY); //Forge: Allow fisher, and bobber }); - public static final LootParameterSet field_216263_d = func_216253_a("entity", (p_216251_0_) -> { - p_216251_0_.func_216269_a(LootParameters.field_216281_a).func_216269_a(LootParameters.field_237457_g_).func_216269_a(LootParameters.field_216283_c).func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216285_e).func_216271_b(LootParameters.field_216282_b); + public static final LootParameterSet ENTITY = register("entity", (p_216251_0_) -> { + p_216251_0_.required(LootParameters.THIS_ENTITY).required(LootParameters.ORIGIN).required(LootParameters.DAMAGE_SOURCE).optional(LootParameters.KILLER_ENTITY).optional(LootParameters.DIRECT_KILLER_ENTITY).optional(LootParameters.LAST_DAMAGE_PLAYER); diff --git a/patches/minecraft/net/minecraft/loot/LootPool.java.patch b/patches/minecraft/net/minecraft/loot/LootPool.java.patch index 1fb3fcc087..f793809aec 100644 --- a/patches/minecraft/net/minecraft/loot/LootPool.java.patch +++ b/patches/minecraft/net/minecraft/loot/LootPool.java.patch @@ -4,45 +4,45 @@ import org.apache.commons.lang3.mutable.MutableInt; public class LootPool { -- private final LootEntry[] field_186453_a; -- private final ILootCondition[] field_186454_b; +- private final LootEntry[] entries; +- private final ILootCondition[] conditions; + private final String name; -+ private final List field_186453_a; -+ private final List field_186454_b; - private final Predicate field_216101_c; - private final ILootFunction[] field_216102_d; - private final BiFunction field_216103_e; - private IRandomRange field_186455_c; - private RandomValueRange field_186456_d; ++ private final List entries; ++ private final List conditions; + private final Predicate compositeCondition; + private final ILootFunction[] functions; + private final BiFunction compositeFunction; + private IRandomRange rolls; + private RandomValueRange bonusRolls; - private LootPool(LootEntry[] p_i51268_1_, ILootCondition[] p_i51268_2_, ILootFunction[] p_i51268_3_, IRandomRange p_i51268_4_, RandomValueRange p_i51268_5_) { -- this.field_186453_a = p_i51268_1_; -- this.field_186454_b = p_i51268_2_; +- this.entries = p_i51268_1_; +- this.conditions = p_i51268_2_; + private LootPool(LootEntry[] p_i51268_1_, ILootCondition[] p_i51268_2_, ILootFunction[] p_i51268_3_, IRandomRange p_i51268_4_, RandomValueRange p_i51268_5_, String name) { + this.name = name; -+ this.field_186453_a = Lists.newArrayList(p_i51268_1_); -+ this.field_186454_b = Lists.newArrayList(p_i51268_2_); - this.field_216101_c = LootConditionManager.func_216305_a(p_i51268_2_); - this.field_216102_d = p_i51268_3_; - this.field_216103_e = LootFunctionManager.func_216241_a(p_i51268_3_); ++ this.entries = Lists.newArrayList(p_i51268_1_); ++ this.conditions = Lists.newArrayList(p_i51268_2_); + this.compositeCondition = LootConditionManager.andConditions(p_i51268_2_); + this.functions = p_i51268_3_; + this.compositeFunction = LootFunctionManager.compose(p_i51268_3_); @@ -92,19 +_,33 @@ } - public void func_227505_a_(ValidationTracker p_227505_1_) { -- for(int i = 0; i < this.field_186454_b.length; ++i) { -- this.field_186454_b[i].func_225580_a_(p_227505_1_.func_227534_b_(".condition[" + i + "]")); -+ for(int i = 0; i < this.field_186454_b.size(); ++i) { -+ this.field_186454_b.get(i).func_225580_a_(p_227505_1_.func_227534_b_(".condition[" + i + "]")); + public void validate(ValidationTracker p_227505_1_) { +- for(int i = 0; i < this.conditions.length; ++i) { +- this.conditions[i].validate(p_227505_1_.forChild(".condition[" + i + "]")); ++ for(int i = 0; i < this.conditions.size(); ++i) { ++ this.conditions.get(i).validate(p_227505_1_.forChild(".condition[" + i + "]")); } - for(int j = 0; j < this.field_216102_d.length; ++j) { - this.field_216102_d[j].func_225580_a_(p_227505_1_.func_227534_b_(".functions[" + j + "]")); + for(int j = 0; j < this.functions.length; ++j) { + this.functions[j].validate(p_227505_1_.forChild(".functions[" + j + "]")); } -- for(int k = 0; k < this.field_186453_a.length; ++k) { -- this.field_186453_a[k].func_225579_a_(p_227505_1_.func_227534_b_(".entries[" + k + "]")); -+ for(int k = 0; k < this.field_186453_a.size(); ++k) { -+ this.field_186453_a.get(k).func_225579_a_(p_227505_1_.func_227534_b_(".entries[" + k + "]")); +- for(int k = 0; k < this.entries.length; ++k) { +- this.entries[k].validate(p_227505_1_.forChild(".entries[" + k + "]")); ++ for(int k = 0; k < this.entries.size(); ++k) { ++ this.entries.get(k).validate(p_227505_1_.forChild(".entries[" + k + "]")); } } @@ -55,22 +55,22 @@ + throw new RuntimeException("Attempted to modify LootPool after being frozen!"); + } + public String getName(){ return this.name; } -+ public IRandomRange getRolls() { return this.field_186455_c; } -+ public IRandomRange getBonusRolls() { return this.field_186456_d; } -+ public void setRolls (RandomValueRange v){ checkFrozen(); this.field_186455_c = v; } -+ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.field_186456_d = v; } ++ public IRandomRange getRolls() { return this.rolls; } ++ public IRandomRange getBonusRolls() { return this.bonusRolls; } ++ public void setRolls (RandomValueRange v){ checkFrozen(); this.rolls = v; } ++ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.bonusRolls = v; } + //======================== FORGE END =============================================== - public static LootPool.Builder func_216096_a() { + public static LootPool.Builder lootPool() { return new LootPool.Builder(); @@ -116,6 +_,7 @@ - private final List field_216049_c = Lists.newArrayList(); - private IRandomRange field_216050_d = new RandomValueRange(1.0F); - private RandomValueRange field_216051_e = new RandomValueRange(0.0F, 0.0F); + private final List functions = Lists.newArrayList(); + private IRandomRange rolls = new RandomValueRange(1.0F); + private RandomValueRange bonusRolls = new RandomValueRange(0.0F, 0.0F); + private String name; - public LootPool.Builder func_216046_a(IRandomRange p_216046_1_) { - this.field_216050_d = p_216046_1_; + public LootPool.Builder setRolls(IRandomRange p_216046_1_) { + this.rolls = p_216046_1_; @@ -141,11 +_,21 @@ return this; } @@ -81,23 +81,23 @@ + } + + public LootPool.Builder bonusRolls(float min, float max) { -+ this.field_216051_e = new RandomValueRange(min, max); ++ this.bonusRolls = new RandomValueRange(min, max); + return this; + } + - public LootPool func_216044_b() { - if (this.field_216050_d == null) { + public LootPool build() { + if (this.rolls == null) { throw new IllegalArgumentException("Rolls not set"); } else { -- return new LootPool(this.field_216047_a.toArray(new LootEntry[0]), this.field_216048_b.toArray(new ILootCondition[0]), this.field_216049_c.toArray(new ILootFunction[0]), this.field_216050_d, this.field_216051_e); -+ return new LootPool(this.field_216047_a.toArray(new LootEntry[0]), this.field_216048_b.toArray(new ILootCondition[0]), this.field_216049_c.toArray(new ILootFunction[0]), this.field_216050_d, this.field_216051_e, name); +- return new LootPool(this.entries.toArray(new LootEntry[0]), this.conditions.toArray(new ILootCondition[0]), this.functions.toArray(new ILootFunction[0]), this.rolls, this.bonusRolls); ++ return new LootPool(this.entries.toArray(new LootEntry[0]), this.conditions.toArray(new ILootCondition[0]), this.functions.toArray(new ILootFunction[0]), this.rolls, this.bonusRolls, name); } } } @@ -158,18 +_,20 @@ - ILootFunction[] ailootfunction = JSONUtils.func_188177_a(jsonobject, "functions", new ILootFunction[0], p_deserialize_3_, ILootFunction[].class); - IRandomRange irandomrange = RandomRanges.func_216130_a(jsonobject.get("rolls"), p_deserialize_3_); - RandomValueRange randomvaluerange = JSONUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); + ILootFunction[] ailootfunction = JSONUtils.getAsObject(jsonobject, "functions", new ILootFunction[0], p_deserialize_3_, ILootFunction[].class); + IRandomRange irandomrange = RandomRanges.deserialize(jsonobject.get("rolls"), p_deserialize_3_); + RandomValueRange randomvaluerange = JSONUtils.getAsObject(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); - return new LootPool(alootentry, ailootcondition, ailootfunction, irandomrange, randomvaluerange); + return new LootPool(alootentry, ailootcondition, ailootfunction, irandomrange, randomvaluerange, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); } @@ -106,14 +106,14 @@ JsonObject jsonobject = new JsonObject(); + if (p_serialize_1_.name != null && !p_serialize_1_.name.startsWith("custom#")) + jsonobject.add("name", p_serialize_3_.serialize(p_serialize_1_.name)); - jsonobject.add("rolls", RandomRanges.func_216131_a(p_serialize_1_.field_186455_c, p_serialize_3_)); - jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.field_186453_a)); - if (p_serialize_1_.field_186456_d.func_186509_a() != 0.0F && p_serialize_1_.field_186456_d.func_186512_b() != 0.0F) { - jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.field_186456_d)); + jsonobject.add("rolls", RandomRanges.serialize(p_serialize_1_.rolls, p_serialize_3_)); + jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.entries)); + if (p_serialize_1_.bonusRolls.getMin() != 0.0F && p_serialize_1_.bonusRolls.getMax() != 0.0F) { + jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.bonusRolls)); } -- if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.field_186454_b)) { -+ if (!p_serialize_1_.field_186454_b.isEmpty()) { - jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186454_b)); +- if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.conditions)) { ++ if (!p_serialize_1_.conditions.isEmpty()) { + jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.conditions)); } diff --git a/patches/minecraft/net/minecraft/loot/LootTable.java.patch b/patches/minecraft/net/minecraft/loot/LootTable.java.patch index 2262dc77e9..4a2ef96bc1 100644 --- a/patches/minecraft/net/minecraft/loot/LootTable.java.patch +++ b/patches/minecraft/net/minecraft/loot/LootTable.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/loot/LootTable.java +++ b/net/minecraft/loot/LootTable.java @@ -31,13 +_,13 @@ - public static final LootTable field_186464_a = new LootTable(LootParameterSets.field_216260_a, new LootPool[0], new ILootFunction[0]); - public static final LootParameterSet field_216126_b = LootParameterSets.field_216266_g; - private final LootParameterSet field_216127_d; -- private final LootPool[] field_186466_c; -+ private final List field_186466_c; - private final ILootFunction[] field_216128_f; - private final BiFunction field_216129_g; + public static final LootTable EMPTY = new LootTable(LootParameterSets.EMPTY, new LootPool[0], new ILootFunction[0]); + public static final LootParameterSet DEFAULT_PARAM_SET = LootParameterSets.ALL_PARAMS; + private final LootParameterSet paramSet; +- private final LootPool[] pools; ++ private final List pools; + private final ILootFunction[] functions; + private final BiFunction compositeFunction; private LootTable(LootParameterSet p_i51265_1_, LootPool[] p_i51265_2_, ILootFunction[] p_i51265_3_) { - this.field_216127_d = p_i51265_1_; -- this.field_186466_c = p_i51265_2_; -+ this.field_186466_c = Lists.newArrayList(p_i51265_2_); - this.field_216128_f = p_i51265_3_; - this.field_216129_g = LootFunctionManager.func_216241_a(p_i51265_3_); + this.paramSet = p_i51265_1_; +- this.pools = p_i51265_2_; ++ this.pools = Lists.newArrayList(p_i51265_2_); + this.functions = p_i51265_3_; + this.compositeFunction = LootFunctionManager.compose(p_i51265_3_); } @@ -75,6 +_,7 @@ } + @Deprecated //Use other method or manually call ForgeHooks.modifyLoot - public void func_216120_b(LootContext p_216120_1_, Consumer p_216120_2_) { - this.func_216114_a(p_216120_1_, func_216124_a(p_216120_2_)); + public void getRandomItems(LootContext p_216120_1_, Consumer p_216120_2_) { + this.getRandomItemsRaw(p_216120_1_, createStackSplitter(p_216120_2_)); } @@ -82,6 +_,7 @@ - public List func_216113_a(LootContext p_216113_1_) { + public List getRandomItems(LootContext p_216113_1_) { List list = Lists.newArrayList(); - this.func_216120_b(p_216113_1_, list::add); + this.getRandomItems(p_216113_1_, list::add); + list = net.minecraftforge.common.ForgeHooks.modifyLoot(this.getLootTableId(), list, p_216113_1_); return list; } @@ -35,14 +35,14 @@ @@ -90,8 +_,8 @@ } - public void func_227506_a_(ValidationTracker p_227506_1_) { -- for(int i = 0; i < this.field_186466_c.length; ++i) { -- this.field_186466_c[i].func_227505_a_(p_227506_1_.func_227534_b_(".pools[" + i + "]")); -+ for(int i = 0; i < this.field_186466_c.size(); ++i) { -+ this.field_186466_c.get(i).func_227505_a_(p_227506_1_.func_227534_b_(".pools[" + i + "]")); + public void validate(ValidationTracker p_227506_1_) { +- for(int i = 0; i < this.pools.length; ++i) { +- this.pools[i].validate(p_227506_1_.forChild(".pools[" + i + "]")); ++ for(int i = 0; i < this.pools.size(); ++i) { ++ this.pools.get(i).validate(p_227506_1_.forChild(".pools[" + i + "]")); } - for(int j = 0; j < this.field_216128_f.length; ++j) { + for(int j = 0; j < this.functions.length; ++j) { @@ -173,6 +_,48 @@ return new LootTable.Builder(); } @@ -51,7 +51,7 @@ + private boolean isFrozen = false; + public void freeze() { + this.isFrozen = true; -+ this.field_186466_c.forEach(LootPool::freeze); ++ this.pools.forEach(LootPool::freeze); + } + public boolean isFrozen(){ return this.isFrozen; } + private void checkFrozen() { @@ -67,14 +67,14 @@ + public ResourceLocation getLootTableId() { return this.lootTableId; } + + public LootPool getPool(String name) { -+ return field_186466_c.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null); ++ return pools.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null); + } + + public LootPool removePool(String name) { + checkFrozen(); -+ for (LootPool pool : this.field_186466_c) { ++ for (LootPool pool : this.pools) { + if (name.equals(pool.getName())) { -+ this.field_186466_c.remove(pool); ++ this.pools.remove(pool); + return pool; + } + } @@ -83,21 +83,21 @@ + + public void addPool(LootPool pool) { + checkFrozen(); -+ if (field_186466_c.stream().anyMatch(e -> e == pool || e.getName() != null && e.getName().equals(pool.getName()))) ++ if (pools.stream().anyMatch(e -> e == pool || e.getName() != null && e.getName().equals(pool.getName()))) + throw new RuntimeException("Attempted to add a duplicate pool to loot table: " + pool.getName()); -+ this.field_186466_c.add(pool); ++ this.pools.add(pool); + } + //======================== FORGE END =============================================== + public static class Builder implements ILootFunctionConsumer { - private final List field_216041_a = Lists.newArrayList(); - private final List field_216042_b = Lists.newArrayList(); + private final List pools = Lists.newArrayList(); + private final List functions = Lists.newArrayList(); @@ -227,7 +_,7 @@ } } -- if (p_serialize_1_.field_186466_c.length > 0) { -+ if (!p_serialize_1_.field_186466_c.isEmpty()) { - jsonobject.add("pools", p_serialize_3_.serialize(p_serialize_1_.field_186466_c)); +- if (p_serialize_1_.pools.length > 0) { ++ if (!p_serialize_1_.pools.isEmpty()) { + jsonobject.add("pools", p_serialize_3_.serialize(p_serialize_1_.pools)); } diff --git a/patches/minecraft/net/minecraft/loot/LootTableManager.java.patch b/patches/minecraft/net/minecraft/loot/LootTableManager.java.patch index 15689465fb..91745715f5 100644 --- a/patches/minecraft/net/minecraft/loot/LootTableManager.java.patch +++ b/patches/minecraft/net/minecraft/loot/LootTableManager.java.patch @@ -5,9 +5,9 @@ p_212853_1_.forEach((p_237403_1_, p_237403_2_) -> { - try { -- LootTable loottable = field_186526_b.fromJson(p_237403_2_, LootTable.class); -+ try (net.minecraft.resources.IResource res = p_212853_2_.func_199002_a(getPreparedPath(p_237403_1_));){ -+ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, p_237403_1_, p_237403_2_, res == null || !res.func_199026_d().equals("Default"), this); +- LootTable loottable = GSON.fromJson(p_237403_2_, LootTable.class); ++ try (net.minecraft.resources.IResource res = p_212853_2_.getResource(getPreparedPath(p_237403_1_));){ ++ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(GSON, p_237403_1_, p_237403_2_, res == null || !res.getSourceName().equals("Default"), this); builder.put(p_237403_1_, loottable); } catch (Exception exception) { - field_186525_a.error("Couldn't parse loot table {}", p_237403_1_, exception); + LOGGER.error("Couldn't parse loot table {}", p_237403_1_, exception); diff --git a/patches/minecraft/net/minecraft/loot/conditions/RandomChanceWithLooting.java.patch b/patches/minecraft/net/minecraft/loot/conditions/RandomChanceWithLooting.java.patch index dff0cfbca0..306b89dab8 100644 --- a/patches/minecraft/net/minecraft/loot/conditions/RandomChanceWithLooting.java.patch +++ b/patches/minecraft/net/minecraft/loot/conditions/RandomChanceWithLooting.java.patch @@ -4,13 +4,13 @@ } public boolean test(LootContext p_test_1_) { -- Entity entity = p_test_1_.func_216031_c(LootParameters.field_216284_d); +- Entity entity = p_test_1_.getParamOrNull(LootParameters.KILLER_ENTITY); - int i = 0; - if (entity instanceof LivingEntity) { -- i = EnchantmentHelper.func_185283_h((LivingEntity)entity); +- i = EnchantmentHelper.getMobLooting((LivingEntity)entity); - } - + int i = p_test_1_.getLootingModifier(); - return p_test_1_.func_216032_b().nextFloat() < this.field_186627_a + (float)i * this.field_186628_b; + return p_test_1_.getRandom().nextFloat() < this.percent + (float)i * this.lootingMultiplier; } diff --git a/patches/minecraft/net/minecraft/loot/functions/LootingEnchantBonus.java.patch b/patches/minecraft/net/minecraft/loot/functions/LootingEnchantBonus.java.patch index 1b0f418924..a4f26449b3 100644 --- a/patches/minecraft/net/minecraft/loot/functions/LootingEnchantBonus.java.patch +++ b/patches/minecraft/net/minecraft/loot/functions/LootingEnchantBonus.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/loot/functions/LootingEnchantBonus.java +++ b/net/minecraft/loot/functions/LootingEnchantBonus.java @@ -43,7 +_,7 @@ - public ItemStack func_215859_a(ItemStack p_215859_1_, LootContext p_215859_2_) { - Entity entity = p_215859_2_.func_216031_c(LootParameters.field_216284_d); + public ItemStack run(ItemStack p_215859_1_, LootContext p_215859_2_) { + Entity entity = p_215859_2_.getParamOrNull(LootParameters.KILLER_ENTITY); if (entity instanceof LivingEntity) { -- int i = EnchantmentHelper.func_185283_h((LivingEntity)entity); +- int i = EnchantmentHelper.getMobLooting((LivingEntity)entity); + int i = p_215859_2_.getLootingModifier(); if (i == 0) { return p_215859_1_; diff --git a/patches/minecraft/net/minecraft/loot/functions/Smelt.java.patch b/patches/minecraft/net/minecraft/loot/functions/Smelt.java.patch index 7c1414693a..6f9bc4884b 100644 --- a/patches/minecraft/net/minecraft/loot/functions/Smelt.java.patch +++ b/patches/minecraft/net/minecraft/loot/functions/Smelt.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/loot/functions/Smelt.java +++ b/net/minecraft/loot/functions/Smelt.java @@ -34,7 +_,7 @@ - ItemStack itemstack = optional.get().func_77571_b(); - if (!itemstack.func_190926_b()) { - ItemStack itemstack1 = itemstack.func_77946_l(); -- itemstack1.func_190920_e(p_215859_1_.func_190916_E()); -+ itemstack1.func_190920_e(p_215859_1_.func_190916_E() * itemstack.func_190916_E()); //Forge: Support smelting returning multiple + ItemStack itemstack = optional.get().getResultItem(); + if (!itemstack.isEmpty()) { + ItemStack itemstack1 = itemstack.copy(); +- itemstack1.setCount(p_215859_1_.getCount()); ++ itemstack1.setCount(p_215859_1_.getCount() * itemstack.getCount()); //Forge: Support smelting returning multiple return itemstack1; } } diff --git a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch index 5bb1e9b6d7..590cba713d 100644 --- a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/nbt/CompoundNBT.java +++ b/net/minecraft/nbt/CompoundNBT.java @@ -49,6 +_,7 @@ - while((b0 = CompoundNBT.func_152447_a(p_225649_1_, p_225649_3_)) != 0) { - String s = CompoundNBT.func_152448_b(p_225649_1_, p_225649_3_); - p_225649_3_.func_152450_a((long)(224 + 16 * s.length())); -+ p_225649_3_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - INBT inbt = CompoundNBT.func_229680_b_(NBTTypes.func_229710_a_(b0), s, p_225649_1_, p_225649_2_ + 1, p_225649_3_); + while((b0 = CompoundNBT.readNamedTagType(p_225649_1_, p_225649_3_)) != 0) { + String s = CompoundNBT.readNamedTagName(p_225649_1_, p_225649_3_); + p_225649_3_.accountBits((long)(224 + 16 * s.length())); ++ p_225649_3_.accountBits(32); //Forge: 4 extra bytes for the object allocation. + INBT inbt = CompoundNBT.readNamedTagData(NBTTypes.getType(b0), s, p_225649_1_, p_225649_2_ + 1, p_225649_3_); if (map.put(s, inbt) != null) { - p_225649_3_.func_152450_a(288L); + p_225649_3_.accountBits(288L); @@ -104,6 +_,7 @@ @Nullable - public INBT func_218657_a(String p_218657_1_, INBT p_218657_2_) { + public INBT put(String p_218657_1_, INBT p_218657_2_) { + if (p_218657_2_ == null) throw new IllegalArgumentException("Invalid null NBT value with key " + p_218657_1_); - return this.field_74784_a.put(p_218657_1_, p_218657_2_); + return this.tags.put(p_218657_1_, p_218657_2_); } @@ -408,11 +_,12 @@ } - private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { -+ p_152447_1_.func_152450_a(8); + private static byte readNamedTagType(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { ++ p_152447_1_.accountBits(8); return p_152447_0_.readByte(); } - private static String func_152448_b(DataInput p_152448_0_, NBTSizeTracker p_152448_1_) throws IOException { + private static String readNamedTagName(DataInput p_152448_0_, NBTSizeTracker p_152448_1_) throws IOException { - return p_152448_0_.readUTF(); + return p_152448_1_.readUTF(p_152448_0_.readUTF()); } - private static INBT func_229680_b_(INBTType p_229680_0_, String p_229680_1_, DataInput p_229680_2_, int p_229680_3_, NBTSizeTracker p_229680_4_) { + private static INBT readNamedTagData(INBTType p_229680_0_, String p_229680_1_, DataInput p_229680_2_, int p_229680_3_, NBTSizeTracker p_229680_4_) { diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index b89a4c1ba8..6c441f952f 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -2,15 +2,15 @@ +++ b/net/minecraft/nbt/CompressedStreamTools.java @@ -106,10 +_,12 @@ - private static INBT func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { + private static INBT readUnnamedTag(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { byte b0 = p_152455_0_.readByte(); -+ p_152455_2_.func_152450_a(8); // Forge: Count everything! ++ p_152455_2_.accountBits(8); // Forge: Count everything! if (b0 == 0) { - return EndNBT.field_229686_b_; + return EndNBT.INSTANCE; } else { - p_152455_0_.readUTF(); + p_152455_2_.readUTF(p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. ++ p_152455_2_.accountBits(32); //Forge: 4 extra bytes for the object allocation. try { - return NBTTypes.func_229710_a_(b0).func_225649_b_(p_152455_0_, p_152455_1_, p_152455_2_); + return NBTTypes.getType(b0).load(p_152455_0_, p_152455_1_, p_152455_2_); diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch index a7527f2b42..0922582935 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/nbt/NBTSizeTracker.java +++ b/net/minecraft/nbt/NBTSizeTracker.java @@ -18,4 +_,34 @@ - throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.field_152453_c + "bytes where max allowed: " + this.field_152452_b); + throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.usage + "bytes where max allowed: " + this.quota); } } + @@ -17,7 +17,7 @@ + * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. + */ + public String readUTF(String data) { -+ func_152450_a(16); //Header length ++ accountBits(16); //Header length + if (data == null) + return data; + @@ -30,7 +30,7 @@ + else if (c > 0x07FF) utflen += 3; + else utflen += 2; + } -+ func_152450_a(8 * utflen); ++ accountBits(8 * utflen); + + return data; + } diff --git a/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch index 86ea890670..3d6510751c 100644 --- a/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch +++ b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/nbt/StringNBT.java +++ b/net/minecraft/nbt/StringNBT.java @@ -12,7 +_,7 @@ - public StringNBT func_225649_b_(DataInput p_225649_1_, int p_225649_2_, NBTSizeTracker p_225649_3_) throws IOException { - p_225649_3_.func_152450_a(288L); + public StringNBT load(DataInput p_225649_1_, int p_225649_2_, NBTSizeTracker p_225649_3_) throws IOException { + p_225649_3_.accountBits(288L); String s = p_225649_1_.readUTF(); -- p_225649_3_.func_152450_a((long)(16 * s.length())); +- p_225649_3_.accountBits((long)(16 * s.length())); + p_225649_3_.readUTF(s); - return StringNBT.func_229705_a_(s); + return StringNBT.valueOf(s); } diff --git a/patches/minecraft/net/minecraft/network/NettyCompressionEncoder.java.patch b/patches/minecraft/net/minecraft/network/NettyCompressionEncoder.java.patch index 95f3e54950..6872439ad2 100644 --- a/patches/minecraft/net/minecraft/network/NettyCompressionEncoder.java.patch +++ b/patches/minecraft/net/minecraft/network/NettyCompressionEncoder.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/network/NettyCompressionEncoder.java +++ b/net/minecraft/network/NettyCompressionEncoder.java @@ -9,6 +_,8 @@ - private final byte[] field_179302_a = new byte[8192]; - private final Deflater field_179300_b; - private int field_179301_c; + private final byte[] encodeBuf = new byte[8192]; + private final Deflater deflater; + private int threshold; + private static final boolean DISABLE_PACKET_DEBUG = Boolean.parseBoolean(System.getProperty("forge.disablePacketCompressionDebug", "false")); + private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); public NettyCompressionEncoder(int p_i46005_1_) { - this.field_179301_c = p_i46005_1_; + this.threshold = p_i46005_1_; @@ -22,6 +_,12 @@ - packetbuffer.func_150787_b(0); + packetbuffer.writeVarInt(0); packetbuffer.writeBytes(p_encode_2_); } else { + if (!DISABLE_PACKET_DEBUG && i > 2097152) { @@ -21,4 +21,4 @@ + } byte[] abyte = new byte[i]; p_encode_2_.readBytes(abyte); - packetbuffer.func_150787_b(abyte.length); + packetbuffer.writeVarInt(abyte.length); diff --git a/patches/minecraft/net/minecraft/network/NettyPacketEncoder.java.patch b/patches/minecraft/net/minecraft/network/NettyPacketEncoder.java.patch index ef2a515e1d..8362578625 100644 --- a/patches/minecraft/net/minecraft/network/NettyPacketEncoder.java.patch +++ b/patches/minecraft/net/minecraft/network/NettyPacketEncoder.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/network/NettyPacketEncoder.java @@ -37,7 +_,7 @@ try { - p_encode_2_.func_148840_b(packetbuffer); + p_encode_2_.write(packetbuffer); } catch (Throwable throwable) { -- field_150798_a.error(throwable); -+ field_150798_a.error("Error encoding packet", throwable); // Forge: Get Minecraft to spit out more information about the Throwable we got. - if (p_encode_2_.func_211402_a()) { +- LOGGER.error(throwable); ++ LOGGER.error("Error encoding packet", throwable); // Forge: Get Minecraft to spit out more information about the Throwable we got. + if (p_encode_2_.isSkippable()) { throw new SkipableEncoderException(throwable); } else { diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index a14b4fe349..689a46be22 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,34 +1,34 @@ --- a/net/minecraft/network/NetworkManager.java +++ b/net/minecraft/network/NetworkManager.java @@ -74,6 +_,7 @@ - private float field_211397_t; - private int field_211398_u; - private boolean field_211399_v; + private float averageSentPackets; + private int tickCount; + private boolean handlingFault; + private java.util.function.Consumer activationHandler; public NetworkManager(PacketDirection p_i46004_1_) { - this.field_179294_g = p_i46004_1_; + this.receiving = p_i46004_1_; @@ -83,6 +_,7 @@ super.channelActive(p_channelActive_1_); - this.field_150746_k = p_channelActive_1_.channel(); - this.field_150743_l = this.field_150746_k.remoteAddress(); + this.channel = p_channelActive_1_.channel(); + this.address = this.channel.remoteAddress(); + if (activationHandler != null) activationHandler.accept(this); try { - this.func_150723_a(ProtocolType.HANDSHAKING); + this.setProtocol(ProtocolType.HANDSHAKING); @@ -171,7 +_,7 @@ - ++this.field_211395_r; + ++this.sentPackets; if (protocoltype1 != protocoltype) { - field_150735_g.debug("Disabled auto read"); -- this.field_150746_k.config().setAutoRead(false); -+ this.field_150746_k.eventLoop().execute(()->this.field_150746_k.config().setAutoRead(false)); + LOGGER.debug("Disabled auto read"); +- this.channel.config().setAutoRead(false); ++ this.channel.eventLoop().execute(()->this.channel.config().setAutoRead(false)); } - if (this.field_150746_k.eventLoop().inEventLoop()) { + if (this.channel.eventLoop().inEventLoop()) { @@ -259,7 +_,9 @@ @OnlyIn(Dist.CLIENT) - public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { + public static NetworkManager connectToServer(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { + if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); + networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; @@ -37,24 +37,24 @@ if (Epoll.isAvailable() && p_181124_2_) { @@ -286,6 +_,7 @@ @OnlyIn(Dist.CLIENT) - public static NetworkManager func_150722_a(SocketAddress p_150722_0_) { + public static NetworkManager connectToLocalServer(SocketAddress p_150722_0_) { final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); + networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; - (new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer() { + (new Bootstrap()).group(LOCAL_WORKER_GROUP.get()).handler(new ChannelInitializer() { protected void initChannel(Channel p_initChannel_1_) throws Exception { p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); @@ -374,6 +_,14 @@ @OnlyIn(Dist.CLIENT) - public float func_211390_n() { - return this.field_211397_t; + public float getAverageSentPackets() { + return this.averageSentPackets; + } + + public Channel channel() { -+ return field_150746_k; ++ return channel; + } + + public PacketDirection getDirection() { -+ return this.field_179294_g; ++ return this.receiving; } static class QueuedPacket { diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index e3ea0b6ddd..c00338e280 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -3,24 +3,24 @@ @@ -41,11 +_,12 @@ public class NetworkSystem { - private static final Logger field_151275_b = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); + private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30")); - public static final LazyValue field_151276_c = new LazyValue<>(() -> { + public static final LazyValue SERVER_EVENT_GROUP = new LazyValue<>(() -> { - return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); + return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build()); }); - public static final LazyValue field_181141_b = new LazyValue<>(() -> { + public static final LazyValue SERVER_EPOLL_EVENT_GROUP = new LazyValue<>(() -> { - return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build()); + return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build()); }); - private final MinecraftServer field_151273_d; - public volatile boolean field_151277_a; + private final MinecraftServer server; + public volatile boolean running; @@ -58,6 +_,7 @@ } - public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException { + public void startTcpServerListener(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException { + if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); - synchronized(this.field_151274_e) { + synchronized(this.channels) { Class oclass; LazyValue lazyvalue; @@ -78,7 +_,7 @@ @@ -29,6 +29,6 @@ - p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); + p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); - int i = NetworkSystem.this.field_151273_d.func_241871_k(); + int i = NetworkSystem.this.server.getRateLimitPacketsPerSecond(); NetworkManager networkmanager = (NetworkManager)(i > 0 ? new RateLimitedNetworkManager(i) : new NetworkManager(PacketDirection.SERVERBOUND)); - NetworkSystem.this.field_151272_f.add(networkmanager); + NetworkSystem.this.connections.add(networkmanager); diff --git a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch index 15d00ed051..fa7286d676 100644 --- a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch +++ b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch @@ -6,13 +6,13 @@ -public class PacketBuffer extends ByteBuf { +public class PacketBuffer extends ByteBuf implements net.minecraftforge.common.extensions.IForgePacketBuffer { - private final ByteBuf field_150794_a; + private final ByteBuf source; public PacketBuffer(ByteBuf p_i45154_1_) { @@ -287,6 +_,15 @@ } - public PacketBuffer func_150788_a(ItemStack p_150788_1_) { + public PacketBuffer writeItem(ItemStack p_150788_1_) { + return writeItemStack(p_150788_1_, true); + } + @@ -22,26 +22,26 @@ + * If you want to send the FULL tag set limitedTag to false + */ + public PacketBuffer writeItemStack(ItemStack p_150788_1_, boolean limitedTag) { - if (p_150788_1_.func_190926_b()) { + if (p_150788_1_.isEmpty()) { this.writeBoolean(false); } else { @@ -295,8 +_,8 @@ - this.func_150787_b(Item.func_150891_b(item)); - this.writeByte(p_150788_1_.func_190916_E()); + this.writeVarInt(Item.getId(item)); + this.writeByte(p_150788_1_.getCount()); CompoundNBT compoundnbt = null; -- if (item.func_77645_m() || item.func_77651_p()) { -- compoundnbt = p_150788_1_.func_77978_p(); -+ if (item.isDamageable(p_150788_1_) || item.func_77651_p()) { -+ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p(); +- if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) { +- compoundnbt = p_150788_1_.getTag(); ++ if (item.isDamageable(p_150788_1_) || item.shouldOverrideMultiplayerNbt()) { ++ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.getTag(); } - this.func_150786_a(compoundnbt); + this.writeNbt(compoundnbt); @@ -312,7 +_,7 @@ - int i = this.func_150792_a(); + int i = this.readVarInt(); int j = this.readByte(); - ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j); -- itemstack.func_77982_d(this.func_150793_b()); -+ itemstack.readShareTag(this.func_150793_b()); + ItemStack itemstack = new ItemStack(Item.byId(i), j); +- itemstack.setTag(this.readNbt()); ++ itemstack.readShareTag(this.readNbt()); return itemstack; } } diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 6778b73fe3..adc138d4c1 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/network/ServerStatusResponse.java +++ b/net/minecraft/network/ServerStatusResponse.java @@ -19,6 +_,16 @@ - private ServerStatusResponse.Players field_151324_b; - private ServerStatusResponse.Version field_151325_c; - private String field_151323_d; + private ServerStatusResponse.Players players; + private ServerStatusResponse.Version version; + private String favicon; + private transient net.minecraftforge.fml.network.FMLStatusPing forgeData; + + public net.minecraftforge.fml.network.FMLStatusPing getForgeData() { @@ -15,38 +15,38 @@ + invalidateJson(); + } - public ITextComponent func_151317_a() { - return this.field_151326_a; + public ITextComponent getDescription() { + return this.description; @@ -26,6 +_,7 @@ - public void func_151315_a(ITextComponent p_151315_1_) { - this.field_151326_a = p_151315_1_; + public void setDescription(ITextComponent p_151315_1_) { + this.description = p_151315_1_; + invalidateJson(); } - public ServerStatusResponse.Players func_151318_b() { + public ServerStatusResponse.Players getPlayers() { @@ -34,6 +_,7 @@ - public void func_151319_a(ServerStatusResponse.Players p_151319_1_) { - this.field_151324_b = p_151319_1_; + public void setPlayers(ServerStatusResponse.Players p_151319_1_) { + this.players = p_151319_1_; + invalidateJson(); } - public ServerStatusResponse.Version func_151322_c() { + public ServerStatusResponse.Version getVersion() { @@ -42,16 +_,51 @@ - public void func_151321_a(ServerStatusResponse.Version p_151321_1_) { - this.field_151325_c = p_151321_1_; + public void setVersion(ServerStatusResponse.Version p_151321_1_) { + this.version = p_151321_1_; + invalidateJson(); } - public void func_151320_a(String p_151320_1_) { - this.field_151323_d = p_151320_1_; + public void setFavicon(String p_151320_1_) { + this.favicon = p_151320_1_; + invalidateJson(); } - public String func_151316_d() { - return this.field_151323_d; + public String getFavicon() { + return this.favicon; } + private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); @@ -66,7 +66,7 @@ + mutex.acquireUninterruptibly(); + ret = this.json; + if (ret == null) { -+ ret = net.minecraft.network.status.server.SServerInfoPacket.field_149297_a.toJson(this); ++ ret = net.minecraft.network.status.server.SServerInfoPacket.GSON.toJson(this); + this.json = ret; + } + mutex.release(); @@ -83,14 +83,14 @@ + } + public static class Players { - private final int field_151336_a; - private final int field_151334_b; + private final int maxPlayers; + private final int numPlayers; @@ -143,6 +_,10 @@ - serverstatusresponse.func_151320_a(JSONUtils.func_151200_h(jsonobject, "favicon")); + serverstatusresponse.setFavicon(JSONUtils.getAsString(jsonobject, "favicon")); } + if (jsonobject.has("forgeData")) { -+ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JSONUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_)); ++ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JSONUtils.getAsJsonObject(jsonobject, "forgeData"), p_deserialize_3_)); + } + return serverstatusresponse; @@ -98,8 +98,8 @@ @@ -162,6 +_,10 @@ - if (p_serialize_1_.func_151316_d() != null) { - jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); + if (p_serialize_1_.getFavicon() != null) { + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + } + + if(p_serialize_1_.getForgeData() != null){ diff --git a/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch b/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch index 6f8392de37..10fb7b356a 100644 --- a/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch +++ b/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch @@ -3,20 +3,20 @@ @@ -301,16 +_,16 @@ }; - public static void func_187189_a(IDataSerializer p_187189_0_) { -- field_187204_n.func_186808_c(p_187189_0_); -+ if (field_187204_n.func_186808_c(p_187189_0_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); + public static void registerSerializer(IDataSerializer p_187189_0_) { +- SERIALIZERS.add(p_187189_0_); ++ if (SERIALIZERS.add(p_187189_0_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); } @Nullable - public static IDataSerializer func_187190_a(int p_187190_0_) { -- return field_187204_n.func_148745_a(p_187190_0_); -+ return net.minecraftforge.common.ForgeHooks.getSerializer(p_187190_0_, field_187204_n); + public static IDataSerializer getSerializer(int p_187190_0_) { +- return SERIALIZERS.byId(p_187190_0_); ++ return net.minecraftforge.common.ForgeHooks.getSerializer(p_187190_0_, SERIALIZERS); } - public static int func_187188_b(IDataSerializer p_187188_0_) { -- return field_187204_n.func_148757_b(p_187188_0_); -+ return net.minecraftforge.common.ForgeHooks.getSerializerId(p_187188_0_, field_187204_n); + public static int getSerializedId(IDataSerializer p_187188_0_) { +- return SERIALIZERS.getId(p_187188_0_); ++ return net.minecraftforge.common.ForgeHooks.getSerializerId(p_187188_0_, SERIALIZERS); } static { diff --git a/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch index eb788a40e9..a229cdf75d 100644 --- a/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch +++ b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch @@ -3,16 +3,16 @@ @@ -36,11 +_,13 @@ } - public static DataParameter func_187226_a(Class p_187226_0_, IDataSerializer p_187226_1_) { -- if (field_190303_a.isDebugEnabled()) { -+ if (true || field_190303_a.isDebugEnabled()) { // Forge: This is very useful for mods that register keys on classes that are not their own + public static DataParameter defineId(Class p_187226_0_, IDataSerializer p_187226_1_) { +- if (LOGGER.isDebugEnabled()) { ++ if (true || LOGGER.isDebugEnabled()) { // 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_187226_0_)) { -- field_190303_a.debug("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); +- LOGGER.debug("defineId called for: {} from {}", p_187226_0_, oclass, 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 (field_190303_a.isDebugEnabled()) field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); -+ else field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass); ++ if (LOGGER.isDebugEnabled()) LOGGER.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException()); ++ else LOGGER.warn("defineId called for: {} from {}", p_187226_0_, oclass); } } catch (ClassNotFoundException classnotfoundexception) { } diff --git a/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch index 39c1058b2f..675ac7b613 100644 --- a/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch @@ -3,8 +3,8 @@ @@ -23,6 +_,7 @@ } - public void func_147383_a(CHandshakePacket p_147383_1_) { -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147386_b)) return; - switch(p_147383_1_.func_149594_c()) { + public void handleIntention(CHandshakePacket p_147383_1_) { ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.connection)) return; + switch(p_147383_1_.getIntention()) { case LOGIN: - this.field_147386_b.func_150723_a(ProtocolType.LOGIN); + this.connection.setProtocol(ProtocolType.LOGIN); diff --git a/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch index a6ce7e7117..55baaf3236 100644 --- a/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/network/handshake/client/CHandshakePacket.java +++ b/net/minecraft/network/handshake/client/CHandshakePacket.java @@ -14,6 +_,7 @@ - private String field_149598_b; - private int field_149599_c; - private ProtocolType field_149597_d; + private String hostName; + private int port; + private ProtocolType intention; + private String fmlVersion = net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION; public CHandshakePacket() { } @@ -31,11 +_,13 @@ - this.field_149598_b = p_148837_1_.func_150789_c(255); - this.field_149599_c = p_148837_1_.readUnsignedShort(); - this.field_149597_d = ProtocolType.func_150760_a(p_148837_1_.func_150792_a()); -+ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.field_149598_b); -+ this.field_149598_b = this.field_149598_b.split("\0")[0]; + this.hostName = p_148837_1_.readUtf(255); + this.port = p_148837_1_.readUnsignedShort(); + this.intention = ProtocolType.getById(p_148837_1_.readVarInt()); ++ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.hostName); ++ this.hostName = this.hostName.split("\0")[0]; } - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - p_148840_1_.func_150787_b(this.field_149600_a); -- p_148840_1_.func_180714_a(this.field_149598_b); -+ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION+"\0"); - p_148840_1_.writeShort(this.field_149599_c); - p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c()); + public void write(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.writeVarInt(this.protocolVersion); +- p_148840_1_.writeUtf(this.hostName); ++ p_148840_1_.writeUtf(this.hostName + "\0"+net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION+"\0"); + p_148840_1_.writeShort(this.port); + p_148840_1_.writeVarInt(this.intention.getId()); } @@ -50,5 +_,9 @@ - public int func_149595_d() { - return this.field_149600_a; + public int getProtocolVersion() { + return this.protocolVersion; + } + + public String getFMLVersion() { diff --git a/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch b/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch index ddf3535398..7758f43ec7 100644 --- a/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch @@ -3,24 +3,24 @@ @@ -55,7 +_,13 @@ } - public void func_73660_a() { -- if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) { -+ if (this.field_147328_g == State.NEGOTIATING) { + public void tick() { +- if (this.state == ServerLoginNetHandler.State.READY_TO_ACCEPT) { ++ if (this.state == State.NEGOTIATING) { + // We force the state into "NEGOTIATING" which is otherwise unused. Once we're completed we move the negotiation onto "READY_TO_ACCEPT" + // Might want to promote player object creation to here as well.. -+ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.field_147333_a, this.field_181025_l); ++ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.connection, this.delayedAcceptPlayer); + if (negotiationComplete) -+ this.field_147328_g = State.READY_TO_ACCEPT; -+ } else if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) { - this.func_147326_c(); - } else if (this.field_147328_g == ServerLoginNetHandler.State.DELAY_ACCEPT) { - ServerPlayerEntity serverplayerentity = this.field_147327_f.func_184103_al().func_177451_a(this.field_147337_i.getId()); ++ this.state = State.READY_TO_ACCEPT; ++ } else if (this.state == ServerLoginNetHandler.State.READY_TO_ACCEPT) { + this.handleAcceptedLogin(); + } else if (this.state == ServerLoginNetHandler.State.DELAY_ACCEPT) { + ServerPlayerEntity serverplayerentity = this.server.getPlayerList().getPlayer(this.gameProfile.getId()); @@ -130,7 +_,7 @@ - this.field_147328_g = ServerLoginNetHandler.State.KEY; - this.field_147333_a.func_179290_a(new SEncryptionRequestPacket("", this.field_147327_f.func_71250_E().getPublic().getEncoded(), this.field_147330_e)); + this.state = ServerLoginNetHandler.State.KEY; + this.connection.send(new SEncryptionRequestPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); } else { -- this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; -+ this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; +- this.state = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ this.state = ServerLoginNetHandler.State.NEGOTIATING; } } @@ -28,39 +28,39 @@ throw new IllegalStateException("Protocol error", cryptexception); } -- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) { -+ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) { +- Thread thread = new Thread("User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { ++ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { public void run() { - GameProfile gameprofile = ServerLoginNetHandler.this.field_147337_i; + GameProfile gameprofile = ServerLoginNetHandler.this.gameProfile; @@ -163,11 +_,11 @@ - ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a()); - if (ServerLoginNetHandler.this.field_147337_i != null) { - ServerLoginNetHandler.field_147332_c.info("UUID of player {} is {}", ServerLoginNetHandler.this.field_147337_i.getName(), ServerLoginNetHandler.this.field_147337_i.getId()); -- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; -+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; - } else if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { - ServerLoginNetHandler.field_147332_c.warn("Failed to verify username but will let them in anyway!"); - ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); -- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; -+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + ServerLoginNetHandler.this.gameProfile = ServerLoginNetHandler.this.server.getSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.getAddress()); + if (ServerLoginNetHandler.this.gameProfile != null) { + ServerLoginNetHandler.LOGGER.info("UUID of player {} is {}", ServerLoginNetHandler.this.gameProfile.getName(), ServerLoginNetHandler.this.gameProfile.getId()); +- ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.NEGOTIATING; + } else if (ServerLoginNetHandler.this.server.isSingleplayer()) { + ServerLoginNetHandler.LOGGER.warn("Failed to verify username but will let them in anyway!"); + ServerLoginNetHandler.this.gameProfile = ServerLoginNetHandler.this.createFakeProfile(gameprofile); +- ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.NEGOTIATING; } else { - ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unverified_username")); - ServerLoginNetHandler.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); + ServerLoginNetHandler.this.disconnect(new TranslationTextComponent("multiplayer.disconnect.unverified_username")); + ServerLoginNetHandler.LOGGER.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); @@ -176,7 +_,7 @@ - if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { - ServerLoginNetHandler.field_147332_c.warn("Authentication servers are down but will let them in anyway!"); - ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); -- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; -+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + if (ServerLoginNetHandler.this.server.isSingleplayer()) { + ServerLoginNetHandler.LOGGER.warn("Authentication servers are down but will let them in anyway!"); + ServerLoginNetHandler.this.gameProfile = ServerLoginNetHandler.this.createFakeProfile(gameprofile); +- ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.state = ServerLoginNetHandler.State.NEGOTIATING; } else { - ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.authservers_down")); - ServerLoginNetHandler.field_147332_c.error("Couldn't verify username because servers are unavailable"); + ServerLoginNetHandler.this.disconnect(new TranslationTextComponent("multiplayer.disconnect.authservers_down")); + ServerLoginNetHandler.LOGGER.error("Couldn't verify username because servers are unavailable"); @@ -196,6 +_,7 @@ } - public void func_209526_a(CCustomPayloadLoginPacket p_209526_1_) { -+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a)) - this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unexpected_query_response")); + public void handleCustomQueryPacket(CCustomPayloadLoginPacket p_209526_1_) { ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.connection)) + this.disconnect(new TranslationTextComponent("multiplayer.disconnect.unexpected_query_response")); } diff --git a/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch b/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch index a0ce1534dd..8c5dd969e3 100644 --- a/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch @@ -6,6 +6,6 @@ -public class CCustomPayloadLoginPacket implements IPacket { +public class CCustomPayloadLoginPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { - private int field_209922_a; - private PacketBuffer field_209923_b; + private int transactionId; + private PacketBuffer data; diff --git a/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch b/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch index 69f48902ac..a0fb89e875 100644 --- a/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch @@ -6,6 +6,6 @@ -public class SCustomPayloadLoginPacket implements IPacket { +public class SCustomPayloadLoginPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { - private int field_209919_a; - private ResourceLocation field_209920_b; - private PacketBuffer field_209921_c; + private int transactionId; + private ResourceLocation identifier; + private PacketBuffer data; diff --git a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch index 756a30299f..d49c27ff0f 100644 --- a/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch @@ -3,60 +3,60 @@ @@ -391,9 +_,11 @@ } - entity.func_70080_a(d3, d4, d5, f, f1); -+ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving - boolean flag2 = serverworld.func_226665_a__(entity, entity.func_174813_aQ().func_186664_h(0.0625D)); + entity.absMoveTo(d3, d4, d5, f, f1); ++ this.player.absMoveTo(d3, d4, d5, this.player.yRot, this.player.xRot); // Forge - Resync player position on vehicle moving + boolean flag2 = serverworld.noCollision(entity, entity.getBoundingBox().deflate(0.0625D)); if (flag && (flag1 || !flag2)) { - entity.func_70080_a(d0, d1, d2, f, f1); -+ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving - this.field_147371_a.func_179290_a(new SMoveVehiclePacket(entity)); + entity.absMoveTo(d0, d1, d2, f, f1); ++ this.player.absMoveTo(d3, d4, d5, this.player.yRot, this.player.xRot); // Forge - Resync player position on vehicle moving + this.connection.send(new SMoveVehiclePacket(entity)); return; } @@ -410,7 +_,7 @@ } - private boolean func_241162_a_(Entity p_241162_1_) { -- return p_241162_1_.field_70170_p.func_234853_a_(p_241162_1_.func_174813_aQ().func_186662_g(0.0625D).func_72321_a(0.0D, -0.55D, 0.0D)).allMatch(AbstractBlock.AbstractBlockState::func_196958_f); -+ return BlockPos.func_239581_a_(p_241162_1_.func_174813_aQ().func_186662_g(0.0625D).func_72321_a(0.0D, -0.55D, 0.0D)).allMatch(b -> p_241162_1_.field_70170_p.func_180495_p(b).isAir(p_241162_1_.field_70170_p, b)); + private boolean noBlocksAround(Entity p_241162_1_) { +- return p_241162_1_.level.getBlockStates(p_241162_1_.getBoundingBox().inflate(0.0625D).expandTowards(0.0D, -0.55D, 0.0D)).allMatch(AbstractBlock.AbstractBlockState::isAir); ++ return BlockPos.betweenClosedStream(p_241162_1_.getBoundingBox().inflate(0.0625D).expandTowards(0.0D, -0.55D, 0.0D)).allMatch(b -> p_241162_1_.level.getBlockState(b).isAir(p_241162_1_.level, b)); } - public void func_184339_a(CConfirmTeleportPacket p_184339_1_) { + public void handleAcceptTeleportPacket(CConfirmTeleportPacket p_184339_1_) { @@ -950,7 +_,9 @@ - Direction direction = blockraytraceresult.func_216354_b(); - this.field_147369_b.func_143004_u(); - if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { -- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && serverworld.func_175660_a(this.field_147369_b, blockpos)) { -+ double dist = field_147369_b.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e() + 3; + Direction direction = blockraytraceresult.getDirection(); + this.player.resetLastActionTime(); + if (blockpos.getY() < this.server.getMaxBuildHeight()) { +- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && serverworld.mayInteract(this.player, blockpos)) { ++ double dist = player.getAttribute(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).getValue() + 3; + dist *= dist; -+ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && serverworld.func_175660_a(this.field_147369_b, blockpos)) { - ActionResultType actionresulttype = this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult); - if (direction == Direction.UP && !actionresulttype.func_226246_a_() && blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z() - 1 && func_241166_a_(this.field_147369_b, itemstack)) { - ITextComponent itextcomponent = (new TranslationTextComponent("build.tooHigh", this.field_147367_d.func_71207_Z())).func_240699_a_(TextFormatting.RED); ++ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && serverworld.mayInteract(this.player, blockpos)) { + ActionResultType actionresulttype = this.player.gameMode.useItemOn(this.player, serverworld, itemstack, hand, blockraytraceresult); + if (direction == Direction.UP && !actionresulttype.consumesAction() && blockpos.getY() >= this.server.getMaxBuildHeight() - 1 && wasBlockPlacementAttempt(this.player, itemstack)) { + ITextComponent itextcomponent = (new TranslationTextComponent("build.tooHigh", this.server.getMaxBuildHeight())).withStyle(TextFormatting.RED); @@ -1097,7 +_,9 @@ if (p_244548_1_.startsWith("/")) { - this.func_147361_d(p_244548_1_); + this.handleCommand(p_244548_1_); } else { -- ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), p_244548_1_); -+ ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_244548_1_)); +- ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.player.getDisplayName(), p_244548_1_); ++ ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.player.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_244548_1_)); + itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, p_244548_1_, itextcomponent); + if (itextcomponent == null) return; - this.field_147367_d.func_184103_al().func_232641_a_(itextcomponent, ChatType.CHAT, this.field_147369_b.func_110124_au()); + this.server.getPlayerList().broadcastMessage(itextcomponent, ChatType.CHAT, this.player.getUUID()); } @@ -1187,6 +_,7 @@ - if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT) { - optional = Optional.of(this.field_147369_b.func_190775_a(entity, hand)); - } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT_AT) { -+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand) != null) return; - optional = Optional.of(entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand)); - } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.ATTACK) { - if (entity instanceof ItemEntity || entity instanceof ExperienceOrbEntity || entity instanceof AbstractArrowEntity || entity == this.field_147369_b) { + if (p_147340_1_.getAction() == CUseEntityPacket.Action.INTERACT) { + optional = Optional.of(this.player.interactOn(entity, hand)); + } else if (p_147340_1_.getAction() == CUseEntityPacket.Action.INTERACT_AT) { ++ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(player, entity, p_147340_1_.getLocation(), hand) != null) return; + optional = Optional.of(entity.interactAt(this.player, p_147340_1_.getLocation(), hand)); + } else if (p_147340_1_.getAction() == CUseEntityPacket.Action.ATTACK) { + if (entity instanceof ItemEntity || entity instanceof ExperienceOrbEntity || entity instanceof AbstractArrowEntity || entity == this.player) { @@ -1402,6 +_,8 @@ } - public void func_147349_a(CCustomPayloadPacket p_147349_1_) { -+ PacketThreadUtil.func_218796_a(p_147349_1_, this, this.field_147369_b.func_71121_q()); -+ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.field_147371_a); + public void handleCustomPayload(CCustomPayloadPacket p_147349_1_) { ++ PacketThreadUtil.ensureRunningOnSameThread(p_147349_1_, this, this.player.getLevel()); ++ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.connection); } - public void func_217263_a(CSetDifficultyPacket p_217263_1_) { + public void handleChangeDifficulty(CSetDifficultyPacket p_217263_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch b/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch index 8c87e6baa6..6ef187d887 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/play/client/CClickWindowPacket.java +++ b/net/minecraft/network/play/client/CClickWindowPacket.java @@ -49,7 +_,7 @@ - p_148840_1_.writeByte(this.field_149553_c); - p_148840_1_.writeShort(this.field_149550_d); - p_148840_1_.func_179249_a(this.field_149549_f); -- p_148840_1_.func_150788_a(this.field_149551_e); -+ p_148840_1_.writeItemStack(this.field_149551_e, false); //Forge: Include full tag for C->S + p_148840_1_.writeByte(this.buttonNum); + p_148840_1_.writeShort(this.uid); + p_148840_1_.writeEnum(this.clickType); +- p_148840_1_.writeItem(this.itemStack); ++ p_148840_1_.writeItemStack(this.itemStack, false); //Forge: Include full tag for C->S } - public int func_149548_c() { + public int getContainerId() { diff --git a/patches/minecraft/net/minecraft/network/play/client/CClientSettingsPacket.java.patch b/patches/minecraft/net/minecraft/network/play/client/CClientSettingsPacket.java.patch index 837f3006de..8b11cd3bb1 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CClientSettingsPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CClientSettingsPacket.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/play/client/CClientSettingsPacket.java +++ b/net/minecraft/network/play/client/CClientSettingsPacket.java @@ -67,4 +_,8 @@ - public HandSide func_186991_f() { - return this.field_186992_f; + public HandSide getMainHand() { + return this.mainHand; } + -+ public String func_149524_c() { -+ return this.field_149530_a; ++ public String getLanguage() { ++ return this.language; + } } diff --git a/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch b/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch index 50d64ae8f2..f10675d010 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java @@ -32,7 +_,7 @@ - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - p_148840_1_.writeShort(this.field_149629_a); -- p_148840_1_.func_150788_a(this.field_149628_b); -+ p_148840_1_.writeItemStack(this.field_149628_b, false); //Forge: Include full tag for C->S + public void write(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.writeShort(this.slotNum); +- p_148840_1_.writeItem(this.itemStack); ++ p_148840_1_.writeItemStack(this.itemStack, false); //Forge: Include full tag for C->S } - public int func_149627_c() { + public int getSlotNum() { diff --git a/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch b/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch index d4720f1ee5..da3c0b3413 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch @@ -6,15 +6,15 @@ -public class CCustomPayloadPacket implements IPacket { +public class CCustomPayloadPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { - public static final ResourceLocation field_210344_a = new ResourceLocation("brand"); - private ResourceLocation field_149562_a; - private PacketBuffer field_149561_c; + public static final ResourceLocation BRAND = new ResourceLocation("brand"); + private ResourceLocation identifier; + private PacketBuffer data; @@ -35,7 +_,7 @@ - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - p_148840_1_.func_192572_a(this.field_149562_a); -- p_148840_1_.writeBytes((ByteBuf)this.field_149561_c); -+ p_148840_1_.writeBytes((ByteBuf)this.field_149561_c.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet + public void write(PacketBuffer p_148840_1_) throws IOException { + p_148840_1_.writeResourceLocation(this.identifier); +- p_148840_1_.writeBytes((ByteBuf)this.data); ++ p_148840_1_.writeBytes((ByteBuf)this.data.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet } - public void func_148833_a(IServerPlayNetHandler p_148833_1_) { + public void handle(IServerPlayNetHandler p_148833_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch b/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch index 0e298d41e7..fef768bf4b 100644 --- a/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch @@ -6,6 +6,6 @@ -public class SCustomPayloadPlayPacket implements IPacket { +public class SCustomPayloadPlayPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { - public static final ResourceLocation field_209911_b = new ResourceLocation("brand"); - public static final ResourceLocation field_209913_d = new ResourceLocation("debug/path"); - public static final ResourceLocation field_209914_e = new ResourceLocation("debug/neighbors_update"); + public static final ResourceLocation BRAND = new ResourceLocation("brand"); + public static final ResourceLocation DEBUG_PATHFINDING_PACKET = new ResourceLocation("debug/path"); + public static final ResourceLocation DEBUG_NEIGHBORSUPDATE_PACKET = new ResourceLocation("debug/neighbors_update"); diff --git a/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch b/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch index 3be730acec..6c8f3044f5 100644 --- a/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch +++ b/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch @@ -3,7 +3,7 @@ @@ -116,13 +_,14 @@ } - private void func_72655_a(int p_72655_1_, String p_72655_2_) throws IOException { + private void sendCmdResponse(int p_72655_1_, String p_72655_2_) throws IOException { - int i = p_72655_2_.length(); - + byte[] whole = p_72655_2_.getBytes(StandardCharsets.UTF_8); @@ -11,10 +11,10 @@ + int start = 0; do { int j = 4096 <= i ? 4096 : i; -- this.func_72654_a(p_72655_1_, 0, p_72655_2_.substring(0, j)); +- this.send(p_72655_1_, 0, p_72655_2_.substring(0, j)); - p_72655_2_ = p_72655_2_.substring(j); - i = p_72655_2_.length(); -+ this.func_72654_a(p_72655_1_, 0, new String(java.util.Arrays.copyOfRange(whole, start, j+start), StandardCharsets.UTF_8)); ++ this.send(p_72655_1_, 0, new String(java.util.Arrays.copyOfRange(whole, start, j+start), StandardCharsets.UTF_8)); + i -= j; + start += j; } while(0 != i); diff --git a/patches/minecraft/net/minecraft/network/rcon/RConConsoleSource.java.patch b/patches/minecraft/net/minecraft/network/rcon/RConConsoleSource.java.patch index 352b5c8983..47a25ad62b 100644 --- a/patches/minecraft/net/minecraft/network/rcon/RConConsoleSource.java.patch +++ b/patches/minecraft/net/minecraft/network/rcon/RConConsoleSource.java.patch @@ -3,9 +3,9 @@ @@ -34,7 +_,7 @@ } - public void func_145747_a(ITextComponent p_145747_1_, UUID p_145747_2_) { -- this.field_70009_b.append(p_145747_1_.getString()); -+ this.field_70009_b.append(p_145747_1_.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output + public void sendMessage(ITextComponent p_145747_1_, UUID p_145747_2_) { +- this.buffer.append(p_145747_1_.getString()); ++ this.buffer.append(p_145747_1_.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output } - public boolean func_195039_a() { + public boolean acceptsSuccess() { diff --git a/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch b/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch index ff5a7239dc..0ccdc66fa1 100644 --- a/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch @@ -3,9 +3,9 @@ @@ -30,7 +_,7 @@ } - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { -- p_148840_1_.func_180714_a(field_149297_a.toJson(this.field_149296_b)); -+ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); //Forge: Let the response cache the JSON + public void write(PacketBuffer p_148840_1_) throws IOException { +- p_148840_1_.writeUtf(GSON.toJson(this.status)); ++ p_148840_1_.writeUtf(this.status.getJson()); //Forge: Let the response cache the JSON } - public void func_148833_a(IClientStatusNetHandler p_148833_1_) { + public void handle(IClientStatusNetHandler p_148833_1_) { diff --git a/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch b/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch index 8e9fd2f03b..afb607d772 100644 --- a/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch +++ b/patches/minecraft/net/minecraft/particles/BlockParticleData.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/particles/BlockParticleData.java +++ b/net/minecraft/particles/BlockParticleData.java @@ -54,4 +_,15 @@ - public BlockState func_197584_c() { - return this.field_197587_c; + public BlockState getState() { + return this.state; } + + //FORGE: Add a source pos property, so we can provide models with additional model data diff --git a/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch b/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch index 0bf23847db..219b107eb0 100644 --- a/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch +++ b/patches/minecraft/net/minecraft/particles/ItemParticleData.java.patch @@ -3,9 +3,9 @@ @@ -37,7 +_,7 @@ public ItemParticleData(ParticleType p_i47952_1_, ItemStack p_i47952_2_) { - this.field_197558_b = p_i47952_1_; -- this.field_197559_c = p_i47952_2_; -+ this.field_197559_c = p_i47952_2_.func_77946_l(); //Forge: Fix stack updating after the fact causing particle changes. + this.type = p_i47952_1_; +- this.itemStack = p_i47952_2_; ++ this.itemStack = p_i47952_2_.copy(); //Forge: Fix stack updating after the fact causing particle changes. } - public void func_197553_a(PacketBuffer p_197553_1_) { + public void writeToNetwork(PacketBuffer p_197553_1_) { diff --git a/patches/minecraft/net/minecraft/particles/ParticleType.java.patch b/patches/minecraft/net/minecraft/particles/ParticleType.java.patch index c01c114c0b..aac8b97ad2 100644 --- a/patches/minecraft/net/minecraft/particles/ParticleType.java.patch +++ b/patches/minecraft/net/minecraft/particles/ParticleType.java.patch @@ -6,6 +6,6 @@ -public abstract class ParticleType { +public abstract class ParticleType extends net.minecraftforge.registries.ForgeRegistryEntry>{ - private final boolean field_197581_e; - private final IParticleData.IDeserializer field_197582_f; + private final boolean overrideLimiter; + private final IParticleData.IDeserializer deserializer; diff --git a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch index 00b961d798..bdfe5c5ffb 100644 --- a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch +++ b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch @@ -6,5 +6,5 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class ParticleTypes { - public static final BasicParticleType field_197608_a = func_218415_a("ambient_entity_effect", false); - public static final BasicParticleType field_197609_b = func_218415_a("angry_villager", false); + public static final BasicParticleType AMBIENT_ENTITY_EFFECT = register("ambient_entity_effect", false); + public static final BasicParticleType ANGRY_VILLAGER = register("angry_villager", false); diff --git a/patches/minecraft/net/minecraft/pathfinding/ClimberPathNavigator.java.patch b/patches/minecraft/net/minecraft/pathfinding/ClimberPathNavigator.java.patch index 92fd1a7913..ec05edea33 100644 --- a/patches/minecraft/net/minecraft/pathfinding/ClimberPathNavigator.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/ClimberPathNavigator.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/pathfinding/ClimberPathNavigator.java +++ b/net/minecraft/pathfinding/ClimberPathNavigator.java @@ -38,7 +_,8 @@ - super.func_75501_e(); + super.tick(); } else { - if (this.field_179696_f != null) { -- if (!this.field_179696_f.func_218137_a(this.field_75515_a.func_213303_ch(), (double)this.field_75515_a.func_213311_cf()) && (!(this.field_75515_a.func_226278_cu_() > (double)this.field_179696_f.func_177956_o()) || !(new BlockPos((double)this.field_179696_f.func_177958_n(), this.field_75515_a.func_226278_cu_(), (double)this.field_179696_f.func_177952_p())).func_218137_a(this.field_75515_a.func_213303_ch(), (double)this.field_75515_a.func_213311_cf()))) { + if (this.pathToPosition != null) { +- if (!this.pathToPosition.closerThan(this.mob.position(), (double)this.mob.getBbWidth()) && (!(this.mob.getY() > (double)this.pathToPosition.getY()) || !(new BlockPos((double)this.pathToPosition.getX(), this.mob.getY(), (double)this.pathToPosition.getZ())).closerThan(this.mob.position(), (double)this.mob.getBbWidth()))) { + // FORGE: Fix MC-94054 -+ if (!this.field_179696_f.func_218137_a(this.field_75515_a.func_213303_ch(), Math.max((double)this.field_75515_a.func_213311_cf(), 1.0D)) && (!(this.field_75515_a.func_226278_cu_() > (double)this.field_179696_f.func_177956_o()) || !(new BlockPos((double)this.field_179696_f.func_177958_n(), this.field_75515_a.func_226278_cu_(), (double)this.field_179696_f.func_177952_p())).func_218137_a(this.field_75515_a.func_213303_ch(), Math.max((double)this.field_75515_a.func_213311_cf(), 1.0D)))) { - this.field_75515_a.func_70605_aq().func_75642_a((double)this.field_179696_f.func_177958_n(), (double)this.field_179696_f.func_177956_o(), (double)this.field_179696_f.func_177952_p(), this.field_75511_d); ++ if (!this.pathToPosition.closerThan(this.mob.position(), Math.max((double)this.mob.getBbWidth(), 1.0D)) && (!(this.mob.getY() > (double)this.pathToPosition.getY()) || !(new BlockPos((double)this.pathToPosition.getX(), this.mob.getY(), (double)this.pathToPosition.getZ())).closerThan(this.mob.position(), Math.max((double)this.mob.getBbWidth(), 1.0D)))) { + this.mob.getMoveControl().setWantedPosition((double)this.pathToPosition.getX(), (double)this.pathToPosition.getY(), (double)this.pathToPosition.getZ(), this.speedModifier); } else { - this.field_179696_f = null; + this.pathToPosition = null; diff --git a/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch b/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch index b4309e269c..0e4a9ee93e 100644 --- a/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/PathNavigator.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/pathfinding/PathNavigator.java +++ b/net/minecraft/pathfinding/PathNavigator.java @@ -208,10 +_,10 @@ - Vector3d vector3d = this.func_75502_i(); - this.field_188561_o = this.field_75515_a.func_213311_cf() > 0.75F ? this.field_75515_a.func_213311_cf() / 2.0F : 0.75F - this.field_75515_a.func_213311_cf() / 2.0F; - Vector3i vector3i = this.field_75514_c.func_242948_g(); -- double d0 = Math.abs(this.field_75515_a.func_226277_ct_() - ((double)vector3i.func_177958_n() + 0.5D)); -+ double d0 = Math.abs(this.field_75515_a.func_226277_ct_() - ((double)vector3i.func_177958_n() + (this.field_75515_a.func_213311_cf() + 1) / 2D)); //Forge: Fix MC-94054 - double d1 = Math.abs(this.field_75515_a.func_226278_cu_() - (double)vector3i.func_177956_o()); -- double d2 = Math.abs(this.field_75515_a.func_226281_cx_() - ((double)vector3i.func_177952_p() + 0.5D)); -- boolean flag = d0 < (double)this.field_188561_o && d2 < (double)this.field_188561_o && d1 < 1.0D; -+ double d2 = Math.abs(this.field_75515_a.func_226281_cx_() - ((double)vector3i.func_177952_p() + (this.field_75515_a.func_213311_cf() + 1) / 2D)); //Forge: Fix MC-94054 -+ boolean flag = d0 <= (double)this.field_188561_o && d2 <= (double)this.field_188561_o && d1 < 1.0D; //Forge: Fix MC-94054 - if (flag || this.field_75515_a.func_233660_b_(this.field_75514_c.func_237225_h_().field_186287_m) && this.func_234112_b_(vector3d)) { - this.field_75514_c.func_75875_a(); + Vector3d vector3d = this.getTempMobPos(); + this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; + Vector3i vector3i = this.path.getNextNodePos(); +- double d0 = Math.abs(this.mob.getX() - ((double)vector3i.getX() + 0.5D)); ++ double d0 = Math.abs(this.mob.getX() - ((double)vector3i.getX() + (this.mob.getBbWidth() + 1) / 2D)); //Forge: Fix MC-94054 + double d1 = Math.abs(this.mob.getY() - (double)vector3i.getY()); +- double d2 = Math.abs(this.mob.getZ() - ((double)vector3i.getZ() + 0.5D)); +- boolean flag = d0 < (double)this.maxDistanceToWaypoint && d2 < (double)this.maxDistanceToWaypoint && d1 < 1.0D; ++ double d2 = Math.abs(this.mob.getZ() - ((double)vector3i.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.mob.canCutCorner(this.path.getNextNode().type) && this.shouldTargetNextNodeInDirection(vector3d)) { + this.path.advance(); } diff --git a/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch b/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch index 06623f6f15..9bccb479ca 100644 --- a/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/PathNodeType.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/pathfinding/PathNodeType.java +++ b/net/minecraft/pathfinding/PathNodeType.java @@ -35,4 +_,13 @@ - public float func_186289_a() { - return this.field_186307_r; + public float getMalus() { + return this.malus; } + + @javax.annotation.Nullable diff --git a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch index 44e2e6143f..8da6f882f6 100644 --- a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/pathfinding/WalkNodeProcessor.java @@ -463,9 +_,11 @@ - protected static PathNodeType func_237238_b_(IBlockReader p_237238_0_, BlockPos p_237238_1_) { - BlockState blockstate = p_237238_0_.func_180495_p(p_237238_1_); + protected static PathNodeType getBlockPathTypeRaw(IBlockReader p_237238_0_, BlockPos p_237238_1_) { + BlockState blockstate = p_237238_0_.getBlockState(p_237238_1_); + PathNodeType type = blockstate.getAiPathNodeType(p_237238_0_, p_237238_1_); + if (type != null) return type; - Block block = blockstate.func_177230_c(); - Material material = blockstate.func_185904_a(); -- if (blockstate.func_196958_f()) { + Block block = blockstate.getBlock(); + Material material = blockstate.getMaterial(); +- if (blockstate.isAir()) { + if (blockstate.isAir(p_237238_0_, p_237238_1_)) { return PathNodeType.OPEN; - } else if (!blockstate.func_235714_a_(BlockTags.field_212185_E) && !blockstate.func_203425_a(Blocks.field_196651_dG)) { - if (blockstate.func_203425_a(Blocks.field_150434_aF)) { + } else if (!blockstate.is(BlockTags.TRAPDOORS) && !blockstate.is(Blocks.LILY_PAD)) { + if (blockstate.is(Blocks.CACTUS)) { diff --git a/patches/minecraft/net/minecraft/potion/Effect.java.patch b/patches/minecraft/net/minecraft/potion/Effect.java.patch index 0f12fa0b6a..0b1eb51df9 100644 --- a/patches/minecraft/net/minecraft/potion/Effect.java.patch +++ b/patches/minecraft/net/minecraft/potion/Effect.java.patch @@ -6,6 +6,6 @@ -public class Effect { +public class Effect extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeEffect { - private final Map field_111188_I = Maps.newHashMap(); - private final EffectType field_220305_b; - private final int field_76414_N; + private final Map attributeModifiers = Maps.newHashMap(); + private final EffectType category; + private final int color; diff --git a/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch index 6b96959a7c..0a462fdc27 100644 --- a/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch +++ b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch @@ -6,42 +6,42 @@ -public class EffectInstance implements Comparable { +public class EffectInstance implements Comparable, net.minecraftforge.common.extensions.IForgeEffectInstance { - private static final Logger field_180155_a = LogManager.getLogger(); - private final Effect field_188420_b; - private int field_76460_b; + private static final Logger LOGGER = LogManager.getLogger(); + private final Effect effect; + private int duration; @@ -64,6 +_,7 @@ - this.field_82724_e = p_230117_1_.field_82724_e; - this.field_188421_h = p_230117_1_.field_188421_h; - this.field_205349_i = p_230117_1_.field_205349_i; + this.ambient = p_230117_1_.ambient; + this.visible = p_230117_1_.visible; + this.showIcon = p_230117_1_.showIcon; + this.curativeItems = p_230117_1_.curativeItems == null ? null : new java.util.ArrayList(p_230117_1_.curativeItems); } - public boolean func_199308_a(EffectInstance p_199308_1_) { + public boolean update(EffectInstance p_199308_1_) { @@ -112,7 +_,7 @@ } - public Effect func_188419_a() { -- return this.field_188420_b; -+ return this.field_188420_b == null ? null : this.field_188420_b.delegate.get(); + public Effect getEffect() { +- return this.effect; ++ return this.effect == null ? null : this.effect.delegate.get(); } - public int func_76459_b() { + public int getDuration() { @@ -230,11 +_,12 @@ - this.field_230115_j_.func_82719_a(compoundnbt); - p_230119_1_.func_218657_a("HiddenEffect", compoundnbt); + this.hiddenEffect.save(compoundnbt); + p_230119_1_.put("HiddenEffect", compoundnbt); } + writeCurativeItems(p_230119_1_); } - public static EffectInstance func_82722_b(CompoundNBT p_82722_0_) { -- int i = p_82722_0_.func_74771_c("Id"); -+ int i = p_82722_0_.func_74771_c("Id") & 0xFF; - Effect effect = Effect.func_188412_a(i); - return effect == null ? null : func_230116_a_(effect, p_82722_0_); + public static EffectInstance load(CompoundNBT p_82722_0_) { +- int i = p_82722_0_.getByte("Id"); ++ int i = p_82722_0_.getByte("Id") & 0xFF; + Effect effect = Effect.byId(i); + return effect == null ? null : loadSpecifiedEffect(effect, p_82722_0_); } @@ -258,7 +_,7 @@ - effectinstance = func_230116_a_(p_230116_0_, p_230116_1_.func_74775_l("HiddenEffect")); + effectinstance = loadSpecifiedEffect(p_230116_0_, p_230116_1_.getCompound("HiddenEffect")); } - return new EffectInstance(p_230116_0_, j, i < 0 ? 0 : i, flag, flag1, flag2, effectinstance); @@ -53,8 +53,8 @@ public int compareTo(EffectInstance p_compareTo_1_) { int i = 32147; -- return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result() : ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result(); -+ return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(this)).result() : ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(this)).result(); +- return (this.getDuration() <= 32147 || p_compareTo_1_.getDuration() <= 32147) && (!this.isAmbient() || !p_compareTo_1_.isAmbient()) ? ComparisonChain.start().compare(this.isAmbient(), p_compareTo_1_.isAmbient()).compare(this.getDuration(), p_compareTo_1_.getDuration()).compare(this.getEffect().getColor(), p_compareTo_1_.getEffect().getColor()).result() : ComparisonChain.start().compare(this.isAmbient(), p_compareTo_1_.isAmbient()).compare(this.getEffect().getColor(), p_compareTo_1_.getEffect().getColor()).result(); ++ return (this.getDuration() <= 32147 || p_compareTo_1_.getDuration() <= 32147) && (!this.isAmbient() || !p_compareTo_1_.isAmbient()) ? ComparisonChain.start().compare(this.isAmbient(), p_compareTo_1_.isAmbient()).compare(this.getDuration(), p_compareTo_1_.getDuration()).compare(this.getEffect().getGuiSortColor(this), p_compareTo_1_.getEffect().getGuiSortColor(this)).result() : ComparisonChain.start().compare(this.isAmbient(), p_compareTo_1_.isAmbient()).compare(this.getEffect().getGuiSortColor(this), p_compareTo_1_.getEffect().getGuiSortColor(this)).result(); + } + + //======================= FORGE START =========================== @@ -63,7 +63,7 @@ + @Override + public java.util.List getCurativeItems() { + if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. -+ this.curativeItems = func_188419_a().getCurativeItems(); ++ this.curativeItems = getEffect().getCurativeItems(); + return this.curativeItems; + } + @Override @@ -71,11 +71,11 @@ + this.curativeItems = curativeItems; + } + private static EffectInstance readCurativeItems(EffectInstance effect, CompoundNBT nbt) { -+ if (nbt.func_150297_b("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_LIST)) { ++ if (nbt.contains("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_LIST)) { + java.util.List items = new java.util.ArrayList(); -+ net.minecraft.nbt.ListNBT list = nbt.func_150295_c("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND); ++ net.minecraft.nbt.ListNBT list = nbt.getList("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < list.size(); i++) { -+ items.add(net.minecraft.item.ItemStack.func_199557_a(list.func_150305_b(i))); ++ items.add(net.minecraft.item.ItemStack.of(list.getCompound(i))); + } + effect.setCurativeItems(items); + } diff --git a/patches/minecraft/net/minecraft/potion/Effects.java.patch b/patches/minecraft/net/minecraft/potion/Effects.java.patch index 1018313b8e..423b7a6e1f 100644 --- a/patches/minecraft/net/minecraft/potion/Effects.java.patch +++ b/patches/minecraft/net/minecraft/potion/Effects.java.patch @@ -6,5 +6,5 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class Effects { - public static final Effect field_76424_c = func_220308_a(1, "speed", (new Effect(EffectType.BENEFICIAL, 8171462)).func_220304_a(Attributes.field_233821_d_, "91AEAA56-376B-4498-935B-2F7F68070635", (double)0.2F, AttributeModifier.Operation.MULTIPLY_TOTAL)); - public static final Effect field_76421_d = func_220308_a(2, "slowness", (new Effect(EffectType.HARMFUL, 5926017)).func_220304_a(Attributes.field_233821_d_, "7107DE5E-7CE8-4030-940E-514C1F160890", (double)-0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL)); + public static final Effect MOVEMENT_SPEED = register(1, "speed", (new Effect(EffectType.BENEFICIAL, 8171462)).addAttributeModifier(Attributes.MOVEMENT_SPEED, "91AEAA56-376B-4498-935B-2F7F68070635", (double)0.2F, AttributeModifier.Operation.MULTIPLY_TOTAL)); + public static final Effect MOVEMENT_SLOWDOWN = register(2, "slowness", (new Effect(EffectType.HARMFUL, 5926017)).addAttributeModifier(Attributes.MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", (double)-0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL)); diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index aacc9bb081..d80221a24b 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -6,14 +6,14 @@ -public class Potion { +public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry { -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.func_242178_a().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.POTION_TYPES)); - private final String field_185179_d; - private final ImmutableList field_185180_e; ++ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.getInstance().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.POTION_TYPES)); + private final String name; + private final ImmutableList effects; @@ -21,6 +_,14 @@ public Potion(@Nullable String p_i46740_1_, EffectInstance... p_i46740_2_) { - this.field_185179_d = p_i46740_1_; - this.field_185180_e = ImmutableList.copyOf(p_i46740_2_); + this.name = p_i46740_1_; + this.effects = ImmutableList.copyOf(p_i46740_2_); + } + + public java.util.Set getTags() { @@ -21,7 +21,7 @@ + } + + public boolean isIn(net.minecraft.tags.ITag tag) { -+ return tag.func_230235_a_(this); ++ return tag.contains(this); } - public String func_185174_b(String p_185174_1_) { + public String getName(String p_185174_1_) { diff --git a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch index e6a61c49e9..da93aaff30 100644 --- a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch @@ -3,70 +3,70 @@ @@ -56,7 +_,7 @@ int i = 0; - for(int j = field_185213_a.size(); i < j; ++i) { -- if ((field_185213_a.get(i)).field_185200_c == p_222124_0_) { -+ if ((field_185213_a.get(i)).field_185200_c.get() == p_222124_0_) { + for(int j = POTION_MIXES.size(); i < j; ++i) { +- if ((POTION_MIXES.get(i)).to == p_222124_0_) { ++ if ((POTION_MIXES.get(i)).to.get() == p_222124_0_) { return true; } } @@ -78,7 +_,7 @@ - for(int j = field_185214_b.size(); i < j; ++i) { - PotionBrewing.MixPredicate mixpredicate = field_185214_b.get(i); -- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185206_1_)) { -+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185206_1_)) { + for(int j = CONTAINER_MIXES.size(); i < j; ++i) { + PotionBrewing.MixPredicate mixpredicate = CONTAINER_MIXES.get(i); +- if (mixpredicate.from == item && mixpredicate.ingredient.test(p_185206_1_)) { ++ if (mixpredicate.from.get() == item && mixpredicate.ingredient.test(p_185206_1_)) { return true; } } @@ -92,7 +_,7 @@ - for(int j = field_185213_a.size(); i < j; ++i) { - PotionBrewing.MixPredicate mixpredicate = field_185213_a.get(i); -- if (mixpredicate.field_185198_a == potion && mixpredicate.field_185199_b.test(p_185209_1_)) { -+ if (mixpredicate.field_185198_a.get() == potion && mixpredicate.field_185199_b.test(p_185209_1_)) { + for(int j = POTION_MIXES.size(); i < j; ++i) { + PotionBrewing.MixPredicate mixpredicate = POTION_MIXES.get(i); +- if (mixpredicate.from == potion && mixpredicate.ingredient.test(p_185209_1_)) { ++ if (mixpredicate.from.get() == potion && mixpredicate.ingredient.test(p_185209_1_)) { return true; } } @@ -108,8 +_,8 @@ - for(int j = field_185214_b.size(); i < j; ++i) { - PotionBrewing.MixPredicate mixpredicate = field_185214_b.get(i); -- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185212_0_)) { -- return PotionUtils.func_185188_a(new ItemStack(mixpredicate.field_185200_c), potion); -+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185212_0_)) { -+ return PotionUtils.func_185188_a(new ItemStack(mixpredicate.field_185200_c.get()), potion); + for(int j = CONTAINER_MIXES.size(); i < j; ++i) { + PotionBrewing.MixPredicate mixpredicate = CONTAINER_MIXES.get(i); +- if (mixpredicate.from == item && mixpredicate.ingredient.test(p_185212_0_)) { +- return PotionUtils.setPotion(new ItemStack(mixpredicate.to), potion); ++ if (mixpredicate.from.get() == item && mixpredicate.ingredient.test(p_185212_0_)) { ++ return PotionUtils.setPotion(new ItemStack(mixpredicate.to.get()), potion); } } @@ -117,8 +_,8 @@ - for(int k = field_185213_a.size(); i < k; ++i) { - PotionBrewing.MixPredicate mixpredicate1 = field_185213_a.get(i); -- if (mixpredicate1.field_185198_a == potion && mixpredicate1.field_185199_b.test(p_185212_0_)) { -- return PotionUtils.func_185188_a(new ItemStack(item), mixpredicate1.field_185200_c); -+ if (mixpredicate1.field_185198_a.get() == potion && mixpredicate1.field_185199_b.test(p_185212_0_)) { -+ return PotionUtils.func_185188_a(new ItemStack(item), mixpredicate1.field_185200_c.get()); + for(int k = POTION_MIXES.size(); i < k; ++i) { + PotionBrewing.MixPredicate mixpredicate1 = POTION_MIXES.get(i); +- if (mixpredicate1.from == potion && mixpredicate1.ingredient.test(p_185212_0_)) { +- return PotionUtils.setPotion(new ItemStack(item), mixpredicate1.to); ++ if (mixpredicate1.from.get() == potion && mixpredicate1.ingredient.test(p_185212_0_)) { ++ return PotionUtils.setPotion(new ItemStack(item), mixpredicate1.to.get()); } } } @@ -211,15 +_,15 @@ - field_185213_a.add(new PotionBrewing.MixPredicate<>(p_193357_0_, Ingredient.func_199804_a(p_193357_1_), p_193357_2_)); + POTION_MIXES.add(new PotionBrewing.MixPredicate<>(p_193357_0_, Ingredient.of(p_193357_1_), p_193357_2_)); } - static class MixPredicate { -- private final T field_185198_a; +- private final T from; + public static class MixPredicate> { -+ public final net.minecraftforge.registries.IRegistryDelegate field_185198_a; - private final Ingredient field_185199_b; -- private final T field_185200_c; -+ public final net.minecraftforge.registries.IRegistryDelegate field_185200_c; ++ public final net.minecraftforge.registries.IRegistryDelegate from; + private final Ingredient ingredient; +- private final T to; ++ public final net.minecraftforge.registries.IRegistryDelegate to; public MixPredicate(T p_i47570_1_, Ingredient p_i47570_2_, T p_i47570_3_) { -- this.field_185198_a = p_i47570_1_; -+ this.field_185198_a = p_i47570_1_.delegate; - this.field_185199_b = p_i47570_2_; -- this.field_185200_c = p_i47570_3_; -+ this.field_185200_c = p_i47570_3_.delegate; +- this.from = p_i47570_1_; ++ this.from = p_i47570_1_.delegate; + this.ingredient = p_i47570_2_; +- this.to = p_i47570_3_; ++ this.to = p_i47570_3_.delegate; } } } diff --git a/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch b/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch index 1f22d61d0b..a6bddfe325 100644 --- a/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch +++ b/patches/minecraft/net/minecraft/resources/DataPackRegistries.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/resources/DataPackRegistries.java +++ b/net/minecraft/resources/DataPackRegistries.java @@ -32,6 +_,7 @@ - this.field_240952_b_.func_219534_a(this.field_240957_g_); - this.field_240952_b_.func_219534_a(this.field_240959_i_); - this.field_240952_b_.func_219534_a(this.field_240958_h_); -+ net.minecraftforge.event.ForgeEventFactory.onResourceReload(this).forEach(field_240952_b_::func_219534_a); + this.resources.registerReloadListener(this.lootTables); + this.resources.registerReloadListener(this.functionLibrary); + this.resources.registerReloadListener(this.advancements); ++ net.minecraftforge.event.ForgeEventFactory.onResourceReload(this).forEach(resources::registerReloadListener); } - public FunctionReloader func_240960_a_() { + public FunctionReloader getFunctionLibrary() { @@ -81,6 +_,7 @@ - public void func_240971_i_() { - this.field_240955_e_.func_242231_a().func_242212_e(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.CustomTagTypes(field_240955_e_.func_242231_a())); + public void updateGlobals() { + this.tagManager.getTags().bindToGlobal(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.CustomTagTypes(tagManager.getTags())); } public void close() { diff --git a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch index 03bde233d9..e7364cad1b 100644 --- a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch @@ -10,12 +10,12 @@ + */ +@Deprecated public interface IResourceManagerReloadListener extends IFutureReloadListener { - default CompletableFuture func_215226_a(IFutureReloadListener.IStage p_215226_1_, IResourceManager p_215226_2_, IProfiler p_215226_3_, IProfiler p_215226_4_, Executor p_215226_5_, Executor p_215226_6_) { - return p_215226_1_.func_216872_a(Unit.INSTANCE).thenRunAsync(() -> { + default CompletableFuture reload(IFutureReloadListener.IStage p_215226_1_, IResourceManager p_215226_2_, IProfiler p_215226_3_, IProfiler p_215226_4_, Executor p_215226_5_, Executor p_215226_6_) { + return p_215226_1_.wait(Unit.INSTANCE).thenRunAsync(() -> { @@ -17,4 +_,9 @@ } - void func_195410_a(IResourceManager p_195410_1_); + void onResourceManagerReload(IResourceManager p_195410_1_); + + @javax.annotation.Nullable + default net.minecraftforge.resource.IResourceType getResourceType() { diff --git a/patches/minecraft/net/minecraft/resources/IResourcePack.java.patch b/patches/minecraft/net/minecraft/resources/IResourcePack.java.patch index 072185ad1b..3538439a41 100644 --- a/patches/minecraft/net/minecraft/resources/IResourcePack.java.patch +++ b/patches/minecraft/net/minecraft/resources/IResourcePack.java.patch @@ -7,5 +7,5 @@ -public interface IResourcePack extends AutoCloseable { +public interface IResourcePack extends AutoCloseable, net.minecraftforge.common.extensions.IForgeResourcePack { @OnlyIn(Dist.CLIENT) - InputStream func_195763_b(String p_195763_1_) throws IOException; + InputStream getRootResource(String p_195763_1_) throws IOException; diff --git a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch index 9797579a1a..0a241471ce 100644 --- a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/resources/ResourcePackInfo.java +++ b/net/minecraft/resources/ResourcePackInfo.java @@ -30,6 +_,7 @@ - private final ResourcePackInfo.Priority field_195805_g; - private final boolean field_195806_h; - private final boolean field_195807_i; + private final ResourcePackInfo.Priority defaultPosition; + private final boolean required; + private final boolean fixedPosition; + private final boolean hidden; // Forge: Allow packs to be hidden from the UI entirely - private final IPackNameDecorator field_232611_k_; + private final IPackNameDecorator packSource; @Nullable @@ -53,7 +_,12 @@ @@ -18,30 +18,30 @@ + } + + public ResourcePackInfo(String p_i231422_1_, boolean p_i231422_2_, Supplier p_i231422_3_, ITextComponent p_i231422_4_, ITextComponent p_i231422_5_, PackCompatibility p_i231422_6_, ResourcePackInfo.Priority p_i231422_7_, boolean p_i231422_8_, IPackNameDecorator p_i231422_9_, boolean hidden) { - this.field_195800_b = p_i231422_1_; - this.field_195801_c = p_i231422_3_; - this.field_195802_d = p_i231422_4_; + this.id = p_i231422_1_; + this.supplier = p_i231422_3_; + this.title = p_i231422_4_; @@ -63,10 +_,16 @@ - this.field_195805_g = p_i231422_7_; - this.field_195807_i = p_i231422_8_; - this.field_232611_k_ = p_i231422_9_; + this.defaultPosition = p_i231422_7_; + this.fixedPosition = p_i231422_8_; + this.packSource = p_i231422_9_; + this.hidden = hidden; } + @Deprecated public ResourcePackInfo(String p_i231421_1_, boolean p_i231421_2_, Supplier p_i231421_3_, IResourcePack p_i231421_4_, PackMetadataSection p_i231421_5_, ResourcePackInfo.Priority p_i231421_6_, IPackNameDecorator p_i231421_7_) { -- this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.func_195762_a()), p_i231421_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i231421_5_.func_198962_b()), p_i231421_6_, false, p_i231421_7_); +- this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.getName()), p_i231421_5_.getDescription(), PackCompatibility.forFormat(p_i231421_5_.getPackFormat()), p_i231421_6_, false, p_i231421_7_); + this(p_i231421_1_, p_i231421_2_, p_i231421_3_, p_i231421_4_, p_i231421_5_, p_i231421_6_, p_i231421_7_, false); + } + + public ResourcePackInfo(String p_i231421_1_, boolean p_i231421_2_, Supplier p_i231421_3_, IResourcePack p_i231421_4_, PackMetadataSection p_i231421_5_, ResourcePackInfo.Priority p_i231421_6_, IPackNameDecorator p_i231421_7_, boolean hidden) { -+ this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.func_195762_a()), p_i231421_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i231421_5_.func_198962_b()), p_i231421_6_, false, p_i231421_7_, hidden); ++ this(p_i231421_1_, p_i231421_2_, p_i231421_3_, new StringTextComponent(p_i231421_4_.getName()), p_i231421_5_.getDescription(), PackCompatibility.forFormat(p_i231421_5_.getPackFormat()), p_i231421_6_, false, p_i231421_7_, hidden); } @OnlyIn(Dist.CLIENT) @@ -113,6 +_,8 @@ - public IPackNameDecorator func_232614_i_() { - return this.field_232611_k_; + public IPackNameDecorator getPackSource() { + return this.packSource; } + + public boolean isHidden() { return hidden; } diff --git a/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch b/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch index 7ff5a99af8..4a0c60464b 100644 --- a/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourcePackList.java.patch @@ -3,20 +3,20 @@ @@ -22,7 +_,7 @@ public ResourcePackList(ResourcePackInfo.IFactory p_i231423_1_, IPackFinder... p_i231423_2_) { - this.field_198990_d = p_i231423_1_; -- this.field_198987_a = ImmutableSet.copyOf(p_i231423_2_); -+ this.field_198987_a = new java.util.HashSet<>(java.util.Arrays.asList(p_i231423_2_)); + this.constructor = p_i231423_1_; +- this.sources = ImmutableSet.copyOf(p_i231423_2_); ++ this.sources = new java.util.HashSet<>(java.util.Arrays.asList(p_i231423_2_)); } public ResourcePackList(IPackFinder... p_i241886_1_) { @@ -87,6 +_,10 @@ @Nullable - public ResourcePackInfo func_198981_a(String p_198981_1_) { - return this.field_198988_b.get(p_198981_1_); + public ResourcePackInfo getPack(String p_198981_1_) { + return this.available.get(p_198981_1_); + } + + public synchronized void addPackFinder(IPackFinder packFinder) { -+ this.field_198987_a.add(packFinder); ++ this.sources.add(packFinder); } public void close() { diff --git a/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch index 6294faa21e..8a9230bec0 100644 --- a/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch +++ b/patches/minecraft/net/minecraft/resources/VanillaPack.java.patch @@ -4,20 +4,20 @@ try { URL url = VanillaPack.class.getResource(s); -- return func_223459_a(s, url) ? url.openStream() : null; -+ return func_223459_a(s, url) ? getExtraInputStream(p_195782_1_, s) : null; +- return isResourceUrlValid(s, url) ? url.openStream() : null; ++ return isResourceUrlValid(s, url) ? getExtraInputStream(p_195782_1_, s) : null; } catch (IOException ioexception) { return VanillaPack.class.getResourceAsStream(s); } @@ -187,7 +_,7 @@ @Nullable - protected InputStream func_200010_a(String p_200010_1_) { + protected InputStream getResourceAsStream(String p_200010_1_) { - return VanillaPack.class.getResourceAsStream("/" + p_200010_1_); + return getExtraInputStream(ResourcePackType.SERVER_DATA, "/" + p_200010_1_); } - public boolean func_195764_b(ResourcePackType p_195764_1_, ResourceLocation p_195764_2_) { + public boolean hasResource(ResourcePackType p_195764_1_, ResourceLocation p_195764_2_) { @@ -225,5 +_,19 @@ } @@ -29,7 +29,7 @@ + //So find that extra jar using the .mcassetsroot marker. + private InputStream getExtraInputStream(ResourcePackType type, String resource) { + try { -+ FileSystem fs = field_217810_e.get(type); ++ FileSystem fs = JAR_FILESYSTEM_BY_TYPE.get(type); + if (fs != null) + return Files.newInputStream(fs.getPath(resource)); + return VanillaPack.class.getResourceAsStream(resource); diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index 259bbce804..4c5f6a746b 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -16,29 +16,29 @@ + Path path1 = Paths.get("eula.txt"); + ServerEula servereula = new ServerEula(path1); + -+ if (!servereula.func_154346_a()) { -+ field_240759_a_.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); ++ if (!servereula.hasAgreedToEULA()) { ++ LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + return; + } - CrashReport.func_230188_h_(); - Bootstrap.func_151354_b(); - Bootstrap.func_218821_c(); - Util.func_240994_l_(); + CrashReport.preload(); + Bootstrap.bootStrap(); + Bootstrap.validate(); + Util.startTimerHackThread(); + if (!optionset.has(optionspec1)) net.minecraftforge.fml.server.ServerModLoader.load(); // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param - DynamicRegistries.Impl dynamicregistries$impl = DynamicRegistries.func_239770_b_(); + DynamicRegistries.Impl dynamicregistries$impl = DynamicRegistries.builtin(); Path path = Paths.get("server.properties"); ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(dynamicregistries$impl, path); - serverpropertiesprovider.func_219035_b(); + serverpropertiesprovider.forceSave(); - Path path1 = Paths.get("eula.txt"); - ServerEula servereula = new ServerEula(path1); if (optionset.has(optionspec1)) { - field_240759_a_.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath()); + LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath()); return; } -- if (!servereula.func_154346_a()) { -- field_240759_a_.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); +- if (!servereula.hasAgreedToEULA()) { +- LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - return; - } - @@ -46,29 +46,29 @@ YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); - PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.field_152367_a.getName())); - String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o); + PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.USERID_CACHE_FILE.getName())); + String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(serverpropertiesprovider.getProperties().levelName); + if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { -+ field_240759_a_.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); ++ LOGGER.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); + return; + } - SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath()); - SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s); - MinecraftServer.func_240777_a_(saveformat$levelsave); + SaveFormat saveformat = SaveFormat.createDefault(file1.toPath()); + SaveFormat.LevelSave saveformat$levelsave = saveformat.createAccess(s); + MinecraftServer.convertFromRegionFormatIfNeeded(saveformat$levelsave); @@ -142,6 +_,8 @@ - dimensiongeneratorsettings = optionset.has(optionspec3) ? serverproperties.field_241082_U_.func_236230_k_() : serverproperties.field_241082_U_; + dimensiongeneratorsettings = optionset.has(optionspec3) ? serverproperties.worldGenSettings.withBonusChest() : serverproperties.worldGenSettings; } + // Forge: Deserialize the DimensionGeneratorSettings to ensure modded dims are loaded on first server load (see SimpleRegistryCodec#decode). Vanilla behaviour only loads from the server.properties and deserializes only after the 2nd server load. -+ dimensiongeneratorsettings = DimensionGeneratorSettings.field_236201_a_.encodeStart(net.minecraft.util.registry.WorldGenSettingsExport.func_240896_a_(NBTDynamicOps.field_210820_a, dynamicregistries$impl), dimensiongeneratorsettings).flatMap(nbt -> DimensionGeneratorSettings.field_236201_a_.parse(worldsettingsimport, nbt)).getOrThrow(false, errorMsg->{}); ++ dimensiongeneratorsettings = DimensionGeneratorSettings.CODEC.encodeStart(net.minecraft.util.registry.WorldGenSettingsExport.create(NBTDynamicOps.INSTANCE, dynamicregistries$impl), dimensiongeneratorsettings).flatMap(nbt -> DimensionGeneratorSettings.CODEC.parse(worldsettingsimport, nbt)).getOrThrow(false, errorMsg->{}); iserverconfiguration = new ServerWorldInfo(worldsettings, dimensiongeneratorsettings, Lifecycle.stable()); } @@ -169,6 +_,7 @@ Thread thread = new Thread("Server Shutdown Thread") { public void run() { - dedicatedserver.func_71263_m(true); + dedicatedserver.halt(true); + 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(field_240759_a_)); + thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 473bc5a15e..8c2c09f04f 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -2,142 +2,142 @@ +++ b/net/minecraft/server/MinecraftServer.java @@ -228,7 +_,7 @@ - public static S func_240784_a_(Function p_240784_0_) { + public static S spin(Function p_240784_0_) { AtomicReference atomicreference = new AtomicReference<>(); - Thread thread = new Thread(() -> { + Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, () -> { - atomicreference.get().func_240802_v_(); + atomicreference.get().runServer(); }, "Server thread"); thread.setUncaughtExceptionHandler((p_240779_0_, p_240779_1_) -> { @@ -376,6 +_,7 @@ - worldborder.func_177737_a(new IBorderListener.Impl(serverworld1.func_175723_af())); - this.field_71305_c.put(registrykey1, serverworld1); + worldborder.addListener(new IBorderListener.Impl(serverworld1.getWorldBorder())); + this.levels.put(registrykey1, serverworld1); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(field_71305_c.get(registrykey))); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(levels.get(registrykey))); } } @@ -387,6 +_,7 @@ } else if (p_240786_3_) { - p_240786_1_.func_176143_a(BlockPos.field_177992_a.func_177984_a(), 0.0F); + p_240786_1_.setSpawn(BlockPos.ZERO.above(), 0.0F); } else { + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_240786_0_, p_240786_1_)) return; - BiomeProvider biomeprovider = chunkgenerator.func_202090_b(); - Random random = new Random(p_240786_0_.func_72905_C()); - BlockPos blockpos = biomeprovider.func_225531_a_(0, p_240786_0_.func_181545_F(), 0, 256, (p_244265_0_) -> { + BiomeProvider biomeprovider = chunkgenerator.getBiomeSource(); + Random random = new Random(p_240786_0_.getSeed()); + BlockPos blockpos = biomeprovider.findBiomeHorizontal(0, p_240786_0_.getSeaLevel(), 0, 256, (p_244265_0_) -> { @@ -452,6 +_,7 @@ } - private void func_213186_a(IChunkStatusListener p_213186_1_) { + private void prepareLevels(IChunkStatusListener p_213186_1_) { + net.minecraftforge.common.world.StructureSpawnManager.gatherEntitySpawns(); - ServerWorld serverworld = this.func_241755_D_(); - field_147145_h.info("Preparing start region for dimension {}", (Object)serverworld.func_234923_W_().func_240901_a_()); - BlockPos blockpos = serverworld.func_241135_u_(); + ServerWorld serverworld = this.overworld(); + LOGGER.info("Preparing start region for dimension {}", (Object)serverworld.dimension().location()); + BlockPos blockpos = serverworld.getSharedSpawnPos(); @@ -479,6 +_,7 @@ ChunkPos chunkpos = new ChunkPos(i); - serverworld1.func_72863_F().func_217206_a(chunkpos, true); + serverworld1.getChunkSource().updateChunkForced(chunkpos, true); } + net.minecraftforge.common.world.ForgeChunkManager.reinstatePersistentChunks(serverworld1, forcedchunkssavedata); } } @@ -566,6 +_,7 @@ - for(ServerWorld serverworld1 : this.func_212370_w()) { + for(ServerWorld serverworld1 : this.getAllLevels()) { if (serverworld1 != null) { try { + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(serverworld1)); serverworld1.close(); } catch (IOException ioexception1) { - field_147145_h.error("Exception closing the level", (Throwable)ioexception1); + LOGGER.error("Exception closing the level", (Throwable)ioexception1); @@ -614,6 +_,7 @@ - protected void func_240802_v_() { + protected void runServer() { try { - if (this.func_71197_b()) { + if (this.initServer()) { + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarted(this); - this.field_211151_aa = Util.func_211177_b(); - this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); - this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); + this.nextTickTime = Util.getMillis(); + this.status.setDescription(new StringTextComponent(this.motd)); + this.status.setVersion(new ServerStatusResponse.Version(SharedConstants.getCurrentVersion().getName(), SharedConstants.getCurrentVersion().getProtocolVersion())); @@ -643,7 +_,10 @@ - this.func_240795_b_(longtickdetector); - this.field_71296_Q = true; + this.endProfilerTick(longtickdetector); + this.isReady = true; } + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopping(this); + net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions } else { + net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions - this.func_71228_a((CrashReport)null); + this.onServerCrash((CrashReport)null); } } catch (Throwable throwable1) { @@ -662,6 +_,7 @@ - field_147145_h.error("We were unable to save this crash report to disk."); + LOGGER.error("We were unable to save this crash report to disk."); } + net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions - this.func_71228_a(crashreport); + this.onServerCrash(crashreport); } finally { try { @@ -670,6 +_,7 @@ } catch (Throwable throwable) { - field_147145_h.error("Exception stopping the server", throwable); + LOGGER.error("Exception stopping the server", throwable); } finally { + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopped(this); - this.func_71240_o(); + this.onServerExit(); } @@ -771,6 +_,7 @@ - protected void func_71217_p(BooleanSupplier p_71217_1_) { - long i = Util.func_211178_c(); + protected void tickServer(BooleanSupplier p_71217_1_) { + long i = Util.getNanos(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPreServerTick(); - ++this.field_71315_w; - this.func_71190_q(p_71217_1_); - if (i - this.field_147142_T >= 5000000000L) { + ++this.tickCount; + this.tickChildren(p_71217_1_); + if (i - this.lastServerStatus >= 5000000000L) { @@ -785,6 +_,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); - this.field_147147_p.func_151318_b().func_151330_a(agameprofile); -+ this.field_147147_p.invalidateJson(); + this.status.getPlayers().setSample(agameprofile); ++ this.status.invalidateJson(); } - if (this.field_71315_w % 6000 == 0) { + if (this.tickCount % 6000 == 0) { @@ -812,6 +_,7 @@ - long i1 = Util.func_211178_c(); - this.field_213215_ap.func_181747_a(i1 - i); - this.field_71304_b.func_76319_b(); + long i1 = Util.getNanos(); + this.frameTimer.logFrameDuration(i1 - i); + this.profiler.pop(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPostServerTick(); } - protected void func_71190_q(BooleanSupplier p_71190_1_) { + protected void tickChildren(BooleanSupplier p_71190_1_) { @@ -819,7 +_,8 @@ - this.func_193030_aL().func_73660_a(); - this.field_71304_b.func_219895_b("levels"); + this.getFunctions().tick(); + this.profiler.popPush("levels"); -- for(ServerWorld serverworld : this.func_212370_w()) { +- for(ServerWorld serverworld : this.getAllLevels()) { + for(ServerWorld serverworld : this.getWorldArray()) { -+ long tickStart = Util.func_211178_c(); - this.field_71304_b.func_194340_a(() -> { - return serverworld + " " + serverworld.func_234923_W_().func_240901_a_(); ++ long tickStart = Util.getNanos(); + this.profiler.push(() -> { + return serverworld + " " + serverworld.dimension().location(); }); @@ -830,6 +_,7 @@ } - this.field_71304_b.func_76320_a("tick"); + this.profiler.push("tick"); + net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(serverworld); try { - serverworld.func_72835_b(p_71190_1_); + serverworld.tick(p_71190_1_); @@ -838,9 +_,11 @@ - serverworld.func_72914_a(crashreport); + serverworld.fillReportDetails(crashreport); throw new ReportedException(crashreport); } + net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(serverworld); - this.field_71304_b.func_76319_b(); - this.field_71304_b.func_76319_b(); -+ perWorldTickTimes.computeIfAbsent(serverworld.func_234923_W_(), k -> new long[100])[this.field_71315_w % 100] = Util.func_211178_c() - tickStart; + this.profiler.pop(); + this.profiler.pop(); ++ perWorldTickTimes.computeIfAbsent(serverworld.dimension(), k -> new long[100])[this.tickCount % 100] = Util.getNanos() - tickStart; } - this.field_71304_b.func_219895_b("connection"); + this.profiler.popPush("connection"); @@ -915,7 +_,7 @@ } @@ -146,42 +146,42 @@ + return net.minecraftforge.fml.BrandingControl.getServerBranding(); } - public CrashReport func_71230_b(CrashReport p_71230_1_) { + public CrashReport fillReport(CrashReport p_71230_1_) { @@ -928,6 +_,7 @@ - p_71230_1_.func_85056_g().func_189529_a("Data Packs", () -> { + p_71230_1_.getSystemDetails().setDetail("Data Packs", () -> { StringBuilder stringbuilder = new StringBuilder(); + LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. - for(ResourcePackInfo resourcepackinfo : this.field_195577_ad.func_198980_d()) { + for(ResourcePackInfo resourcepackinfo : this.packRepository.getSelectedPacks()) { if (stringbuilder.length() > 0) { stringbuilder.append(", "); @@ -1280,6 +_,7 @@ - this.func_184103_al().func_193244_w(); - this.field_200258_al.func_240946_a_(this.field_195576_ac.func_240960_a_()); - this.field_240765_ak_.func_195410_a(this.field_195576_ac.func_240970_h_()); -+ this.func_184103_al().func_181057_v().forEach(this.func_184103_al()::func_187243_f); //Forge: Fix newly added/modified commands not being sent to the client when commands reload. + this.getPlayerList().reloadResources(); + this.functionManager.replaceLibrary(this.resources.getFunctionLibrary()); + this.structureManager.onResourceManagerReload(this.resources.getResourceManager()); ++ 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.func_213162_bc()) { - this.func_213161_c(completablefuture::isDone); + if (this.isSameThread()) { + this.managedBlock(completablefuture::isDone); @@ -1289,10 +_,13 @@ } - public static DatapackCodec func_240772_a_(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) { + public static DatapackCodec configurePackRepository(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) { + net.minecraftforge.fml.packs.ResourcePackLoader.loadResourcePacks(p_240772_0_, net.minecraftforge.fml.server.ServerLifecycleHooks::buildPackFinder); - p_240772_0_.func_198983_a(); -+ DatapackCodec.field_234880_a_.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); + p_240772_0_.reload(); ++ DatapackCodec.DEFAULT.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); + p_240772_1_.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); if (p_240772_2_) { -- p_240772_0_.func_198985_a(Collections.singleton("vanilla")); +- p_240772_0_.setSelected(Collections.singleton("vanilla")); - return new DatapackCodec(ImmutableList.of("vanilla"), ImmutableList.of()); -+ p_240772_0_.func_198985_a(net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla()); ++ p_240772_0_.setSelected(net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla()); + return new DatapackCodec(net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla(), ImmutableList.of()); } else { Set set = Sets.newLinkedHashSet(); @@ -1442,6 +_,31 @@ - public abstract boolean func_213199_b(GameProfile p_213199_1_); + public abstract boolean isSingleplayerOwner(GameProfile p_213199_1_); + private Map, long[]> perWorldTickTimes = Maps.newIdentityHashMap(); + @Nullable @@ -191,7 +191,7 @@ + + @Deprecated //Forge Internal use Only, You can screw up a lot of things if you mess with this map. + public synchronized Map, ServerWorld> forgeGetWorldMap() { -+ return this.field_71305_c; ++ return this.levels; + } + private int worldArrayMarker = 0; + private int worldArrayLast = -1; @@ -203,22 +203,22 @@ + private ServerWorld[] getWorldArray() { + if (worldArrayMarker == worldArrayLast && worldArray != null) + return worldArray; -+ worldArray = this.field_71305_c.values().stream().toArray(x -> new ServerWorld[x]); ++ worldArray = this.levels.values().stream().toArray(x -> new ServerWorld[x]); + worldArrayLast = worldArrayMarker; + return worldArray; + } + - public void func_223711_a(Path p_223711_1_) throws IOException { + public void saveDebugReport(Path p_223711_1_) throws IOException { Path path = p_223711_1_.resolve("levels"); @@ -1568,6 +_,10 @@ - public IServerConfiguration func_240793_aU_() { - return this.field_240768_i_; + public IServerConfiguration getWorldData() { + return this.worldData; + } + + public DataPackRegistries getDataPackRegistries() { -+ return field_195576_ac; ++ return resources; } - public DynamicRegistries func_244267_aX() { + public DynamicRegistries registryAccess() { diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index c4e7018c71..075b912a0a 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java @@ -81,6 +_,7 @@ - public boolean func_71197_b() throws IOException { + public boolean initServer() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; @@ -9,26 +9,26 @@ String s1; @@ -162,11 +_,13 @@ - SkullTileEntity.func_184293_a(this.func_152358_ax()); - SkullTileEntity.func_184294_a(this.func_147130_as()); - PlayerProfileCache.func_187320_a(this.func_71266_T()); + SkullTileEntity.setProfileCache(this.getProfileCache()); + SkullTileEntity.setSessionService(this.getSessionService()); + PlayerProfileCache.setUsesAuthentication(this.usesAuthentication()); + if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - field_155771_h.info("Preparing level \"{}\"", (Object)this.func_230542_k__()); - this.func_240800_l__(); - long j = Util.func_211178_c() - i; + LOGGER.info("Preparing level \"{}\"", (Object)this.getLevelIdName()); + this.loadLevel(); + long j = Util.getNanos() - i; String s = String.format(Locale.ROOT, "%.3fs", (double)j / 1.0E9D); - field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s); -+ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. - if (serverproperties.field_219027_u != null) { - this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this); + LOGGER.info("Done ({})! For help, type \"help\"", (Object)s); ++ this.nextTickTime = Util.getMillis(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (serverproperties.announcePlayerAchievements != null) { + this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS).set(serverproperties.announcePlayerAchievements, this); } @@ -190,11 +_,12 @@ } - Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); + Items.AIR.fillItemCategory(ItemGroup.TAB_SEARCH, NonNullList.create()); + // <3 you Grum for this, saves us ~30 patch files! --^ - if (serverproperties.field_241079_P_) { - ServerInfoMBean.func_233490_a_(this); + if (serverproperties.enableJmxMonitoring) { + ServerInfoMBean.registerJmxMonitoring(this); } - return true; @@ -38,13 +38,13 @@ @@ -513,6 +_,11 @@ - public boolean func_213199_b(GameProfile p_213199_1_) { + public boolean isSingleplayerOwner(GameProfile p_213199_1_) { return false; + } + + @Override //Forge: Enable formated text for colors in console. -+ public void func_145747_a(net.minecraft.util.text.ITextComponent message, java.util.UUID p_145747_2_) { -+ field_155771_h.info(message.getString()); ++ public void sendMessage(net.minecraft.util.text.ITextComponent message, java.util.UUID p_145747_2_) { ++ LOGGER.info(message.getString()); } - public int func_230512_b_(int p_230512_1_) { + public int getScaledTrackingDistance(int p_230512_1_) { diff --git a/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch b/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch index b177a94161..75acd8ada2 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/PropertyManager.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/server/dedicated/PropertyManager.java @@ -39,7 +_,7 @@ - public void func_218970_c(Path p_218970_1_) { + public void store(Path p_218970_1_) { try (OutputStream outputstream = Files.newOutputStream(p_218970_1_)) { -- this.field_73672_b.store(outputstream, "Minecraft server properties"); -+ net.minecraftforge.common.util.SortedProperties.store(field_73672_b, outputstream, "Minecraft server properties"); +- this.properties.store(outputstream, "Minecraft server properties"); ++ net.minecraftforge.common.util.SortedProperties.store(properties, outputstream, "Minecraft server properties"); } catch (IOException ioexception) { - field_164440_a.error("Failed to store properties to file: " + p_218970_1_); + LOGGER.error("Failed to store properties to file: " + p_218970_1_); } diff --git a/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch index 38cc8b0876..07c37fe703 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch @@ -8,4 +8,4 @@ + Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error for(ThreadInfo threadinfo : athreadinfo) { - if (threadinfo.getThreadId() == this.field_180249_b.func_213170_ax().getId()) { + if (threadinfo.getThreadId() == this.server.getRunningThread().getId()) { diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index af93e0adc8..6545afad23 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -5,19 +5,19 @@ } + private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); - public void func_206931_a() { - this.field_206932_d.start(); + public void start() { + this.logAppenderThread.start(); + latch.countDown(); } - public void func_219050_b() { + public void close() { @@ -153,6 +_,9 @@ } - public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { + public void print(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { + try { + latch.await(); + } catch (InterruptedException e){} //Prevent logging until after constructor has ended. if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(() -> { - this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_); + this.print(p_164247_1_, p_164247_2_, p_164247_3_); diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index d968148116..e6186743e5 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/server/integrated/IntegratedServer.java +++ b/net/minecraft/server/integrated/IntegratedServer.java @@ -56,9 +_,10 @@ - this.func_71188_g(true); - this.func_71245_h(true); - this.func_244801_P(); + this.setPvpAllowed(true); + this.setFlightAllowed(true); + this.initializeKeyPair(); + if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - this.func_240800_l__(); - this.func_71205_p(this.func_71214_G() + " - " + this.func_240793_aU_().func_76065_j()); + this.loadLevel(); + this.setMotd(this.getSingleplayerName() + " - " + this.getWorldData().getLevelName()); - return true; + return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); } - public void func_71217_p(BooleanSupplier p_71217_1_) { + public void tickServer(BooleanSupplier p_71217_1_) { @@ -172,6 +_,7 @@ } - public void func_71263_m(boolean p_71263_1_) { -+ if (func_71278_l()) - this.func_213167_f(() -> { - for(ServerPlayerEntity serverplayerentity : Lists.newArrayList(this.func_184103_al().func_181057_v())) { - if (!serverplayerentity.func_110124_au().equals(this.field_211528_n)) { + public void halt(boolean p_71263_1_) { ++ if (isRunning()) + this.executeBlocking(() -> { + for(ServerPlayerEntity serverplayerentity : Lists.newArrayList(this.getPlayerList().getPlayers())) { + if (!serverplayerentity.getUUID().equals(this.uuid)) { diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 97378cb3cd..f55b1f5b9f 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -1,100 +1,100 @@ --- a/net/minecraft/server/management/PlayerInteractionManager.java +++ b/net/minecraft/server/management/PlayerInteractionManager.java @@ -87,7 +_,7 @@ - ++this.field_73100_i; - if (this.field_73097_j) { - BlockState blockstate = this.field_73092_a.func_180495_p(this.field_180241_i); -- if (blockstate.func_196958_f()) { -+ if (blockstate.isAir(field_73092_a, field_180241_i)) { - this.field_73097_j = false; + ++this.gameTicks; + if (this.hasDelayedDestroy) { + BlockState blockstate = this.level.getBlockState(this.delayedDestroyPos); +- if (blockstate.isAir()) { ++ if (blockstate.isAir(level, delayedDestroyPos)) { + this.hasDelayedDestroy = false; } else { - float f = this.func_229859_a_(blockstate, this.field_180241_i, this.field_73093_n); + float f = this.incrementDestroyProgress(blockstate, this.delayedDestroyPos, this.delayedTickStart); @@ -98,7 +_,7 @@ } - } else if (this.field_73088_d) { - BlockState blockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); -- if (blockstate1.func_196958_f()) { -+ if (blockstate1.isAir(field_73092_a, field_180240_f)) { - this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); - this.field_73094_o = -1; - this.field_73088_d = false; + } else if (this.isDestroyingBlock) { + BlockState blockstate1 = this.level.getBlockState(this.destroyPos); +- if (blockstate1.isAir()) { ++ if (blockstate1.isAir(level, destroyPos)) { + this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1); + this.lastSentState = -1; + this.isDestroyingBlock = false; @@ -126,7 +_,15 @@ - double d1 = this.field_73090_b.func_226278_cu_() - ((double)p_225416_1_.func_177956_o() + 0.5D) + 1.5D; - double d2 = this.field_73090_b.func_226281_cx_() - ((double)p_225416_1_.func_177952_p() + 0.5D); + double d1 = this.player.getY() - ((double)p_225416_1_.getY() + 0.5D) + 1.5D; + double d2 = this.player.getZ() - ((double)p_225416_1_.getZ() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 > 36.0D) { -+ double dist = field_73090_b.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e() + 1; -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_225416_1_, p_225416_3_); -+ if (event.isCanceled() || (!this.func_73083_d() && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "mod canceled")); -+ field_73092_a.func_184138_a(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), field_73092_a.func_180495_p(p_225416_1_), 3); ++ double dist = player.getAttribute(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).getValue() + 1; ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(player, p_225416_1_, p_225416_3_); ++ if (event.isCanceled() || (!this.isCreative() && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data ++ player.connection.send(new SPlayerDiggingPacket(p_225416_1_, level.getBlockState(p_225416_1_), p_225416_2_, false, "mod canceled")); ++ level.sendBlockUpdated(p_225416_1_, level.getBlockState(p_225416_1_), level.getBlockState(p_225416_1_), 3); + return; + } + dist *= dist; + if (d3 > dist) { - this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too far")); - } else if (p_225416_1_.func_177956_o() >= p_225416_4_) { - this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too high")); + this.player.connection.send(new SPlayerDiggingPacket(p_225416_1_, this.level.getBlockState(p_225416_1_), p_225416_2_, false, "too far")); + } else if (p_225416_1_.getY() >= p_225416_4_) { + this.player.connection.send(new SPlayerDiggingPacket(p_225416_1_, this.level.getBlockState(p_225416_1_), p_225416_2_, false, "too high")); @@ -150,12 +_,13 @@ - this.field_73089_e = this.field_73100_i; + this.destroyProgressStart = this.gameTicks; float f = 1.0F; - BlockState blockstate = this.field_73092_a.func_180495_p(p_225416_1_); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(field_73092_a, p_225416_1_)) { + BlockState blockstate = this.level.getBlockState(p_225416_1_); +- if (!blockstate.isAir()) { ++ if (!blockstate.isAir(level, p_225416_1_)) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - blockstate.func_196942_a(this.field_73092_a, p_225416_1_, this.field_73090_b); - f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_225416_1_); + blockstate.attack(this.level, p_225416_1_, this.player); + f = blockstate.getDestroyProgress(this.player, this.player.level, p_225416_1_); } -- if (!blockstate.func_196958_f() && f >= 1.0F) { -+ if (!blockstate.isAir(field_73092_a, p_225416_1_) && f >= 1.0F) { - this.func_229860_a_(p_225416_1_, p_225416_2_, "insta mine"); +- if (!blockstate.isAir() && f >= 1.0F) { ++ if (!blockstate.isAir(level, p_225416_1_) && f >= 1.0F) { + this.destroyAndAck(p_225416_1_, p_225416_2_, "insta mine"); } else { - if (this.field_73088_d) { + if (this.isDestroyingBlock) { @@ -218,7 +_,8 @@ - public boolean func_180237_b(BlockPos p_180237_1_) { - BlockState blockstate = this.field_73092_a.func_180495_p(p_180237_1_); -- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(blockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) { -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); + public boolean destroyBlock(BlockPos p_180237_1_) { + BlockState blockstate = this.level.getBlockState(p_180237_1_); +- if (!this.player.getMainHandItem().getItem().canAttackBlock(blockstate, this.level, p_180237_1_, this.player)) { ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(level, gameModeForPlayer, player, p_180237_1_); + if (exp == -1) { return false; } else { - TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); + TileEntity tileentity = this.level.getBlockEntity(p_180237_1_); @@ -226,30 +_,42 @@ - if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_73090_b.func_195070_dx()) { - this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3); + if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.player.canUseGameMasterBlocks()) { + this.level.sendBlockUpdated(p_180237_1_, blockstate, blockstate, 3); return false; -+ } else if (field_73090_b.func_184614_ca().onBlockStartBreak(p_180237_1_, field_73090_b)) { ++ } else if (player.getMainHandItem().onBlockStartBreak(p_180237_1_, player)) { + return false; - } else if (this.field_73090_b.func_223729_a(this.field_73092_a, p_180237_1_, this.field_73091_c)) { + } else if (this.player.blockActionRestricted(this.level, p_180237_1_, this.gameModeForPlayer)) { return false; } else { -- block.func_176208_a(this.field_73092_a, p_180237_1_, blockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_217377_a(p_180237_1_, false); +- block.playerWillDestroy(this.level, p_180237_1_, blockstate, this.player); +- boolean flag = this.level.removeBlock(p_180237_1_, false); - if (flag) { -- block.func_176206_d(this.field_73092_a, p_180237_1_, blockstate); +- block.destroy(this.level, p_180237_1_, blockstate); - } - - if (this.func_73083_d()) { + if (this.isCreative()) { + removeBlock(p_180237_1_, false); return true; } else { - ItemStack itemstack = this.field_73090_b.func_184614_ca(); - ItemStack itemstack1 = itemstack.func_77946_l(); -- boolean flag1 = this.field_73090_b.func_234569_d_(blockstate); -+ boolean flag1 = blockstate.canHarvestBlock(this.field_73092_a, p_180237_1_, this.field_73090_b); // previously player.hasCorrectToolForDrops(blockstate) - itemstack.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b); -+ if (itemstack.func_190926_b() && !itemstack1.func_190926_b()) -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack1, Hand.MAIN_HAND); + ItemStack itemstack = this.player.getMainHandItem(); + ItemStack itemstack1 = itemstack.copy(); +- boolean flag1 = this.player.hasCorrectToolForDrops(blockstate); ++ boolean flag1 = blockstate.canHarvestBlock(this.level, p_180237_1_, this.player); // previously player.hasCorrectToolForDrops(blockstate) + itemstack.mineBlock(this.level, blockstate, p_180237_1_, this.player); ++ if (itemstack.isEmpty() && !itemstack1.isEmpty()) ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, itemstack1, Hand.MAIN_HAND); + boolean flag = removeBlock(p_180237_1_, flag1); + if (flag && flag1) { - block.func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1); + block.playerDestroy(this.level, this.player, p_180237_1_, blockstate, tileentity, itemstack1); } + if (flag && exp > 0) -+ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ blockstate.getBlock().popExperience(level, p_180237_1_, exp); + return true; } @@ -103,31 +103,31 @@ + } + + private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) { -+ BlockState state = this.field_73092_a.func_180495_p(p_180235_1_); -+ boolean removed = state.removedByPlayer(this.field_73092_a, p_180235_1_, this.field_73090_b, canHarvest, this.field_73092_a.func_204610_c(p_180235_1_)); ++ BlockState state = this.level.getBlockState(p_180235_1_); ++ boolean removed = state.removedByPlayer(this.level, p_180235_1_, this.player, canHarvest, this.level.getFluidState(p_180235_1_)); + if (removed) -+ state.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, state); ++ state.getBlock().destroy(this.level, p_180235_1_, state); + return removed; } - public ActionResultType func_187250_a(ServerPlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) { + public ActionResultType useItem(ServerPlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) { @@ -258,6 +_,8 @@ - } else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) { + } else if (p_187250_1_.getCooldowns().isOnCooldown(p_187250_3_.getItem())) { return ActionResultType.PASS; } else { + ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); + if (cancelResult != null) return cancelResult; - int i = p_187250_3_.func_190916_E(); - int j = p_187250_3_.func_77952_i(); - ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); + int i = p_187250_3_.getCount(); + int j = p_187250_3_.getDamageValue(); + ActionResult actionresult = p_187250_3_.use(p_187250_2_, p_187250_1_, p_187250_4_); @@ -291,6 +_,8 @@ - public ActionResultType func_219441_a(ServerPlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) { - BlockPos blockpos = p_219441_5_.func_216350_a(); - BlockState blockstate = p_219441_2_.func_180495_p(blockpos); + public ActionResultType useItemOn(ServerPlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) { + BlockPos blockpos = p_219441_5_.getBlockPos(); + BlockState blockstate = p_219441_2_.getBlockState(blockpos); + net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_); + if (event.isCanceled()) return event.getCancellationResult(); - if (this.field_73091_c == GameType.SPECTATOR) { - INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos); + if (this.gameModeForPlayer == GameType.SPECTATOR) { + INamedContainerProvider inamedcontainerprovider = blockstate.getMenuProvider(p_219441_2_, blockpos); if (inamedcontainerprovider != null) { @@ -300,10 +_,15 @@ return ActionResultType.PASS; @@ -138,23 +138,23 @@ + ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext); + if (result != ActionResultType.PASS) return result; + } - boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b(); -- boolean flag1 = p_219441_1_.func_226563_dT_() && flag; -+ boolean flag1 = (p_219441_1_.func_226563_dT_() && flag) && !(p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_)); - ItemStack itemstack = p_219441_3_.func_77946_l(); + boolean flag = !p_219441_1_.getMainHandItem().isEmpty() || !p_219441_1_.getOffhandItem().isEmpty(); +- boolean flag1 = p_219441_1_.isSecondaryUseActive() && flag; ++ boolean flag1 = (p_219441_1_.isSecondaryUseActive() && flag) && !(p_219441_1_.getMainHandItem().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && p_219441_1_.getOffhandItem().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_)); + ItemStack itemstack = p_219441_3_.copy(); - if (!flag1) { + if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { - ActionResultType actionresulttype = blockstate.func_227031_a_(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_); - if (actionresulttype.func_226246_a_()) { - CriteriaTriggers.field_232607_M_.func_226695_a_(p_219441_1_, blockpos, itemstack); + ActionResultType actionresulttype = blockstate.use(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_); + if (actionresulttype.consumesAction()) { + CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(p_219441_1_, blockpos, itemstack); @@ -311,8 +_,8 @@ } } -- if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { +- if (!p_219441_3_.isEmpty() && !p_219441_1_.getCooldowns().isOnCooldown(p_219441_3_.getItem())) { - ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b()))) { ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!p_219441_3_.isEmpty() && !p_219441_1_.getCooldowns().isOnCooldown(p_219441_3_.getItem()))) { + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS; ActionResultType actionresulttype1; - if (this.func_73083_d()) { - int i = p_219441_3_.func_190916_E(); + if (this.isCreative()) { + int i = p_219441_3_.getCount(); diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch index 7436acd62b..c14325b7b3 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -1,166 +1,166 @@ --- a/net/minecraft/server/management/PlayerList.java +++ b/net/minecraft/server/management/PlayerList.java @@ -110,6 +_,7 @@ - private GameType field_72410_m; - private boolean field_72407_n; - private int field_72408_o; -+ private final List playersView = java.util.Collections.unmodifiableList(field_72404_b); + private GameType overrideGameMode; + private boolean allowCheatsForAllPlayers; + private int sendAllPlayerInfoIn; ++ private final List playersView = java.util.Collections.unmodifiableList(players); public PlayerList(MinecraftServer p_i231425_1_, DynamicRegistries.Impl p_i231425_2_, PlayerData p_i231425_3_, int p_i231425_4_) { - this.field_72400_f = p_i231425_1_; + this.server = p_i231425_1_; @@ -146,6 +_,7 @@ - IWorldInfo iworldinfo = serverworld1.func_72912_H(); - this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld1); - ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_); + IWorldInfo iworldinfo = serverworld1.getLevelData(); + this.updatePlayerGameMode(p_72355_2_, (ServerPlayerEntity)null, serverworld1); + ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.server, p_72355_1_, p_72355_2_); + net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT"); - GameRules gamerules = serverworld1.func_82736_K(); - boolean flag = gamerules.func_223586_b(GameRules.field_226683_z_); - boolean flag1 = gamerules.func_223586_b(GameRules.field_223612_o); + GameRules gamerules = serverworld1.getGameRules(); + boolean flag = gamerules.getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN); + boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); @@ -154,8 +_,10 @@ - serverplaynethandler.func_147359_a(new SServerDifficultyPacket(iworldinfo.func_176130_y(), iworldinfo.func_176123_z())); - serverplaynethandler.func_147359_a(new SPlayerAbilitiesPacket(p_72355_2_.field_71075_bZ)); - serverplaynethandler.func_147359_a(new SHeldItemChangePacket(p_72355_2_.field_71071_by.field_70461_c)); + serverplaynethandler.send(new SServerDifficultyPacket(iworldinfo.getDifficulty(), iworldinfo.isDifficultyLocked())); + serverplaynethandler.send(new SPlayerAbilitiesPacket(p_72355_2_.abilities)); + serverplaynethandler.send(new SHeldItemChangePacket(p_72355_2_.inventory.selected)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, p_72355_2_)); - serverplaynethandler.func_147359_a(new SUpdateRecipesPacket(this.field_72400_f.func_199529_aN().func_199510_b())); - serverplaynethandler.func_147359_a(new STagsListPacket(this.field_72400_f.func_244266_aF())); -+ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(p_72355_2_, this.field_72400_f.func_244266_aF()); - this.func_187243_f(p_72355_2_); - p_72355_2_.func_147099_x().func_150877_d(); - p_72355_2_.func_192037_E().func_192826_c(p_72355_2_); + serverplaynethandler.send(new SUpdateRecipesPacket(this.server.getRecipeManager().getRecipes())); + serverplaynethandler.send(new STagsListPacket(this.server.getTags())); ++ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(p_72355_2_, this.server.getTags()); + this.sendPlayerPermissionLevel(p_72355_2_); + p_72355_2_.getStats().markAllDirty(); + p_72355_2_.getRecipeBook().sendInitialRecipeBook(p_72355_2_); @@ -170,7 +_,7 @@ - this.func_232641_a_(iformattabletextcomponent.func_240699_a_(TextFormatting.YELLOW), ChatType.SYSTEM, Util.field_240973_b_); - serverplaynethandler.func_147364_a(p_72355_2_.func_226277_ct_(), p_72355_2_.func_226278_cu_(), p_72355_2_.func_226281_cx_(), p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); -- this.field_72404_b.add(p_72355_2_); + this.broadcastMessage(iformattabletextcomponent.withStyle(TextFormatting.YELLOW), ChatType.SYSTEM, Util.NIL_UUID); + serverplaynethandler.teleport(p_72355_2_.getX(), p_72355_2_.getY(), p_72355_2_.getZ(), p_72355_2_.yRot, p_72355_2_.xRot); +- this.players.add(p_72355_2_); + this.addPlayer(p_72355_2_); - this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_); - this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_)); + this.playersByUUID.put(p_72355_2_.getUUID(), p_72355_2_); + this.broadcastAll(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_)); @@ -225,6 +_,7 @@ } - p_72355_2_.func_71116_b(); + p_72355_2_.initMenu(); + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn( p_72355_2_ ); } - protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { + protected void updateEntireScoreboard(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { @@ -285,6 +_,7 @@ compoundnbt1 = compoundnbt; - p_72380_1_.func_70020_e(compoundnbt); - field_148546_d.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); + p_72380_1_.load(compoundnbt); + LOGGER.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.playerIo, p_72380_1_.getUUID().toString()); } else { - compoundnbt1 = this.field_72412_k.func_237336_b_(p_72380_1_); + compoundnbt1 = this.playerIo.load(p_72380_1_); } @@ -293,6 +_,7 @@ } - protected void func_72391_b(ServerPlayerEntity p_72391_1_) { -+ if (p_72391_1_.field_71135_a == null) return; - this.field_72412_k.func_237335_a_(p_72391_1_); - ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au()); + protected void save(ServerPlayerEntity p_72391_1_) { ++ if (p_72391_1_.connection == null) return; + this.playerIo.save(p_72391_1_); + ServerStatisticsManager serverstatisticsmanager = this.stats.get(p_72391_1_.getUUID()); if (serverstatisticsmanager != null) { @@ -307,6 +_,7 @@ } - public void func_72367_e(ServerPlayerEntity p_72367_1_) { + public void remove(ServerPlayerEntity p_72367_1_) { + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedOut(p_72367_1_); - ServerWorld serverworld = p_72367_1_.func_71121_q(); - p_72367_1_.func_195066_a(Stats.field_75947_j); - this.func_72391_b(p_72367_1_); + ServerWorld serverworld = p_72367_1_.getLevel(); + p_72367_1_.awardStat(Stats.LEAVE_GAME); + this.save(p_72367_1_); @@ -330,7 +_,7 @@ - p_72367_1_.func_213319_R(); - serverworld.func_217434_e(p_72367_1_); - p_72367_1_.func_192039_O().func_192745_a(); -- this.field_72404_b.remove(p_72367_1_); + p_72367_1_.unRide(); + serverworld.removePlayerImmediately(p_72367_1_); + p_72367_1_.getAdvancements().stopListening(); +- this.players.remove(p_72367_1_); + this.removePlayer(p_72367_1_); - this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_); - UUID uuid = p_72367_1_.func_110124_au(); - ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid); + this.server.getCustomBossEvents().onPlayerDisconnect(p_72367_1_); + UUID uuid = p_72367_1_.getUUID(); + ServerPlayerEntity serverplayerentity = this.playersByUUID.get(uuid); @@ -400,8 +_,8 @@ } - public ServerPlayerEntity func_232644_a_(ServerPlayerEntity p_232644_1_, boolean p_232644_2_) { -- this.field_72404_b.remove(p_232644_1_); -- p_232644_1_.func_71121_q().func_217434_e(p_232644_1_); + public ServerPlayerEntity respawn(ServerPlayerEntity p_232644_1_, boolean p_232644_2_) { +- this.players.remove(p_232644_1_); +- p_232644_1_.getLevel().removePlayerImmediately(p_232644_1_); + this.removePlayer(p_232644_1_); -+ p_232644_1_.func_71121_q().removePlayer(p_232644_1_, true); // Forge: keep data until copyFrom called - BlockPos blockpos = p_232644_1_.func_241140_K_(); - float f = p_232644_1_.func_242109_L(); - boolean flag = p_232644_1_.func_241142_M_(); ++ p_232644_1_.getLevel().removePlayer(p_232644_1_, true); // Forge: keep data until copyFrom called + BlockPos blockpos = p_232644_1_.getRespawnPosition(); + float f = p_232644_1_.getRespawnAngle(); + boolean flag = p_232644_1_.isRespawnForced(); @@ -424,6 +_,7 @@ - ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, serverworld1, p_232644_1_.func_146103_bH(), playerinteractionmanager); - serverplayerentity.field_71135_a = p_232644_1_.field_71135_a; - serverplayerentity.func_193104_a(p_232644_1_, p_232644_2_); + ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.server, serverworld1, p_232644_1_.getGameProfile(), playerinteractionmanager); + serverplayerentity.connection = p_232644_1_.connection; + serverplayerentity.restoreFrom(p_232644_1_, p_232644_2_); + p_232644_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it - serverplayerentity.func_145769_d(p_232644_1_.func_145782_y()); - serverplayerentity.func_184819_a(p_232644_1_.func_184591_cq()); + serverplayerentity.setId(p_232644_1_.getId()); + serverplayerentity.setMainArm(p_232644_1_.getMainArm()); @@ -465,10 +_,11 @@ - this.func_72354_b(serverplayerentity, serverworld1); - this.func_187243_f(serverplayerentity); - serverworld1.func_217433_d(serverplayerentity); -- this.field_72404_b.add(serverplayerentity); + this.sendLevelInfo(serverplayerentity, serverworld1); + this.sendPlayerPermissionLevel(serverplayerentity); + serverworld1.addRespawnedPlayer(serverplayerentity); +- this.players.add(serverplayerentity); + this.addPlayer(serverplayerentity); - this.field_177454_f.put(serverplayerentity.func_110124_au(), serverplayerentity); - serverplayerentity.func_71116_b(); - serverplayerentity.func_70606_j(serverplayerentity.func_110143_aJ()); + this.playersByUUID.put(serverplayerentity.getUUID(), serverplayerentity); + serverplayerentity.initMenu(); + serverplayerentity.setHealth(serverplayerentity.getHealth()); + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_232644_2_); if (flag2) { - serverplayerentity.field_71135_a.func_147359_a(new SPlaySoundEffectPacket(SoundEvents.field_232818_ms_, SoundCategory.BLOCKS, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), 1.0F, 1.0F)); + serverplayerentity.connection.send(new SPlaySoundEffectPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 1.0F, 1.0F)); } @@ -745,12 +_,6 @@ if (serverstatisticsmanager == null) { - File file1 = this.field_72400_f.func_240776_a_(FolderName.field_237246_b_).toFile(); + File file1 = this.server.getWorldPath(FolderName.PLAYER_STATS_DIR).toFile(); File file2 = new File(file1, uuid + ".json"); - if (!file2.exists()) { -- File file3 = new File(file1, p_152602_1_.func_200200_C_().getString() + ".json"); +- File file3 = new File(file1, p_152602_1_.getName().getString() + ".json"); - if (file3.exists() && file3.isFile()) { - file3.renameTo(file2); - } - } - serverstatisticsmanager = new ServerStatisticsManager(this.field_72400_f, file2); - this.field_148547_k.put(uuid, serverstatisticsmanager); + serverstatisticsmanager = new ServerStatisticsManager(this.server, file2); + this.stats.put(uuid, serverstatisticsmanager); @@ -769,6 +_,8 @@ - this.field_192055_p.put(uuid, playeradvancements); + this.advancements.put(uuid, playeradvancements); } + // Forge: don't overwrite active player with a fake one. + if (!(p_192054_1_ instanceof net.minecraftforge.common.util.FakePlayer)) - playeradvancements.func_192739_a(p_192054_1_); + playeradvancements.setPlayer(p_192054_1_); return playeradvancements; } @@ -786,7 +_,7 @@ } - public List func_181057_v() { -- return this.field_72404_b; + public List getPlayers() { +- return this.players; + return this.playersView; //Unmodifiable view, we don't want people removing things without us knowing. } @Nullable @@ -803,7 +_,9 @@ - playeradvancements.func_240918_a_(this.field_72400_f.func_191949_aK()); + playeradvancements.reload(this.server.getAdvancements()); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, null)); - this.func_148540_a(new STagsListPacket(this.field_72400_f.func_244266_aF())); -+ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(this.field_72400_f.func_244266_aF()); - SUpdateRecipesPacket supdaterecipespacket = new SUpdateRecipesPacket(this.field_72400_f.func_199529_aN().func_199510_b()); + this.broadcastAll(new STagsListPacket(this.server.getTags())); ++ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(this.server.getTags()); + SUpdateRecipesPacket supdaterecipespacket = new SUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()); - for(ServerPlayerEntity serverplayerentity : this.field_72404_b) { + for(ServerPlayerEntity serverplayerentity : this.players) { @@ -815,5 +_,13 @@ - public boolean func_206257_x() { - return this.field_72407_n; + public boolean isAllowCheatsForAllPlayers() { + return this.allowCheatsForAllPlayers; + } + + public boolean addPlayer(ServerPlayerEntity player) { -+ return field_72404_b.add(player); ++ return players.add(player); + } + + public boolean removePlayer(ServerPlayerEntity player) { -+ return this.field_72404_b.remove(player); ++ return this.players.remove(player); } } diff --git a/patches/minecraft/net/minecraft/stats/StatType.java.patch b/patches/minecraft/net/minecraft/stats/StatType.java.patch index 9b2a36533f..68138d60cf 100644 --- a/patches/minecraft/net/minecraft/stats/StatType.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatType.java.patch @@ -6,6 +6,6 @@ -public class StatType implements Iterable> { +public class StatType extends net.minecraftforge.registries.ForgeRegistryEntry> implements Iterable> { - private final Registry field_199082_a; - private final Map> field_199083_b = new IdentityHashMap<>(); + private final Registry registry; + private final Map> map = new IdentityHashMap<>(); @Nullable diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index 65bf7aed28..060e66d4cc 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java @@ -97,6 +_,14 @@ - return field_199899_c.func_232937_a_(p_199894_0_); + return HELPER.bind(p_199894_0_); } + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name) { @@ -9,9 +9,9 @@ + } + + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return field_199899_c.createOptional(name, defaults); ++ return HELPER.createOptional(name, defaults); + } + - public static ITagCollection func_199896_a() { - return field_199899_c.func_232939_b_(); + public static ITagCollection getAllTags() { + return HELPER.getAllTags(); } diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch index 346273f3b9..6053897e11 100644 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/EntityTypeTags.java +++ b/net/minecraft/tags/EntityTypeTags.java @@ -16,6 +_,14 @@ - return field_219766_c.func_232937_a_(p_232896_0_); + return HELPER.bind(p_232896_0_); } + public static net.minecraftforge.common.Tags.IOptionalNamedTag> createOptional(ResourceLocation name) { @@ -9,9 +9,9 @@ + } + + public static net.minecraftforge.common.Tags.IOptionalNamedTag> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set>> defaults) { -+ return field_219766_c.createOptional(name, defaults); ++ return HELPER.createOptional(name, defaults); + } + - public static ITagCollection> func_219762_a() { - return field_219766_c.func_232939_b_(); + public static ITagCollection> getAllTags() { + return HELPER.getAllTags(); } diff --git a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch index 2af7dc0666..88c468876c 100644 --- a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/FluidTags.java +++ b/net/minecraft/tags/FluidTags.java @@ -13,7 +_,20 @@ - return field_206961_c.func_232937_a_(p_206956_0_); + return HELPER.bind(p_206956_0_); } + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name) { @@ -9,15 +9,15 @@ + } + + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return field_206961_c.createOptional(name, defaults); ++ return HELPER.createOptional(name, defaults); + } + - public static List> func_241280_c_() { - return field_206961_c.func_241288_c_(); + public static List> getWrappers() { + return HELPER.getWrappers(); + } + + //Forge: Readd this stripped getter like the other tag classes -+ public static ITagCollection func_226157_a_() { -+ return field_206961_c.func_232939_b_(); ++ public static ITagCollection getAllTags() { ++ return HELPER.getAllTags(); } } diff --git a/patches/minecraft/net/minecraft/tags/ITag.java.patch b/patches/minecraft/net/minecraft/tags/ITag.java.patch index df686e1e3c..649300fe00 100644 --- a/patches/minecraft/net/minecraft/tags/ITag.java.patch +++ b/patches/minecraft/net/minecraft/tags/ITag.java.patch @@ -3,13 +3,13 @@ @@ -46,6 +_,7 @@ public static class Builder { - private final List field_232953_a_ = Lists.newArrayList(); + private final List entries = Lists.newArrayList(); + private boolean replace = false; - public static ITag.Builder func_200047_a() { + public static ITag.Builder tag() { return new ITag.Builder(); @@ -68,6 +_,15 @@ - return this.func_232955_a_(new ITag.TagEntry(p_232964_1_), p_232964_2_); + return this.add(new ITag.TagEntry(p_232964_1_), p_232964_2_); } + public ITag.Builder replace(boolean value) { @@ -21,19 +21,19 @@ + return replace(true); + } + - public Optional> func_232959_a_(Function> p_232959_1_, Function p_232959_2_) { + public Optional> build(Function> p_232959_1_, Function p_232959_2_) { ImmutableSet.Builder builder = ImmutableSet.builder(); @@ -103,6 +_,7 @@ - this.field_232953_a_.clear(); + this.entries.clear(); } -+ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(list, p_232956_1_, field_232953_a_); ++ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(list, p_232956_1_, entries); list.forEach((p_232958_2_) -> { - this.field_232953_a_.add(new ITag.Proxy(p_232958_2_, p_232956_2_)); + this.entries.add(new ITag.Proxy(p_232958_2_, p_232956_2_)); }); @@ -138,7 +_,7 @@ - itag$proxy.func_232968_a_().func_230237_a_(jsonarray); + itag$proxy.getEntry().serializeTo(jsonarray); } - jsonobject.addProperty("replace", false); @@ -43,17 +43,17 @@ } @@ -178,6 +_,7 @@ public String toString() { - return this.field_232969_a_.toString(); + return this.id.toString(); } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.ItemEntry && java.util.Objects.equals(this.field_232969_a_, ((ITag.ItemEntry) o).field_232969_a_)); } ++ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.ItemEntry && java.util.Objects.equals(this.id, ((ITag.ItemEntry) o).id)); } } public static class OptionalItemEntry implements ITag.ITagEntry { @@ -278,5 +_,7 @@ public String toString() { - return "#" + this.field_200163_a; + return "#" + this.id; } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.TagEntry && java.util.Objects.equals(this.field_200163_a, ((ITag.TagEntry) o).field_200163_a)); } -+ public ResourceLocation getId() { return field_200163_a; } ++ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.TagEntry && java.util.Objects.equals(this.id, ((ITag.TagEntry) o).id)); } ++ public ResourceLocation getId() { return id; } } } diff --git a/patches/minecraft/net/minecraft/tags/ITagCollectionSupplier.java.patch b/patches/minecraft/net/minecraft/tags/ITagCollectionSupplier.java.patch index 1f4daf3b04..4413f8a5cd 100644 --- a/patches/minecraft/net/minecraft/tags/ITagCollectionSupplier.java.patch +++ b/patches/minecraft/net/minecraft/tags/ITagCollectionSupplier.java.patch @@ -6,48 +6,48 @@ -public interface ITagCollectionSupplier { +public interface ITagCollectionSupplier extends net.minecraftforge.common.extensions.IForgeTagCollectionSupplier { - ITagCollectionSupplier field_242208_a = func_242209_a(ITagCollection.func_242205_c(), ITagCollection.func_242205_c(), ITagCollection.func_242205_c(), ITagCollection.func_242205_c()); + ITagCollectionSupplier EMPTY = of(ITagCollection.empty(), ITagCollection.empty(), ITagCollection.empty(), ITagCollection.empty()); - ITagCollection func_241835_a(); + ITagCollection getBlocks(); @@ -22,6 +_,7 @@ - default void func_242212_e() { - TagRegistryManager.func_242193_a(this); - Blocks.func_235419_a_(); + default void bindToGlobal() { + TagRegistryManager.resetAll(this); + Blocks.rebuildCache(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.VanillaTagTypes(this)); } - default void func_242210_a(PacketBuffer p_242210_1_) { + default void serializeToNetwork(PacketBuffer p_242210_1_) { @@ -55,6 +_,34 @@ - public ITagCollection> func_241838_d() { + public ITagCollection> getEntityTypes() { return p_242209_3_; + } + }; + } + + static ITagCollectionSupplier reinjectOptionalTags(ITagCollectionSupplier tagCollectionSupplier) { -+ ITagCollection blockTagCollection = BlockTags.field_199899_c.reinjectOptionalTags(tagCollectionSupplier.func_241835_a()); -+ ITagCollection itemTagCollection = ItemTags.field_199906_c.reinjectOptionalTags(tagCollectionSupplier.func_241836_b()); -+ ITagCollection fluidTagCollection = FluidTags.field_206961_c.reinjectOptionalTags(tagCollectionSupplier.func_241837_c()); -+ ITagCollection> entityTypeTagCollection = EntityTypeTags.field_219766_c.reinjectOptionalTags(tagCollectionSupplier.func_241838_d()); ++ ITagCollection blockTagCollection = BlockTags.HELPER.reinjectOptionalTags(tagCollectionSupplier.getBlocks()); ++ ITagCollection itemTagCollection = ItemTags.HELPER.reinjectOptionalTags(tagCollectionSupplier.getItems()); ++ ITagCollection fluidTagCollection = FluidTags.HELPER.reinjectOptionalTags(tagCollectionSupplier.getFluids()); ++ ITagCollection> entityTypeTagCollection = EntityTypeTags.HELPER.reinjectOptionalTags(tagCollectionSupplier.getEntityTypes()); + return new ITagCollectionSupplier() { + @Override -+ public ITagCollection func_241835_a() { ++ public ITagCollection getBlocks() { + return blockTagCollection; + } + + @Override -+ public ITagCollection func_241836_b() { ++ public ITagCollection getItems() { + return itemTagCollection; + } + + @Override -+ public ITagCollection func_241837_c() { ++ public ITagCollection getFluids() { + return fluidTagCollection; + } + + @Override -+ public ITagCollection> func_241838_d() { ++ public ITagCollection> getEntityTypes() { + return entityTypeTagCollection; } }; diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 03c6569b46..377230d73c 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java @@ -65,6 +_,14 @@ - return field_199906_c.func_232937_a_(p_199901_0_); + return HELPER.bind(p_199901_0_); } + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name) { @@ -9,9 +9,9 @@ + } + + public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return field_199906_c.createOptional(name, defaults); ++ return HELPER.createOptional(name, defaults); + } + - public static ITagCollection func_199903_a() { - return field_199906_c.func_232939_b_(); + public static ITagCollection getAllTags() { + return HELPER.getAllTags(); } diff --git a/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch b/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch index b839e0f84c..34f80b0732 100644 --- a/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/tags/NetworkTagManager.java +++ b/net/minecraft/tags/NetworkTagManager.java @@ -20,6 +_,7 @@ - protected TagCollectionReader field_199720_b = new TagCollectionReader<>(Registry.field_212630_s::func_241873_b, "tags/items", "item"); - protected TagCollectionReader field_205705_c = new TagCollectionReader<>(Registry.field_212619_h::func_241873_b, "tags/fluids", "fluid"); - protected TagCollectionReader> field_215299_d = new TagCollectionReader<>(Registry.field_212629_r::func_241873_b, "tags/entity_types", "entity_type"); + protected TagCollectionReader items = new TagCollectionReader<>(Registry.ITEM::getOptional, "tags/items", "item"); + protected TagCollectionReader fluids = new TagCollectionReader<>(Registry.FLUID::getOptional, "tags/fluids", "fluid"); + protected TagCollectionReader> entityTypes = new TagCollectionReader<>(Registry.ENTITY_TYPE::getOptional, "tags/entity_types", "entity_type"); + protected Map> customTagTypeReaders = net.minecraftforge.common.ForgeTagHandler.createCustomTagTypeReaders(); - private ITagCollectionSupplier field_242230_e = ITagCollectionSupplier.field_242208_a; + private ITagCollectionSupplier tags = ITagCollectionSupplier.EMPTY; - public ITagCollectionSupplier func_242231_a() { + public ITagCollectionSupplier getTags() { @@ -31,11 +_,13 @@ - CompletableFuture> completablefuture1 = this.field_199720_b.func_242224_a(p_215226_2_, p_215226_5_); - CompletableFuture> completablefuture2 = this.field_205705_c.func_242224_a(p_215226_2_, p_215226_5_); - CompletableFuture> completablefuture3 = this.field_215299_d.func_242224_a(p_215226_2_, p_215226_5_); -- return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> { + CompletableFuture> completablefuture1 = this.items.prepare(p_215226_2_, p_215226_5_); + CompletableFuture> completablefuture2 = this.fluids.prepare(p_215226_2_, p_215226_5_); + CompletableFuture> completablefuture3 = this.entityTypes.prepare(p_215226_2_, p_215226_5_); +- return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3).thenCompose(p_215226_1_::wait).thenAcceptAsync((p_232979_5_) -> { + CompletableFuture> customTagTypeResults = net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeReloadResults(p_215226_2_, p_215226_5_, customTagTypeReaders); -+ return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3, customTagTypeResults).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> { - ITagCollection itagcollection = this.field_199719_a.func_242226_a(completablefuture.join()); - ITagCollection itagcollection1 = this.field_199720_b.func_242226_a(completablefuture1.join()); - ITagCollection itagcollection2 = this.field_205705_c.func_242226_a(completablefuture2.join()); - ITagCollection> itagcollection3 = this.field_215299_d.func_242226_a(completablefuture3.join()); ++ return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3, customTagTypeResults).thenCompose(p_215226_1_::wait).thenAcceptAsync((p_232979_5_) -> { + ITagCollection itagcollection = this.blocks.load(completablefuture.join()); + ITagCollection itagcollection1 = this.items.load(completablefuture1.join()); + ITagCollection itagcollection2 = this.fluids.load(completablefuture2.join()); + ITagCollection> itagcollection3 = this.entityTypes.load(completablefuture3.join()); + net.minecraftforge.common.ForgeTagHandler.updateCustomTagTypes(customTagTypeResults.join()); - ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.func_242209_a(itagcollection, itagcollection1, itagcollection2, itagcollection3); - Multimap multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier); + ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.of(itagcollection, itagcollection1, itagcollection2, itagcollection3); + Multimap multimap = TagRegistryManager.getAllMissingTags(itagcollectionsupplier); if (!multimap.isEmpty()) { @@ -43,6 +_,8 @@ return p_232978_0_.getKey() + ":" + p_232978_0_.getValue(); @@ -29,6 +29,6 @@ } else { + itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier); + net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTagsCustomTypes(); - TagCollectionManager.func_242180_a(itagcollectionsupplier); - this.field_242230_e = itagcollectionsupplier; + TagCollectionManager.bind(itagcollectionsupplier); + this.tags = itagcollectionsupplier; } diff --git a/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch b/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch index fd844b9017..2ad27da110 100644 --- a/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch @@ -4,17 +4,17 @@ import java.util.stream.Collectors; public class TagCollectionManager { -- private static volatile ITagCollectionSupplier field_232918_a_ = ITagCollectionSupplier.func_242209_a(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> { -+ private static volatile ITagCollectionSupplier field_232918_a_ = net.minecraftforge.common.ForgeTagHandler.populateTagCollectionManager(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> { +- private static volatile ITagCollectionSupplier instance = ITagCollectionSupplier.of(ITagCollection.of(BlockTags.getWrappers().stream().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242183_0_) -> { ++ private static volatile ITagCollectionSupplier instance = net.minecraftforge.common.ForgeTagHandler.populateTagCollectionManager(ITagCollection.of(BlockTags.getWrappers().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242183_0_) -> { return p_242183_0_; -- }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> { -+ }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> { +- }))), ITagCollection.of(ItemTags.getWrappers().stream().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242182_0_) -> { ++ }))), ITagCollection.of(ItemTags.getWrappers().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242182_0_) -> { return p_242182_0_; -- }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> { -+ }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> { +- }))), ITagCollection.of(FluidTags.getWrappers().stream().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242181_0_) -> { ++ }))), ITagCollection.of(FluidTags.getWrappers().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242181_0_) -> { return p_242181_0_; -- }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> { -+ }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> { +- }))), ITagCollection.of(EntityTypeTags.getWrappers().stream().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242179_0_) -> { ++ }))), ITagCollection.of(EntityTypeTags.getWrappers().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::getName, (p_242179_0_) -> { return p_242179_0_; })))); diff --git a/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch b/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch index 10981dd6be..d3e8443136 100644 --- a/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/tags/TagRegistry.java +++ b/net/minecraft/tags/TagRegistry.java @@ -16,13 +_,51 @@ - private ITagCollection field_232930_b_ = ITagCollection.func_242205_c(); - private final List> field_232931_c_ = Lists.newArrayList(); - private final Function> field_242184_c; + private ITagCollection source = ITagCollection.empty(); + private final List> wrappers = Lists.newArrayList(); + private final Function> collectionGetter; + private static java.util.Map>> toAdd = com.google.common.collect.Maps.newHashMap(); public TagRegistry(Function> p_i241894_1_) { - this.field_242184_c = p_i241894_1_; + this.collectionGetter = p_i241894_1_; } - public ITag.INamedTag func_232937_a_(String p_232937_1_) { + public ITag.INamedTag bind(String p_232937_1_) { - TagRegistry.NamedTag namedtag = new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_)); + return add(new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_))); + } @@ -49,8 +49,8 @@ + } + + private > R add(R namedtag) { -+ namedtag.func_232943_a_(field_232930_b_::func_199910_a); - this.field_232931_c_.add(namedtag); ++ namedtag.rebind(source::getTag); + this.wrappers.add(namedtag); return namedtag; } @@ -46,6 +_,20 @@ @@ -58,43 +58,43 @@ } + public ITagCollection reinjectOptionalTags(ITagCollection tagCollection) { -+ java.util.Map> currentTags = tagCollection.func_241833_a(); -+ java.util.Map> missingOptionals = this.field_232931_c_.stream().filter(e -> e instanceof OptionalNamedTag && !currentTags.containsKey(e.func_230234_a_())).collect(Collectors.toMap(NamedTag::func_230234_a_, namedTag -> { ++ java.util.Map> currentTags = tagCollection.getAllTags(); ++ java.util.Map> missingOptionals = this.wrappers.stream().filter(e -> e instanceof OptionalNamedTag && !currentTags.containsKey(e.getName())).collect(Collectors.toMap(NamedTag::getName, namedTag -> { + OptionalNamedTag optionalNamedTag = (OptionalNamedTag) namedTag; + optionalNamedTag.defaulted = true; + return optionalNamedTag.resolveDefaulted(); -+ }, (existingTag, newTag) -> Tag.func_241286_a_(ImmutableSet.builder().addAll(existingTag.func_230236_b_()).addAll(newTag.func_230236_b_()).build()))); ++ }, (existingTag, newTag) -> Tag.create(ImmutableSet.builder().addAll(existingTag.getValues()).addAll(newTag.getValues()).build()))); + if (!missingOptionals.isEmpty()) { + missingOptionals.putAll(currentTags); -+ return ITagCollection.func_242202_a(missingOptionals); ++ return ITagCollection.of(missingOptionals); + } + return tagCollection; + } + - public ITagCollection func_232939_b_() { - return this.field_232930_b_; + public ITagCollection getAllTags() { + return this.source; } @@ -56,7 +_,7 @@ - public Set func_242189_b(ITagCollectionSupplier p_242189_1_) { - ITagCollection itagcollection = this.field_242184_c.apply(p_242189_1_); -- Set set = this.field_232931_c_.stream().map(TagRegistry.NamedTag::func_230234_a_).collect(Collectors.toSet()); -+ Set set = this.field_232931_c_.stream().filter(e -> !(e instanceof OptionalNamedTag)).map(TagRegistry.NamedTag::func_230234_a_).collect(Collectors.toSet()); - ImmutableSet immutableset = ImmutableSet.copyOf(itagcollection.func_199908_a()); + public Set getMissingTags(ITagCollectionSupplier p_242189_1_) { + ITagCollection itagcollection = this.collectionGetter.apply(p_242189_1_); +- Set set = this.wrappers.stream().map(TagRegistry.NamedTag::getName).collect(Collectors.toSet()); ++ Set set = this.wrappers.stream().filter(e -> !(e instanceof OptionalNamedTag)).map(TagRegistry.NamedTag::getName).collect(Collectors.toSet()); + ImmutableSet immutableset = ImmutableSet.copyOf(itagcollection.getAvailableTags()); return Sets.difference(set, immutableset); } @@ -92,6 +_,41 @@ - public List func_230236_b_() { - return this.func_232944_c_().func_230236_b_(); + public List getValues() { + return this.resolve().getValues(); + } + + @Override + public String toString() { -+ return "NamedTag[" + func_230234_a_().toString() + ']'; ++ return "NamedTag[" + getName().toString() + ']'; + } -+ @Override public boolean equals(Object o) { return (o == this) || (o instanceof ITag.INamedTag && java.util.Objects.equals(this.func_230234_a_(), ((ITag.INamedTag)o).func_230234_a_())); } -+ @Override public int hashCode() { return func_230234_a_().hashCode(); } ++ @Override public boolean equals(Object o) { return (o == this) || (o instanceof ITag.INamedTag && java.util.Objects.equals(this.getName(), ((ITag.INamedTag)o).getName())); } ++ @Override public int hashCode() { return getName().hashCode(); } + } + + private static class OptionalNamedTag extends NamedTag implements net.minecraftforge.common.Tags.IOptionalNamedTag { @@ -114,14 +114,14 @@ + + Tag resolveDefaulted() { + if (defaults == null || defaults.isEmpty()) { -+ return Tag.func_241284_a_(); ++ return Tag.empty(); + } -+ return Tag.func_241286_a_(ImmutableSet.copyOf(defaults.stream().map(java.util.function.Supplier::get).collect(Collectors.toSet()))); ++ return Tag.create(ImmutableSet.copyOf(defaults.stream().map(java.util.function.Supplier::get).collect(Collectors.toSet()))); + } + + @Override + public String toString() { -+ return "OptionalNamedTag[" + func_230234_a_().toString() + ']'; ++ return "OptionalNamedTag[" + getName().toString() + ']'; } } } diff --git a/patches/minecraft/net/minecraft/tags/TagRegistryManager.java.patch b/patches/minecraft/net/minecraft/tags/TagRegistryManager.java.patch index f2d5324968..ca6dda6a7b 100644 --- a/patches/minecraft/net/minecraft/tags/TagRegistryManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagRegistryManager.java.patch @@ -7,20 +7,20 @@ + + @javax.annotation.Nullable + public static TagRegistry get(ResourceLocation rl) { -+ return field_242190_a.get(rl); ++ return HELPERS.get(rl); + } + + public static Multimap validateVanillaTags(ITagCollectionSupplier tagCollectionSupplier) { + Multimap missingTags = HashMultimap.create(); -+ for (java.util.Map.Entry> entry : field_242190_a.entrySet()) { ++ for (java.util.Map.Entry> entry : HELPERS.entrySet()) { + if (!net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().contains(entry.getKey())) { -+ missingTags.putAll(entry.getKey(), entry.getValue().func_242189_b(tagCollectionSupplier)); ++ missingTags.putAll(entry.getKey(), entry.getValue().getMissingTags(tagCollectionSupplier)); + } + } + return missingTags; + } + + public static void fetchCustomTagTypes(ITagCollectionSupplier tagCollectionSupplier) { -+ net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().forEach(tagRegistry -> field_242190_a.get(tagRegistry).func_242188_a(tagCollectionSupplier)); ++ net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().forEach(tagRegistry -> HELPERS.get(tagRegistry).reset(tagCollectionSupplier)); + } } diff --git a/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch index ddfc7c978e..204d210438 100644 --- a/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch @@ -1,127 +1,127 @@ --- a/net/minecraft/tileentity/AbstractFurnaceTileEntity.java +++ b/net/minecraft/tileentity/AbstractFurnaceTileEntity.java @@ -91,6 +_,7 @@ - this.field_214014_c = p_i49964_2_; + this.recipeType = p_i49964_2_; } + @Deprecated //Forge - get burn times by calling ForgeHooks#getBurnTime(ItemStack) - public static Map func_214001_f() { + public static Map getFuel() { Map map = Maps.newLinkedHashMap(); - func_213996_a(map, Items.field_151129_at, 20000); + add(map, Items.LAVA_BUCKET, 20000); @@ -184,13 +_,13 @@ - return this.field_214018_j > 0; + return this.litTime > 0; } -- public void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { -+ public void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { //TODO: MARK - super.func_230337_a_(p_230337_1_, p_230337_2_); - this.field_214012_a = NonNullList.func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a); - ItemStackHelper.func_191283_b(p_230337_2_, this.field_214012_a); -- this.field_214018_j = p_230337_2_.func_74765_d("BurnTime"); -- this.field_214020_l = p_230337_2_.func_74765_d("CookTime"); -- this.field_214021_m = p_230337_2_.func_74765_d("CookTimeTotal"); -+ this.field_214018_j = p_230337_2_.func_74762_e("BurnTime"); -+ this.field_214020_l = p_230337_2_.func_74762_e("CookTime"); -+ this.field_214021_m = p_230337_2_.func_74762_e("CookTimeTotal"); - this.field_214019_k = this.func_213997_a(this.field_214012_a.get(1)); - CompoundNBT compoundnbt = p_230337_2_.func_74775_l("RecipesUsed"); +- public void load(BlockState p_230337_1_, CompoundNBT p_230337_2_) { ++ public void load(BlockState p_230337_1_, CompoundNBT p_230337_2_) { //TODO: MARK + super.load(p_230337_1_, p_230337_2_); + this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + ItemStackHelper.loadAllItems(p_230337_2_, this.items); +- this.litTime = p_230337_2_.getShort("BurnTime"); +- this.cookingProgress = p_230337_2_.getShort("CookTime"); +- this.cookingTotalTime = p_230337_2_.getShort("CookTimeTotal"); ++ this.litTime = p_230337_2_.getInt("BurnTime"); ++ this.cookingProgress = p_230337_2_.getInt("CookTime"); ++ this.cookingTotalTime = p_230337_2_.getInt("CookTimeTotal"); + this.litDuration = this.getBurnDuration(this.items.get(1)); + CompoundNBT compoundnbt = p_230337_2_.getCompound("RecipesUsed"); @@ -202,9 +_,9 @@ - public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { - super.func_189515_b(p_189515_1_); -- p_189515_1_.func_74777_a("BurnTime", (short)this.field_214018_j); -- p_189515_1_.func_74777_a("CookTime", (short)this.field_214020_l); -- p_189515_1_.func_74777_a("CookTimeTotal", (short)this.field_214021_m); -+ p_189515_1_.func_74768_a("BurnTime", this.field_214018_j); -+ p_189515_1_.func_74768_a("CookTime", this.field_214020_l); -+ p_189515_1_.func_74768_a("CookTimeTotal", this.field_214021_m); - ItemStackHelper.func_191282_a(p_189515_1_, this.field_214012_a); + public CompoundNBT save(CompoundNBT p_189515_1_) { + super.save(p_189515_1_); +- p_189515_1_.putShort("BurnTime", (short)this.litTime); +- p_189515_1_.putShort("CookTime", (short)this.cookingProgress); +- p_189515_1_.putShort("CookTimeTotal", (short)this.cookingTotalTime); ++ p_189515_1_.putInt("BurnTime", this.litTime); ++ p_189515_1_.putInt("CookTime", this.cookingProgress); ++ p_189515_1_.putInt("CookTimeTotal", this.cookingTotalTime); + ItemStackHelper.saveAllItems(p_189515_1_, this.items); CompoundNBT compoundnbt = new CompoundNBT(); - this.field_214022_n.forEach((p_235643_1_, p_235643_2_) -> { + this.recipesUsed.forEach((p_235643_1_, p_235643_2_) -> { @@ -230,12 +_,14 @@ - this.field_214019_k = this.field_214018_j; - if (this.func_214006_r()) { + this.litDuration = this.litTime; + if (this.isLit()) { flag1 = true; + if (itemstack.hasContainerItem()) -+ this.field_214012_a.set(1, itemstack.getContainerItem()); ++ this.items.set(1, itemstack.getContainerItem()); + else - if (!itemstack.func_190926_b()) { - Item item = itemstack.func_77973_b(); - itemstack.func_190918_g(1); - if (itemstack.func_190926_b()) { -- Item item1 = item.func_77668_q(); -- this.field_214012_a.set(1, item1 == null ? ItemStack.field_190927_a : new ItemStack(item1)); -+ this.field_214012_a.set(1, itemstack.getContainerItem()); + if (!itemstack.isEmpty()) { + Item item = itemstack.getItem(); + itemstack.shrink(1); + if (itemstack.isEmpty()) { +- Item item1 = item.getCraftingRemainingItem(); +- this.items.set(1, item1 == null ? ItemStack.EMPTY : new ItemStack(item1)); ++ this.items.set(1, itemstack.getContainerItem()); } } } @@ -270,7 +_,7 @@ - protected boolean func_214008_b(@Nullable IRecipe p_214008_1_) { - if (!this.field_214012_a.get(0).func_190926_b() && p_214008_1_ != null) { -- ItemStack itemstack = p_214008_1_.func_77571_b(); -+ ItemStack itemstack = ((IRecipe) p_214008_1_).func_77572_b(this); - if (itemstack.func_190926_b()) { + protected boolean canBurn(@Nullable IRecipe p_214008_1_) { + if (!this.items.get(0).isEmpty() && p_214008_1_ != null) { +- ItemStack itemstack = p_214008_1_.getResultItem(); ++ ItemStack itemstack = ((IRecipe) p_214008_1_).assemble(this); + if (itemstack.isEmpty()) { return false; } else { @@ -279,10 +_,10 @@ return true; - } else if (!itemstack1.func_77969_a(itemstack)) { + } else if (!itemstack1.sameItem(itemstack)) { return false; -- } else if (itemstack1.func_190916_E() < this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) { -+ } else if (itemstack1.func_190916_E() + itemstack.func_190916_E() <= this.func_70297_j_() && itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack1.func_77976_d()) { // Forge fix: make furnace respect stack sizes in furnace recipes +- } else if (itemstack1.getCount() < this.getMaxStackSize() && itemstack1.getCount() < itemstack1.getMaxStackSize()) { ++ } else if (itemstack1.getCount() + itemstack.getCount() <= this.getMaxStackSize() && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize()) { // Forge fix: make furnace respect stack sizes in furnace recipes return true; } else { -- return itemstack1.func_190916_E() < itemstack.func_77976_d(); -+ return itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack.func_77976_d(); // Forge fix: make furnace respect stack sizes in furnace recipes +- return itemstack1.getCount() < itemstack.getMaxStackSize(); ++ return itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes } } } else { @@ -293,12 +_,12 @@ - private void func_214007_c(@Nullable IRecipe p_214007_1_) { - if (p_214007_1_ != null && this.func_214008_b(p_214007_1_)) { - ItemStack itemstack = this.field_214012_a.get(0); -- ItemStack itemstack1 = p_214007_1_.func_77571_b(); -+ ItemStack itemstack1 = ((IRecipe) p_214007_1_).func_77572_b(this); - ItemStack itemstack2 = this.field_214012_a.get(2); - if (itemstack2.func_190926_b()) { - this.field_214012_a.set(2, itemstack1.func_77946_l()); - } else if (itemstack2.func_77973_b() == itemstack1.func_77973_b()) { -- itemstack2.func_190917_f(1); -+ itemstack2.func_190917_f(itemstack1.func_190916_E()); + private void burn(@Nullable IRecipe p_214007_1_) { + if (p_214007_1_ != null && this.canBurn(p_214007_1_)) { + ItemStack itemstack = this.items.get(0); +- ItemStack itemstack1 = p_214007_1_.getResultItem(); ++ ItemStack itemstack1 = ((IRecipe) p_214007_1_).assemble(this); + ItemStack itemstack2 = this.items.get(2); + if (itemstack2.isEmpty()) { + this.items.set(2, itemstack1.copy()); + } else if (itemstack2.getItem() == itemstack1.getItem()) { +- itemstack2.grow(1); ++ itemstack2.grow(itemstack1.getCount()); } - if (!this.field_145850_b.field_72995_K) { + if (!this.level.isClientSide) { @@ -318,7 +_,7 @@ return 0; } else { - Item item = p_213997_1_.func_77973_b(); -- return func_214001_f().getOrDefault(item, 0); -+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_213997_1_, this.field_214014_c); + Item item = p_213997_1_.getItem(); +- return getFuel().getOrDefault(item, 0); ++ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_213997_1_, this.recipeType); } } @@ -327,7 +_,7 @@ } - public static boolean func_213991_b(ItemStack p_213991_0_) { -- return func_214001_f().containsKey(p_213991_0_.func_77973_b()); + public static boolean isFuel(ItemStack p_213991_0_) { +- return getFuel().containsKey(p_213991_0_.getItem()); + return net.minecraftforge.common.ForgeHooks.getBurnTime(p_213991_0_, null) > 0; } - public int[] func_180463_a(Direction p_180463_1_) { + public int[] getSlotsForFace(Direction p_180463_1_) { @@ -410,7 +_,7 @@ return true; } else { - ItemStack itemstack = this.field_214012_a.get(1); -- return func_213991_b(p_94041_2_) || p_94041_2_.func_77973_b() == Items.field_151133_ar && itemstack.func_77973_b() != Items.field_151133_ar; -+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_94041_2_, this.field_214014_c) > 0 || p_94041_2_.func_77973_b() == Items.field_151133_ar && itemstack.func_77973_b() != Items.field_151133_ar; + ItemStack itemstack = this.items.get(1); +- return isFuel(p_94041_2_) || p_94041_2_.getItem() == Items.BUCKET && itemstack.getItem() != Items.BUCKET; ++ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_94041_2_, this.recipeType) > 0 || p_94041_2_.getItem() == Items.BUCKET && itemstack.getItem() != Items.BUCKET; } } @@ -473,5 +_,28 @@ - p_194018_1_.func_194112_a(itemstack); + p_194018_1_.accountStack(itemstack); } + } @@ -131,7 +131,7 @@ + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { -+ if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (!this.remove && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == Direction.UP) + return handlers[0].cast(); + else if (facing == Direction.DOWN) diff --git a/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch index 1dbcbf7cd3..dda53ff188 100644 --- a/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/tileentity/BeaconTileEntity.java +++ b/net/minecraft/tileentity/BeaconTileEntity.java @@ -112,8 +_,8 @@ - for(int i1 = 0; i1 < 10 && blockpos.func_177956_o() <= l; ++i1) { - BlockState blockstate = this.field_145850_b.func_180495_p(blockpos); - Block block = blockstate.func_177230_c(); + for(int i1 = 0; i1 < 10 && blockpos.getY() <= l; ++i1) { + BlockState blockstate = this.level.getBlockState(blockpos); + Block block = blockstate.getBlock(); - if (block instanceof IBeaconBeamColorProvider) { -- float[] afloat = ((IBeaconBeamColorProvider)block).func_196457_d().func_193349_f(); -+ float[] afloat = blockstate.getBeaconColorMultiplier(this.field_145850_b, blockpos, func_174877_v()); +- float[] afloat = ((IBeaconBeamColorProvider)block).getColor().getTextureDiffuseColors(); ++ float[] afloat = blockstate.getBeaconColorMultiplier(this.level, blockpos, getBlockPos()); + if (afloat != null) { - if (this.field_213934_g.size() <= 1) { + if (this.checkingBeamSections.size() <= 1) { beacontileentity$beamsegment = new BeaconTileEntity.BeamSegment(afloat); - this.field_213934_g.add(beacontileentity$beamsegment); + this.checkingBeamSections.add(beacontileentity$beamsegment); diff --git a/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch index a505e7015d..ac14bc1701 100644 --- a/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch @@ -2,62 +2,62 @@ +++ b/net/minecraft/tileentity/BrewingStandTileEntity.java @@ -146,6 +_,7 @@ - private boolean func_145934_k() { - ItemStack itemstack = this.field_145945_j.get(3); -+ if (!itemstack.func_190926_b()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, itemstack, field_145947_i); // divert to VanillaBrewingRegistry - if (itemstack.func_190926_b()) { + private boolean isBrewable() { + ItemStack itemstack = this.items.get(3); ++ if (!itemstack.isEmpty()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(items, itemstack, SLOTS_FOR_SIDES); // divert to VanillaBrewingRegistry + if (itemstack.isEmpty()) { return false; - } else if (!PotionBrewing.func_185205_a(itemstack)) { + } else if (!PotionBrewing.isIngredient(itemstack)) { @@ -163,22 +_,22 @@ } - private void func_145940_l() { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(field_145945_j)) return; - ItemStack itemstack = this.field_145945_j.get(3); + private void doBrew() { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(items)) return; + ItemStack itemstack = this.items.get(3); - for(int i = 0; i < 3; ++i) { -- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i))); +- this.items.set(i, PotionBrewing.mix(itemstack, this.items.get(i))); - } - -- itemstack.func_190918_g(1); -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i); -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); - BlockPos blockpos = this.func_174877_v(); -- if (itemstack.func_77973_b().func_77634_r()) { -- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- itemstack.shrink(1); ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(items, itemstack, SLOTS_FOR_SIDES); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(items); + BlockPos blockpos = this.getBlockPos(); +- if (itemstack.getItem().hasCraftingRemainingItem()) { +- ItemStack itemstack1 = new ItemStack(itemstack.getItem().getCraftingRemainingItem()); + if (itemstack.hasContainerItem()) { + ItemStack itemstack1 = itemstack.getContainerItem(); -+ itemstack.func_190918_g(1); - if (itemstack.func_190926_b()) { ++ itemstack.shrink(1); + if (itemstack.isEmpty()) { itemstack = itemstack1; - } else if (!this.field_145850_b.field_72995_K) { - InventoryHelper.func_180173_a(this.field_145850_b, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), itemstack1); + } else if (!this.level.isClientSide) { + InventoryHelper.dropItemStack(this.level, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), itemstack1); } } -+ else itemstack.func_190918_g(1); ++ else itemstack.shrink(1); - this.field_145945_j.set(3, itemstack); - this.field_145850_b.func_217379_c(1035, blockpos, 0); + this.items.set(3, itemstack); + this.level.levelEvent(1035, blockpos, 0); @@ -229,13 +_,13 @@ - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { + public boolean canPlaceItem(int p_94041_1_, ItemStack p_94041_2_) { if (p_94041_1_ == 3) { -- return PotionBrewing.func_185205_a(p_94041_2_); +- return PotionBrewing.isIngredient(p_94041_2_); + return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_); } else { - Item item = p_94041_2_.func_77973_b(); + Item item = p_94041_2_.getItem(); if (p_94041_1_ == 4) { - return item == Items.field_151065_br; + return item == Items.BLAZE_POWDER; } else { -- return (item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo) && this.func_70301_a(p_94041_1_).func_190926_b(); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_) && this.func_70301_a(p_94041_1_).func_190926_b(); +- return (item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE) && this.getItem(p_94041_1_).isEmpty(); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_) && this.getItem(p_94041_1_).isEmpty(); } } } @@ -266,5 +_,28 @@ - protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { - return new BrewingStandContainer(p_213906_1_, p_213906_2_, this, this.field_213954_a); + protected Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_) { + return new BrewingStandContainer(p_213906_1_, p_213906_2_, this, this.dataAccess); + } + + net.minecraftforge.common.util.LazyOptional[] handlers = @@ -65,7 +65,7 @@ + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { -+ if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (!this.remove && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == Direction.UP) + return handlers[0].cast(); + else if (facing == Direction.DOWN) diff --git a/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch index 686577087d..fc7fcf5d69 100644 --- a/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch @@ -1,31 +1,31 @@ --- a/net/minecraft/tileentity/ChestTileEntity.java +++ b/net/minecraft/tileentity/ChestTileEntity.java @@ -38,6 +_,7 @@ - protected float field_145986_n; - protected int field_145987_o; - private int field_145983_q; + protected float oOpenness; + protected int openCount; + private int tickInterval; + private net.minecraftforge.common.util.LazyOptional chestHandler; protected ChestTileEntity(TileEntityType p_i48287_1_) { super(p_i48287_1_); @@ -202,7 +_,7 @@ - public static int func_195481_a(IBlockReader p_195481_0_, BlockPos p_195481_1_) { - BlockState blockstate = p_195481_0_.func_180495_p(p_195481_1_); -- if (blockstate.func_177230_c().func_235695_q_()) { + public static int getOpenCount(IBlockReader p_195481_0_, BlockPos p_195481_1_) { + BlockState blockstate = p_195481_0_.getBlockState(p_195481_1_); +- if (blockstate.getBlock().isEntityBlock()) { + if (blockstate.hasTileEntity()) { - TileEntity tileentity = p_195481_0_.func_175625_s(p_195481_1_); + TileEntity tileentity = p_195481_0_.getBlockEntity(p_195481_1_); if (tileentity instanceof ChestTileEntity) { - return ((ChestTileEntity)tileentity).field_145987_o; + return ((ChestTileEntity)tileentity).openCount; @@ -220,5 +_,41 @@ - protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { - return ChestContainer.func_216992_a(p_213906_1_, p_213906_2_, this); + protected Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_) { + return ChestContainer.threeRows(p_213906_1_, p_213906_2_, this); + } + + @Override -+ public void func_145836_u() { -+ super.func_145836_u(); ++ public void clearCache() { ++ super.clearCache(); + if (this.chestHandler != null) { + net.minecraftforge.common.util.LazyOptional oldHandler = this.chestHandler; + this.chestHandler = null; @@ -35,7 +35,7 @@ + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, Direction side) { -+ if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (!this.remove && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (this.chestHandler == null) + this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler); + return this.chestHandler.cast(); @@ -44,11 +44,11 @@ + } + + private net.minecraftforge.items.IItemHandlerModifiable createHandler() { -+ BlockState state = this.func_195044_w(); -+ if (!(state.func_177230_c() instanceof ChestBlock)) { ++ BlockState state = this.getBlockState(); ++ if (!(state.getBlock() instanceof ChestBlock)) { + return new net.minecraftforge.items.wrapper.InvWrapper(this); + } -+ IInventory inv = ChestBlock.func_226916_a_((ChestBlock) state.func_177230_c(), state, func_145831_w(), func_174877_v(), true); ++ IInventory inv = ChestBlock.getContainer((ChestBlock) state.getBlock(), state, getLevel(), getBlockPos(), true); + return new net.minecraftforge.items.wrapper.InvWrapper(inv == null ? this : inv); + } + diff --git a/patches/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch index d258070390..85d7a2f4a3 100644 --- a/patches/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ConduitTileEntity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/tileentity/ConduitTileEntity.java +++ b/net/minecraft/tileentity/ConduitTileEntity.java @@ -130,10 +_,8 @@ - BlockPos blockpos1 = this.field_174879_c.func_177982_a(j1, k1, l1); - BlockState blockstate = this.field_145850_b.func_180495_p(blockpos1); + BlockPos blockpos1 = this.worldPosition.offset(j1, k1, l1); + BlockState blockstate = this.level.getBlockState(blockpos1); -- for(Block block : field_205042_e) { -- if (blockstate.func_203425_a(block)) { -- this.field_205046_i.add(blockpos1); +- for(Block block : VALID_BLOCKS) { +- if (blockstate.is(block)) { +- this.effectBlocks.add(blockpos1); - } -+ if (blockstate.isConduitFrame(this.field_145850_b, blockpos1, func_174877_v())) { -+ this.field_205046_i.add(blockpos1); ++ if (blockstate.isConduitFrame(this.level, blockpos1, getBlockPos())) { ++ this.effectBlocks.add(blockpos1); } } } diff --git a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch index 928c3ce512..8fdcff4c9e 100644 --- a/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch @@ -3,32 +3,32 @@ @@ -133,6 +_,7 @@ } - private boolean func_145883_k() { + private boolean ejectItems() { + if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) return true; - IInventory iinventory = this.func_145895_l(); + IInventory iinventory = this.getAttachedContainer(); if (iinventory == null) { return false; @@ -177,6 +_,8 @@ } - public static boolean func_145891_a(IHopper p_145891_0_) { + public static boolean suckInItems(IHopper p_145891_0_) { + Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_); + if (ret != null) return ret; - IInventory iinventory = func_145884_b(p_145891_0_); + IInventory iinventory = getSourceContainer(p_145891_0_); if (iinventory != null) { Direction direction = Direction.DOWN; @@ -325,7 +_,7 @@ - Block block = blockstate.func_177230_c(); + Block block = blockstate.getBlock(); if (block instanceof ISidedInventoryProvider) { - iinventory = ((ISidedInventoryProvider)block).func_219966_a(blockstate, p_145893_0_, blockpos); -- } else if (block.func_235695_q_()) { + iinventory = ((ISidedInventoryProvider)block).getContainer(blockstate, p_145893_0_, blockpos); +- } else if (block.isEntityBlock()) { + } else if (blockstate.hasTileEntity()) { - TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); + TileEntity tileentity = p_145893_0_.getBlockEntity(blockpos); if (tileentity instanceof IInventory) { iinventory = (IInventory)tileentity; @@ -403,5 +_,14 @@ - protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { + protected Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_) { return new HopperContainer(p_213906_1_, p_213906_2_, this); + } + @@ -38,6 +38,6 @@ + } + + public long getLastUpdateTime() { -+ return this.field_190578_g; ++ return this.tickedGameTime; } } diff --git a/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch index c77323ae19..093a5d09f7 100644 --- a/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch @@ -3,7 +3,7 @@ @@ -81,4 +_,21 @@ } - protected abstract Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_); + protected abstract Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_); + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> createUnSidedHandler()); + protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { @@ -11,7 +11,7 @@ + } + + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, @javax.annotation.Nullable net.minecraft.util.Direction side) { -+ if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) ++ if (!this.remove && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) + return itemHandler.cast(); + return super.getCapability(cap, side); + } diff --git a/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch index 76703fe7a8..abcba524b3 100644 --- a/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/tileentity/PistonTileEntity.java +++ b/net/minecraft/tileentity/PistonTileEntity.java @@ -108,7 +_,7 @@ - List list = this.field_145850_b.func_72839_b((Entity)null, AabbHelper.func_227019_a_(axisalignedbb, direction, d0).func_111270_a(axisalignedbb)); + List list = this.level.getEntities((Entity)null, AabbHelper.getMovementArea(axisalignedbb, direction, d0).minmax(axisalignedbb)); if (!list.isEmpty()) { - List list1 = voxelshape.func_197756_d(); -- boolean flag = this.field_200231_a.func_203425_a(Blocks.field_180399_cE); -+ boolean flag = this.field_200231_a.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later + List list1 = voxelshape.toAabbs(); +- boolean flag = this.movedState.is(Blocks.SLIME_BLOCK); ++ boolean flag = this.movedState.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later Iterator iterator = list.iterator(); while(true) { diff --git a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch index 5b8b3d0657..6da4026e77 100644 --- a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/tileentity/ShulkerBoxTileEntity.java +++ b/net/minecraft/tileentity/ShulkerBoxTileEntity.java @@ -284,6 +_,11 @@ - return this.field_190599_i == ShulkerBoxTileEntity.AnimationStatus.CLOSED; + return this.animationStatus == ShulkerBoxTileEntity.AnimationStatus.CLOSED; } + @Override diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 1bb3e1a096..f1025ca2c2 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -6,53 +6,53 @@ -public abstract class TileEntity { +public abstract class TileEntity extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeTileEntity { - private static final Logger field_145852_a = LogManager.getLogger(); - private final TileEntityType field_200663_e; + private static final Logger LOGGER = LogManager.getLogger(); + private final TileEntityType type; @Nullable @@ -26,9 +_,12 @@ @Nullable - private BlockState field_195045_e; - private boolean field_222816_g; + private BlockState blockState; + private boolean hasLoggedInvalidStateBefore; + private CompoundNBT customTileData; public TileEntity(TileEntityType p_i48289_1_) { + super(TileEntity.class); - this.field_200663_e = p_i48289_1_; + this.type = p_i48289_1_; + this.gatherCapabilities(); } @Nullable @@ -47,6 +_,8 @@ - public void func_230337_a_(BlockState p_230337_1_, CompoundNBT p_230337_2_) { - this.field_174879_c = new BlockPos(p_230337_2_.func_74762_e("x"), p_230337_2_.func_74762_e("y"), p_230337_2_.func_74762_e("z")); -+ if (p_230337_2_.func_74764_b("ForgeData")) this.customTileData = p_230337_2_.func_74775_l("ForgeData"); -+ if (getCapabilities() != null && p_230337_2_.func_74764_b("ForgeCaps")) deserializeCaps(p_230337_2_.func_74775_l("ForgeCaps")); + public void load(BlockState p_230337_1_, CompoundNBT p_230337_2_) { + this.worldPosition = new BlockPos(p_230337_2_.getInt("x"), p_230337_2_.getInt("y"), p_230337_2_.getInt("z")); ++ if (p_230337_2_.contains("ForgeData")) this.customTileData = p_230337_2_.getCompound("ForgeData"); ++ if (getCapabilities() != null && p_230337_2_.contains("ForgeCaps")) deserializeCaps(p_230337_2_.getCompound("ForgeCaps")); } - public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { + public CompoundNBT save(CompoundNBT p_189515_1_) { @@ -62,6 +_,8 @@ - p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); - p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); - p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); -+ if (this.customTileData != null) p_189516_1_.func_218657_a("ForgeData", this.customTileData); -+ if (getCapabilities() != null) p_189516_1_.func_218657_a("ForgeCaps", serializeCaps()); + p_189516_1_.putInt("x", this.worldPosition.getX()); + p_189516_1_.putInt("y", this.worldPosition.getY()); + p_189516_1_.putInt("z", this.worldPosition.getZ()); ++ if (this.customTileData != null) p_189516_1_.put("ForgeData", this.customTileData); ++ if (getCapabilities() != null) p_189516_1_.put("ForgeCaps", serializeCaps()); return p_189516_1_; } } @@ -94,7 +_,7 @@ - if (this.field_145850_b != null) { - this.field_195045_e = this.field_145850_b.func_180495_p(this.field_174879_c); - this.field_145850_b.func_175646_b(this.field_174879_c, this); -- if (!this.field_195045_e.func_196958_f()) { -+ if (!this.field_195045_e.isAir(this.field_145850_b, this.field_174879_c)) { - this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); + if (this.level != null) { + this.blockState = this.level.getBlockState(this.worldPosition); + this.level.blockEntityChanged(this.worldPosition, this); +- if (!this.blockState.isAir()) { ++ if (!this.blockState.isAir(this.level, this.worldPosition)) { + this.level.updateNeighbourForOutputSignal(this.worldPosition, this.blockState.getBlock()); } } @@ -133,6 +_,13 @@ - public void func_145843_s() { - this.field_145846_f = true; + public void setRemoved() { + this.remove = true; + this.invalidateCaps(); + requestModelDataUpdate(); + } @@ -62,11 +62,11 @@ + this.invalidateCaps(); } - public void func_145829_t() { + public void clearRemoved() { @@ -173,6 +_,13 @@ - public TileEntityType func_200662_C() { - return this.field_200663_e; + public TileEntityType getType() { + return this.type; + } + + @Override @@ -76,4 +76,4 @@ + return this.customTileData; } - public void func_222814_r() { + public void logInvalidState() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch index 2c2d7f6ce2..2b56a031ad 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch @@ -6,21 +6,21 @@ -public class TileEntityType { +public class TileEntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final Logger field_206866_A = LogManager.getLogger(); - public static final TileEntityType field_200971_b = func_200966_a("furnace", TileEntityType.Builder.func_223042_a(FurnaceTileEntity::new, Blocks.field_150460_al)); - public static final TileEntityType field_200972_c = func_200966_a("chest", TileEntityType.Builder.func_223042_a(ChestTileEntity::new, Blocks.field_150486_ae)); + private static final Logger LOGGER = LogManager.getLogger(); + public static final TileEntityType FURNACE = register("furnace", TileEntityType.Builder.of(FurnaceTileEntity::new, Blocks.FURNACE)); + public static final TileEntityType CHEST = register("chest", TileEntityType.Builder.of(ChestTileEntity::new, Blocks.CHEST)); @@ -54,6 +_,7 @@ - private final Supplier field_200995_z; - private final Set field_223046_I; - private final Type field_206867_C; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.func_242178_a().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.TILE_ENTITIES)); + private final Supplier factory; + private final Set validBlocks; + private final Type dataType; ++ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.TagCollectionManager.getInstance().getCustomTypeCollection(net.minecraftforge.registries.ForgeRegistries.TILE_ENTITIES)); @Nullable - public static ResourceLocation func_200969_a(TileEntityType p_200969_0_) { + public static ResourceLocation getKey(TileEntityType p_200969_0_) { @@ -73,6 +_,14 @@ - this.field_200995_z = p_i51497_1_; - this.field_223046_I = p_i51497_2_; - this.field_206867_C = p_i51497_3_; + this.factory = p_i51497_1_; + this.validBlocks = p_i51497_2_; + this.dataType = p_i51497_3_; + } + + public java.util.Set getTags() { @@ -28,7 +28,7 @@ + } + + public boolean isIn(net.minecraft.tags.ITag> tag) { -+ return tag.func_230235_a_(this); ++ return tag.contains(this); } @Nullable diff --git a/patches/minecraft/net/minecraft/util/RegistryKey.java.patch b/patches/minecraft/net/minecraft/util/RegistryKey.java.patch index 7031e32b7c..0a7f09a30d 100644 --- a/patches/minecraft/net/minecraft/util/RegistryKey.java.patch +++ b/patches/minecraft/net/minecraft/util/RegistryKey.java.patch @@ -6,23 +6,23 @@ -public class RegistryKey { +public class RegistryKey implements Comparable> { - private static final Map> field_240898_a_ = Collections.synchronizedMap(Maps.newIdentityHashMap()); - private final ResourceLocation field_240899_b_; - private final ResourceLocation field_240900_c_; + private static final Map> VALUES = Collections.synchronizedMap(Maps.newIdentityHashMap()); + private final ResourceLocation registryName; + private final ResourceLocation location; @@ -47,5 +_,16 @@ return (p_240907_1_) -> { - return func_240903_a_(p_240902_0_, p_240907_1_); + return create(p_240902_0_, p_240907_1_); }; + } + + public ResourceLocation getRegistryName() { -+ return this.field_240899_b_; ++ return this.registryName; + } + + @Override + public int compareTo(RegistryKey o) { + int ret = this.getRegistryName().compareTo(o.getRegistryName()); -+ if (ret == 0) ret = this.func_240901_a_().compareTo(o.func_240901_a_()); ++ if (ret == 0) ret = this.location().compareTo(o.location()); + return ret; } } diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch index 28d4109f10..0f1b0e08d1 100644 --- a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -6,10 +6,10 @@ + // Normal compare sorts by path first, this compares namespace first. + public int compareNamespaced(ResourceLocation o) { -+ int ret = this.field_110626_a.compareTo(o.field_110626_a); -+ return ret != 0 ? ret : this.field_110625_b.compareTo(o.field_110625_b); ++ int ret = this.namespace.compareTo(o.namespace); ++ return ret != 0 ? ret : this.path.compareTo(o.path); + } + - public static ResourceLocation func_195826_a(StringReader p_195826_0_) throws CommandSyntaxException { + public static ResourceLocation read(StringReader p_195826_0_) throws CommandSyntaxException { int i = p_195826_0_.getCursor(); diff --git a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch index 98e7d10cf6..41b4495b2e 100644 --- a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch +++ b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch @@ -11,13 +11,13 @@ + } + final File target = event.getScreenshotFile(); + - Util.func_240992_g_().execute(() -> { + Util.ioPool().execute(() -> { try { -- nativeimage.func_209271_a(file2); -+ nativeimage.func_209271_a(target); - ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_240699_a_(TextFormatting.UNDERLINE).func_240700_a_((p_238335_1_) -> { -- return p_238335_1_.func_240715_a_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); -+ return p_238335_1_.func_240715_a_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())); +- nativeimage.writeToFile(file2); ++ nativeimage.writeToFile(target); + ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).withStyle(TextFormatting.UNDERLINE).withStyle((p_238335_1_) -> { +- return p_238335_1_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); ++ return p_238335_1_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())); }); - p_228051_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent)); + if (event.getResultMessage() != null) @@ -25,5 +25,5 @@ + else + p_228051_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent)); } catch (Exception exception) { - field_148261_a.warn("Couldn't save screenshot", (Throwable)exception); + LOGGER.warn("Couldn't save screenshot", (Throwable)exception); p_228051_5_.accept(new TranslationTextComponent("screenshot.failure", exception.getMessage())); diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index b9750f9680..fab63f2ae8 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/util/Session.java +++ b/net/minecraft/util/Session.java @@ -18,8 +_,22 @@ - private final String field_148257_b; - private final String field_148258_c; - private final Session.Type field_152429_d; + private final String uuid; + private final String accessToken; + private final Session.Type type; + /** Forge: Cache of the local session's GameProfile properties. */ + private com.mojang.authlib.properties.PropertyMap properties; @@ -20,19 +20,19 @@ + logger.log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); + logger.log(org.apache.logging.log4j.Level.WARN, "========================================================="); + } - this.field_74286_b = p_i1098_1_; - this.field_148257_b = p_i1098_2_; - this.field_148258_c = p_i1098_3_; + this.name = p_i1098_1_; + this.uuid = p_i1098_2_; + this.accessToken = p_i1098_3_; @@ -45,10 +_,22 @@ - public GameProfile func_148256_e() { + public GameProfile getGameProfile() { try { - UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b()); -- return new GameProfile(uuid, this.func_111285_a()); -+ GameProfile ret = new GameProfile(uuid, this.func_111285_a()); //Forge: Adds cached GameProfile properties to returned GameProfile. + UUID uuid = UUIDTypeAdapter.fromString(this.getUuid()); +- return new GameProfile(uuid, this.getName()); ++ GameProfile ret = new GameProfile(uuid, this.getName()); //Forge: Adds cached GameProfile properties to returned GameProfile. + if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service, + return ret; // which helps to fix MC-52974. } catch (IllegalArgumentException illegalargumentexception) { - return new GameProfile((UUID)null, this.func_111285_a()); + return new GameProfile((UUID)null, this.getName()); } + } + diff --git a/patches/minecraft/net/minecraft/util/SharedConstants.java.patch b/patches/minecraft/net/minecraft/util/SharedConstants.java.patch index 6d0af6230d..dc75670429 100644 --- a/patches/minecraft/net/minecraft/util/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/util/SharedConstants.java.patch @@ -5,6 +5,6 @@ static { + if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified - ResourceLeakDetector.setLevel(field_184877_a); + ResourceLeakDetector.setLevel(NETTY_LEAK_DETECTION); CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false; CommandSyntaxException.BUILT_IN_EXCEPTIONS = new TranslatableExceptionProvider(); diff --git a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch index 9329017a3c..1d5e3a4dc6 100644 --- a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch +++ b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch @@ -6,6 +6,6 @@ -public class SoundEvent { +public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Codec field_232678_a_ = ResourceLocation.field_240908_a_.xmap(SoundEvent::new, (p_232679_0_) -> { - return p_232679_0_.field_187506_b; + public static final Codec CODEC = ResourceLocation.CODEC.xmap(SoundEvent::new, (p_232679_0_) -> { + return p_232679_0_.location; }); diff --git a/patches/minecraft/net/minecraft/util/SoundEvents.java.patch b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch index 3502002388..1bff2eadf4 100644 --- a/patches/minecraft/net/minecraft/util/SoundEvents.java.patch +++ b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch @@ -6,5 +6,5 @@ +@net.minecraftforge.registries.ObjectHolder("minecraft") public class SoundEvents { - public static final SoundEvent field_187674_a = func_219592_a("ambient.cave"); - public static final SoundEvent field_232692_b_ = func_219592_a("ambient.basalt_deltas.additions"); + public static final SoundEvent AMBIENT_CAVE = register("ambient.cave"); + public static final SoundEvent AMBIENT_BASALT_DELTAS_ADDITIONS = register("ambient.basalt_deltas.additions"); diff --git a/patches/minecraft/net/minecraft/util/Util.java.patch b/patches/minecraft/net/minecraft/util/Util.java.patch index ed30fc929a..83b0c14c01 100644 --- a/patches/minecraft/net/minecraft/util/Util.java.patch +++ b/patches/minecraft/net/minecraft/util/Util.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/util/Util.java @@ -200,7 +_,7 @@ try { - type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(SharedConstants.func_215069_a().getWorldVersion())).getChoiceType(p_240990_0_, p_240990_1_); + type = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getWorldVersion())).getChoiceType(p_240990_0_, p_240990_1_); } catch (IllegalArgumentException illegalargumentexception) { -- field_195650_a.error("No data fixer registered for {}", (Object)p_240990_1_); -+ field_195650_a.debug("No data fixer registered for {}", (Object)p_240990_1_); - if (SharedConstants.field_206244_b) { +- LOGGER.error("No data fixer registered for {}", (Object)p_240990_1_); ++ LOGGER.debug("No data fixer registered for {}", (Object)p_240990_1_); + if (SharedConstants.IS_RUNNING_IN_IDE) { throw illegalargumentexception; } diff --git a/patches/minecraft/net/minecraft/util/datafix/codec/DatapackCodec.java.patch b/patches/minecraft/net/minecraft/util/datafix/codec/DatapackCodec.java.patch index d327ab3a34..be232f0bc1 100644 --- a/patches/minecraft/net/minecraft/util/datafix/codec/DatapackCodec.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/codec/DatapackCodec.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/util/datafix/codec/DatapackCodec.java +++ b/net/minecraft/util/datafix/codec/DatapackCodec.java @@ -18,7 +_,7 @@ - private final List field_234883_d_; + private final List disabled; public DatapackCodec(List p_i231607_1_, List p_i231607_2_) { -- this.field_234882_c_ = ImmutableList.copyOf(p_i231607_1_); -+ this.field_234882_c_ = com.google.common.collect.Lists.newArrayList(p_i231607_1_); - this.field_234883_d_ = ImmutableList.copyOf(p_i231607_2_); +- this.enabled = ImmutableList.copyOf(p_i231607_1_); ++ this.enabled = com.google.common.collect.Lists.newArrayList(p_i231607_1_); + this.disabled = ImmutableList.copyOf(p_i231607_2_); } @@ -28,5 +_,9 @@ - public List func_234887_b_() { - return this.field_234883_d_; + public List getDisabled() { + return this.disabled; + } + + public void addModPacks(List modPacks) { -+ field_234882_c_.addAll(modPacks.stream().filter(p->!field_234882_c_.contains(p)).collect(java.util.stream.Collectors.toList())); ++ enabled.addAll(modPacks.stream().filter(p->!enabled.contains(p)).collect(java.util.stream.Collectors.toList())); } } diff --git a/patches/minecraft/net/minecraft/util/math/RayTraceContext.java.patch b/patches/minecraft/net/minecraft/util/math/RayTraceContext.java.patch index 89b11e5f5c..b9f0cf3614 100644 --- a/patches/minecraft/net/minecraft/util/math/RayTraceContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/RayTraceContext.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/util/math/RayTraceContext.java +++ b/net/minecraft/util/math/RayTraceContext.java @@ -18,12 +_,12 @@ - private final RayTraceContext.FluidMode field_222257_d; - private final ISelectionContext field_222258_e; + private final RayTraceContext.FluidMode fluid; + private final ISelectionContext collisionContext; - public RayTraceContext(Vector3d p_i50009_1_, Vector3d p_i50009_2_, RayTraceContext.BlockMode p_i50009_3_, RayTraceContext.FluidMode p_i50009_4_, Entity p_i50009_5_) { + public RayTraceContext(Vector3d p_i50009_1_, Vector3d p_i50009_2_, RayTraceContext.BlockMode p_i50009_3_, RayTraceContext.FluidMode p_i50009_4_, @javax.annotation.Nullable Entity p_i50009_5_) { - this.field_222254_a = p_i50009_1_; - this.field_222255_b = p_i50009_2_; - this.field_222256_c = p_i50009_3_; - this.field_222257_d = p_i50009_4_; -- this.field_222258_e = ISelectionContext.func_216374_a(p_i50009_5_); -+ this.field_222258_e = p_i50009_5_ == null ? ISelectionContext.func_216377_a() : ISelectionContext.func_216374_a(p_i50009_5_); + this.from = p_i50009_1_; + this.to = p_i50009_2_; + this.block = p_i50009_3_; + this.fluid = p_i50009_4_; +- this.collisionContext = ISelectionContext.of(p_i50009_5_); ++ this.collisionContext = p_i50009_5_ == null ? ISelectionContext.empty() : ISelectionContext.of(p_i50009_5_); } - public Vector3d func_222250_a() { + public Vector3d getTo() { diff --git a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch index c9240b0c14..15d7e2cbb1 100644 --- a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch +++ b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch @@ -3,7 +3,7 @@ @@ -5,6 +_,11 @@ public abstract class RayTraceResult { - protected final Vector3d field_72307_f; + protected final Vector3d location; + /** Used to determine what sub-segment is hit */ + public int subHit = -1; + @@ -11,4 +11,4 @@ + public Object hitInfo = null; protected RayTraceResult(Vector3d p_i51183_1_) { - this.field_72307_f = p_i51183_1_; + this.location = p_i51183_1_; diff --git a/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch b/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch index 793c7503a5..6223187eba 100644 --- a/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/shapes/EntitySelectionContext.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/util/math/shapes/EntitySelectionContext.java +++ b/net/minecraft/util/math/shapes/EntitySelectionContext.java @@ -25,6 +_,11 @@ - private final Predicate field_237493_e_; + private final Predicate canStandOnFluid; protected EntitySelectionContext(boolean p_i232177_1_, double p_i232177_2_, Item p_i232177_4_, Predicate p_i232177_5_) { + this(null, p_i232177_1_, p_i232177_2_, p_i232177_4_, p_i232177_5_); @@ -9,22 +9,22 @@ + + protected EntitySelectionContext(@javax.annotation.Nullable Entity entity, boolean p_i232177_1_, double p_i232177_2_, Item p_i232177_4_, Predicate p_i232177_5_) { + this.entity = entity; - this.field_227579_b_ = p_i232177_1_; - this.field_216381_c = p_i232177_2_; - this.field_216382_d = p_i232177_4_; + this.descending = p_i232177_1_; + this.entityBottom = p_i232177_2_; + this.heldItem = p_i232177_4_; @@ -33,7 +_,7 @@ @Deprecated protected EntitySelectionContext(Entity p_i51182_1_) { -- this(p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_)::func_230285_a_ : (p_237494_0_) -> { -+ this(p_i51182_1_, p_i51182_1_.func_226274_bn_(), p_i51182_1_.func_226278_cu_(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_)::func_230285_a_ : (p_237494_0_) -> { +- this(p_i51182_1_.isDescending(), p_i51182_1_.getY(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).getMainHandItem().getItem() : Items.AIR, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_)::canStandOnFluid : (p_237494_0_) -> { ++ this(p_i51182_1_, p_i51182_1_.isDescending(), p_i51182_1_.getY(), p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).getMainHandItem().getItem() : Items.AIR, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_)::canStandOnFluid : (p_237494_0_) -> { return false; }); } @@ -52,5 +_,12 @@ - public boolean func_216378_a(VoxelShape p_216378_1_, BlockPos p_216378_2_, boolean p_216378_3_) { - return this.field_216381_c > (double)p_216378_2_.func_177956_o() + p_216378_1_.func_197758_c(Direction.Axis.Y) - (double)1.0E-5F; + public boolean isAbove(VoxelShape p_216378_1_, BlockPos p_216378_2_, boolean p_216378_3_) { + return this.entityBottom > (double)p_216378_2_.getY() + p_216378_1_.max(Direction.Axis.Y) - (double)1.0E-5F; + } + + private final @javax.annotation.Nullable Entity entity; diff --git a/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch b/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch index c3da893a8f..882f312f97 100644 --- a/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch +++ b/patches/minecraft/net/minecraft/util/math/shapes/ISelectionContext.java.patch @@ -6,6 +6,6 @@ -public interface ISelectionContext { +public interface ISelectionContext extends net.minecraftforge.common.extensions.IForgeSelectionContext { - static ISelectionContext func_216377_a() { - return EntitySelectionContext.field_216379_a; + static ISelectionContext empty() { + return EntitySelectionContext.EMPTY; } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch index 794025eb0d..b1229392b0 100644 --- a/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch +++ b/patches/minecraft/net/minecraft/util/math/vector/Matrix3f.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/util/math/vector/Matrix3f.java +++ b/net/minecraft/util/math/vector/Matrix3f.java @@ -444,4 +_,11 @@ - public Matrix3f func_226121_d_() { + public Matrix3f copy() { return new Matrix3f(this); } + + // Forge start + public void multiplyBackward(Matrix3f other) { -+ Matrix3f copy = other.func_226121_d_(); -+ copy.func_226118_b_(this); -+ this.func_226114_a_(copy); ++ Matrix3f copy = other.copy(); ++ copy.mul(this); ++ this.load(copy); + } } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch index 1d9e1c697a..d2a3521877 100644 --- a/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch +++ b/patches/minecraft/net/minecraft/util/math/vector/Matrix4f.java.patch @@ -1,81 +1,81 @@ --- a/net/minecraft/util/math/vector/Matrix4f.java +++ b/net/minecraft/util/math/vector/Matrix4f.java @@ -386,4 +_,78 @@ - matrix4f.field_226586_l_ = p_226599_2_; + matrix4f.m23 = p_226599_2_; return matrix4f; } + + // Forge start + public Matrix4f(float[] values) { -+ field_226575_a_ = values[0]; -+ field_226576_b_ = values[1]; -+ field_226577_c_ = values[2]; -+ field_226578_d_ = values[3]; -+ field_226579_e_ = values[4]; -+ field_226580_f_ = values[5]; -+ field_226581_g_ = values[6]; -+ field_226582_h_ = values[7]; -+ field_226583_i_ = values[8]; -+ field_226584_j_ = values[9]; -+ field_226585_k_ = values[10]; -+ field_226586_l_ = values[11]; -+ field_226587_m_ = values[12]; -+ field_226588_n_ = values[13]; -+ field_226589_o_ = values[14]; -+ field_226590_p_ = values[15]; ++ m00 = values[0]; ++ m01 = values[1]; ++ m02 = values[2]; ++ m03 = values[3]; ++ m10 = values[4]; ++ m11 = values[5]; ++ m12 = values[6]; ++ m13 = values[7]; ++ m20 = values[8]; ++ m21 = values[9]; ++ m22 = values[10]; ++ m23 = values[11]; ++ m30 = values[12]; ++ m31 = values[13]; ++ m32 = values[14]; ++ m33 = values[15]; + } + + public void set(Matrix4f mat) { -+ this.field_226575_a_ = mat.field_226575_a_; -+ this.field_226576_b_ = mat.field_226576_b_; -+ this.field_226577_c_ = mat.field_226577_c_; -+ this.field_226578_d_ = mat.field_226578_d_; -+ this.field_226579_e_ = mat.field_226579_e_; -+ this.field_226580_f_ = mat.field_226580_f_; -+ this.field_226581_g_ = mat.field_226581_g_; -+ this.field_226582_h_ = mat.field_226582_h_; -+ this.field_226583_i_ = mat.field_226583_i_; -+ this.field_226584_j_ = mat.field_226584_j_; -+ this.field_226585_k_ = mat.field_226585_k_; -+ this.field_226586_l_ = mat.field_226586_l_; -+ this.field_226587_m_ = mat.field_226587_m_; -+ this.field_226588_n_ = mat.field_226588_n_; -+ this.field_226589_o_ = mat.field_226589_o_; -+ this.field_226590_p_ = mat.field_226590_p_; ++ this.m00 = mat.m00; ++ this.m01 = mat.m01; ++ this.m02 = mat.m02; ++ this.m03 = mat.m03; ++ this.m10 = mat.m10; ++ this.m11 = mat.m11; ++ this.m12 = mat.m12; ++ this.m13 = mat.m13; ++ this.m20 = mat.m20; ++ this.m21 = mat.m21; ++ this.m22 = mat.m22; ++ this.m23 = mat.m23; ++ this.m30 = mat.m30; ++ this.m31 = mat.m31; ++ this.m32 = mat.m32; ++ this.m33 = mat.m33; + } + + public void add(Matrix4f other) { -+ field_226575_a_ += other.field_226575_a_; -+ field_226576_b_ += other.field_226576_b_; -+ field_226577_c_ += other.field_226577_c_; -+ field_226578_d_ += other.field_226578_d_; -+ field_226579_e_ += other.field_226579_e_; -+ field_226580_f_ += other.field_226580_f_; -+ field_226581_g_ += other.field_226581_g_; -+ field_226582_h_ += other.field_226582_h_; -+ field_226583_i_ += other.field_226583_i_; -+ field_226584_j_ += other.field_226584_j_; -+ field_226585_k_ += other.field_226585_k_; -+ field_226586_l_ += other.field_226586_l_; -+ field_226587_m_ += other.field_226587_m_; -+ field_226588_n_ += other.field_226588_n_; -+ field_226589_o_ += other.field_226589_o_; -+ field_226590_p_ += other.field_226590_p_; ++ m00 += other.m00; ++ m01 += other.m01; ++ m02 += other.m02; ++ m03 += other.m03; ++ m10 += other.m10; ++ m11 += other.m11; ++ m12 += other.m12; ++ m13 += other.m13; ++ m20 += other.m20; ++ m21 += other.m21; ++ m22 += other.m22; ++ m23 += other.m23; ++ m30 += other.m30; ++ m31 += other.m31; ++ m32 += other.m32; ++ m33 += other.m33; + } + + public void multiplyBackward(Matrix4f other) { -+ Matrix4f copy = other.func_226601_d_(); -+ copy.func_226595_a_(this); ++ Matrix4f copy = other.copy(); ++ copy.multiply(this); + this.set(copy); + } + + public void setTranslation(float x, float y, float z) { -+ this.field_226575_a_ = 1.0F; -+ this.field_226580_f_ = 1.0F; -+ this.field_226585_k_ = 1.0F; -+ this.field_226590_p_ = 1.0F; -+ this.field_226578_d_ = x; -+ this.field_226582_h_ = y; -+ this.field_226586_l_ = z; ++ this.m00 = 1.0F; ++ this.m11 = 1.0F; ++ this.m22 = 1.0F; ++ this.m33 = 1.0F; ++ this.m03 = x; ++ this.m13 = y; ++ this.m23 = z; + } } diff --git a/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch b/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch index 68dc6a560e..b7e331552b 100644 --- a/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch +++ b/patches/minecraft/net/minecraft/util/math/vector/TransformationMatrix.java.patch @@ -6,44 +6,47 @@ @OnlyIn(Dist.CLIENT) -public final class TransformationMatrix { +public final class TransformationMatrix implements net.minecraftforge.client.extensions.IForgeTransformationMatrix { - private final Matrix4f field_227976_a_; - private boolean field_227977_b_; + private final Matrix4f matrix; + private boolean decomposed; @Nullable -@@ -50,14 +_,14 @@ - return field_227982_g_; +@@ -50,14 +_,17 @@ + return IDENTITY; } -- public TransformationMatrix func_227985_a_(TransformationMatrix p_227985_1_) { -+ public TransformationMatrix compose(TransformationMatrix p_227985_1_) { - Matrix4f matrix4f = this.func_227988_c_(); - matrix4f.func_226595_a_(p_227985_1_.func_227988_c_()); +- public TransformationMatrix compose(TransformationMatrix p_227985_1_) { ++ // FORGE: The methods below are not actually unused. To avoid FG6 reobfuscating the compose/inverse ++ // methods in IForgeTransformationMatrix, we rename the vanilla methods, and inject the original ++ // names at runtime via coremod (add_bouncer_method.js). The bouncers will call these methods. ++ private TransformationMatrix composeVanilla(TransformationMatrix p_227985_1_) { + Matrix4f matrix4f = this.getMatrix(); + matrix4f.multiply(p_227985_1_.getMatrix()); return new TransformationMatrix(matrix4f); } @Nullable -- public TransformationMatrix func_227987_b_() { -+ public TransformationMatrix inverse() { - if (this == field_227982_g_) { +- public TransformationMatrix inverse() { ++ private TransformationMatrix inverseVanilla() { + if (this == IDENTITY) { return this; } else { @@ -133,4 +_,32 @@ public int hashCode() { - return Objects.hash(this.field_227976_a_); + return Objects.hash(this.matrix); } + + // FORGE START + public Vector3f getTranslation() { -+ func_227990_e_(); -+ return field_227978_c_.func_229195_e_(); ++ ensureDecomposed(); ++ return translation.copy(); + } + public Vector3f getScale() { -+ func_227990_e_(); -+ return field_227980_e_.func_229195_e_(); ++ ensureDecomposed(); ++ return scale.copy(); + } + + public Quaternion getRightRot() { -+ func_227990_e_(); -+ return field_227981_f_.func_227068_g_(); ++ ensureDecomposed(); ++ return rightRotation.copy(); + } + + private Matrix3f normalTransform = null; @@ -53,9 +56,9 @@ + } + private void checkNormalTransform() { + if (normalTransform == null) { -+ normalTransform = new Matrix3f(field_227976_a_); -+ normalTransform.func_226123_f_(); -+ normalTransform.func_226110_a_(); ++ normalTransform = new Matrix3f(matrix); ++ normalTransform.invert(); ++ normalTransform.transpose(); + } + } } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch index 8978d47a1a..471d0edcba 100644 --- a/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch +++ b/patches/minecraft/net/minecraft/util/math/vector/Vector3f.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/util/math/vector/Vector3f.java @@ -196,4 +_,17 @@ public String toString() { - return "[" + this.field_229184_g_ + ", " + this.field_229185_h_ + ", " + this.field_229186_i_ + "]"; + return "[" + this.x + ", " + this.y + ", " + this.z + "]"; } + + // Forge start @@ -10,11 +10,11 @@ + set(values); + } + public void set(float[] values) { -+ this.field_229184_g_ = values[0]; -+ this.field_229185_h_ = values[1]; -+ this.field_229186_i_ = values[2]; ++ this.x = values[0]; ++ this.y = values[1]; ++ this.z = values[2]; + } -+ public void setX(float x) { this.field_229184_g_ = x; } -+ public void setY(float y) { this.field_229185_h_ = y; } -+ public void setZ(float z) { this.field_229186_i_ = z; } ++ public void setX(float x) { this.x = x; } ++ public void setY(float y) { this.y = y; } ++ public void setZ(float z) { this.z = z; } } diff --git a/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch b/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch index d2880d9846..fe858b1d24 100644 --- a/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch +++ b/patches/minecraft/net/minecraft/util/math/vector/Vector4f.java.patch @@ -2,18 +2,18 @@ +++ b/net/minecraft/util/math/vector/Vector4f.java @@ -125,4 +_,16 @@ public String toString() { - return "[" + this.field_229368_a_ + ", " + this.field_229369_b_ + ", " + this.field_229370_c_ + ", " + this.field_229371_d_ + "]"; + return "[" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + "]"; } + + // Forge start + public void set(float[] values) { -+ this.field_229368_a_ = values[0]; -+ this.field_229369_b_ = values[1]; -+ this.field_229370_c_ = values[2]; -+ this.field_229371_d_ = values[3]; ++ this.x = values[0]; ++ this.y = values[1]; ++ this.z = values[2]; ++ this.w = values[3]; + } -+ public void setX(float x) { this.field_229368_a_ = x; } -+ public void setY(float y) { this.field_229369_b_ = y; } -+ public void setZ(float z) { this.field_229370_c_ = z; } -+ public void setW(float z) { this.field_229371_d_ = z; } ++ public void setX(float x) { this.x = x; } ++ public void setY(float y) { this.y = y; } ++ public void setZ(float z) { this.z = z; } ++ public void setW(float z) { this.w = z; } } diff --git a/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch index 089c89fc99..eadcfa10df 100644 --- a/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch +++ b/patches/minecraft/net/minecraft/util/palette/PalettedContainer.java.patch @@ -3,41 +3,41 @@ @@ -66,8 +_,11 @@ } - private void func_186012_b(int p_186012_1_) { -- if (p_186012_1_ != this.field_186024_e) { -- this.field_186024_e = p_186012_1_; + private void setBits(int p_186012_1_) { +- if (p_186012_1_ != this.bits) { +- this.bits = p_186012_1_; + setBits(p_186012_1_, false); + } + private void setBits(int bitsIn, boolean forceBits) { -+ if (bitsIn != this.field_186024_e) { -+ this.field_186024_e = bitsIn; - if (this.field_186024_e <= 4) { - this.field_186024_e = 4; - this.field_186022_c = new ArrayPalette<>(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); ++ if (bitsIn != this.bits) { ++ this.bits = bitsIn; + if (this.bits <= 4) { + this.bits = 4; + this.palette = new ArrayPalette<>(this.registry, this.bits, this, this.reader); @@ -76,6 +_,8 @@ } else { - this.field_186022_c = this.field_205521_b; - this.field_186024_e = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); + this.palette = this.globalPalette; + this.bits = MathHelper.ceillog2(this.registry.size()); + if (forceBits) -+ this.field_186024_e = bitsIn; ++ this.bits = bitsIn; } - this.field_186022_c.func_186041_a(this.field_205526_g); + this.palette.idFor(this.defaultValue); @@ -138,12 +_,16 @@ - this.func_210459_b(); + this.acquire(); int i = p_186010_1_.readByte(); - if (this.field_186024_e != i) { -- this.func_186012_b(i); + if (this.bits != i) { +- this.setBits(i); + this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed. } - this.field_186022_c.func_186038_a(p_186010_1_); - p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a()); - this.func_210460_c(); + this.palette.read(p_186010_1_); + p_186010_1_.readLongArray(this.storage.getRaw()); + this.release(); + -+ int regSize = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); -+ if (this.field_186022_c == field_205521_b && this.field_186024_e != regSize) // Resize bits to fit registry. -+ this.onResize(regSize, field_205526_g); ++ int regSize = MathHelper.ceillog2(this.registry.size()); ++ if (this.palette == globalPalette && this.bits != regSize) // Resize bits to fit registry. ++ this.onResize(regSize, defaultValue); } - public void func_186009_b(PacketBuffer p_186009_1_) { + public void write(PacketBuffer p_186009_1_) { diff --git a/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch index 85cfbec62c..01ec0dcbc1 100644 --- a/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/util/registry/Bootstrap.java +++ b/net/minecraft/util/registry/Bootstrap.java @@ -48,6 +_,8 @@ - IDispenseItemBehavior.func_218401_c(); - ArgumentTypes.func_197483_a(); - TagRegistryManager.func_242197_b(); + IDispenseItemBehavior.bootStrap(); + ArgumentTypes.bootStrap(); + TagRegistryManager.bootStrap(); + 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 - func_179868_d(); + wrapStreams(); } } @@ -103,7 +_,6 @@ - Commands.func_242986_b(); + Commands.validate(); } -- GlobalEntityTypeAttributes.func_233834_a_(); +- GlobalEntityTypeAttributes.validate(); } } diff --git a/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch b/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch index 434ee0fc1e..ff7d8bec5f 100644 --- a/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/util/registry/DynamicRegistries.java +++ b/net/minecraft/util/registry/DynamicRegistries.java @@ -90,6 +_,8 @@ - RegistryKey> registrykey = p_243607_2_.func_243622_a(); - boolean flag = !registrykey.equals(Registry.field_243549_ar) && !registrykey.equals(Registry.field_239698_ad_); - Registry registry = field_243600_c.func_243612_b(registrykey); -+ if (!registrykey.equals(Registry.field_239698_ad_)) -+ registry = ((Registry>)WorldGenRegistries.field_243650_b).func_230516_a_((RegistryKey>)registrykey); - MutableRegistry mutableregistry = p_243607_0_.func_243612_b(registrykey); + RegistryKey> registrykey = p_243607_2_.key(); + boolean flag = !registrykey.equals(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY) && !registrykey.equals(Registry.DIMENSION_TYPE_REGISTRY); + Registry registry = BUILTIN.registryOrThrow(registrykey); ++ if (!registrykey.equals(Registry.DIMENSION_TYPE_REGISTRY)) ++ registry = ((Registry>)WorldGenRegistries.REGISTRY).get((RegistryKey>)registrykey); + MutableRegistry mutableregistry = p_243607_0_.registryOrThrow(registrykey); - for(Entry, E> entry : registry.func_239659_c_()) { + for(Entry, E> entry : registry.entrySet()) { diff --git a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch index 5bbd78a751..3db3a0dfde 100644 --- a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -9,202 +9,202 @@ + * We will be wrapping all of these in our API as necessary for syncing and management. + */ public abstract class Registry implements Codec, Keyable, IObjectIntIterable { - protected static final Logger field_212616_e = LogManager.getLogger(); - private static final Map> field_218376_a = Maps.newLinkedHashMap(); + protected static final Logger LOGGER = LogManager.getLogger(); + private static final Map> LOADERS = Maps.newLinkedHashMap(); @@ -133,43 +_,43 @@ - public static final RegistryKey> field_239698_ad_ = func_239741_a_("dimension_type"); - public static final RegistryKey> field_239699_ae_ = func_239741_a_("dimension"); - public static final RegistryKey> field_239700_af_ = func_239741_a_("dimension"); -- public static final Registry field_212633_v = func_239746_a_(field_239708_i_, () -> { -+ @Deprecated public static final Registry field_212633_v = forge(field_239708_i_, () -> { - return SoundEvents.field_187638_cR; + public static final RegistryKey> DIMENSION_TYPE_REGISTRY = createRegistryKey("dimension_type"); + public static final RegistryKey> DIMENSION_REGISTRY = createRegistryKey("dimension"); + public static final RegistryKey> LEVEL_STEM_REGISTRY = createRegistryKey("dimension"); +- public static final Registry SOUND_EVENT = registerSimple(SOUND_EVENT_REGISTRY, () -> { ++ @Deprecated public static final Registry SOUND_EVENT = forge(SOUND_EVENT_REGISTRY, () -> { + return SoundEvents.ITEM_PICKUP; }); -- public static final DefaultedRegistry field_212619_h = func_239745_a_(field_239709_j_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry field_212619_h = forge(field_239709_j_, "empty", () -> { - return Fluids.field_204541_a; +- public static final DefaultedRegistry FLUID = registerDefaulted(FLUID_REGISTRY, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry FLUID = forge(FLUID_REGISTRY, "empty", () -> { + return Fluids.EMPTY; }); -- public static final Registry field_212631_t = func_239746_a_(field_239710_k_, () -> { -+ @Deprecated public static final Registry field_212631_t = forge(field_239710_k_, () -> { - return Effects.field_188425_z; +- public static final Registry MOB_EFFECT = registerSimple(MOB_EFFECT_REGISTRY, () -> { ++ @Deprecated public static final Registry MOB_EFFECT = forge(MOB_EFFECT_REGISTRY, () -> { + return Effects.LUCK; }); -- public static final DefaultedRegistry field_212618_g = func_239745_a_(field_239711_l_, "air", () -> { -+ @Deprecated public static final DefaultedRegistry field_212618_g = forge(field_239711_l_, "air", () -> { - return Blocks.field_150350_a; +- public static final DefaultedRegistry BLOCK = registerDefaulted(BLOCK_REGISTRY, "air", () -> { ++ @Deprecated public static final DefaultedRegistry BLOCK = forge(BLOCK_REGISTRY, "air", () -> { + return Blocks.AIR; }); -- public static final Registry field_212628_q = func_239746_a_(field_239712_m_, () -> { -+ @Deprecated public static final Registry field_212628_q = forge(field_239712_m_, () -> { - return Enchantments.field_185308_t; +- public static final Registry ENCHANTMENT = registerSimple(ENCHANTMENT_REGISTRY, () -> { ++ @Deprecated public static final Registry ENCHANTMENT = forge(ENCHANTMENT_REGISTRY, () -> { + return Enchantments.BLOCK_FORTUNE; }); -- public static final DefaultedRegistry> field_212629_r = func_239745_a_(field_239713_n_, "pig", () -> { -+ @Deprecated public static final DefaultedRegistry> field_212629_r = forge(field_239713_n_, "pig", () -> { - return EntityType.field_200784_X; +- public static final DefaultedRegistry> ENTITY_TYPE = registerDefaulted(ENTITY_TYPE_REGISTRY, "pig", () -> { ++ @Deprecated public static final DefaultedRegistry> ENTITY_TYPE = forge(ENTITY_TYPE_REGISTRY, "pig", () -> { + return EntityType.PIG; }); -- public static final DefaultedRegistry field_212630_s = func_239745_a_(field_239714_o_, "air", () -> { -+ @Deprecated public static final DefaultedRegistry field_212630_s = forge(field_239714_o_, "air", () -> { - return Items.field_190931_a; +- public static final DefaultedRegistry ITEM = registerDefaulted(ITEM_REGISTRY, "air", () -> { ++ @Deprecated public static final DefaultedRegistry ITEM = forge(ITEM_REGISTRY, "air", () -> { + return Items.AIR; }); -- public static final DefaultedRegistry field_212621_j = func_239745_a_(field_239715_p_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry field_212621_j = forge(field_239715_p_, "empty", () -> { - return Potions.field_185229_a; +- public static final DefaultedRegistry POTION = registerDefaulted(POTION_REGISTRY, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry POTION = forge(POTION_REGISTRY, "empty", () -> { + return Potions.EMPTY; }); -- public static final Registry> field_212632_u = func_239746_a_(field_239664_B_, () -> { -+ @Deprecated public static final Registry> field_212632_u = forge(field_239664_B_, () -> { - return ParticleTypes.field_197611_d; +- public static final Registry> PARTICLE_TYPE = registerSimple(PARTICLE_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> PARTICLE_TYPE = forge(PARTICLE_TYPE_REGISTRY, () -> { + return ParticleTypes.BLOCK; }); -- public static final Registry> field_212626_o = func_239746_a_(field_239667_E_, () -> { -+ @Deprecated public static final Registry> field_212626_o = forge(field_239667_E_, () -> { - return TileEntityType.field_200971_b; +- public static final Registry> BLOCK_ENTITY_TYPE = registerSimple(BLOCK_ENTITY_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> BLOCK_ENTITY_TYPE = forge(BLOCK_ENTITY_TYPE_REGISTRY, () -> { + return TileEntityType.FURNACE; }); -- public static final DefaultedRegistry field_212620_i = func_239745_a_(field_239668_F_, "kebab", () -> { -+ @Deprecated public static final DefaultedRegistry field_212620_i = forge(field_239668_F_, "kebab", () -> { - return PaintingType.field_200843_b; +- public static final DefaultedRegistry MOTIVE = registerDefaulted(MOTIVE_REGISTRY, "kebab", () -> { ++ @Deprecated public static final DefaultedRegistry MOTIVE = forge(MOTIVE_REGISTRY, "kebab", () -> { + return PaintingType.KEBAB; }); - public static final Registry field_212623_l = func_239746_a_(field_239669_G_, () -> { - return Stats.field_75953_u; + public static final Registry CUSTOM_STAT = registerSimple(CUSTOM_STAT_REGISTRY, () -> { + return Stats.JUMP; }); -- public static final DefaultedRegistry field_218360_A = func_239745_a_(field_239670_H_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry field_218360_A = forge(field_239670_H_, "empty", () -> { - return ChunkStatus.field_223226_a_; +- public static final DefaultedRegistry CHUNK_STATUS = registerDefaulted(CHUNK_STATUS_REGISTRY, "empty", () -> { ++ @Deprecated public static final DefaultedRegistry CHUNK_STATUS = forge(CHUNK_STATUS_REGISTRY, "empty", () -> { + return ChunkStatus.EMPTY; }); - public static final Registry> field_218363_D = func_239746_a_(field_239673_K_, () -> { + public static final Registry> RULE_TEST = registerSimple(RULE_TEST_REGISTRY, () -> { @@ -178,40 +_,40 @@ - public static final Registry> field_239691_aJ_ = func_239746_a_(field_239674_L_, () -> { - return IPosRuleTests.field_237103_a_; + public static final Registry> POS_RULE_TEST = registerSimple(POS_RULE_TEST_REGISTRY, () -> { + return IPosRuleTests.ALWAYS_TRUE_TEST; }); -- public static final Registry> field_218366_G = func_239746_a_(field_239677_O_, () -> { -+ @Deprecated public static final Registry> field_218366_G = forge(field_239677_O_, () -> { - return ContainerType.field_221514_h; +- public static final Registry> MENU = registerSimple(MENU_REGISTRY, () -> { ++ @Deprecated public static final Registry> MENU = forge(MENU_REGISTRY, () -> { + return ContainerType.ANVIL; }); - public static final Registry> field_218367_H = func_239746_a_(field_239678_P_, () -> { - return IRecipeType.field_222149_a; + public static final Registry> RECIPE_TYPE = registerSimple(RECIPE_TYPE_REGISTRY, () -> { + return IRecipeType.CRAFTING; }); -- public static final Registry> field_218368_I = func_239746_a_(field_239679_Q_, () -> { -+ @Deprecated public static final Registry> field_218368_I = forge(field_239679_Q_, () -> { - return IRecipeSerializer.field_222158_b; +- public static final Registry> RECIPE_SERIALIZER = registerSimple(RECIPE_SERIALIZER_REGISTRY, () -> { ++ @Deprecated public static final Registry> RECIPE_SERIALIZER = forge(RECIPE_SERIALIZER_REGISTRY, () -> { + return IRecipeSerializer.SHAPELESS_RECIPE; }); -- public static final Registry field_239692_aP_ = func_239746_a_(field_239680_R_, () -> { -+ @Deprecated public static final Registry field_239692_aP_ = forge(field_239680_R_, () -> { - return Attributes.field_233828_k_; +- public static final Registry ATTRIBUTE = registerSimple(ATTRIBUTE_REGISTRY, () -> { ++ @Deprecated public static final Registry ATTRIBUTE = forge(ATTRIBUTE_REGISTRY, () -> { + return Attributes.LUCK; }); -- public static final Registry> field_212634_w = func_239746_a_(field_239681_S_, () -> { -+ @Deprecated public static final Registry> field_212634_w = forge(field_239681_S_, () -> { - return Stats.field_75929_E; +- public static final Registry> STAT_TYPE = registerSimple(STAT_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> STAT_TYPE = forge(STAT_TYPE_REGISTRY, () -> { + return Stats.ITEM_USED; }); - public static final DefaultedRegistry field_218369_K = func_239745_a_(field_239682_T_, "plains", () -> { - return VillagerType.field_221175_c; + public static final DefaultedRegistry VILLAGER_TYPE = registerDefaulted(VILLAGER_TYPE_REGISTRY, "plains", () -> { + return VillagerType.PLAINS; }); -- public static final DefaultedRegistry field_218370_L = func_239745_a_(field_239683_U_, "none", () -> { -+ @Deprecated public static final DefaultedRegistry field_218370_L = forge(field_239683_U_, "none", () -> { - return VillagerProfession.field_221151_a; +- public static final DefaultedRegistry VILLAGER_PROFESSION = registerDefaulted(VILLAGER_PROFESSION_REGISTRY, "none", () -> { ++ @Deprecated public static final DefaultedRegistry VILLAGER_PROFESSION = forge(VILLAGER_PROFESSION_REGISTRY, "none", () -> { + return VillagerProfession.NONE; }); -- public static final DefaultedRegistry field_218371_M = func_239745_a_(field_239684_V_, "unemployed", () -> { -+ @Deprecated public static final DefaultedRegistry field_218371_M = forge(field_239684_V_, "unemployed", () -> { - return PointOfInterestType.field_221054_b; +- public static final DefaultedRegistry POINT_OF_INTEREST_TYPE = registerDefaulted(POINT_OF_INTEREST_TYPE_REGISTRY, "unemployed", () -> { ++ @Deprecated public static final DefaultedRegistry POINT_OF_INTEREST_TYPE = forge(POINT_OF_INTEREST_TYPE_REGISTRY, "unemployed", () -> { + return PointOfInterestType.UNEMPLOYED; }); -- public static final DefaultedRegistry> field_218372_N = func_239745_a_(field_239685_W_, "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> field_218372_N = forge(field_239685_W_, "dummy", () -> { - return MemoryModuleType.field_220940_a; +- public static final DefaultedRegistry> MEMORY_MODULE_TYPE = registerDefaulted(MEMORY_MODULE_TYPE_REGISTRY, "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> MEMORY_MODULE_TYPE = forge(MEMORY_MODULE_TYPE_REGISTRY, "dummy", () -> { + return MemoryModuleType.DUMMY; }); -- public static final DefaultedRegistry> field_218373_O = func_239745_a_(field_239686_X_, "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> field_218373_O = forge(field_239686_X_, "dummy", () -> { - return SensorType.field_220997_a; +- public static final DefaultedRegistry> SENSOR_TYPE = registerDefaulted(SENSOR_TYPE_REGISTRY, "dummy", () -> { ++ @Deprecated public static final DefaultedRegistry> SENSOR_TYPE = forge(SENSOR_TYPE_REGISTRY, "dummy", () -> { + return SensorType.DUMMY; }); -- public static final Registry field_218374_P = func_239746_a_(field_239687_Y_, () -> { -+ @Deprecated public static final Registry field_218374_P = forge(field_239687_Y_, () -> { - return Schedule.field_221383_a; +- public static final Registry SCHEDULE = registerSimple(SCHEDULE_REGISTRY, () -> { ++ @Deprecated public static final Registry SCHEDULE = forge(SCHEDULE_REGISTRY, () -> { + return Schedule.EMPTY; }); -- public static final Registry field_218375_Q = func_239746_a_(field_239688_Z_, () -> { -+ @Deprecated public static final Registry field_218375_Q = forge(field_239688_Z_, () -> { - return Activity.field_221366_b; +- public static final Registry ACTIVITY = registerSimple(ACTIVITY_REGISTRY, () -> { ++ @Deprecated public static final Registry ACTIVITY = forge(ACTIVITY_REGISTRY, () -> { + return Activity.IDLE; }); - public static final Registry field_239693_aY_ = func_239746_a_(field_239695_aa_, () -> { + public static final Registry LOOT_POOL_ENTRY_TYPE = registerSimple(LOOT_ENTRY_REGISTRY, () -> { @@ -232,19 +_,19 @@ - public static final RegistryKey> field_243555_ax = func_239741_a_("worldgen/template_pool"); - public static final RegistryKey> field_239720_u_ = func_239741_a_("worldgen/biome"); - public static final RegistryKey>> field_239717_r_ = func_239741_a_("worldgen/surface_builder"); -- public static final Registry> field_218378_p = func_239746_a_(field_239717_r_, () -> { -+ @Deprecated public static final Registry> field_218378_p = forge(field_239717_r_, () -> { - return SurfaceBuilder.field_215396_G; + public static final RegistryKey> TEMPLATE_POOL_REGISTRY = createRegistryKey("worldgen/template_pool"); + public static final RegistryKey> BIOME_REGISTRY = createRegistryKey("worldgen/biome"); + public static final RegistryKey>> SURFACE_BUILDER_REGISTRY = createRegistryKey("worldgen/surface_builder"); +- public static final Registry> SURFACE_BUILDER = registerSimple(SURFACE_BUILDER_REGISTRY, () -> { ++ @Deprecated public static final Registry> SURFACE_BUILDER = forge(SURFACE_BUILDER_REGISTRY, () -> { + return SurfaceBuilder.DEFAULT; }); - public static final RegistryKey>> field_239716_q_ = func_239741_a_("worldgen/carver"); -- public static final Registry> field_218377_o = func_239746_a_(field_239716_q_, () -> { -+ @Deprecated public static final Registry> field_218377_o = forge(field_239716_q_, () -> { - return WorldCarver.field_222709_a; + public static final RegistryKey>> CARVER_REGISTRY = createRegistryKey("worldgen/carver"); +- public static final Registry> CARVER = registerSimple(CARVER_REGISTRY, () -> { ++ @Deprecated public static final Registry> CARVER = forge(CARVER_REGISTRY, () -> { + return WorldCarver.CAVE; }); - public static final RegistryKey>> field_239718_s_ = func_239741_a_("worldgen/feature"); -- public static final Registry> field_218379_q = func_239746_a_(field_239718_s_, () -> { -+ @Deprecated public static final Registry> field_218379_q = forge(field_239718_s_, () -> { - return Feature.field_202290_aj; + public static final RegistryKey>> FEATURE_REGISTRY = createRegistryKey("worldgen/feature"); +- public static final Registry> FEATURE = registerSimple(FEATURE_REGISTRY, () -> { ++ @Deprecated public static final Registry> FEATURE = forge(FEATURE_REGISTRY, () -> { + return Feature.ORE; }); - public static final RegistryKey>> field_239671_I_ = func_239741_a_("worldgen/structure_feature"); -- public static final Registry> field_218361_B = func_239746_a_(field_239671_I_, () -> { -+ @Deprecated public static final Registry> field_218361_B = forge(field_239671_I_, () -> { - return Structure.field_236367_c_; + public static final RegistryKey>> STRUCTURE_FEATURE_REGISTRY = createRegistryKey("worldgen/structure_feature"); +- public static final Registry> STRUCTURE_FEATURE = registerSimple(STRUCTURE_FEATURE_REGISTRY, () -> { ++ @Deprecated public static final Registry> STRUCTURE_FEATURE = forge(STRUCTURE_FEATURE_REGISTRY, () -> { + return Structure.MINESHAFT; }); - public static final RegistryKey> field_239672_J_ = func_239741_a_("worldgen/structure_piece"); + public static final RegistryKey> STRUCTURE_PIECE_REGISTRY = createRegistryKey("worldgen/structure_piece"); @@ -252,7 +_,7 @@ - return IStructurePieceType.field_214782_c; + return IStructurePieceType.MINE_SHAFT_ROOM; }); - public static final RegistryKey>> field_239719_t_ = func_239741_a_("worldgen/decorator"); -- public static final Registry> field_218380_r = func_239746_a_(field_239719_t_, () -> { -+ @Deprecated public static final Registry> field_218380_r = forge(field_239719_t_, () -> { - return Placement.field_215022_h; + public static final RegistryKey>> DECORATOR_REGISTRY = createRegistryKey("worldgen/decorator"); +- public static final Registry> DECORATOR = registerSimple(DECORATOR_REGISTRY, () -> { ++ @Deprecated public static final Registry> DECORATOR = forge(DECORATOR_REGISTRY, () -> { + return Placement.NOPE; }); - public static final RegistryKey>> field_239721_v_ = func_239741_a_("worldgen/block_state_provider_type"); + public static final RegistryKey>> BLOCK_STATE_PROVIDER_TYPE_REGISTRY = createRegistryKey("worldgen/block_state_provider_type"); @@ -265,19 +_,19 @@ - public static final RegistryKey>> field_239666_D_ = func_239741_a_("worldgen/chunk_generator"); - public static final RegistryKey>> field_239675_M_ = func_239741_a_("worldgen/structure_processor"); - public static final RegistryKey>> field_239676_N_ = func_239741_a_("worldgen/structure_pool_element"); -- public static final Registry> field_229387_t_ = func_239746_a_(field_239721_v_, () -> { -+ @Deprecated public static final Registry> field_229387_t_ = forge(field_239721_v_, () -> { - return BlockStateProviderType.field_227394_a_; + public static final RegistryKey>> CHUNK_GENERATOR_REGISTRY = createRegistryKey("worldgen/chunk_generator"); + public static final RegistryKey>> STRUCTURE_PROCESSOR_REGISTRY = createRegistryKey("worldgen/structure_processor"); + public static final RegistryKey>> STRUCTURE_POOL_ELEMENT_REGISTRY = createRegistryKey("worldgen/structure_pool_element"); +- public static final Registry> BLOCKSTATE_PROVIDER_TYPES = registerSimple(BLOCK_STATE_PROVIDER_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> BLOCKSTATE_PROVIDER_TYPES = forge(BLOCK_STATE_PROVIDER_TYPE_REGISTRY, () -> { + return BlockStateProviderType.SIMPLE_STATE_PROVIDER; }); -- public static final Registry> field_229388_u_ = func_239746_a_(field_239722_w_, () -> { -+ @Deprecated public static final Registry> field_229388_u_ = forge(field_239722_w_, () -> { - return BlockPlacerType.field_227259_a_; +- public static final Registry> BLOCK_PLACER_TYPES = registerSimple(BLOCK_PLACER_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> BLOCK_PLACER_TYPES = forge(BLOCK_PLACER_TYPE_REGISTRY, () -> { + return BlockPlacerType.SIMPLE_BLOCK_PLACER; }); -- public static final Registry> field_229389_v_ = func_239746_a_(field_239723_x_, () -> { -+ @Deprecated public static final Registry> field_229389_v_ = forge(field_239723_x_, () -> { - return FoliagePlacerType.field_227386_a_; +- public static final Registry> FOLIAGE_PLACER_TYPES = registerSimple(FOLIAGE_PLACER_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> FOLIAGE_PLACER_TYPES = forge(FOLIAGE_PLACER_TYPE_REGISTRY, () -> { + return FoliagePlacerType.BLOB_FOLIAGE_PLACER; }); - public static final Registry> field_239701_aw_ = func_239746_a_(field_239724_y_, () -> { - return TrunkPlacerType.field_236920_a_; + public static final Registry> TRUNK_PLACER_TYPES = registerSimple(TRUNK_PLACER_TYPE_REGISTRY, () -> { + return TrunkPlacerType.STRAIGHT_TRUNK_PLACER; }); -- public static final Registry> field_229390_w_ = func_239746_a_(field_239725_z_, () -> { -+ @Deprecated public static final Registry> field_229390_w_ = forge(field_239725_z_, () -> { - return TreeDecoratorType.field_227426_b_; +- public static final Registry> TREE_DECORATOR_TYPES = registerSimple(TREE_DECORATOR_TYPE_REGISTRY, () -> { ++ @Deprecated public static final Registry> TREE_DECORATOR_TYPES = forge(TREE_DECORATOR_TYPE_REGISTRY, () -> { + return TreeDecoratorType.LEAVE_VINE; }); - public static final Registry> field_239702_ay_ = func_239746_a_(field_239663_A_, () -> { + public static final Registry> FEATURE_SIZE_TYPES = registerSimple(FEATURE_SIZE_TYPE_REGISTRY, () -> { @@ -323,16 +_,32 @@ - return func_239742_a_(p_239746_0_, Lifecycle.experimental(), p_239746_1_); + return registerSimple(p_239746_0_, Lifecycle.experimental(), p_239746_1_); } + private static > Registry forge(RegistryKey> key, Supplier def) { + return forge(key, Lifecycle.experimental(), def); + } + - private static DefaultedRegistry func_239745_a_(RegistryKey> p_239745_0_, String p_239745_1_, Supplier p_239745_2_) { - return func_239744_a_(p_239745_0_, p_239745_1_, Lifecycle.experimental(), p_239745_2_); + private static DefaultedRegistry registerDefaulted(RegistryKey> p_239745_0_, String p_239745_1_, Supplier p_239745_2_) { + return registerDefaulted(p_239745_0_, p_239745_1_, Lifecycle.experimental(), p_239745_2_); } + private static > DefaultedRegistry forge(RegistryKey> key, String defKey, Supplier def) { + return forge(key, defKey, Lifecycle.experimental(), def); + } + - private static Registry func_239742_a_(RegistryKey> p_239742_0_, Lifecycle p_239742_1_, Supplier p_239742_2_) { - return func_239743_a_(p_239742_0_, new SimpleRegistry<>(p_239742_0_, p_239742_1_), p_239742_2_, p_239742_1_); + private static Registry registerSimple(RegistryKey> p_239742_0_, Lifecycle p_239742_1_, Supplier p_239742_2_) { + return internalRegister(p_239742_0_, new SimpleRegistry<>(p_239742_0_, p_239742_1_), p_239742_2_, p_239742_1_); } + private static > Registry forge(RegistryKey> key, Lifecycle cycle, Supplier def) { -+ return func_239743_a_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle); ++ return internalRegister(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle); + } + - private static DefaultedRegistry func_239744_a_(RegistryKey> p_239744_0_, String p_239744_1_, Lifecycle p_239744_2_, Supplier p_239744_3_) { - return func_239743_a_(p_239744_0_, new DefaultedRegistry<>(p_239744_1_, p_239744_0_, p_239744_2_), p_239744_3_, p_239744_2_); + private static DefaultedRegistry registerDefaulted(RegistryKey> p_239744_0_, String p_239744_1_, Lifecycle p_239744_2_, Supplier p_239744_3_) { + return internalRegister(p_239744_0_, new DefaultedRegistry<>(p_239744_1_, p_239744_0_, p_239744_2_), p_239744_3_, p_239744_2_); + } + + private static > DefaultedRegistry forge(RegistryKey> key, String defKey, Lifecycle cycle, Supplier def) { -+ return func_239743_a_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle); ++ return internalRegister(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle); } - private static > R func_239743_a_(RegistryKey> p_239743_0_, R p_239743_1_, Supplier p_239743_2_, Lifecycle p_239743_3_) { + private static > R internalRegister(RegistryKey> p_239743_0_, R p_239743_1_, Supplier p_239743_2_, Lifecycle p_239743_3_) { diff --git a/patches/minecraft/net/minecraft/util/registry/SimpleRegistry.java.patch b/patches/minecraft/net/minecraft/util/registry/SimpleRegistry.java.patch index fe4acd7369..5647f4d3c1 100644 --- a/patches/minecraft/net/minecraft/util/registry/SimpleRegistry.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/SimpleRegistry.java.patch @@ -3,10 +3,10 @@ @@ -212,7 +_,8 @@ } - public static Codec> func_241745_c_(RegistryKey> p_241745_0_, Lifecycle p_241745_1_, Codec p_241745_2_) { -- return Codec.unboundedMap(ResourceLocation.field_240908_a_.xmap(RegistryKey.func_240902_a_(p_241745_0_), RegistryKey::func_240901_a_), p_241745_2_).xmap((p_239656_2_) -> { + public static Codec> directCodec(RegistryKey> p_241745_0_, Lifecycle p_241745_1_, Codec p_241745_2_) { +- return Codec.unboundedMap(ResourceLocation.CODEC.xmap(RegistryKey.elementKey(p_241745_0_), RegistryKey::location), p_241745_2_).xmap((p_239656_2_) -> { + // FORGE: Fix MC-197860 -+ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceLocation.field_240908_a_.xmap(RegistryKey.func_240902_a_(p_241745_0_), RegistryKey::func_240901_a_), p_241745_2_).xmap((p_239656_2_) -> { ++ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceLocation.CODEC.xmap(RegistryKey.elementKey(p_241745_0_), RegistryKey::location), p_241745_2_).xmap((p_239656_2_) -> { SimpleRegistry simpleregistry = new SimpleRegistry<>(p_241745_0_, p_241745_1_); p_239656_2_.forEach((p_239653_2_, p_239653_3_) -> { - simpleregistry.func_218381_a(p_239653_2_, p_239653_3_, p_241745_1_); + simpleregistry.register(p_239653_2_, p_239653_3_, p_241745_1_); diff --git a/patches/minecraft/net/minecraft/util/registry/WorldGenRegistries.java.patch b/patches/minecraft/net/minecraft/util/registry/WorldGenRegistries.java.patch index d7d70e011d..8b64b2aa2f 100644 --- a/patches/minecraft/net/minecraft/util/registry/WorldGenRegistries.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/WorldGenRegistries.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/util/registry/WorldGenRegistries.java +++ b/net/minecraft/util/registry/WorldGenRegistries.java @@ -45,13 +_,17 @@ - return ProcessorLists.field_244102_b; + return ProcessorLists.ZOMBIE_PLAINS; }); - public static final Registry field_243656_h = func_243667_a(Registry.field_243555_ax, JigsawPatternRegistry::func_244093_a); -- public static final Registry field_243657_i = func_243667_a(Registry.field_239720_u_, () -> { -+ @Deprecated public static final Registry field_243657_i = forge(Registry.field_239720_u_, () -> { - return BiomeRegistry.field_244200_a; + public static final Registry TEMPLATE_POOL = registerSimple(Registry.TEMPLATE_POOL_REGISTRY, JigsawPatternRegistry::bootstrap); +- public static final Registry BIOME = registerSimple(Registry.BIOME_REGISTRY, () -> { ++ @Deprecated public static final Registry BIOME = forge(Registry.BIOME_REGISTRY, () -> { + return BiomeRegistry.PLAINS; }); - public static final Registry field_243658_j = func_243667_a(Registry.field_243549_ar, DimensionSettings::func_242746_i); + public static final Registry NOISE_GENERATOR_SETTINGS = registerSimple(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY, DimensionSettings::bootstrap); - private static Registry func_243667_a(RegistryKey> p_243667_0_, Supplier p_243667_1_) { - return func_243665_a(p_243667_0_, Lifecycle.stable(), p_243667_1_); + private static Registry registerSimple(RegistryKey> p_243667_0_, Supplier p_243667_1_) { + return registerSimple(p_243667_0_, Lifecycle.stable(), p_243667_1_); + } + + private static > Registry forge(RegistryKey> key, Supplier def) { -+ return func_243666_a(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), def, Lifecycle.stable()); ++ return internalRegister(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), def, Lifecycle.stable()); } - private static Registry func_243665_a(RegistryKey> p_243665_0_, Lifecycle p_243665_1_, Supplier p_243665_2_) { + private static Registry registerSimple(RegistryKey> p_243665_0_, Lifecycle p_243665_1_, Supplier p_243665_2_) { diff --git a/patches/minecraft/net/minecraft/util/registry/WorldSettingsImport.java.patch b/patches/minecraft/net/minecraft/util/registry/WorldSettingsImport.java.patch index 1ab024a611..c2964a37d0 100644 --- a/patches/minecraft/net/minecraft/util/registry/WorldSettingsImport.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/WorldSettingsImport.java.patch @@ -4,15 +4,15 @@ ) { JsonParser jsonparser = new JsonParser(); JsonElement jsonelement = jsonparser.parse(reader); -+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString()); ++ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.location().toString()); return p_241879_4_.parse(p_241879_1_, jsonelement).map((p_244347_0_) -> { return Pair.of(p_244347_0_, OptionalInt.empty()); }); @@ -231,6 +_,7 @@ - public DataResult> func_241879_a(DynamicOps p_241879_1_, RegistryKey> p_241879_2_, RegistryKey p_241879_3_, Decoder p_241879_4_) { - JsonElement jsonelement = this.field_244349_a.get(p_241879_3_); -+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString()); - return jsonelement == null ? DataResult.error("Unknown element: " + p_241879_3_) : p_241879_4_.parse(p_241879_1_, jsonelement).setLifecycle(this.field_244351_c.get(p_241879_3_)).map((p_244353_2_) -> { - return Pair.of(p_244353_2_, OptionalInt.of(this.field_244350_b.getInt(p_241879_3_))); + public DataResult> parseElement(DynamicOps p_241879_1_, RegistryKey> p_241879_2_, RegistryKey p_241879_3_, Decoder p_241879_4_) { + JsonElement jsonelement = this.data.get(p_241879_3_); ++ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.location().toString()); + return jsonelement == null ? DataResult.error("Unknown element: " + p_241879_3_) : p_241879_4_.parse(p_241879_1_, jsonelement).setLifecycle(this.lifecycles.get(p_241879_3_)).map((p_244353_2_) -> { + return Pair.of(p_244353_2_, OptionalInt.of(this.ids.getInt(p_241879_3_))); }); diff --git a/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch index 2524105ac6..93949e625b 100644 --- a/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch +++ b/patches/minecraft/net/minecraft/util/text/LanguageMap.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/util/text/LanguageMap.java +++ b/net/minecraft/util/text/LanguageMap.java @@ -40,7 +_,8 @@ - field_201045_a.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)ioexception); + LOGGER.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)ioexception); } - final Map map = builder.build(); + final Map map = new java.util.HashMap<>(builder.build()); + net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(map); return new LanguageMap() { - public String func_230503_a_(String p_230503_1_) { + public String getOrDefault(String p_230503_1_) { return map.getOrDefault(p_230503_1_, p_230503_1_); @@ -63,6 +_,11 @@ - }, Style.field_240709_b_).isPresent(); + }, Style.EMPTY).isPresent(); }; } + @@ -23,12 +23,12 @@ } @@ -84,6 +_,9 @@ - public static void func_240594_a_(LanguageMap p_240594_0_) { - field_240592_d_ = p_240594_0_; + public static void inject(LanguageMap p_240594_0_) { + instance = p_240594_0_; } + + // FORGE START + public Map getLanguageData() { return ImmutableMap.of(); } - public abstract String func_230503_a_(String p_230503_1_); + public abstract String getOrDefault(String p_230503_1_); diff --git a/patches/minecraft/net/minecraft/util/text/Style.java.patch b/patches/minecraft/net/minecraft/util/text/Style.java.patch index b71811f18b..03cc09c134 100644 --- a/patches/minecraft/net/minecraft/util/text/Style.java.patch +++ b/patches/minecraft/net/minecraft/util/text/Style.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/util/text/Style.java +++ b/net/minecraft/util/text/Style.java @@ -125,6 +_,18 @@ - return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, p_244282_1_, this.field_150243_f, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); + return new Style(this.color, this.bold, this.italic, p_244282_1_, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font); } + public Style setUnderlined(@Nullable Boolean underlined) { -+ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, underlined, this.field_150243_f, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ return new Style(this.color, this.bold, this.italic, underlined, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font); + } + + public Style setStrikethrough(@Nullable Boolean strikethrough) { -+ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, strikethrough, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ return new Style(this.color, this.bold, this.italic, this.underlined, strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font); + } + + public Style setObfuscated(@Nullable Boolean obfuscated) { -+ return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, this.field_150243_f, obfuscated, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_); ++ return new Style(this.color, this.bold, this.italic, this.underlined, this.strikethrough, obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font); + } + - public Style func_240715_a_(@Nullable ClickEvent p_240715_1_) { - return new Style(this.field_150247_b, this.field_150248_c, this.field_150245_d, this.field_150246_e, this.field_150243_f, this.field_150244_g, p_240715_1_, this.field_150252_i, this.field_179990_j, this.field_240710_l_); + public Style withClickEvent(@Nullable ClickEvent p_240715_1_) { + return new Style(this.color, this.bold, this.italic, this.underlined, this.strikethrough, this.obfuscated, p_240715_1_, this.hoverEvent, this.insertion, this.font); } diff --git a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch index 9ac5955bc9..6b13a24801 100644 --- a/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch +++ b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch @@ -6,7 +6,7 @@ + if (j == 0) { + // if we failed to match above, lets try the messageformat handler instead. -+ j = net.minecraftforge.fml.TextComponentMessageFormatHandler.handle(this, this.field_150278_b, this.field_150277_e, p_240758_1_); ++ j = net.minecraftforge.fml.TextComponentMessageFormatHandler.handle(this, this.decomposedParts, this.args, p_240758_1_); + } if (j < p_240758_1_.length()) { String s3 = p_240758_1_.substring(j); diff --git a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch index 9cb693598b..c87156936f 100644 --- a/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch +++ b/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch @@ -6,36 +6,36 @@ -public class PointOfInterestType { +public class PointOfInterestType extends net.minecraftforge.registries.ForgeRegistryEntry { - private static final Supplier> field_234168_y_ = Suppliers.memoize(() -> { - return Registry.field_218370_L.func_201756_e().map(VillagerProfession::func_221149_b).collect(Collectors.toSet()); + private static final Supplier> ALL_JOB_POI_TYPES = Suppliers.memoize(() -> { + return Registry.VILLAGER_PROFESSION.stream().map(VillagerProfession::getJobPoiType).collect(Collectors.toSet()); }); @@ -36,7 +_,7 @@ }).filter((p_234173_0_) -> { - return p_234173_0_.func_177229_b(BedBlock.field_176472_a) == BedPart.HEAD; + return p_234173_0_.getValue(BedBlock.PART) == BedPart.HEAD; }).collect(ImmutableSet.toImmutableSet()); -- private static final Map field_221073_u = Maps.newHashMap(); -+ private static final Map field_221073_u = net.minecraftforge.registries.GameData.getBlockStatePointOfInterestTypeMap(); - public static final PointOfInterestType field_221054_b = func_226360_a_("unemployed", ImmutableSet.of(), 1, field_221071_s, 1); - public static final PointOfInterestType field_221055_c = func_226359_a_("armorer", func_221042_a(Blocks.field_222424_lM), 1, 1); - public static final PointOfInterestType field_221056_d = func_226359_a_("butcher", func_221042_a(Blocks.field_222423_lL), 1, 1); +- private static final Map TYPE_BY_STATE = Maps.newHashMap(); ++ private static final Map TYPE_BY_STATE = net.minecraftforge.registries.GameData.getBlockStatePointOfInterestTypeMap(); + public static final PointOfInterestType UNEMPLOYED = register("unemployed", ImmutableSet.of(), 1, ALL_JOBS, 1); + public static final PointOfInterestType ARMORER = register("armorer", getBlockStates(Blocks.BLAST_FURNACE), 1, 1); + public static final PointOfInterestType BUTCHER = register("butcher", getBlockStates(Blocks.SMOKER), 1, 1); @@ -112,16 +_,14 @@ } - private static PointOfInterestType func_221052_a(PointOfInterestType p_221052_0_) { -- p_221052_0_.field_221075_w.forEach((p_234169_1_) -> { -- PointOfInterestType pointofinteresttype = field_221073_u.put(p_234169_1_, p_221052_0_); + private static PointOfInterestType registerBlockStates(PointOfInterestType p_221052_0_) { +- p_221052_0_.matchingStates.forEach((p_234169_1_) -> { +- PointOfInterestType pointofinteresttype = TYPE_BY_STATE.put(p_234169_1_, p_221052_0_); - if (pointofinteresttype != null) { -- throw (IllegalStateException)Util.func_229757_c_(new IllegalStateException(String.format("%s is defined in too many tags", p_234169_1_))); +- throw (IllegalStateException)Util.pauseInIde(new IllegalStateException(String.format("%s is defined in too many tags", p_234169_1_))); - } - }); return p_221052_0_; } - public static Optional func_221047_b(BlockState p_221047_0_) { - return Optional.ofNullable(field_221073_u.get(p_221047_0_)); + public static Optional forState(BlockState p_221047_0_) { + return Optional.ofNullable(TYPE_BY_STATE.get(p_221047_0_)); + } + + public ImmutableSet getBlockStates() { -+ return ImmutableSet.copyOf(this.field_221075_w); ++ return ImmutableSet.copyOf(this.matchingStates); } } diff --git a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch index d02e839ca5..9ef2876396 100644 --- a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/village/VillageSiege.java +++ b/net/minecraft/village/VillageSiege.java @@ -78,7 +_,9 @@ - this.field_75532_g = blockpos.func_177958_n() + MathHelper.func_76141_d(MathHelper.func_76134_b(f) * 32.0F); - this.field_75538_h = blockpos.func_177956_o(); - this.field_75539_i = blockpos.func_177952_p() + MathHelper.func_76141_d(MathHelper.func_76126_a(f) * 32.0F); -- if (this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)) != null) { -+ Vector3d siegeLocation = this.func_225476_a(p_75529_1_, new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); + this.spawnX = blockpos.getX() + MathHelper.floor(MathHelper.cos(f) * 32.0F); + this.spawnY = blockpos.getY(); + this.spawnZ = blockpos.getZ() + MathHelper.floor(MathHelper.sin(f) * 32.0F); +- if (this.findRandomSpawnPos(p_75529_1_, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)) != null) { ++ Vector3d siegeLocation = this.findRandomSpawnPos(p_75529_1_, new BlockPos(this.spawnX, this.spawnY, this.spawnZ)); + if (siegeLocation != null) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, p_75529_1_, playerentity, siegeLocation))) return false; - this.field_75534_e = 0; - this.field_75533_d = 20; + this.nextSpawnTime = 0; + this.zombiesToSpawn = 20; break; @@ -98,7 +_,7 @@ if (vector3d != null) { ZombieEntity zombieentity; try { - zombieentity = new ZombieEntity(p_75530_1_); -+ zombieentity = EntityType.field_200725_aD.func_200721_a(p_75530_1_); //Forge: Direct Initialization is deprecated, use EntityType. - zombieentity.func_213386_a(p_75530_1_, p_75530_1_.func_175649_E(zombieentity.func_233580_cy_()), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null); ++ zombieentity = EntityType.ZOMBIE.create(p_75530_1_); //Forge: Direct Initialization is deprecated, use EntityType. + zombieentity.finalizeSpawn(p_75530_1_, p_75530_1_.getCurrentDifficultyAt(zombieentity.blockPosition()), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null); } catch (Exception exception) { - field_242320_a.warn("Failed to create zombie for village siege at {}", vector3d, exception); + LOGGER.warn("Failed to create zombie for village siege at {}", vector3d, exception); diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index e00bb5abd3..a1a5033249 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,58 +1,58 @@ --- a/net/minecraft/world/Explosion.java +++ b/net/minecraft/world/Explosion.java @@ -58,6 +_,7 @@ - private final ExplosionContext field_234893_k_; - private final List field_77281_g = Lists.newArrayList(); - private final Map field_77288_k = Maps.newHashMap(); + private final ExplosionContext damageCalculator; + private final List toBlow = Lists.newArrayList(); + private final Map hitPlayers = Maps.newHashMap(); + private final Vector3d position; @OnlyIn(Dist.CLIENT) public Explosion(World p_i45752_1_, @Nullable Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) { @@ -86,6 +_,7 @@ - this.field_222260_b = p_i231610_13_; - this.field_199593_j = p_i231610_3_ == null ? DamageSource.func_94539_a(this) : p_i231610_3_; - this.field_234893_k_ = p_i231610_4_ == null ? this.func_234894_a_(p_i231610_2_) : p_i231610_4_; -+ this.position = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + this.blockInteraction = p_i231610_13_; + this.damageSource = p_i231610_3_ == null ? DamageSource.explosion(this) : p_i231610_3_; + this.damageCalculator = p_i231610_4_ == null ? this.makeDamageCalculator(p_i231610_2_) : p_i231610_4_; ++ this.position = new Vector3d(this.x, this.y, this.z); } - private ExplosionContext func_234894_a_(@Nullable Entity p_234894_1_) { + private ExplosionContext makeDamageCalculator(@Nullable Entity p_234894_1_) { @@ -176,6 +_,7 @@ - int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f2 - 1.0D); - int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f2 + 1.0D); - List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f2); - Vector3d vector3d = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + int j2 = MathHelper.floor(this.z - (double)f2 - 1.0D); + int j1 = MathHelper.floor(this.z + (double)f2 + 1.0D); + List list = this.level.getEntities(this.source, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.level, this, list, f2); + Vector3d vector3d = new Vector3d(this.x, this.y, this.z); for(int k2 = 0; k2 < list.size(); ++k2) { @@ -234,11 +_,11 @@ - for(BlockPos blockpos : this.field_77281_g) { - BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); - Block block = blockstate.func_177230_c(); -- if (!blockstate.func_196958_f()) { -+ if (!blockstate.isAir(this.field_77287_j, blockpos)) { - BlockPos blockpos1 = blockpos.func_185334_h(); - this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks"); -- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) { -- TileEntity tileentity = block.func_235695_q_() ? this.field_77287_j.func_175625_s(blockpos) : null; -+ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) { -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_237457_g_, Vector3d.func_237489_a_(blockpos)).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e); - if (this.field_222260_b == Explosion.Mode.DESTROY) { - lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f); + for(BlockPos blockpos : this.toBlow) { + BlockState blockstate = this.level.getBlockState(blockpos); + Block block = blockstate.getBlock(); +- if (!blockstate.isAir()) { ++ if (!blockstate.isAir(this.level, blockpos)) { + BlockPos blockpos1 = blockpos.immutable(); + this.level.getProfiler().push("explosion_blocks"); +- if (block.dropFromExplosion(this) && this.level instanceof ServerWorld) { +- TileEntity tileentity = block.isEntityBlock() ? this.level.getBlockEntity(blockpos) : null; ++ if (blockstate.canDropFromExplosion(this.level, blockpos, this) && this.level instanceof ServerWorld) { ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.level.getBlockEntity(blockpos) : null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.level)).withRandom(this.level.random).withParameter(LootParameters.ORIGIN, Vector3d.atCenterOf(blockpos)).withParameter(LootParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootParameters.THIS_ENTITY, this.source); + if (this.blockInteraction == Explosion.Mode.DESTROY) { + lootcontext$builder.withParameter(LootParameters.EXPLOSION_RADIUS, this.radius); @@ -249,8 +_,7 @@ }); } -- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3); -- block.func_180652_a(this.field_77287_j, blockpos, this); -+ blockstate.onBlockExploded(this.field_77287_j, blockpos, this); - this.field_77287_j.func_217381_Z().func_76319_b(); +- this.level.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 3); +- block.wasExploded(this.level, blockpos, this); ++ blockstate.onBlockExploded(this.level, blockpos, this); + this.level.getProfiler().pop(); } } @@ -322,6 +_,15 @@ - public List func_180343_e() { - return this.field_77281_g; + public List getToBlow() { + return this.toBlow; + } + + public Vector3d getPosition() { @@ -61,7 +61,7 @@ + + @Nullable + public Entity getExploder() { -+ return this.field_77283_e; ++ return this.source; } public static enum Mode { diff --git a/patches/minecraft/net/minecraft/world/ExplosionContext.java.patch b/patches/minecraft/net/minecraft/world/ExplosionContext.java.patch index a1ad5cb35e..63b180f0a2 100644 --- a/patches/minecraft/net/minecraft/world/ExplosionContext.java.patch +++ b/patches/minecraft/net/minecraft/world/ExplosionContext.java.patch @@ -3,9 +3,9 @@ @@ -7,7 +_,7 @@ public class ExplosionContext { - public Optional func_230312_a_(Explosion p_230312_1_, IBlockReader p_230312_2_, BlockPos p_230312_3_, BlockState p_230312_4_, FluidState p_230312_5_) { -- return p_230312_4_.func_196958_f() && p_230312_5_.func_206888_e() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.func_177230_c().func_149638_a(), p_230312_5_.func_210200_l())); -+ return p_230312_4_.isAir(p_230312_2_, p_230312_3_) && p_230312_5_.func_206888_e() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_), p_230312_5_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_))); + public Optional getBlockExplosionResistance(Explosion p_230312_1_, IBlockReader p_230312_2_, BlockPos p_230312_3_, BlockState p_230312_4_, FluidState p_230312_5_) { +- return p_230312_4_.isAir() && p_230312_5_.isEmpty() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.getBlock().getExplosionResistance(), p_230312_5_.getExplosionResistance())); ++ return p_230312_4_.isAir(p_230312_2_, p_230312_3_) && p_230312_5_.isEmpty() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_), p_230312_5_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_))); } - public boolean func_230311_a_(Explosion p_230311_1_, IBlockReader p_230311_2_, BlockPos p_230311_3_, BlockState p_230311_4_, float p_230311_5_) { + public boolean shouldBlockExplode(Explosion p_230311_1_, IBlockReader p_230311_2_, BlockPos p_230311_3_, BlockState p_230311_4_, float p_230311_5_) { diff --git a/patches/minecraft/net/minecraft/world/ForcedChunksSaveData.java.patch b/patches/minecraft/net/minecraft/world/ForcedChunksSaveData.java.patch index 4a6bc33bab..2f2f63fe12 100644 --- a/patches/minecraft/net/minecraft/world/ForcedChunksSaveData.java.patch +++ b/patches/minecraft/net/minecraft/world/ForcedChunksSaveData.java.patch @@ -2,21 +2,21 @@ +++ b/net/minecraft/world/ForcedChunksSaveData.java @@ -14,14 +_,30 @@ - public void func_76184_a(CompoundNBT p_76184_1_) { - this.field_212439_a = new LongOpenHashSet(p_76184_1_.func_197645_o("Forced")); + public void load(CompoundNBT p_76184_1_) { + this.chunks = new LongOpenHashSet(p_76184_1_.getLongArray("Forced")); + this.blockForcedChunks = new net.minecraftforge.common.world.ForgeChunkManager.TicketTracker<>(); + this.entityForcedChunks = new net.minecraftforge.common.world.ForgeChunkManager.TicketTracker<>(); + net.minecraftforge.common.world.ForgeChunkManager.readForgeForcedChunks(p_76184_1_, this.blockForcedChunks, this.entityForcedChunks); } - public CompoundNBT func_189551_b(CompoundNBT p_189551_1_) { - p_189551_1_.func_197644_a("Forced", this.field_212439_a.toLongArray()); + public CompoundNBT save(CompoundNBT p_189551_1_) { + p_189551_1_.putLongArray("Forced", this.chunks.toLongArray()); + net.minecraftforge.common.world.ForgeChunkManager.writeForgeForcedChunks(p_189551_1_, this.blockForcedChunks, this.entityForcedChunks); return p_189551_1_; } - public LongSet func_212438_a() { - return this.field_212439_a; + public LongSet getChunks() { + return this.chunks; + } + + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/world/IBlockReader.java.patch b/patches/minecraft/net/minecraft/world/IBlockReader.java.patch index e31d6724a6..6446a8612e 100644 --- a/patches/minecraft/net/minecraft/world/IBlockReader.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockReader.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/IBlockReader.java +++ b/net/minecraft/world/IBlockReader.java @@ -26,7 +_,7 @@ - FluidState func_204610_c(BlockPos p_204610_1_); + FluidState getFluidState(BlockPos p_204610_1_); - default int func_217298_h(BlockPos p_217298_1_) { -- return this.func_180495_p(p_217298_1_).func_185906_d(); -+ return this.func_180495_p(p_217298_1_).getLightValue(this, p_217298_1_); + default int getLightEmission(BlockPos p_217298_1_) { +- return this.getBlockState(p_217298_1_).getLightEmission(); ++ return this.getBlockState(p_217298_1_).getLightValue(this, p_217298_1_); } - default int func_201572_C() { + default int getMaxLightLevel() { diff --git a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch index 7258623530..a900f376d4 100644 --- a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch +++ b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch @@ -3,20 +3,20 @@ @@ -68,7 +_,7 @@ } - default boolean func_175623_d(BlockPos p_175623_1_) { -- return this.func_180495_p(p_175623_1_).func_196958_f(); -+ return this.func_180495_p(p_175623_1_).isAir(this, p_175623_1_); + default boolean isEmptyBlock(BlockPos p_175623_1_) { +- return this.getBlockState(p_175623_1_).isAir(); ++ return this.getBlockState(p_175623_1_).isAir(this, p_175623_1_); } - default boolean func_175710_j(BlockPos p_175710_1_) { + default boolean canSeeSkyFromBelowWater(BlockPos p_175710_1_) { @@ -155,6 +_,10 @@ @Deprecated - default boolean func_175667_e(BlockPos p_175667_1_) { - return this.func_217354_b(p_175667_1_.func_177958_n() >> 4, p_175667_1_.func_177952_p() >> 4); + default boolean hasChunkAt(BlockPos p_175667_1_) { + return this.hasChunk(p_175667_1_.getX() >> 4, p_175667_1_.getZ() >> 4); + } + + default boolean isAreaLoaded(BlockPos center, int range) { -+ return this.func_175707_a(center.func_177982_a(-range, -range, -range), center.func_177982_a(range, range, range)); ++ return this.hasChunksAt(center.offset(-range, -range, -range), center.offset(range, range, range)); } @Deprecated diff --git a/patches/minecraft/net/minecraft/world/Teleporter.java.patch b/patches/minecraft/net/minecraft/world/Teleporter.java.patch index e0508c3465..895312723f 100644 --- a/patches/minecraft/net/minecraft/world/Teleporter.java.patch +++ b/patches/minecraft/net/minecraft/world/Teleporter.java.patch @@ -6,6 +6,6 @@ -public class Teleporter { +public class Teleporter implements net.minecraftforge.common.util.ITeleporter { - protected final ServerWorld field_85192_a; + protected final ServerWorld level; public Teleporter(ServerWorld p_i1963_1_) { diff --git a/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch index 455bdd442f..c6de60adc4 100644 --- a/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/TrackedEntity.java +++ b/net/minecraft/world/TrackedEntity.java @@ -81,9 +_,8 @@ - if (this.field_219461_c instanceof ItemFrameEntity && this.field_219472_n % 10 == 0) { - ItemFrameEntity itemframeentity = (ItemFrameEntity)this.field_219461_c; - ItemStack itemstack = itemframeentity.func_82335_i(); -- if (itemstack.func_77973_b() instanceof FilledMapItem) { -- MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b); + if (this.entity instanceof ItemFrameEntity && this.tickCount % 10 == 0) { + ItemFrameEntity itemframeentity = (ItemFrameEntity)this.entity; + ItemStack itemstack = itemframeentity.getItem(); +- if (itemstack.getItem() instanceof FilledMapItem) { +- MapData mapdata = FilledMapItem.getOrCreateSavedData(itemstack, this.level); - -+ MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b); ++ MapData mapdata = FilledMapItem.getOrCreateSavedData(itemstack, this.level); + if (mapdata != null) { - for(ServerPlayerEntity serverplayerentity : this.field_219460_b.func_217369_A()) { - mapdata.func_76191_a(serverplayerentity, itemstack); - IPacket ipacket = ((FilledMapItem)itemstack.func_77973_b()).func_150911_c(itemstack, this.field_219460_b, serverplayerentity); + for(ServerPlayerEntity serverplayerentity : this.level.players()) { + mapdata.tickCarriedBy(serverplayerentity, itemstack); + IPacket ipacket = ((FilledMapItem)itemstack.getItem()).getUpdatePacket(itemstack, this.level, serverplayerentity); @@ -187,12 +_,14 @@ - public void func_219454_a(ServerPlayerEntity p_219454_1_) { - this.field_219461_c.func_184203_c(p_219454_1_); - p_219454_1_.func_152339_d(this.field_219461_c); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.field_219461_c, p_219454_1_); + public void removePairing(ServerPlayerEntity p_219454_1_) { + this.entity.stopSeenByPlayer(p_219454_1_); + p_219454_1_.sendRemoveEntity(this.entity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.entity, p_219454_1_); } - public void func_219455_b(ServerPlayerEntity p_219455_1_) { - this.func_219452_a(p_219455_1_.field_71135_a::func_147359_a); - this.field_219461_c.func_184178_b(p_219455_1_); - p_219455_1_.func_184848_d(this.field_219461_c); -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.field_219461_c, p_219455_1_); + public void addPairing(ServerPlayerEntity p_219455_1_) { + this.sendPairingData(p_219455_1_.connection::send); + this.entity.startSeenByPlayer(p_219455_1_); + p_219455_1_.cancelRemoveEntity(this.entity); ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.entity, p_219455_1_); } - public void func_219452_a(Consumer> p_219452_1_) { + public void sendPairingData(Consumer> p_219452_1_) { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index d1e9463b2c..4f47306280 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -6,58 +6,58 @@ -public abstract class World implements IWorld, AutoCloseable { +public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { - protected static final Logger field_195596_d = LogManager.getLogger(); - public static final Codec> field_234917_f_ = ResourceLocation.field_240908_a_.xmap(RegistryKey.func_240902_a_(Registry.field_239699_ae_), RegistryKey::func_240901_a_); - public static final RegistryKey field_234918_g_ = RegistryKey.func_240903_a_(Registry.field_239699_ae_, new ResourceLocation("overworld")); + protected static final Logger LOGGER = LogManager.getLogger(); + public static final Codec> RESOURCE_KEY_CODEC = ResourceLocation.CODEC.xmap(RegistryKey.elementKey(Registry.DIMENSION_REGISTRY), RegistryKey::location); + public static final RegistryKey OVERWORLD = RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("overworld")); @@ -73,7 +_,7 @@ - public final List field_147482_g = Lists.newArrayList(); - public final List field_175730_i = Lists.newArrayList(); - protected final List field_147484_a = Lists.newArrayList(); -- protected final List field_147483_b = Lists.newArrayList(); -+ protected final java.util.Set field_147483_b = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient - private final Thread field_217407_c; - private final boolean field_234916_c_; - private int field_73008_k; + public final List blockEntityList = Lists.newArrayList(); + public final List tickableBlockEntities = Lists.newArrayList(); + protected final List pendingBlockEntities = Lists.newArrayList(); +- protected final List blockEntitiesToUnload = Lists.newArrayList(); ++ protected final java.util.Set blockEntitiesToUnload = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient + private final Thread thread; + private final boolean isDebug; + private int skyDarken; @@ -92,8 +_,12 @@ - private final WorldBorder field_175728_M; - private final BiomeManager field_226689_w_; - private final RegistryKey field_73011_w; + private final WorldBorder worldBorder; + private final BiomeManager biomeManager; + private final RegistryKey dimension; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; + public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList<>(); protected World(ISpawnWorldInfo p_i241925_1_, RegistryKey p_i241925_2_, final DimensionType p_i241925_3_, Supplier p_i241925_4_, boolean p_i241925_5_, boolean p_i241925_6_, long p_i241925_7_) { + super(World.class); - this.field_72984_F = p_i241925_4_; - this.field_72986_A = p_i241925_1_; - this.field_234921_x_ = p_i241925_3_; + this.profiler = p_i241925_4_; + this.levelData = p_i241925_1_; + this.dimensionType = p_i241925_3_; @@ -180,17 +_,45 @@ } else { - Chunk chunk = this.func_175726_f(p_241211_1_); - Block block = p_241211_2_.func_177230_c(); + Chunk chunk = this.getChunkAt(p_241211_1_); + Block block = p_241211_2_.getBlock(); + -+ p_241211_1_ = p_241211_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks ++ p_241211_1_ = p_241211_1_.immutable(); // Forge - prevent mutable BlockPos leaks + net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.field_72995_K) { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.field_73011_w, this, p_241211_1_, p_241211_3_); ++ if (this.captureBlockSnapshots && !this.isClientSide) { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.dimension, this, p_241211_1_, p_241211_3_); + this.capturedBlockSnapshots.add(blockSnapshot); + } + -+ BlockState old = func_180495_p(p_241211_1_); ++ BlockState old = getBlockState(p_241211_1_); + int oldLight = old.getLightValue(this, p_241211_1_); -+ int oldOpacity = old.func_200016_a(this, p_241211_1_); ++ int oldOpacity = old.getLightBlock(this, p_241211_1_); + - BlockState blockstate = chunk.func_177436_a(p_241211_1_, p_241211_2_, (p_241211_3_ & 64) != 0); + BlockState blockstate = chunk.setBlockState(p_241211_1_, p_241211_2_, (p_241211_3_ & 64) != 0); if (blockstate == null) { + if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); return false; } else { - BlockState blockstate1 = this.func_180495_p(p_241211_1_); -- if ((p_241211_3_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_241211_1_) != blockstate.func_200016_a(this, p_241211_1_) || blockstate1.func_185906_d() != blockstate.func_185906_d() || blockstate1.func_215691_g() || blockstate.func_215691_g())) { -+ if ((p_241211_3_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_241211_1_) != oldOpacity || blockstate1.getLightValue(this, p_241211_1_) != oldLight || blockstate1.func_215691_g() || blockstate.func_215691_g())) { - this.func_217381_Z().func_76320_a("queueCheckLight"); - this.func_72863_F().func_212863_j_().func_215568_a(p_241211_1_); - this.func_217381_Z().func_76319_b(); + BlockState blockstate1 = this.getBlockState(p_241211_1_); +- if ((p_241211_3_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.getLightBlock(this, p_241211_1_) != blockstate.getLightBlock(this, p_241211_1_) || blockstate1.getLightEmission() != blockstate.getLightEmission() || blockstate1.useShapeForLightOcclusion() || blockstate.useShapeForLightOcclusion())) { ++ if ((p_241211_3_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.getLightBlock(this, p_241211_1_) != oldOpacity || blockstate1.getLightValue(this, p_241211_1_) != oldLight || blockstate1.useShapeForLightOcclusion() || blockstate.useShapeForLightOcclusion())) { + this.getProfiler().push("queueCheckLight"); + this.getChunkSource().getLightEngine().checkBlock(p_241211_1_); + this.getProfiler().pop(); } + if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates @@ -71,16 +71,16 @@ + // Split off from original setBlockState(BlockPos, BlockState, int, int) method in order to directly send client and physic updates + public void markAndNotifyBlock(BlockPos p_241211_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_241211_2_, int p_241211_3_, int p_241211_4_) + { -+ Block block = p_241211_2_.func_177230_c(); -+ BlockState blockstate1 = func_180495_p(p_241211_1_); ++ Block block = p_241211_2_.getBlock(); ++ BlockState blockstate1 = getBlockState(p_241211_1_); + { + { if (blockstate1 == p_241211_2_) { if (blockstate != blockstate1) { - this.func_225319_b(p_241211_1_, blockstate, blockstate1); + this.setBlocksDirty(p_241211_1_, blockstate, blockstate1); @@ -216,8 +_,6 @@ - this.func_217393_a(p_241211_1_, blockstate, blockstate1); + this.onBlockStateChange(p_241211_1_, blockstate, blockstate1); } - - return true; @@ -89,120 +89,120 @@ } @@ -232,7 +_,7 @@ - public boolean func_241212_a_(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { - BlockState blockstate = this.func_180495_p(p_241212_1_); -- if (blockstate.func_196958_f()) { + public boolean destroyBlock(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { + BlockState blockstate = this.getBlockState(p_241212_1_); +- if (blockstate.isAir()) { + if (blockstate.isAir(this, p_241212_1_)) { return false; } else { - FluidState fluidstate = this.func_204610_c(p_241212_1_); + FluidState fluidstate = this.getFluidState(p_241212_1_); @@ -241,7 +_,7 @@ } if (p_241212_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? this.func_175625_s(p_241212_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_241212_1_) : null; - Block.func_220054_a(blockstate, this, p_241212_1_, tileentity, p_241212_3_, ItemStack.field_190927_a); +- TileEntity tileentity = blockstate.getBlock().isEntityBlock() ? this.getBlockEntity(p_241212_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.getBlockEntity(p_241212_1_) : null; + Block.dropResources(blockstate, this, p_241212_1_, tileentity, p_241212_3_, ItemStack.EMPTY); } @@ -259,6 +_,8 @@ } - public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_195593_1_, this.func_180495_p(p_195593_1_), java.util.EnumSet.allOf(Direction.class), false).isCanceled()) + public void updateNeighborsAt(BlockPos p_195593_1_, Block p_195593_2_) { ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_195593_1_, this.getBlockState(p_195593_1_), java.util.EnumSet.allOf(Direction.class), false).isCanceled()) + return; - this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_); - this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_); - this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_); + this.neighborChanged(p_195593_1_.west(), p_195593_2_, p_195593_1_); + this.neighborChanged(p_195593_1_.east(), p_195593_2_, p_195593_1_); + this.neighborChanged(p_195593_1_.below(), p_195593_2_, p_195593_1_); @@ -268,6 +_,11 @@ } - public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { + public void updateNeighborsAtExceptFromFacing(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { + java.util.EnumSet directions = java.util.EnumSet.allOf(Direction.class); + directions.remove(p_175695_3_); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions, false).isCanceled()) ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.getBlockState(p_175695_1_), directions, false).isCanceled()) + return; + if (p_175695_3_ != Direction.WEST) { - this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); + this.neighborChanged(p_175695_1_.west(), p_175695_2_, p_175695_1_); } @@ -305,9 +_,9 @@ - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); - crashreportcategory.func_189529_a("Source block type", () -> { + CrashReportCategory crashreportcategory = crashreport.addCategory("Block being updated"); + crashreportcategory.setDetail("Source block type", () -> { try { -- return String.format("ID #%s (%s // %s)", Registry.field_212618_g.func_177774_c(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); -+ return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); +- return String.format("ID #%s (%s // %s)", Registry.BLOCK.getKey(p_190524_2_), p_190524_2_.getDescriptionId(), p_190524_2_.getClass().getCanonicalName()); ++ return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.getDescriptionId(), p_190524_2_.getClass().getCanonicalName()); } catch (Throwable throwable1) { -- return "ID #" + Registry.field_212618_g.func_177774_c(p_190524_2_); +- return "ID #" + Registry.BLOCK.getKey(p_190524_2_); + return "ID #" + p_190524_2_.getRegistryName(); } }); - CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate); + CrashReportCategory.populateBlockDetails(crashreportcategory, p_190524_1_, blockstate); @@ -391,10 +_,12 @@ } - public boolean func_175700_a(TileEntity p_175700_1_) { -+ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_226984_a_(this, p_175700_1_.func_174877_v()); // Forge - set the world early as vanilla doesn't set it until next tick - if (this.field_147481_N) { - field_195596_d.error("Adding block entity while ticking: {} @ {}", () -> { - return Registry.field_212626_o.func_177774_c(p_175700_1_.func_200662_C()); - }, p_175700_1_::func_174877_v); -+ return field_147484_a.add(p_175700_1_); // Forge: wait to add new TE if we're currently processing existing ones + public boolean addBlockEntity(TileEntity p_175700_1_) { ++ if (p_175700_1_.getLevel() != this) p_175700_1_.setLevelAndPosition(this, p_175700_1_.getBlockPos()); // Forge - set the world early as vanilla doesn't set it until next tick + if (this.updatingBlockEntities) { + LOGGER.error("Adding block entity while ticking: {} @ {}", () -> { + return Registry.BLOCK_ENTITY_TYPE.getKey(p_175700_1_.getType()); + }, p_175700_1_::getBlockPos); ++ return pendingBlockEntities.add(p_175700_1_); // Forge: wait to add new TE if we're currently processing existing ones } - boolean flag = this.field_147482_g.add(p_175700_1_); + boolean flag = this.blockEntityList.add(p_175700_1_); @@ -402,6 +_,8 @@ - this.field_175730_i.add(p_175700_1_); + this.tickableBlockEntities.add(p_175700_1_); } + p_175700_1_.onLoad(); + - if (this.field_72995_K) { - BlockPos blockpos = p_175700_1_.func_174877_v(); - BlockState blockstate = this.func_180495_p(blockpos); + if (this.isClientSide) { + BlockPos blockpos = p_175700_1_.getBlockPos(); + BlockState blockstate = this.getBlockState(blockpos); @@ -413,6 +_,7 @@ - public void func_147448_a(Collection p_147448_1_) { - if (this.field_147481_N) { -+ p_147448_1_.stream().filter(te -> te.func_145831_w() != this).forEach(te -> te.func_226984_a_(this, te.func_174877_v())); // Forge - set the world early as vanilla doesn't set it until next tick - this.field_147484_a.addAll(p_147448_1_); + public void addAllPendingBlockEntities(Collection p_147448_1_) { + if (this.updatingBlockEntities) { ++ p_147448_1_.stream().filter(te -> te.getLevel() != this).forEach(te -> te.setLevelAndPosition(this, te.getBlockPos())); // Forge - set the world early as vanilla doesn't set it until next tick + this.pendingBlockEntities.addAll(p_147448_1_); } else { for(TileEntity tileentity : p_147448_1_) { @@ -425,13 +_,14 @@ - public void func_217391_K() { - IProfiler iprofiler = this.func_217381_Z(); - iprofiler.func_76320_a("blockEntities"); -+ this.field_147481_N = true;// Forge: Move above remove to prevent CMEs - if (!this.field_147483_b.isEmpty()) { -+ this.field_147483_b.forEach(e -> e.onChunkUnloaded()); - this.field_175730_i.removeAll(this.field_147483_b); - this.field_147482_g.removeAll(this.field_147483_b); - this.field_147483_b.clear(); + public void tickBlockEntities() { + IProfiler iprofiler = this.getProfiler(); + iprofiler.push("blockEntities"); ++ this.updatingBlockEntities = true;// Forge: Move above remove to prevent CMEs + if (!this.blockEntitiesToUnload.isEmpty()) { ++ this.blockEntitiesToUnload.forEach(e -> e.onChunkUnloaded()); + this.tickableBlockEntities.removeAll(this.blockEntitiesToUnload); + this.blockEntityList.removeAll(this.blockEntitiesToUnload); + this.blockEntitiesToUnload.clear(); } -- this.field_147481_N = true; - Iterator iterator = this.field_175730_i.iterator(); +- this.updatingBlockEntities = true; + Iterator iterator = this.tickableBlockEntities.iterator(); while(iterator.hasNext()) { @@ -440,8 +_,9 @@ - BlockPos blockpos = tileentity.func_174877_v(); - if (this.func_72863_F().func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) { + BlockPos blockpos = tileentity.getBlockPos(); + if (this.getChunkSource().isTickingChunk(blockpos) && this.getWorldBorder().isWithinBounds(blockpos)) { try { + net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity); - iprofiler.func_194340_a(() -> { -- return String.valueOf((Object)TileEntityType.func_200969_a(tileentity.func_200662_C())); -+ return String.valueOf(tileentity.func_200662_C().getRegistryName()); + iprofiler.push(() -> { +- return String.valueOf((Object)TileEntityType.getKey(tileentity.getType())); ++ return String.valueOf(tileentity.getType().getRegistryName()); }); - if (tileentity.func_200662_C().func_223045_a(this.func_180495_p(blockpos).func_177230_c())) { - ((ITickableTileEntity)tileentity).func_73660_a(); + if (tileentity.getType().isValid(this.getBlockState(blockpos).getBlock())) { + ((ITickableTileEntity)tileentity).tick(); @@ -454,8 +_,16 @@ - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block entity being ticked"); - tileentity.func_145828_a(crashreportcategory); + CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory = crashreport.addCategory("Block entity being ticked"); + tileentity.fillCrashReportCategory(crashreportcategory); + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringTileEntities.get()) { -+ LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); -+ tileentity.func_145843_s(); -+ this.func_175713_t(tileentity.func_174877_v()); ++ LogManager.getLogger().fatal("{}", crashreport.getFriendlyReport()); ++ tileentity.setRemoved(); ++ this.removeBlockEntity(tileentity.getBlockPos()); + } else throw new ReportedException(crashreport); } @@ -214,26 +214,26 @@ @@ -463,7 +_,10 @@ iterator.remove(); - this.field_147482_g.remove(tileentity); - if (this.func_175667_e(tileentity.func_174877_v())) { -- this.func_175726_f(tileentity.func_174877_v()).func_177425_e(tileentity.func_174877_v()); + this.blockEntityList.remove(tileentity); + if (this.hasChunkAt(tileentity.getBlockPos())) { +- this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos()); + //Forge: Bugfix: If we set the tile entity it immediately sets it in the chunk, so we could be desyned -+ Chunk chunk = this.func_175726_f(tileentity.func_174877_v()); -+ if (chunk.func_177424_a(tileentity.func_174877_v(), Chunk.CreateEntityType.CHECK) == tileentity) -+ chunk.func_177425_e(tileentity.func_174877_v()); ++ Chunk chunk = this.getChunkAt(tileentity.getBlockPos()); ++ if (chunk.getBlockEntity(tileentity.getBlockPos(), Chunk.CreateEntityType.CHECK) == tileentity) ++ chunk.removeBlockEntity(tileentity.getBlockPos()); } } } @@ -495,12 +_,15 @@ - public void func_217390_a(Consumer p_217390_1_, Entity p_217390_2_) { + public void guardEntityTick(Consumer p_217390_1_, Entity p_217390_2_) { try { + net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(p_217390_2_); p_217390_1_.accept(p_217390_2_); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking entity"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Entity being ticked"); - p_217390_2_.func_85029_a(crashreportcategory); + CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity"); + CrashReportCategory crashreportcategory = crashreport.addCategory("Entity being ticked"); + p_217390_2_.fillCrashReportCategory(crashreportcategory); throw new ReportedException(crashreport); + } finally { + net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(p_217390_2_); @@ -242,61 +242,61 @@ @@ -514,6 +_,7 @@ - public Explosion func_230546_a_(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable ExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { + public Explosion explode(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable ExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { Explosion explosion = new Explosion(this, p_230546_1_, p_230546_2_, p_230546_3_, p_230546_4_, p_230546_6_, p_230546_8_, p_230546_10_, p_230546_11_, p_230546_12_); + if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.func_77278_a(); - explosion.func_77279_a(true); + explosion.explode(); + explosion.finalizeExplosion(true); return explosion; @@ -561,6 +_,7 @@ - public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { - if (!func_189509_E(p_175690_1_)) { -+ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks - if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) { - if (this.field_147481_N) { - p_175690_2_.func_226984_a_(this, p_175690_1_); + public void setBlockEntity(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { + if (!isOutsideBuildHeight(p_175690_1_)) { ++ p_175690_1_ = p_175690_1_.immutable(); // Forge - prevent mutable BlockPos leaks + if (p_175690_2_ != null && !p_175690_2_.isRemoved()) { + if (this.updatingBlockEntities) { + p_175690_2_.setLevelAndPosition(this, p_175690_1_); @@ -576,7 +_,8 @@ - this.field_147484_a.add(p_175690_2_); + this.pendingBlockEntities.add(p_175690_2_); } else { -- this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_); -+ Chunk chunk = this.func_175726_f(p_175690_1_); -+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); - this.func_175700_a(p_175690_2_); +- this.getChunkAt(p_175690_1_).setBlockEntity(p_175690_1_, p_175690_2_); ++ Chunk chunk = this.getChunkAt(p_175690_1_); ++ if (chunk != null) chunk.setBlockEntity(p_175690_1_, p_175690_2_); + this.addBlockEntity(p_175690_2_); } } @@ -589,6 +_,8 @@ - if (tileentity != null && this.field_147481_N) { - tileentity.func_145843_s(); - this.field_147484_a.remove(tileentity); + if (tileentity != null && this.updatingBlockEntities) { + tileentity.setRemoved(); + this.pendingBlockEntities.remove(tileentity); + if (!(tileentity instanceof ITickableTileEntity)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.field_147482_g.remove(tileentity); ++ this.blockEntityList.remove(tileentity); } else { if (tileentity != null) { - this.field_147484_a.remove(tileentity); + this.pendingBlockEntities.remove(tileentity); @@ -598,7 +_,7 @@ - this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); + this.getChunkAt(p_175713_1_).removeBlockEntity(p_175713_1_); } - -+ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes ++ this.updateNeighbourForOutputSignal(p_175713_1_, getBlockState(p_175713_1_).getBlock()); //Notify neighbors of changes } - public boolean func_195588_v(BlockPos p_195588_1_) { + public boolean isLoaded(BlockPos p_195588_1_) { @@ -651,10 +_,10 @@ - public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { - this.func_217381_Z().func_230035_c_("getEntities"); + public List getEntities(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { + this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); -- int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); -+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); -+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); - AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); +- int i = MathHelper.floor((p_175674_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor((p_175674_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor((p_175674_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor((p_175674_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_175674_2_.minX - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.floor((p_175674_2_.maxX + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.floor((p_175674_2_.minZ - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.floor((p_175674_2_.maxZ + getMaxEntityRadius()) / 16.0D); + AbstractChunkProvider abstractchunkprovider = this.getChunkSource(); for(int i1 = i; i1 <= j; ++i1) { @@ -665,16 +_,21 @@ @@ -304,7 +304,7 @@ } } + for (net.minecraftforge.entity.PartEntity p : this.getPartEntities()) { -+ if (p != p_175674_1_ && p.func_174813_aQ().func_72326_a(p_175674_2_) && (p_175674_3_ == null || p_175674_3_.test(p))) { ++ if (p != p_175674_1_ && p.getBoundingBox().intersects(p_175674_2_) && (p_175674_3_ == null || p_175674_3_.test(p))) { + list.add(p); + } + } @@ -312,91 +312,91 @@ return list; } - public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { - this.func_217381_Z().func_230035_c_("getEntities"); -- int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); -+ int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); -+ int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + public List getEntities(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { + this.getProfiler().incrementCounter("getEntities"); +- int i = MathHelper.floor((p_217394_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.ceil((p_217394_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor((p_217394_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.ceil((p_217394_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_217394_2_.minX - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.ceil((p_217394_2_.maxX + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.floor((p_217394_2_.minZ - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.ceil((p_217394_2_.maxZ + getMaxEntityRadius()) / 16.0D); List list = Lists.newArrayList(); for(int i1 = i; i1 < j; ++i1) { @@ -691,10 +_,10 @@ - public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { - this.func_217381_Z().func_230035_c_("getEntities"); -- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); -+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); -+ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + public List getEntitiesOfClass(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { + this.getProfiler().incrementCounter("getEntities"); +- int i = MathHelper.floor((p_175647_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.ceil((p_175647_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor((p_175647_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.ceil((p_175647_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_175647_2_.minX - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.ceil((p_175647_2_.maxX + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.floor((p_175647_2_.minZ - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.ceil((p_175647_2_.maxZ + getMaxEntityRadius()) / 16.0D); List list = Lists.newArrayList(); - AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); + AbstractChunkProvider abstractchunkprovider = this.getChunkSource(); @@ -712,10 +_,10 @@ - public List func_225316_b(Class p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate p_225316_3_) { - this.func_217381_Z().func_230035_c_("getLoadedEntities"); -- int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + getMaxEntityRadius()) / 16.0D); -+ int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - getMaxEntityRadius()) / 16.0D); -+ int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + getMaxEntityRadius()) / 16.0D); + public List getLoadedEntitiesOfClass(Class p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate p_225316_3_) { + this.getProfiler().incrementCounter("getLoadedEntities"); +- int i = MathHelper.floor((p_225316_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.ceil((p_225316_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor((p_225316_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.ceil((p_225316_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_225316_2_.minX - getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.ceil((p_225316_2_.maxX + getMaxEntityRadius()) / 16.0D); ++ int k = MathHelper.floor((p_225316_2_.minZ - getMaxEntityRadius()) / 16.0D); ++ int l = MathHelper.ceil((p_225316_2_.maxZ + getMaxEntityRadius()) / 16.0D); List list = Lists.newArrayList(); - AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); + AbstractChunkProvider abstractchunkprovider = this.getChunkSource(); @@ -739,6 +_,7 @@ - this.func_175726_f(p_175646_1_).func_76630_e(); + this.getChunkAt(p_175646_1_).markUnsaved(); } -+ this.func_175666_e(p_175646_1_, func_180495_p(p_175646_1_).func_177230_c()); //Notify neighbors of changes ++ this.updateNeighbourForOutputSignal(p_175646_1_, getBlockState(p_175646_1_).getBlock()); //Notify neighbors of changes } - public int func_181545_F() { + public int getSeaLevel() { @@ -783,7 +_,7 @@ - public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) { - BlockState blockstate = this.func_180495_p(p_175651_1_); - int i = blockstate.func_185911_a(this, p_175651_1_, p_175651_2_); -- return blockstate.func_215686_e(this, p_175651_1_) ? Math.max(i, this.func_175676_y(p_175651_1_)) : i; -+ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? Math.max(i, this.func_175676_y(p_175651_1_)) : i; + public int getSignal(BlockPos p_175651_1_, Direction p_175651_2_) { + BlockState blockstate = this.getBlockState(p_175651_1_); + int i = blockstate.getSignal(this, p_175651_1_, p_175651_2_); +- return blockstate.isRedstoneConductor(this, p_175651_1_) ? Math.max(i, this.getDirectSignalTo(p_175651_1_)) : i; ++ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? Math.max(i, this.getDirectSignalTo(p_175651_1_)) : i; } - public boolean func_175640_z(BlockPos p_175640_1_) { + public boolean hasNeighborSignal(BlockPos p_175640_1_) { @@ -938,16 +_,15 @@ - public abstract Scoreboard func_96441_U(); + public abstract Scoreboard getScoreboard(); - public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { + public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_) { - for(Direction direction : Direction.Plane.HORIZONTAL) { + for(Direction direction : Direction.values()) { - BlockPos blockpos = p_175666_1_.func_177972_a(direction); - if (this.func_175667_e(blockpos)) { - BlockState blockstate = this.func_180495_p(blockpos); -- if (blockstate.func_203425_a(Blocks.field_196762_fd)) { -- blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); -- } else if (blockstate.func_215686_e(this, blockpos)) { + BlockPos blockpos = p_175666_1_.relative(direction); + if (this.hasChunkAt(blockpos)) { + BlockState blockstate = this.getBlockState(blockpos); +- if (blockstate.is(Blocks.COMPARATOR)) { +- blockstate.neighborChanged(this, blockpos, p_175666_2_, p_175666_1_, false); +- } else if (blockstate.isRedstoneConductor(this, blockpos)) { + blockstate.onNeighborChange(this, blockpos, p_175666_1_); -+ if (blockstate.func_215686_e(this, blockpos)) { - blockpos = blockpos.func_177972_a(direction); - blockstate = this.func_180495_p(blockpos); -- if (blockstate.func_203425_a(Blocks.field_196762_fd)) { ++ if (blockstate.isRedstoneConductor(this, blockpos)) { + blockpos = blockpos.relative(direction); + blockstate = this.getBlockState(blockpos); +- if (blockstate.is(Blocks.COMPARATOR)) { + if (blockstate.getWeakChanges(this, blockpos)) { - blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); + blockstate.neighborChanged(this, blockpos, p_175666_2_, p_175666_1_, false); } } @@ -1022,6 +_,18 @@ - public BiomeManager func_225523_d_() { - return this.field_226689_w_; + public BiomeManager getBiomeManager() { + return this.biomeManager; + } + + private double maxEntityRadius = 2.0D; @@ -411,4 +411,4 @@ + return maxEntityRadius; } - public final boolean func_234925_Z_() { + public final boolean isDebug() { diff --git a/patches/minecraft/net/minecraft/world/WorldSettings.java.patch b/patches/minecraft/net/minecraft/world/WorldSettings.java.patch index 9432c5ff44..e8489e05bd 100644 --- a/patches/minecraft/net/minecraft/world/WorldSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldSettings.java.patch @@ -3,8 +3,8 @@ @@ -62,6 +_,7 @@ } - public WorldSettings func_234948_a_(Difficulty p_234948_1_) { -+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_234948_1_, this.field_234944_d_); - return new WorldSettings(this.field_234943_a_, this.field_77172_b, this.field_77170_d, p_234948_1_, this.field_77168_f, this.field_234945_f_, this.field_234946_g_); + public WorldSettings withDifficulty(Difficulty p_234948_1_) { ++ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_234948_1_, this.difficulty); + return new WorldSettings(this.levelName, this.gameType, this.hardcore, p_234948_1_, this.allowCommands, this.gameRules, this.dataPackConfig); } diff --git a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch index 598f090bb8..143b5461b8 100644 --- a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -6,26 +6,26 @@ -public final class Biome { +public final class Biome extends net.minecraftforge.registries.ForgeRegistryEntry.UncheckedRegistryEntry { - public static final Logger field_150586_aC = LogManager.getLogger(); - public static final Codec field_242418_b = RecordCodecBuilder.create((p_235064_0_) -> { - return p_235064_0_.group(Biome.Climate.field_242459_a.forGetter((p_242446_0_) -> { + public static final Logger LOGGER = LogManager.getLogger(); + public static final Codec DIRECT_CODEC = RecordCodecBuilder.create((p_235064_0_) -> { + return p_235064_0_.group(Biome.Climate.CODEC.forGetter((p_242446_0_) -> { @@ -70,7 +_,9 @@ - return p_242443_0_.field_242424_k; - }), MobSpawnInfo.field_242552_c.forGetter((p_242442_0_) -> { - return p_242442_0_.field_242425_l; + return p_242443_0_.generationSettings; + }), MobSpawnInfo.CODEC.forGetter((p_242442_0_) -> { + return p_242442_0_.mobSettings; - })).apply(p_235064_0_, Biome::new); -+ }), ResourceLocation.field_240908_a_.optionalFieldOf("forge:registry_name").forGetter(b -> Optional.ofNullable(b.getRegistryName()))) ++ }), ResourceLocation.CODEC.optionalFieldOf("forge:registry_name").forGetter(b -> Optional.ofNullable(b.getRegistryName()))) + .apply(p_235064_0_, (climate, category, depth, scale, effects, gen, spawns, name) -> + net.minecraftforge.common.ForgeHooks.enhanceBiome(name.orElse(null), climate, category, depth, scale, effects, gen, spawns, p_235064_0_, Biome::new)); }); - public static final Codec field_242419_c = RecordCodecBuilder.create((p_242432_0_) -> { - return p_242432_0_.group(Biome.Climate.field_242459_a.forGetter((p_242441_0_) -> { + public static final Codec NETWORK_CODEC = RecordCodecBuilder.create((p_242432_0_) -> { + return p_242432_0_.group(Biome.Climate.CODEC.forGetter((p_242441_0_) -> { @@ -200,7 +_,7 @@ } else { - if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) { - BlockState blockstate = p_201850_1_.func_180495_p(p_201850_2_); -- if (blockstate.func_196958_f() && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { -+ if (blockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { + if (p_201850_2_.getY() >= 0 && p_201850_2_.getY() < 256 && p_201850_1_.getBrightness(LightType.BLOCK, p_201850_2_) < 10) { + BlockState blockstate = p_201850_1_.getBlockState(p_201850_2_); +- if (blockstate.isAir() && Blocks.SNOW.defaultBlockState().canSurvive(p_201850_1_, p_201850_2_)) { ++ if (blockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.SNOW.defaultBlockState().canSurvive(p_201850_1_, p_201850_2_)) { return true; } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeAmbience.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeAmbience.java.patch index ab4066dbca..b0799b4b93 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeAmbience.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeAmbience.java.patch @@ -8,25 +8,25 @@ + public static enum GrassColorModifier implements IStringSerializable, net.minecraftforge.common.IExtensibleEnum { NONE("none") { @OnlyIn(Dist.CLIENT) - public int func_241853_a(double p_241853_1_, double p_241853_3_, int p_241853_5_) { + public int modifyColor(double p_241853_1_, double p_241853_3_, int p_241853_5_) { @@ -226,18 +_,36 @@ }; - private final String field_242543_e; -- public static final Codec field_242542_d = IStringSerializable.func_233023_a_(BiomeAmbience.GrassColorModifier::values, BiomeAmbience.GrassColorModifier::func_242546_a); -+ public static final Codec field_242542_d = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(BiomeAmbience.GrassColorModifier::values, BiomeAmbience.GrassColorModifier::func_242546_a); - private static final Map field_242544_f = Arrays.stream(values()).collect(Collectors.toMap(BiomeAmbience.GrassColorModifier::func_242547_b, (p_242545_0_) -> { + private final String name; +- public static final Codec CODEC = IStringSerializable.fromEnum(BiomeAmbience.GrassColorModifier::values, BiomeAmbience.GrassColorModifier::byName); ++ public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(BiomeAmbience.GrassColorModifier::values, BiomeAmbience.GrassColorModifier::byName); + private static final Map BY_NAME = Arrays.stream(values()).collect(Collectors.toMap(BiomeAmbience.GrassColorModifier::getName, (p_242545_0_) -> { return p_242545_0_; })); @OnlyIn(Dist.CLIENT) -- public abstract int func_241853_a(double p_241853_1_, double p_241853_3_, int p_241853_5_); -+ public int func_241853_a(double p_241853_1_, double p_241853_3_, int p_241853_5_) { +- public abstract int modifyColor(double p_241853_1_, double p_241853_3_, int p_241853_5_); ++ public int modifyColor(double p_241853_1_, double p_241853_3_, int p_241853_5_) { + return delegate.modifyGrassColor(p_241853_1_, p_241853_3_, p_241853_5_); + } private GrassColorModifier(String p_i241940_3_) { - this.field_242543_e = p_i241940_3_; + this.name = p_i241940_3_; } + private ColorModifier delegate; @@ -39,12 +39,12 @@ + } + @Override + public void init() { -+ field_242544_f.put(this.func_242547_b(), this); ++ BY_NAME.put(this.getName(), this); + } + @FunctionalInterface + public interface ColorModifier { + int modifyGrassColor(double x, double z, int color); + } - public String func_242547_b() { - return this.field_242543_e; + public String getName() { + return this.name; } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenerationSettings.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenerationSettings.java.patch index c3ff059fdf..fb610eeeba 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenerationSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenerationSettings.java.patch @@ -2,25 +2,25 @@ +++ b/net/minecraft/world/biome/BiomeGenerationSettings.java @@ -47,6 +_,7 @@ }); - private final Supplier> field_242482_d; - private final Map>>> field_242483_e; + private final Supplier> surfaceBuilder; + private final Map>>> carvers; + private final java.util.Set carversView; - private final List>>> field_242484_f; - private final List>> field_242485_g; - private final List> field_242486_h; + private final List>>> features; + private final List>> structureStarts; + private final List> flowerFeatures; @@ -59,10 +_,15 @@ - this.field_242486_h = p_i241935_3_.stream().flatMap(Collection::stream).map(Supplier::get).flatMap(ConfiguredFeature::func_242768_d).filter((p_242490_0_) -> { - return p_242490_0_.field_222737_a == Feature.field_227247_y_; + this.flowerFeatures = p_i241935_3_.stream().flatMap(Collection::stream).map(Supplier::get).flatMap(ConfiguredFeature::getFeatures).filter((p_242490_0_) -> { + return p_242490_0_.feature == Feature.FLOWER; }).collect(ImmutableList.toImmutableList()); -+ this.carversView = java.util.Collections.unmodifiableSet(field_242483_e.keySet()); ++ this.carversView = java.util.Collections.unmodifiableSet(carvers.keySet()); } - public List>> func_242489_a(GenerationStage.Carving p_242489_1_) { - return this.field_242483_e.getOrDefault(p_242489_1_, ImmutableList.of()); + public List>> getCarvers(GenerationStage.Carving p_242489_1_) { + return this.carvers.getOrDefault(p_242489_1_, ImmutableList.of()); + } + + public java.util.Set getCarvingStages() { + return this.carversView; } - public boolean func_242493_a(Structure p_242493_1_) { + public boolean isValidStart(Structure p_242493_1_) { diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeRegistry.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeRegistry.java.patch index 1ea2a23f5a..5fc0ff11c5 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeRegistry.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeRegistry.java.patch @@ -3,8 +3,8 @@ @@ -17,7 +_,7 @@ } - public static RegistryKey func_244203_a(int p_244203_0_) { -- return field_244202_c.get(p_244203_0_); + public static RegistryKey byId(int p_244203_0_) { +- return TO_NAME.get(p_244203_0_); + return ((net.minecraftforge.registries.ForgeRegistry)net.minecraftforge.registries.ForgeRegistries.BIOMES).getKey(p_244203_0_); } diff --git a/patches/minecraft/net/minecraft/world/biome/MobSpawnInfo.java.patch b/patches/minecraft/net/minecraft/world/biome/MobSpawnInfo.java.patch index 55e992eb85..4668f79fe8 100644 --- a/patches/minecraft/net/minecraft/world/biome/MobSpawnInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/MobSpawnInfo.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/world/biome/MobSpawnInfo.java +++ b/net/minecraft/world/biome/MobSpawnInfo.java @@ -42,21 +_,33 @@ - private final Map> field_242554_e; - private final Map, MobSpawnInfo.SpawnCosts> field_242555_f; - private final boolean field_242556_g; + private final Map> spawners; + private final Map, MobSpawnInfo.SpawnCosts> mobSpawnCosts; + private final boolean playerSpawnFriendly; + private final java.util.Set typesView; + private final java.util.Set> costView; private MobSpawnInfo(float p_i241946_1_, Map> p_i241946_2_, Map, MobSpawnInfo.SpawnCosts> p_i241946_3_, boolean p_i241946_4_) { - this.field_242553_d = p_i241946_1_; - this.field_242554_e = p_i241946_2_; - this.field_242555_f = p_i241946_3_; - this.field_242556_g = p_i241946_4_; -+ this.typesView = java.util.Collections.unmodifiableSet(this.field_242554_e.keySet()); -+ this.costView = java.util.Collections.unmodifiableSet(this.field_242555_f.keySet()); + this.creatureGenerationProbability = p_i241946_1_; + this.spawners = p_i241946_2_; + this.mobSpawnCosts = p_i241946_3_; + this.playerSpawnFriendly = p_i241946_4_; ++ this.typesView = java.util.Collections.unmodifiableSet(this.spawners.keySet()); ++ this.costView = java.util.Collections.unmodifiableSet(this.mobSpawnCosts.keySet()); } - public List func_242559_a(EntityClassification p_242559_1_) { - return this.field_242554_e.getOrDefault(p_242559_1_, ImmutableList.of()); + public List getMobs(EntityClassification p_242559_1_) { + return this.spawners.getOrDefault(p_242559_1_, ImmutableList.of()); } + public java.util.Set getSpawnerTypes() { @@ -25,12 +25,12 @@ + } + @Nullable - public MobSpawnInfo.SpawnCosts func_242558_a(EntityType p_242558_1_) { - return this.field_242555_f.get(p_242558_1_); + public MobSpawnInfo.SpawnCosts getMobSpawnCost(EntityType p_242558_1_) { + return this.mobSpawnCosts.get(p_242558_1_); + } + + public java.util.Set> getEntityTypes() { + return this.costView; } - public float func_242557_a() { + public float getCreatureProbability() { diff --git a/patches/minecraft/net/minecraft/world/biome/provider/OverworldBiomeProvider.java.patch b/patches/minecraft/net/minecraft/world/biome/provider/OverworldBiomeProvider.java.patch index 1b007c303d..bd16b628f8 100644 --- a/patches/minecraft/net/minecraft/world/biome/provider/OverworldBiomeProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/provider/OverworldBiomeProvider.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/biome/provider/OverworldBiomeProvider.java +++ b/net/minecraft/world/biome/provider/OverworldBiomeProvider.java @@ -35,7 +_,7 @@ - private final Registry field_242636_k; + private final Registry biomes; public OverworldBiomeProvider(long p_i241958_1_, boolean p_i241958_3_, boolean p_i241958_4_, Registry p_i241958_5_) { -- super(field_226847_e_.stream().map((p_242638_1_) -> { -+ super(java.util.stream.Stream.concat(field_226847_e_.stream(), net.minecraftforge.common.BiomeManager.getAdditionalOverworldBiomes().stream()).map((p_242638_1_) -> { +- super(POSSIBLE_BIOMES.stream().map((p_242638_1_) -> { ++ super(java.util.stream.Stream.concat(POSSIBLE_BIOMES.stream(), net.minecraftforge.common.BiomeManager.getAdditionalOverworldBiomes().stream()).map((p_242638_1_) -> { return () -> { - return p_i241958_5_.func_243576_d(p_242638_1_); + return p_i241958_5_.getOrThrow(p_242638_1_); }; diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index e36afa8eaa..d270859a23 100644 --- a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/border/WorldBorder.java +++ b/net/minecraft/world/border/WorldBorder.java @@ -136,6 +_,10 @@ - this.field_177758_a.add(p_177737_1_); + this.listeners.add(p_177737_1_); } + public void removeListener(IBorderListener listener) { -+ this.field_177758_a.remove(listener); ++ this.listeners.remove(listener); + } + - public void func_177725_a(int p_177725_1_) { - this.field_177762_h = p_177725_1_; - this.field_212674_i.func_212652_j(); + public void setAbsoluteMaxSize(int p_177725_1_) { + this.absoluteMaxSize = p_177725_1_; + this.extent.onAbsoluteMaxSizeChange(); diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index fd66177088..b2f76368fb 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -6,19 +6,19 @@ -public class Chunk implements IChunk { +public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk { - private static final Logger field_150817_t = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @Nullable - public static final ChunkSection field_186036_a = null; + public static final ChunkSection EMPTY_SECTION = null; @@ -92,6 +_,7 @@ } public Chunk(World p_i225781_1_, ChunkPos p_i225781_2_, BiomeContainer p_i225781_3_, UpgradeData p_i225781_4_, ITickList p_i225781_5_, ITickList p_i225781_6_, long p_i225781_7_, @Nullable ChunkSection[] p_i225781_9_, @Nullable Consumer p_i225781_10_) { + super(Chunk.class); - this.field_76645_j = new ClassInheritanceMultiMap[16]; - this.field_76637_e = p_i225781_1_; - this.field_212816_F = p_i225781_2_; + this.entitySections = new ClassInheritanceMultiMap[16]; + this.level = p_i225781_1_; + this.chunkPos = p_i225781_2_; @@ -119,7 +_,7 @@ - field_150817_t.warn("Could not set level chunk sections, array length is {} instead of {}", p_i225781_9_.length, this.field_76652_q.length); + LOGGER.warn("Could not set level chunk sections, array length is {} instead of {}", p_i225781_9_.length, this.sections.length); } } - @@ -28,86 +28,86 @@ public Chunk(World p_i49947_1_, ChunkPrimer p_i49947_2_) { @@ -264,28 +_,28 @@ - if (!this.field_76637_e.field_72995_K) { - blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_); + if (!this.level.isClientSide) { + blockstate.onRemove(this.level, p_177436_1_, p_177436_2_, p_177436_3_); - } else if (block1 != block && block1 instanceof ITileEntityProvider) { + } else if ((block1 != block || !p_177436_2_.hasTileEntity()) && blockstate.hasTileEntity()) { - this.field_76637_e.func_175713_t(p_177436_1_); + this.level.removeBlockEntity(p_177436_1_); } - if (!chunksection.func_177485_a(i, j & 15, k).func_203425_a(block)) { + if (!chunksection.getBlockState(i, j & 15, k).is(block)) { return null; } else { - if (block1 instanceof ITileEntityProvider) { + if (blockstate.hasTileEntity()) { - TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); + TileEntity tileentity = this.getBlockEntity(p_177436_1_, Chunk.CreateEntityType.CHECK); if (tileentity != null) { - tileentity.func_145836_u(); + tileentity.clearCache(); } } -- if (!this.field_76637_e.field_72995_K) { -+ if (!this.field_76637_e.field_72995_K && !this.field_76637_e.captureBlockSnapshots) { - p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_); +- if (!this.level.isClientSide) { ++ if (!this.level.isClientSide && !this.level.captureBlockSnapshots) { + p_177436_2_.onPlace(this.level, p_177436_1_, blockstate, p_177436_3_); } - if (block instanceof ITileEntityProvider) { + if (p_177436_2_.hasTileEntity()) { - TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); + TileEntity tileentity1 = this.getBlockEntity(p_177436_1_, Chunk.CreateEntityType.CHECK); if (tileentity1 == null) { -- tileentity1 = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); -+ tileentity1 = p_177436_2_.createTileEntity(this.field_76637_e); - this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); +- tileentity1 = ((ITileEntityProvider)block).newBlockEntity(this.level); ++ tileentity1 = p_177436_2_.createTileEntity(this.level); + this.level.setBlockEntity(p_177436_1_, tileentity1); } else { - tileentity1.func_145836_u(); + tileentity1.clearCache(); @@ -321,11 +_,13 @@ - k = this.field_76645_j.length - 1; + k = this.entitySections.length - 1; } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_212816_F.field_77276_a, this.field_212816_F.field_77275_b, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj)); - p_76612_1_.field_70175_ag = true; - p_76612_1_.field_70176_ah = this.field_212816_F.field_77276_a; - p_76612_1_.field_70162_ai = k; - p_76612_1_.field_70164_aj = this.field_212816_F.field_77275_b; - this.field_76645_j[k].add(p_76612_1_); -+ this.func_76630_e(); // Forge - ensure chunks are marked to save after an entity add ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.chunkPos.x, this.chunkPos.z, p_76612_1_.xChunk, p_76612_1_.zChunk)); + p_76612_1_.inChunk = true; + p_76612_1_.xChunk = this.chunkPos.x; + p_76612_1_.yChunk = k; + p_76612_1_.zChunk = this.chunkPos.z; + this.entitySections[k].add(p_76612_1_); ++ this.markUnsaved(); // Forge - ensure chunks are marked to save after an entity add } - public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) { + public void setHeightmap(Heightmap.Type p_201607_1_, long[] p_201607_2_) { @@ -346,6 +_,7 @@ } - this.field_76645_j[p_76608_2_].remove(p_76608_1_); -+ this.func_76630_e(); // Forge - ensure chunks are marked to save after entity removals + this.entitySections[p_76608_2_].remove(p_76608_1_); ++ this.markUnsaved(); // Forge - ensure chunks are marked to save after entity removals } - public int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { + public int getHeight(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { @@ -356,7 +_,7 @@ - private TileEntity func_177422_i(BlockPos p_177422_1_) { - BlockState blockstate = this.func_180495_p(p_177422_1_); - Block block = blockstate.func_177230_c(); -- return !block.func_235695_q_() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); -+ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.field_76637_e); + private TileEntity createBlockEntity(BlockPos p_177422_1_) { + BlockState blockstate = this.getBlockState(p_177422_1_); + Block block = blockstate.getBlock(); +- return !block.isEntityBlock() ? null : ((ITileEntityProvider)block).newBlockEntity(this.level); ++ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.level); } @Nullable @@ -367,6 +_,10 @@ @Nullable - public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.CreateEntityType p_177424_2_) { - TileEntity tileentity = this.field_150816_i.get(p_177424_1_); -+ if (tileentity != null && tileentity.func_145837_r()) { -+ field_150816_i.remove(p_177424_1_); + public TileEntity getBlockEntity(BlockPos p_177424_1_, Chunk.CreateEntityType p_177424_2_) { + TileEntity tileentity = this.blockEntities.get(p_177424_1_); ++ if (tileentity != null && tileentity.isRemoved()) { ++ blockEntities.remove(p_177424_1_); + tileentity = null; + } if (tileentity == null) { - CompoundNBT compoundnbt = this.field_201618_i.remove(p_177424_1_); + CompoundNBT compoundnbt = this.pendingBlockEntities.remove(p_177424_1_); if (compoundnbt != null) { @@ -382,9 +_,6 @@ - tileentity = this.func_177422_i(p_177424_1_); - this.field_76637_e.func_175690_a(p_177424_1_, tileentity); + tileentity = this.createBlockEntity(p_177424_1_); + this.level.setBlockEntity(p_177424_1_, tileentity); } -- } else if (tileentity.func_145837_r()) { -- this.field_150816_i.remove(p_177424_1_); +- } else if (tileentity.isRemoved()) { +- this.blockEntities.remove(p_177424_1_); - return null; } @@ -115,37 +115,37 @@ @@ -399,7 +_,7 @@ } - public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_) { -- if (this.func_180495_p(p_177426_1_).func_177230_c() instanceof ITileEntityProvider) { -+ if (this.func_180495_p(p_177426_1_).hasTileEntity()) { - p_177426_2_.func_226984_a_(this.field_76637_e, p_177426_1_); - p_177426_2_.func_145829_t(); - TileEntity tileentity = this.field_150816_i.put(p_177426_1_.func_185334_h(), p_177426_2_); + public void setBlockEntity(BlockPos p_177426_1_, TileEntity p_177426_2_) { +- if (this.getBlockState(p_177426_1_).getBlock() instanceof ITileEntityProvider) { ++ if (this.getBlockState(p_177426_1_).hasTileEntity()) { + p_177426_2_.setLevelAndPosition(this.level, p_177426_1_); + p_177426_2_.clearRemoved(); + TileEntity tileentity = this.blockEntities.put(p_177426_1_.immutable(), p_177426_2_); @@ -418,9 +_,14 @@ - public CompoundNBT func_223134_j(BlockPos p_223134_1_) { - TileEntity tileentity = this.func_175625_s(p_223134_1_); - if (tileentity != null && !tileentity.func_145837_r()) { + public CompoundNBT getBlockEntityNbtForSaving(BlockPos p_223134_1_) { + TileEntity tileentity = this.getBlockEntity(p_223134_1_); + if (tileentity != null && !tileentity.isRemoved()) { + try { - CompoundNBT compoundnbt1 = tileentity.func_189515_b(new CompoundNBT()); - compoundnbt1.func_74757_a("keepPacked", false); + CompoundNBT compoundnbt1 = tileentity.save(new CompoundNBT()); + compoundnbt1.putBoolean("keepPacked", false); return compoundnbt1; + } catch (Exception e) { + LogManager.getLogger().error("A TileEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", tileentity.getClass().getName(), e); + return null; + } } else { - CompoundNBT compoundnbt = this.field_201618_i.get(p_223134_1_); + CompoundNBT compoundnbt = this.pendingBlockEntities.get(p_223134_1_); if (compoundnbt != null) { @@ -455,8 +_,8 @@ } - public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, @Nullable Predicate p_177414_4_) { -- int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D); - i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); - j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); + public void getEntities(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, @Nullable Predicate p_177414_4_) { +- int i = MathHelper.floor((p_177414_2_.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor((p_177414_2_.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_177414_2_.minY - this.level.getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.floor((p_177414_2_.maxY + this.level.getMaxEntityRadius()) / 16.0D); + i = MathHelper.clamp(i, 0, this.entitySections.length - 1); + j = MathHelper.clamp(j, 0, this.entitySections.length - 1); @@ -472,6 +_,7 @@ p_177414_3_.add(entity); @@ -153,63 +153,63 @@ + if (false) // // Forge: Fix MC-158205: Moved into World.getEntities() if (entity instanceof EnderDragonEntity) { - for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)entity).func_213404_dT()) { - if (enderdragonpartentity != p_177414_1_ && enderdragonpartentity.func_174813_aQ().func_72326_a(p_177414_2_) && (p_177414_4_ == null || p_177414_4_.test(enderdragonpartentity))) { + for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)entity).getSubEntities()) { + if (enderdragonpartentity != p_177414_1_ && enderdragonpartentity.getBoundingBox().intersects(p_177414_2_) && (p_177414_4_ == null || p_177414_4_.test(enderdragonpartentity))) { @@ -486,8 +_,8 @@ } - public void func_217313_a(@Nullable EntityType p_217313_1_, AxisAlignedBB p_217313_2_, List p_217313_3_, Predicate p_217313_4_) { -- int i = MathHelper.func_76128_c((p_217313_2_.field_72338_b - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_217313_2_.field_72337_e + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_217313_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76128_c((p_217313_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D); - i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); - j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); + public void getEntities(@Nullable EntityType p_217313_1_, AxisAlignedBB p_217313_2_, List p_217313_3_, Predicate p_217313_4_) { +- int i = MathHelper.floor((p_217313_2_.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor((p_217313_2_.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_217313_2_.minY - this.level.getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.floor((p_217313_2_.maxY + this.level.getMaxEntityRadius()) / 16.0D); + i = MathHelper.clamp(i, 0, this.entitySections.length - 1); + j = MathHelper.clamp(j, 0, this.entitySections.length - 1); @@ -502,8 +_,8 @@ } - public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, @Nullable Predicate p_177430_4_) { -- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); -+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D); - i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); - j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); + public void getEntitiesOfClass(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, @Nullable Predicate p_177430_4_) { +- int i = MathHelper.floor((p_177430_2_.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor((p_177430_2_.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor((p_177430_2_.minY - this.level.getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.floor((p_177430_2_.maxY + this.level.getMaxEntityRadius()) / 16.0D); + i = MathHelper.clamp(i, 0, this.entitySections.length - 1); + j = MathHelper.clamp(j, 0, this.entitySections.length - 1); @@ -535,6 +_,11 @@ }; - Sets.newHashSet(this.field_150816_i.keySet()).stream().filter(predicate).forEach(this.field_76637_e::func_175713_t); + Sets.newHashSet(this.blockEntities.keySet()).stream().filter(predicate).forEach(this.level::removeBlockEntity); -+ for (TileEntity tileEntity : field_150816_i.values()) { -+ tileEntity.func_145836_u(); -+ tileEntity.func_195044_w(); ++ for (TileEntity tileEntity : blockEntities.values()) { ++ tileEntity.clearCache(); ++ tileEntity.getBlockState(); + } + - for(int i = 0; i < this.field_76652_q.length; ++i) { - ChunkSection chunksection = this.field_76652_q[i]; + for(int i = 0; i < this.sections.length; ++i) { + ChunkSection chunksection = this.sections[i]; if ((p_227073_4_ & 1 << i) == 0) { @@ -598,7 +_,7 @@ - public Stream func_217304_m() { - return StreamSupport.stream(BlockPos.func_191531_b(this.field_212816_F.func_180334_c(), 0, this.field_212816_F.func_180333_d(), this.field_212816_F.func_180332_e(), 255, this.field_212816_F.func_180330_f()).spliterator(), false).filter((p_217312_1_) -> { -- return this.func_180495_p(p_217312_1_).func_185906_d() != 0; -+ return this.func_180495_p(p_217312_1_).getLightValue(func_177412_p(), p_217312_1_) != 0; + public Stream getLights() { + return StreamSupport.stream(BlockPos.betweenClosed(this.chunkPos.getMinBlockX(), 0, this.chunkPos.getMinBlockZ(), this.chunkPos.getMaxBlockX(), 255, this.chunkPos.getMaxBlockZ()).spliterator(), false).filter((p_217312_1_) -> { +- return this.getBlockState(p_217312_1_).getLightEmission() != 0; ++ return this.getBlockState(p_217312_1_).getLightValue(getLevel(), p_217312_1_) != 0; }); } @@ -704,9 +_,8 @@ - BlockState blockstate = this.func_180495_p(p_212815_1_); + BlockState blockstate = this.getBlockState(p_212815_1_); TileEntity tileentity; - if ("DUMMY".equals(p_212815_2_.func_74779_i("id"))) { -- Block block = blockstate.func_177230_c(); + if ("DUMMY".equals(p_212815_2_.getString("id"))) { +- Block block = blockstate.getBlock(); - if (block instanceof ITileEntityProvider) { -- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); +- tileentity = ((ITileEntityProvider)block).newBlockEntity(this.level); + if (blockstate.hasTileEntity()) { -+ tileentity = blockstate.createTileEntity(this.field_76637_e); ++ tileentity = blockstate.createTileEntity(this.level); } else { tileentity = null; - field_150817_t.warn("Tried to load a DUMMY block entity @ {} but found not block entity block {} at location", p_212815_1_, blockstate); + LOGGER.warn("Tried to load a DUMMY block entity @ {} but found not block entity block {} at location", p_212815_1_, blockstate); @@ -794,5 +_,31 @@ IMMEDIATE, QUEUED, @@ -239,6 +239,6 @@ + + @Override + public World getWorldForge() { -+ return func_177412_p(); ++ return getLevel(); } } diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch index e02833d64e..8047cf821f 100644 --- a/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkPrimer.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/chunk/ChunkPrimer.java +++ b/net/minecraft/world/chunk/ChunkPrimer.java @@ -138,13 +_,13 @@ - if (this.field_201661_i[j >> 4] == Chunk.field_186036_a && p_177436_2_.func_203425_a(Blocks.field_150350_a)) { + if (this.sections[j >> 4] == Chunk.EMPTY_SECTION && p_177436_2_.is(Blocks.AIR)) { return p_177436_2_; } else { -- if (p_177436_2_.func_185906_d() > 0) { +- if (p_177436_2_.getLightEmission() > 0) { + if (p_177436_2_.getLightValue(this, p_177436_1_) > 0) { - this.field_201663_k.add(new BlockPos((i & 15) + this.func_76632_l().func_180334_c(), j, (k & 15) + this.func_76632_l().func_180333_d())); + this.lights.add(new BlockPos((i & 15) + this.getPos().getMinBlockX(), j, (k & 15) + this.getPos().getMinBlockZ())); } - ChunkSection chunksection = this.func_217332_a(j >> 4); - BlockState blockstate = chunksection.func_222629_a(i & 15, j & 15, k & 15, p_177436_2_); -- if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.func_185906_d() != blockstate.func_185906_d() || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) { -+ if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.getLightValue(this, p_177436_1_) != blockstate.getLightValue(this, p_177436_1_) || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) { - WorldLightManager worldlightmanager = this.func_217307_e(); - worldlightmanager.func_215568_a(p_177436_1_); + ChunkSection chunksection = this.getOrCreateSection(j >> 4); + BlockState blockstate = chunksection.setBlockState(i & 15, j & 15, k & 15, p_177436_2_); +- if (this.status.isOrAfter(ChunkStatus.FEATURES) && p_177436_2_ != blockstate && (p_177436_2_.getLightBlock(this, p_177436_1_) != blockstate.getLightBlock(this, p_177436_1_) || p_177436_2_.getLightEmission() != blockstate.getLightEmission() || p_177436_2_.useShapeForLightOcclusion() || blockstate.useShapeForLightOcclusion())) { ++ if (this.status.isOrAfter(ChunkStatus.FEATURES) && p_177436_2_ != blockstate && (p_177436_2_.getLightBlock(this, p_177436_1_) != blockstate.getLightBlock(this, p_177436_1_) || p_177436_2_.getLightValue(this, p_177436_1_) != blockstate.getLightValue(this, p_177436_1_) || p_177436_2_.useShapeForLightOcclusion() || blockstate.useShapeForLightOcclusion())) { + WorldLightManager worldlightmanager = this.getLightEngine(); + worldlightmanager.checkBlock(p_177436_1_); } diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch index 00dcd662ee..616cef9f07 100644 --- a/patches/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkStatus.java.patch @@ -6,6 +6,6 @@ -public class ChunkStatus { +public class ChunkStatus extends net.minecraftforge.registries.ForgeRegistryEntry { - private static final EnumSet field_222618_n = EnumSet.of(Heightmap.Type.OCEAN_FLOOR_WG, Heightmap.Type.WORLD_SURFACE_WG); - private static final EnumSet field_222619_o = EnumSet.of(Heightmap.Type.OCEAN_FLOOR, Heightmap.Type.WORLD_SURFACE, Heightmap.Type.MOTION_BLOCKING, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES); - private static final ChunkStatus.ILoadingWorker field_223211_p = (p_222588_0_, p_222588_1_, p_222588_2_, p_222588_3_, p_222588_4_, p_222588_5_) -> { + private static final EnumSet PRE_FEATURES = EnumSet.of(Heightmap.Type.OCEAN_FLOOR_WG, Heightmap.Type.WORLD_SURFACE_WG); + private static final EnumSet POST_FEATURES = EnumSet.of(Heightmap.Type.OCEAN_FLOOR, Heightmap.Type.WORLD_SURFACE, Heightmap.Type.MOTION_BLOCKING, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES); + private static final ChunkStatus.ILoadingWorker PASSTHROUGH_LOAD_TASK = (p_222588_0_, p_222588_1_, p_222588_2_, p_222588_3_, p_222588_4_, p_222588_5_) -> { diff --git a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch index f96db555e8..296cc0f0d1 100644 --- a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/chunk/IChunk.java +++ b/net/minecraft/world/chunk/IChunk.java @@ -145,4 +_,9 @@ - boolean func_217310_r(); + boolean isLightCorrect(); - void func_217305_b(boolean p_217305_1_); + void setLightCorrect(boolean p_217305_1_); + + @Nullable + default net.minecraft.world.IWorld getWorldForge() { diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch index d3bfb80919..2698217a12 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/world/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/chunk/storage/ChunkSerializer.java @@ -132,6 +_,7 @@ - ichunk = new Chunk(p_222656_0_.func_201672_e(), p_222656_3_, biomecontainer, upgradedata, iticklist, iticklist1, k1, achunksection, (p_222648_1_) -> { - func_222650_a(compoundnbt, p_222648_1_); + ichunk = new Chunk(p_222656_0_.getLevel(), p_222656_3_, biomecontainer, upgradedata, iticklist, iticklist1, k1, achunksection, (p_222648_1_) -> { + postLoadChunk(compoundnbt, p_222648_1_); }); -+ if (compoundnbt.func_74764_b("ForgeCaps")) ((Chunk)ichunk).readCapsFromNBT(compoundnbt.func_74775_l("ForgeCaps")); ++ if (compoundnbt.contains("ForgeCaps")) ((Chunk)ichunk).readCapsFromNBT(compoundnbt.getCompound("ForgeCaps")); } else { ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist, chunkprimerticklist1); - chunkprimer.func_225548_a_(biomecontainer); + chunkprimer.setBiomes(biomecontainer); @@ -144,7 +_,7 @@ - if (!flag && chunkprimer.func_201589_g().func_209003_a(ChunkStatus.field_222614_j)) { - for(BlockPos blockpos : BlockPos.func_191531_b(p_222656_3_.func_180334_c(), 0, p_222656_3_.func_180333_d(), p_222656_3_.func_180332_e(), 255, p_222656_3_.func_180330_f())) { -- if (ichunk.func_180495_p(blockpos).func_185906_d() != 0) { -+ if (ichunk.func_180495_p(blockpos).getLightValue(ichunk, blockpos) != 0) { - chunkprimer.func_201637_h(blockpos); + if (!flag && chunkprimer.getStatus().isOrAfter(ChunkStatus.LIGHT)) { + for(BlockPos blockpos : BlockPos.betweenClosed(p_222656_3_.getMinBlockX(), 0, p_222656_3_.getMinBlockZ(), p_222656_3_.getMaxBlockX(), 255, p_222656_3_.getMaxBlockZ())) { +- if (ichunk.getBlockState(blockpos).getLightEmission() != 0) { ++ if (ichunk.getBlockState(blockpos).getLightValue(ichunk, blockpos) != 0) { + chunkprimer.addLight(blockpos); } } @@ -167,7 +_,7 @@ - Heightmap.func_222690_a(ichunk, enumset); - CompoundNBT compoundnbt4 = compoundnbt.func_74775_l("Structures"); - ichunk.func_201612_a(func_235967_a_(p_222656_1_, compoundnbt4, p_222656_0_.func_72905_C())); -- ichunk.func_201606_b(func_227075_a_(p_222656_3_, compoundnbt4)); -+ net.minecraftforge.common.ForgeHooks.fixNullStructureReferences(ichunk, func_227075_a_(p_222656_3_, compoundnbt4)); - if (compoundnbt.func_74767_n("shouldSave")) { - ichunk.func_177427_f(true); + Heightmap.primeHeightmaps(ichunk, enumset); + CompoundNBT compoundnbt4 = compoundnbt.getCompound("Structures"); + ichunk.setAllStarts(unpackStructureStart(p_222656_1_, compoundnbt4, p_222656_0_.getSeed())); +- ichunk.setAllReferences(unpackStructureReferences(p_222656_3_, compoundnbt4)); ++ net.minecraftforge.common.ForgeHooks.fixNullStructureReferences(ichunk, unpackStructureReferences(p_222656_3_, compoundnbt4)); + if (compoundnbt.getBoolean("shouldSave")) { + ichunk.setUnsaved(true); } @@ -183,6 +_,7 @@ } @@ -35,7 +35,7 @@ } else { ChunkPrimer chunkprimer1 = (ChunkPrimer)ichunk; @@ -216,6 +_,8 @@ - chunkprimer1.func_205767_a(generationstage$carving, BitSet.valueOf(compoundnbt5.func_74770_j(s1))); + chunkprimer1.setCarvingMask(generationstage$carving, BitSet.valueOf(compoundnbt5.getByteArray(s1))); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, p_222656_4_, chunkstatus$type)); @@ -44,22 +44,22 @@ } } @@ -295,11 +_,21 @@ - for(int k = 0; k < chunk.func_177429_s().length; ++k) { - for(Entity entity : chunk.func_177429_s()[k]) { + for(int k = 0; k < chunk.getEntitySections().length; ++k) { + for(Entity entity : chunk.getEntitySections()[k]) { CompoundNBT compoundnbt3 = new CompoundNBT(); + try { - if (entity.func_70039_c(compoundnbt3)) { - chunk.func_177409_g(true); + if (entity.save(compoundnbt3)) { + chunk.setLastSaveHadEntities(true); listnbt2.add(compoundnbt3); } + } catch (Exception e) { -+ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.func_200600_R(), e); ++ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.getType(), e); + } } + } + try { + final CompoundNBT capTag = chunk.writeCapsToNBT(); -+ if (capTag != null) compoundnbt1.func_218657_a("ForgeCaps", capTag); ++ if (capTag != null) compoundnbt1.put("ForgeCaps", capTag); + } catch (Exception exception) { + LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); } diff --git a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch index 78142b9ba5..e89be6fb97 100644 --- a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch +++ b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -2,32 +2,32 @@ +++ b/net/minecraft/world/end/DragonFightManager.java @@ -84,6 +_,7 @@ - this.field_186117_k = p_i231901_4_.func_74767_n("DragonKilled"); - this.field_186118_l = p_i231901_4_.func_74767_n("PreviouslyKilled"); -+ this.field_186120_n = !p_i231901_4_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 - if (p_i231901_4_.func_74767_n("IsRespawning")) { - this.field_186122_p = DragonSpawnState.START; + this.dragonKilled = p_i231901_4_.getBoolean("DragonKilled"); + this.previouslyKilled = p_i231901_4_.getBoolean("PreviouslyKilled"); ++ this.needsStateScanning = !p_i231901_4_.getBoolean("LegacyScanPerformed"); // Forge: fix MC-105080 + if (p_i231901_4_.getBoolean("IsRespawning")) { + this.respawnStage = DragonSpawnState.START; } @@ -118,6 +_,7 @@ - compoundnbt.func_74757_a("DragonKilled", this.field_186117_k); - compoundnbt.func_74757_a("PreviouslyKilled", this.field_186118_l); -+ compoundnbt.func_74757_a("LegacyScanPerformed", !this.field_186120_n); // Forge: fix MC-105080 - if (this.field_186121_o != null) { - compoundnbt.func_218657_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); + compoundnbt.putBoolean("DragonKilled", this.dragonKilled); + compoundnbt.putBoolean("PreviouslyKilled", this.previouslyKilled); ++ compoundnbt.putBoolean("LegacyScanPerformed", !this.needsStateScanning); // Forge: fix MC-105080 + if (this.portalLocation != null) { + compoundnbt.put("ExitPortalLocation", NBTUtil.writeBlockPos(this.portalLocation)); } @@ -490,6 +_,13 @@ - endercrystalentity.func_184516_a((BlockPos)null); + endercrystalentity.setBeamTarget((BlockPos)null); } } - + } + + public void addPlayer(ServerPlayerEntity player) { -+ this.field_186109_c.func_186760_a(player); ++ this.dragonEvent.addPlayer(player); + } + + public void removePlayer(ServerPlayerEntity player) { -+ this.field_186109_c.func_186761_b(player); ++ this.dragonEvent.removePlayer(player); } } diff --git a/patches/minecraft/net/minecraft/world/gen/DebugChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/DebugChunkGenerator.java.patch index 761f130278..608af49c77 100644 --- a/patches/minecraft/net/minecraft/world/gen/DebugChunkGenerator.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/DebugChunkGenerator.java.patch @@ -6,8 +6,8 @@ } + + public static void initValidStates() { -+ field_177464_a = StreamSupport.stream(Registry.field_212618_g.spliterator(), false).flatMap(block -> block.func_176194_O().func_177619_a().stream()).collect(Collectors.toList()); -+ field_177462_b = MathHelper.func_76123_f(MathHelper.func_76129_c(field_177464_a.size())); -+ field_181039_c = MathHelper.func_76123_f((float) (field_177464_a.size() / field_177462_b)); ++ ALL_BLOCKS = StreamSupport.stream(Registry.BLOCK.spliterator(), false).flatMap(block -> block.getStateDefinition().getPossibleStates().stream()).collect(Collectors.toList()); ++ GRID_WIDTH = MathHelper.ceil(MathHelper.sqrt(ALL_BLOCKS.size())); ++ GRID_HEIGHT = MathHelper.ceil((float) (ALL_BLOCKS.size() / GRID_WIDTH)); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/FlatGenerationSettings.java.patch b/patches/minecraft/net/minecraft/world/gen/FlatGenerationSettings.java.patch index c451eb8054..429431111f 100644 --- a/patches/minecraft/net/minecraft/world/gen/FlatGenerationSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/FlatGenerationSettings.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/gen/FlatGenerationSettings.java +++ b/net/minecraft/world/gen/FlatGenerationSettings.java @@ -147,8 +_,16 @@ - biomegenerationsettings$builder.func_242513_a(GenerationStage.Decoration.LAKES, Features.field_243790_P); + biomegenerationsettings$builder.addFeature(GenerationStage.Decoration.LAKES, Features.LAKE_LAVA); } -+ Map, StructureFeature> map = new java.util.HashMap<>(field_202247_j); -+ net.minecraft.util.registry.WorldGenRegistries.field_243654_f.func_201756_e().filter(f -> !map.containsKey(f.field_236268_b_)).forEach(f -> map.put(f.field_236268_b_, f)); - for(Entry, StructureSeparationSettings> entry : this.field_236933_f_.func_236195_a_().entrySet()) { -- biomegenerationsettings$builder.func_242516_a(biomegenerationsettings.func_242491_a(field_202247_j.get(entry.getKey()))); ++ Map, StructureFeature> map = new java.util.HashMap<>(STRUCTURE_FEATURES); ++ net.minecraft.util.registry.WorldGenRegistries.CONFIGURED_STRUCTURE_FEATURE.stream().filter(f -> !map.containsKey(f.feature)).forEach(f -> map.put(f.feature, f)); + for(Entry, StructureSeparationSettings> entry : this.structureSettings.structureConfig().entrySet()) { +- biomegenerationsettings$builder.addStructureStart(biomegenerationsettings.withBiomeConfig(STRUCTURE_FEATURES.get(entry.getKey()))); + if (!map.containsKey(entry.getKey())) { -+ field_211404_q.error("FORGE: There's no known StructureFeature for {} when preparing the {} flatworld biome." + ++ LOGGER.error("FORGE: There's no known StructureFeature for {} when preparing the {} flatworld biome." + + " The structure will be skipped and may not spawn." + -+ " Please register your StructureFeatures in the WorldGenRegistries!", entry.getKey().func_143025_a(), biome.getRegistryName()); ++ " Please register your StructureFeatures in the WorldGenRegistries!", entry.getKey().getFeatureName(), biome.getRegistryName()); + continue; + } -+ biomegenerationsettings$builder.func_242516_a(biomegenerationsettings.func_242491_a(map.get(entry.getKey()))); ++ biomegenerationsettings$builder.addStructureStart(biomegenerationsettings.withBiomeConfig(map.get(entry.getKey()))); } - boolean flag = (!this.field_202245_D || this.field_242867_d.func_230519_c_(biome).equals(Optional.of(Biomes.field_185440_P))) && this.field_236934_k_; + boolean flag = (!this.voidGen || this.biomes.getResourceKey(biome).equals(Optional.of(Biomes.THE_VOID))) && this.decoration; @@ -174,7 +_,7 @@ } } -- return (new Biome.Builder()).func_205415_a(biome.func_201851_b()).func_205419_a(biome.func_201856_r()).func_205421_a(biome.func_185355_j()).func_205420_b(biome.func_185360_m()).func_205414_c(biome.func_242445_k()).func_205417_d(biome.func_76727_i()).func_235097_a_(biome.func_235089_q_()).func_242457_a(biomegenerationsettings$builder.func_242508_a()).func_242458_a(biome.func_242433_b()).func_242455_a(); -+ return (new Biome.Builder()).func_205415_a(biome.func_201851_b()).func_205419_a(biome.func_201856_r()).func_205421_a(biome.func_185355_j()).func_205420_b(biome.func_185360_m()).func_205414_c(biome.func_242445_k()).func_205417_d(biome.func_76727_i()).func_235097_a_(biome.func_235089_q_()).func_242457_a(biomegenerationsettings$builder.func_242508_a()).func_242458_a(biome.func_242433_b()).func_242455_a().setRegistryName(biome.getRegistryName()); +- return (new Biome.Builder()).precipitation(biome.getPrecipitation()).biomeCategory(biome.getBiomeCategory()).depth(biome.getDepth()).scale(biome.getScale()).temperature(biome.getBaseTemperature()).downfall(biome.getDownfall()).specialEffects(biome.getSpecialEffects()).generationSettings(biomegenerationsettings$builder.build()).mobSpawnSettings(biome.getMobSettings()).build(); ++ return (new Biome.Builder()).precipitation(biome.getPrecipitation()).biomeCategory(biome.getBiomeCategory()).depth(biome.getDepth()).scale(biome.getScale()).temperature(biome.getBaseTemperature()).downfall(biome.getDownfall()).specialEffects(biome.getSpecialEffects()).generationSettings(biomegenerationsettings$builder.build()).mobSpawnSettings(biome.getMobSettings()).build().setRegistryName(biome.getRegistryName()); } - public DimensionStructuresSettings func_236943_d_() { + public DimensionStructuresSettings structureSettings() { diff --git a/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch index 11ad56f7d0..5ec7820209 100644 --- a/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/NoiseChunkGenerator.java.patch @@ -2,30 +2,30 @@ +++ b/net/minecraft/world/gen/NoiseChunkGenerator.java @@ -525,8 +_,8 @@ objectlistiterator1.back(objectlist1.size()); - BlockState blockstate = this.func_236086_a_(d18, i2); - if (blockstate != field_222562_i) { -- if (blockstate.func_185906_d() != 0) { -- blockpos$mutable.func_181079_c(i3, i2, l3); -+ blockpos$mutable.func_181079_c(i3, i2, l3); + BlockState blockstate = this.generateBaseState(d18, i2); + if (blockstate != AIR) { +- if (blockstate.getLightEmission() != 0) { +- blockpos$mutable.set(i3, i2, l3); ++ blockpos$mutable.set(i3, i2, l3); + if (blockstate.getLightValue(chunkprimer, blockpos$mutable) != 0) { - chunkprimer.func_201637_h(blockpos$mutable); + chunkprimer.addLight(blockpos$mutable); } @@ -582,6 +_,9 @@ } - public List func_230353_a_(Biome p_230353_1_, StructureManager p_230353_2_, EntityClassification p_230353_3_, BlockPos p_230353_4_) { + public List getMobsAt(Biome p_230353_1_, StructureManager p_230353_2_, EntityClassification p_230353_3_, BlockPos p_230353_4_) { + List spawns = net.minecraftforge.common.world.StructureSpawnManager.getStructureSpawns(p_230353_2_, p_230353_3_, p_230353_4_); + if (spawns != null) return spawns; + if (false) {//Forge: We handle these hardcoded cases above in StructureSpawnManager#getStructureSpawns, but allow for insideOnly to be changed and allow for creatures to be spawned in ones other than just the witch hut - if (p_230353_2_.func_235010_a_(p_230353_4_, true, Structure.field_236374_j_).func_75069_d()) { + if (p_230353_2_.getStructureAt(p_230353_4_, true, Structure.SWAMP_HUT).isValid()) { if (p_230353_3_ == EntityClassification.MONSTER) { - return Structure.field_236374_j_.func_202279_e(); + return Structure.SWAMP_HUT.getSpecialEnemies(); @@ -604,6 +_,7 @@ - if (p_230353_2_.func_235010_a_(p_230353_4_, true, Structure.field_236378_n_).func_75069_d()) { - return Structure.field_236378_n_.func_202279_e(); + if (p_230353_2_.getStructureAt(p_230353_4_, true, Structure.NETHER_BRIDGE).isValid()) { + return Structure.NETHER_BRIDGE.getSpecialEnemies(); } + } } - return super.func_230353_a_(p_230353_1_, p_230353_2_, p_230353_3_, p_230353_4_); + return super.getMobsAt(p_230353_1_, p_230353_2_, p_230353_3_, p_230353_4_); diff --git a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch index b6e87ad68b..f52348402b 100644 --- a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch @@ -2,59 +2,59 @@ +++ b/net/minecraft/world/gen/WorldGenRegion.java @@ -173,11 +_,11 @@ - public boolean func_241212_a_(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { - BlockState blockstate = this.func_180495_p(p_241212_1_); -- if (blockstate.func_196958_f()) { + public boolean destroyBlock(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_) { + BlockState blockstate = this.getBlockState(p_241212_1_); +- if (blockstate.isAir()) { + if (blockstate.isAir(this, p_241212_1_)) { return false; } else { if (p_241212_2_) { -- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? this.func_175625_s(p_241212_1_) : null; -+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_241212_1_) : null; - Block.func_220054_a(blockstate, this.field_201689_f, p_241212_1_, tileentity, p_241212_3_, ItemStack.field_190927_a); +- TileEntity tileentity = blockstate.getBlock().isEntityBlock() ? this.getBlockEntity(p_241212_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.getBlockEntity(p_241212_1_) : null; + Block.dropResources(blockstate, this.level, p_241212_1_, tileentity, p_241212_3_, ItemStack.EMPTY); } @@ -197,11 +_,11 @@ if (compoundnbt != null) { - if ("DUMMY".equals(compoundnbt.func_74779_i("id"))) { - Block block = blockstate.func_177230_c(); + if ("DUMMY".equals(compoundnbt.getString("id"))) { + Block block = blockstate.getBlock(); - if (!(block instanceof ITileEntityProvider)) { + if (!blockstate.hasTileEntity()) { return null; } -- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_201689_f); -+ tileentity = blockstate.createTileEntity(this.field_201689_f); +- tileentity = ((ITileEntityProvider)block).newBlockEntity(this.level); ++ tileentity = blockstate.createTileEntity(this.level); } else { - tileentity = TileEntity.func_235657_b_(blockstate, compoundnbt); + tileentity = TileEntity.loadStatic(blockstate, compoundnbt); } @@ -212,7 +_,7 @@ } } -- if (blockstate.func_177230_c() instanceof ITileEntityProvider) { +- if (blockstate.getBlock() instanceof ITileEntityProvider) { + if (blockstate.hasTileEntity()) { - field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); + LOGGER.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); } @@ -228,9 +_,9 @@ } - Block block = p_241211_2_.func_177230_c(); -- if (block.func_235695_q_()) { + Block block = p_241211_2_.getBlock(); +- if (block.isEntityBlock()) { + if (p_241211_2_.hasTileEntity()) { - if (ichunk.func_201589_g().func_202129_d() == ChunkStatus.Type.LEVELCHUNK) { -- ichunk.func_177426_a(p_241211_1_, ((ITileEntityProvider)block).func_196283_a_(this)); -+ ichunk.func_177426_a(p_241211_1_, p_241211_2_.createTileEntity(this)); + if (ichunk.getStatus().getChunkType() == ChunkStatus.Type.LEVELCHUNK) { +- ichunk.setBlockEntity(p_241211_1_, ((ITileEntityProvider)block).newBlockEntity(this)); ++ ichunk.setBlockEntity(p_241211_1_, p_241211_2_.createTileEntity(this)); } else { CompoundNBT compoundnbt = new CompoundNBT(); - compoundnbt.func_74768_a("x", p_241211_1_.func_177958_n()); + compoundnbt.putInt("x", p_241211_1_.getX()); @@ -239,7 +_,7 @@ - compoundnbt.func_74778_a("id", "DUMMY"); - ichunk.func_201591_a(compoundnbt); + compoundnbt.putString("id", "DUMMY"); + ichunk.setBlockEntityNbt(compoundnbt); } -- } else if (blockstate != null && blockstate.func_177230_c().func_235695_q_()) { +- } else if (blockstate != null && blockstate.getBlock().isEntityBlock()) { + } else if (blockstate != null && blockstate.hasTileEntity()) { - ichunk.func_177425_e(p_241211_1_); + ichunk.removeBlockEntity(p_241211_1_); } diff --git a/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch index d83cfa6109..a4f623300d 100644 --- a/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch @@ -6,6 +6,6 @@ -public class BlockPlacerType

{ +public class BlockPlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BlockPlacerType field_227259_a_ = func_236438_a_("simple_block_placer", SimpleBlockPlacer.field_236446_b_); - public static final BlockPlacerType field_227260_b_ = func_236438_a_("double_plant_placer", DoublePlantBlockPlacer.field_236443_b_); - public static final BlockPlacerType field_227261_c_ = func_236438_a_("column_placer", ColumnBlockPlacer.field_236439_b_); + public static final BlockPlacerType SIMPLE_BLOCK_PLACER = register("simple_block_placer", SimpleBlockPlacer.CODEC); + public static final BlockPlacerType DOUBLE_PLANT_PLACER = register("double_plant_placer", DoublePlantBlockPlacer.CODEC); + public static final BlockPlacerType COLUMN_PLACER = register("column_placer", ColumnBlockPlacer.CODEC); diff --git a/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch index 8a7b32d0e7..680c46c6c8 100644 --- a/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch @@ -6,6 +6,6 @@ -public class BlockStateProviderType

{ +public class BlockStateProviderType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BlockStateProviderType field_227394_a_ = func_236800_a_("simple_state_provider", SimpleBlockStateProvider.field_236809_b_); - public static final BlockStateProviderType field_227395_b_ = func_236800_a_("weighted_state_provider", WeightedBlockStateProvider.field_236811_b_); - public static final BlockStateProviderType field_227396_c_ = func_236800_a_("plain_flower_provider", PlainFlowerBlockStateProvider.field_236804_b_); + public static final BlockStateProviderType SIMPLE_STATE_PROVIDER = register("simple_state_provider", SimpleBlockStateProvider.CODEC); + public static final BlockStateProviderType WEIGHTED_STATE_PROVIDER = register("weighted_state_provider", WeightedBlockStateProvider.CODEC); + public static final BlockStateProviderType PLAIN_FLOWER_PROVIDER = register("plain_flower_provider", PlainFlowerBlockStateProvider.CODEC); diff --git a/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch b/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch index d5b0d38447..a5b2ad58b3 100644 --- a/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/carver/WorldCarver.java.patch @@ -6,6 +6,6 @@ -public abstract class WorldCarver { +public abstract class WorldCarver extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final WorldCarver field_222709_a = func_222699_a("cave", new CaveWorldCarver(ProbabilityConfig.field_236576_b_, 256)); - public static final WorldCarver field_236240_b_ = func_222699_a("nether_cave", new NetherCaveCarver(ProbabilityConfig.field_236576_b_)); - public static final WorldCarver field_222711_c = func_222699_a("canyon", new CanyonWorldCarver(ProbabilityConfig.field_236576_b_)); + public static final WorldCarver CAVE = register("cave", new CaveWorldCarver(ProbabilityConfig.CODEC, 256)); + public static final WorldCarver NETHER_CAVE = register("nether_cave", new NetherCaveCarver(ProbabilityConfig.CODEC)); + public static final WorldCarver CANYON = register("canyon", new CanyonWorldCarver(ProbabilityConfig.CODEC)); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch index 2f3dc4b1c6..2f20f99865 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java +++ b/net/minecraft/world/gen/feature/AbstractBigMushroomFeature.java @@ -19,7 +_,7 @@ - protected void func_227210_a_(IWorld p_227210_1_, Random p_227210_2_, BlockPos p_227210_3_, BigMushroomFeatureConfig p_227210_4_, int p_227210_5_, BlockPos.Mutable p_227210_6_) { + protected void placeTrunk(IWorld p_227210_1_, Random p_227210_2_, BlockPos p_227210_3_, BigMushroomFeatureConfig p_227210_4_, int p_227210_5_, BlockPos.Mutable p_227210_6_) { for(int i = 0; i < p_227210_5_; ++i) { - p_227210_6_.func_189533_g(p_227210_3_).func_189534_c(Direction.UP, i); -- if (!p_227210_1_.func_180495_p(p_227210_6_).func_200015_d(p_227210_1_, p_227210_6_)) { -+ if (p_227210_1_.func_180495_p(p_227210_6_).canBeReplacedByLogs(p_227210_1_, p_227210_6_)) { - this.func_230367_a_(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_)); + p_227210_6_.set(p_227210_3_).move(Direction.UP, i); +- if (!p_227210_1_.getBlockState(p_227210_6_).isSolidRender(p_227210_1_, p_227210_6_)) { ++ if (p_227210_1_.getBlockState(p_227210_6_).canBeReplacedByLogs(p_227210_1_, p_227210_6_)) { + this.setBlock(p_227210_1_, p_227210_6_, p_227210_4_.stemProvider.getState(p_227210_2_, p_227210_3_)); } } @@ -48,7 +_,7 @@ for(int l = -k; l <= k; ++l) { for(int i1 = -k; i1 <= k; ++i1) { - BlockState blockstate = p_227209_1_.func_180495_p(p_227209_4_.func_239621_a_(p_227209_2_, l, j, i1)); -- if (!blockstate.func_196958_f() && !blockstate.func_235714_a_(BlockTags.field_206952_E)) { -+ if (!blockstate.isAir(p_227209_1_, p_227209_4_.func_239621_a_(p_227209_2_, l, j, i1)) && !blockstate.func_235714_a_(BlockTags.field_206952_E)) { + BlockState blockstate = p_227209_1_.getBlockState(p_227209_4_.setWithOffset(p_227209_2_, l, j, i1)); +- if (!blockstate.isAir() && !blockstate.is(BlockTags.LEAVES)) { ++ if (!blockstate.isAir(p_227209_1_, p_227209_4_.setWithOffset(p_227209_2_, l, j, i1)) && !blockstate.is(BlockTags.LEAVES)) { return false; } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch index dc9a518a5b..2d8eca0d32 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java +++ b/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java @@ -32,6 +_,7 @@ - return p_236684_0_.field_236682_l_; + return p_236684_0_.heightmap; })).apply(p_236683_0_, BaseTreeFeatureConfig::new); }); + //TODO: Review this, see if we can hook in the sapling into the Codec - public final BlockStateProvider field_227368_m_; - public final BlockStateProvider field_227369_n_; - public final List field_227370_o_; + public final BlockStateProvider trunkProvider; + public final BlockStateProvider leavesProvider; + public final List decorators; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch index b6433ded21..3413afe39d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch @@ -3,9 +3,9 @@ @@ -24,7 +_,7 @@ boolean flag5 = flag2 || flag3; if (!flag4 || !flag5) { - p_225564_5_.func_239621_a_(p_225564_3_, j, p_225564_4_, k); -- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { -+ if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + p_225564_5_.setWithOffset(p_225564_3_, j, p_225564_4_, k); +- if (!p_225564_1_.getBlockState(p_225564_5_).isSolidRender(p_225564_1_, p_225564_5_)) { ++ if (p_225564_1_.getBlockState(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { boolean flag6 = flag || flag5 && j == 1 - i; boolean flag7 = flag1 || flag5 && j == i - 1; boolean flag8 = flag2 || flag4 && k == 1 - i; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch index 8a7f5d719b..8b72c1979b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch @@ -3,9 +3,9 @@ @@ -26,7 +_,7 @@ boolean flag5 = flag2 || flag3; if (i >= p_225564_4_ || flag4 != flag5) { - p_225564_5_.func_239621_a_(p_225564_3_, l, i, i1); -- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { -+ if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { - this.func_230367_a_(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k))); + p_225564_5_.setWithOffset(p_225564_3_, l, i, i1); +- if (!p_225564_1_.getBlockState(p_225564_5_).isSolidRender(p_225564_1_, p_225564_5_)) { ++ if (p_225564_1_.getBlockState(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + this.setBlock(p_225564_1_, p_225564_5_, p_225564_6_.capProvider.getState(p_225564_2_, p_225564_3_).setValue(HugeMushroomBlock.UP, Boolean.valueOf(i >= p_225564_4_ - 1)).setValue(HugeMushroomBlock.WEST, Boolean.valueOf(l < -k)).setValue(HugeMushroomBlock.EAST, Boolean.valueOf(l > k)).setValue(HugeMushroomBlock.NORTH, Boolean.valueOf(i1 < -k)).setValue(HugeMushroomBlock.SOUTH, Boolean.valueOf(i1 > k))); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch index f63eb5bb83..40ea495130 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch @@ -3,8 +3,8 @@ @@ -123,6 +_,6 @@ } - private EntityType func_201043_a(Random p_201043_1_) { -- return Util.func_240989_a_(field_175916_b, p_201043_1_); + private EntityType randomEntityId(Random p_201043_1_) { +- return Util.getRandom(MOBS, p_201043_1_); + return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_201043_1_); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch index 988f519fed..943c6038e5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch @@ -6,20 +6,20 @@ -public abstract class Feature { +public abstract class Feature extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final Feature field_227245_q_ = func_214468_a("no_op", new NoOpFeature(NoFeatureConfig.field_236558_a_)); - public static final Feature field_236291_c_ = func_214468_a("tree", new TreeFeature(BaseTreeFeatureConfig.field_236676_a_)); - public static final FlowersFeature field_227247_y_ = func_214468_a("flower", new DefaultFlowersFeature(BlockClusterFeatureConfig.field_236587_a_)); + public static final Feature NO_OP = register("no_op", new NoOpFeature(NoFeatureConfig.CODEC)); + public static final Feature TREE = register("tree", new TreeFeature(BaseTreeFeatureConfig.CODEC)); + public static final FlowersFeature FLOWER = register("flower", new DefaultFlowersFeature(BlockClusterFeatureConfig.CODEC)); @@ -97,11 +_,11 @@ - public abstract boolean func_241855_a(ISeedReader p_241855_1_, ChunkGenerator p_241855_2_, Random p_241855_3_, BlockPos p_241855_4_, FC p_241855_5_); + public abstract boolean place(ISeedReader p_241855_1_, ChunkGenerator p_241855_2_, Random p_241855_3_, BlockPos p_241855_4_, FC p_241855_5_); - protected static boolean func_227249_a_(Block p_227249_0_) { -- return p_227249_0_ == Blocks.field_150348_b || p_227249_0_ == Blocks.field_196650_c || p_227249_0_ == Blocks.field_196654_e || p_227249_0_ == Blocks.field_196656_g; -+ return net.minecraftforge.common.Tags.Blocks.STONE.func_230235_a_(p_227249_0_); + protected static boolean isStone(Block p_227249_0_) { +- return p_227249_0_ == Blocks.STONE || p_227249_0_ == Blocks.GRANITE || p_227249_0_ == Blocks.DIORITE || p_227249_0_ == Blocks.ANDESITE; ++ return net.minecraftforge.common.Tags.Blocks.STONE.contains(p_227249_0_); } - public static boolean func_227250_b_(Block p_227250_0_) { -- return p_227250_0_ == Blocks.field_150346_d || p_227250_0_ == Blocks.field_196658_i || p_227250_0_ == Blocks.field_196661_l || p_227250_0_ == Blocks.field_196660_k || p_227250_0_ == Blocks.field_150391_bh; -+ return net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(p_227250_0_); + public static boolean isDirt(Block p_227250_0_) { +- return p_227250_0_ == Blocks.DIRT || p_227250_0_ == Blocks.GRASS_BLOCK || p_227250_0_ == Blocks.PODZOL || p_227250_0_ == Blocks.COARSE_DIRT || p_227250_0_ == Blocks.MYCELIUM; ++ return net.minecraftforge.common.Tags.Blocks.DIRT.contains(p_227250_0_); } - public static boolean func_236293_a_(IWorldGenerationBaseReader p_236293_0_, BlockPos p_236293_1_) { + public static boolean isGrassOrDirt(IWorldGenerationBaseReader p_236293_0_, BlockPos p_236293_1_) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch index 01b9ae2fab..9082221798 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch @@ -3,9 +3,9 @@ @@ -26,7 +_,7 @@ for(int i = 0; i < 1500; ++i) { - BlockPos blockpos = p_241855_4_.func_177982_a(p_241855_3_.nextInt(8) - p_241855_3_.nextInt(8), -p_241855_3_.nextInt(12), p_241855_3_.nextInt(8) - p_241855_3_.nextInt(8)); -- if (p_241855_1_.func_180495_p(blockpos).func_196958_f()) { -+ if (p_241855_1_.func_180495_p(blockpos).isAir(p_241855_1_, blockpos)) { + BlockPos blockpos = p_241855_4_.offset(p_241855_3_.nextInt(8) - p_241855_3_.nextInt(8), -p_241855_3_.nextInt(12), p_241855_3_.nextInt(8) - p_241855_3_.nextInt(8)); +- if (p_241855_1_.getBlockState(blockpos).isAir()) { ++ if (p_241855_1_.getBlockState(blockpos).isAir(p_241855_1_, blockpos)) { int j = 0; for(Direction direction : Direction.values()) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch index b3c7da451e..0fbb1ef24b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch @@ -2,27 +2,27 @@ +++ b/net/minecraft/world/gen/feature/IceSpikeFeature.java @@ -42,14 +_,14 @@ if ((i1 == 0 && j1 == 0 || !(f1 * f1 + f2 * f2 > f * f)) && (i1 != -l && i1 != l && j1 != -l && j1 != l || !(p_241855_3_.nextFloat() > 0.75F))) { - BlockState blockstate = p_241855_1_.func_180495_p(p_241855_4_.func_177982_a(i1, k, j1)); - Block block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f() || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (blockstate.isAir(p_241855_1_, p_241855_4_.func_177982_a(i1, k, j1)) || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { - this.func_230367_a_(p_241855_1_, p_241855_4_.func_177982_a(i1, k, j1), Blocks.field_150403_cj.func_176223_P()); + BlockState blockstate = p_241855_1_.getBlockState(p_241855_4_.offset(i1, k, j1)); + Block block = blockstate.getBlock(); +- if (blockstate.isAir() || isDirt(block) || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { ++ if (blockstate.isAir(p_241855_1_, p_241855_4_.offset(i1, k, j1)) || isDirt(block) || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { + this.setBlock(p_241855_1_, p_241855_4_.offset(i1, k, j1), Blocks.PACKED_ICE.defaultBlockState()); } if (k != 0 && l > 1) { - blockstate = p_241855_1_.func_180495_p(p_241855_4_.func_177982_a(i1, -k, j1)); - block = blockstate.func_177230_c(); -- if (blockstate.func_196958_f() || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (blockstate.isAir(p_241855_1_, p_241855_4_.func_177982_a(i1, -k, j1)) || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { - this.func_230367_a_(p_241855_1_, p_241855_4_.func_177982_a(i1, -k, j1), Blocks.field_150403_cj.func_176223_P()); + blockstate = p_241855_1_.getBlockState(p_241855_4_.offset(i1, -k, j1)); + block = blockstate.getBlock(); +- if (blockstate.isAir() || isDirt(block) || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { ++ if (blockstate.isAir(p_241855_1_, p_241855_4_.offset(i1, -k, j1)) || isDirt(block) || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { + this.setBlock(p_241855_1_, p_241855_4_.offset(i1, -k, j1), Blocks.PACKED_ICE.defaultBlockState()); } } @@ -76,7 +_,7 @@ - while(blockpos.func_177956_o() > 50) { - BlockState blockstate1 = p_241855_1_.func_180495_p(blockpos); - Block block1 = blockstate1.func_177230_c(); -- if (!blockstate1.func_196958_f() && !func_227250_b_(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { -+ if (!blockstate1.isAir(p_241855_1_, blockpos) && !func_227250_b_(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { + while(blockpos.getY() > 50) { + BlockState blockstate1 = p_241855_1_.getBlockState(blockpos); + Block block1 = blockstate1.getBlock(); +- if (!blockstate1.isAir() && !isDirt(block1) && block1 != Blocks.SNOW_BLOCK && block1 != Blocks.ICE && block1 != Blocks.PACKED_ICE) { ++ if (!blockstate1.isAir(p_241855_1_, blockpos) && !isDirt(block1) && block1 != Blocks.SNOW_BLOCK && block1 != Blocks.ICE && block1 != Blocks.PACKED_ICE) { break; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch index 66693176ff..178fb6d0b4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch @@ -3,9 +3,9 @@ @@ -19,7 +_,7 @@ return false; } else { - BlockState blockstate = p_241855_1_.func_180495_p(p_241855_4_); -- if (!blockstate.func_196958_f() && !p_241855_5_.field_227366_f_.contains(blockstate.func_177230_c())) { -+ if (!blockstate.isAir(p_241855_1_, p_241855_4_) && !p_241855_5_.field_227366_f_.contains(blockstate.func_177230_c())) { + BlockState blockstate = p_241855_1_.getBlockState(p_241855_4_); +- if (!blockstate.isAir() && !p_241855_5_.validBlocks.contains(blockstate.getBlock())) { ++ if (!blockstate.isAir(p_241855_1_, p_241855_4_) && !p_241855_5_.validBlocks.contains(blockstate.getBlock())) { return false; } else { int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch index 69c6dc13c9..172adeec8d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java +++ b/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java @@ -104,11 +_,11 @@ - return this.field_214953_e.size(); + return this.templates.size(); } - public static enum PlacementBehaviour implements IStringSerializable { @@ -9,15 +9,15 @@ TERRAIN_MATCHING("terrain_matching", ImmutableList.of(new GravityStructureProcessor(Heightmap.Type.WORLD_SURFACE_WG, -1))), RIGID("rigid", ImmutableList.of()); -- public static final Codec field_236858_c_ = IStringSerializable.func_233023_a_(JigsawPattern.PlacementBehaviour::values, JigsawPattern.PlacementBehaviour::func_214938_a); -+ public static final Codec field_236858_c_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(JigsawPattern.PlacementBehaviour::values, JigsawPattern.PlacementBehaviour::func_214938_a); - private static final Map field_214939_c = Arrays.stream(values()).collect(Collectors.toMap(JigsawPattern.PlacementBehaviour::func_214936_a, (p_214935_0_) -> { +- public static final Codec CODEC = IStringSerializable.fromEnum(JigsawPattern.PlacementBehaviour::values, JigsawPattern.PlacementBehaviour::byName); ++ public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(JigsawPattern.PlacementBehaviour::values, JigsawPattern.PlacementBehaviour::byName); + private static final Map BY_NAME = Arrays.stream(values()).collect(Collectors.toMap(JigsawPattern.PlacementBehaviour::getName, (p_214935_0_) -> { return p_214935_0_; })); @@ -134,6 +_,16 @@ - public String func_176610_l() { - return this.field_214940_d; + public String getSerializedName() { + return this.name; + } + + public static PlacementBehaviour create(String enumName, String p_i50487_3_, ImmutableList p_i50487_4_) { @@ -27,7 +27,7 @@ + @Override + @Deprecated + public void init() { -+ field_214939_c.put(func_214936_a(), this); ++ BY_NAME.put(getName(), this); } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch index 03bf53934e..4861383516 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java +++ b/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java @@ -106,7 +_,7 @@ - if (!template.func_237146_a_(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, p_230378_9_, 18)) { + if (!template.placeInWorld(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, p_230378_9_, 18)) { return false; } else { -- for(Template.BlockInfo template$blockinfo : Template.func_237145_a_(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.func_214857_a(p_230378_1_, p_230378_5_, p_230378_7_, false))) { -+ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.func_214857_a(p_230378_1_, p_230378_5_, p_230378_7_, false), template)) { - this.func_214846_a(p_230378_2_, template$blockinfo, p_230378_5_, p_230378_7_, p_230378_9_, p_230378_8_); +- for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.getDataMarkers(p_230378_1_, p_230378_5_, p_230378_7_, false))) { ++ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.getDataMarkers(p_230378_1_, p_230378_5_, p_230378_7_, false), template)) { + this.handleDataMarker(p_230378_2_, template$blockinfo, p_230378_5_, p_230378_7_, p_230378_9_, p_230378_8_); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/FortressStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/FortressStructure.java.patch index 70e34afe8f..a72c9a2c4a 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/FortressStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/FortressStructure.java.patch @@ -4,9 +4,9 @@ return FortressStructure.Start::new; } -- public List func_202279_e() { +- public List getSpecialEnemies() { + @Override + public List getDefaultSpawnList() { - return field_202381_d; + return FORTRESS_ENEMIES; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch index b4dafc3732..2d632047fa 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/MineshaftPieces.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/world/gen/feature/structure/MineshaftPieces.java @@ -207,7 +_,7 @@ - protected boolean func_186167_a(ISeedReader p_186167_1_, MutableBoundingBox p_186167_2_, Random p_186167_3_, int p_186167_4_, int p_186167_5_, int p_186167_6_, ResourceLocation p_186167_7_) { - BlockPos blockpos = new BlockPos(this.func_74865_a(p_186167_4_, p_186167_6_), this.func_74862_a(p_186167_5_), this.func_74873_b(p_186167_4_, p_186167_6_)); -- if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).func_196958_f() && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).func_196958_f()) { -+ if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).isAir(p_186167_1_, blockpos) && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).isAir(p_186167_1_, blockpos.func_177977_b())) { - BlockState blockstate = Blocks.field_150448_aq.func_176223_P().func_206870_a(RailBlock.field_176565_b, p_186167_3_.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); - this.func_175811_a(p_186167_1_, blockstate, p_186167_4_, p_186167_5_, p_186167_6_, p_186167_2_); - ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.func_201672_e(), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); + protected boolean createChest(ISeedReader p_186167_1_, MutableBoundingBox p_186167_2_, Random p_186167_3_, int p_186167_4_, int p_186167_5_, int p_186167_6_, ResourceLocation p_186167_7_) { + BlockPos blockpos = new BlockPos(this.getWorldX(p_186167_4_, p_186167_6_), this.getWorldY(p_186167_5_), this.getWorldZ(p_186167_4_, p_186167_6_)); +- if (p_186167_2_.isInside(blockpos) && p_186167_1_.getBlockState(blockpos).isAir() && !p_186167_1_.getBlockState(blockpos.below()).isAir()) { ++ if (p_186167_2_.isInside(blockpos) && p_186167_1_.getBlockState(blockpos).isAir(p_186167_1_, blockpos) && !p_186167_1_.getBlockState(blockpos.below()).isAir(p_186167_1_, blockpos.below())) { + BlockState blockstate = Blocks.RAIL.defaultBlockState().setValue(RailBlock.SHAPE, p_186167_3_.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST); + this.placeBlock(p_186167_1_, blockstate, p_186167_4_, p_186167_5_, p_186167_6_, p_186167_2_); + ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.getLevel(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/OceanMonumentStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/OceanMonumentStructure.java.patch index 610366e549..f7af0f9f53 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/OceanMonumentStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/OceanMonumentStructure.java.patch @@ -4,9 +4,9 @@ return OceanMonumentStructure.Start::new; } -- public List func_202279_e() { +- public List getSpecialEnemies() { + @Override + public List getDefaultSpawnList() { - return field_175803_h; + return MONUMENT_ENEMIES; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/PillagerOutpostStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/PillagerOutpostStructure.java.patch index db2dd13c64..a2d76372f7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/PillagerOutpostStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/PillagerOutpostStructure.java.patch @@ -4,9 +4,9 @@ super(p_i231977_1_, 0, true, true); } -- public List func_202279_e() { +- public List getSpecialEnemies() { + @Override + public List getDefaultSpawnList() { - return field_214558_a; + return OUTPOST_ENEMIES; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/Structure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/Structure.java.patch index 8cb44aef7b..2cceba012c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/Structure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/Structure.java.patch @@ -6,18 +6,18 @@ -public abstract class Structure { +public abstract class Structure extends net.minecraftforge.registries.ForgeRegistryEntry> implements net.minecraftforge.common.extensions.IForgeStructure { - public static final BiMap> field_236365_a_ = HashBiMap.create(); - private static final Map, GenerationStage.Decoration> field_236385_u_ = Maps.newHashMap(); - private static final Logger field_208204_b = LogManager.getLogger(); + public static final BiMap> STRUCTURES_REGISTRY = HashBiMap.create(); + private static final Map, GenerationStage.Decoration> STEP = Maps.newHashMap(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -237,11 +_,16 @@ } - public List func_202279_e() { + public List getSpecialEnemies() { - return ImmutableList.of(); + return getSpawnList(net.minecraft.entity.EntityClassification.MONSTER); } - public List func_214469_f() { + public List getSpecialAnimals() { - return ImmutableList.of(); + return getSpawnList(net.minecraft.entity.EntityClassification.CREATURE); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch index 28c68cc628..438d8dddb4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch @@ -3,10 +3,10 @@ @@ -57,6 +_,9 @@ } - public final CompoundNBT func_143010_b() { -+ if (Registry.field_218362_C.func_177774_c(this.func_214807_k()) == null) { // FORGE: Friendlier error then the Null String error below. -+ throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.func_214807_k() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + public final CompoundNBT createTag() { ++ if (Registry.STRUCTURE_PIECE.getKey(this.getType()) == null) { // FORGE: Friendlier error then the Null String error below. ++ throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.getType() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } CompoundNBT compoundnbt = new CompoundNBT(); - compoundnbt.func_74778_a("id", Registry.field_218362_C.func_177774_c(this.func_214807_k()).toString()); - compoundnbt.func_218657_a("BB", this.field_74887_e.func_151535_h()); + compoundnbt.putString("id", Registry.STRUCTURE_PIECE.getKey(this.getType()).toString()); + compoundnbt.put("BB", this.boundingBox.createTag()); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch index c53125dca8..7f491dfd0b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/gen/feature/structure/StructureStart.java +++ b/net/minecraft/world/gen/feature/structure/StructureStart.java @@ -84,6 +_,9 @@ - public CompoundNBT func_143021_a(int p_143021_1_, int p_143021_2_) { + public CompoundNBT createTag(int p_143021_1_, int p_143021_2_) { CompoundNBT compoundnbt = new CompoundNBT(); - if (this.func_75069_d()) { -+ if (Registry.field_218361_B.func_177774_c(this.func_214627_k()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.func_214627_k() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + if (this.isValid()) { ++ if (Registry.STRUCTURE_FEATURE.getKey(this.getFeature()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.getFeature() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } - compoundnbt.func_74778_a("id", Registry.field_218361_B.func_177774_c(this.func_214627_k()).toString()); - compoundnbt.func_74768_a("ChunkX", p_143021_1_); - compoundnbt.func_74768_a("ChunkZ", p_143021_2_); + compoundnbt.putString("id", Registry.STRUCTURE_FEATURE.getKey(this.getFeature()).toString()); + compoundnbt.putInt("ChunkX", p_143021_1_); + compoundnbt.putInt("ChunkZ", p_143021_2_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/SwampHutStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/SwampHutStructure.java.patch index fc934fc192..d8f0e09596 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/SwampHutStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/SwampHutStructure.java.patch @@ -4,15 +4,15 @@ return SwampHutStructure.Start::new; } -- public List func_202279_e() { +- public List getSpecialEnemies() { + @Override + public List getDefaultSpawnList() { - return field_202384_d; + return SWAMPHUT_ENEMIES; } -- public List func_214469_f() { +- public List getSpecialAnimals() { + @Override + public List getDefaultCreatureSpawnList() { - return field_214559_aS; + return SWAMPHUT_ANIMALS; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch index 9c860e0f95..bc9130c81c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/template/StructureProcessor.java.patch @@ -4,17 +4,17 @@ public abstract class StructureProcessor { @Nullable -- public abstract Template.BlockInfo func_230386_a_(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_); +- public abstract Template.BlockInfo processBlock(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_); + @Deprecated //Forge: Use process below, with the Template context -+ public Template.BlockInfo func_230386_a_(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_) { ++ public Template.BlockInfo processBlock(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_) { + return p_230386_5_; + } - protected abstract IStructureProcessorType func_215192_a(); + protected abstract IStructureProcessorType getType(); + + @Nullable + public Template.BlockInfo process(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_, @Nullable Template template) { -+ return func_230386_a_(p_230386_1_, p_230386_2_, p_230386_3_, p_230386_4_, p_230386_5_, p_230386_6_); ++ return processBlock(p_230386_1_, p_230386_2_, p_230386_3_, p_230386_4_, p_230386_5_, p_230386_6_); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch index 8fdb082967..91a307bbf9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/world/gen/feature/template/Template.java +++ b/net/minecraft/world/gen/feature/template/Template.java @@ -190,6 +_,10 @@ - return func_207669_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d()); + return transform(p_186266_1_, p_186266_0_.getMirror(), p_186266_0_.getRotation(), p_186266_0_.getRotationPivot()); } + public static Vector3d transformedVec3d(PlacementSettings placementIn, Vector3d pos) { -+ return func_207667_a(pos, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d()); ++ return transform(pos, placementIn.getMirror(), placementIn.getRotation(), placementIn.getRotationPivot()); + } + - public void func_237144_a_(IServerWorld p_237144_1_, BlockPos p_237144_2_, PlacementSettings p_237144_3_, Random p_237144_4_) { - p_237144_3_.func_186224_i(); - this.func_237152_b_(p_237144_1_, p_237144_2_, p_237144_3_, p_237144_4_); + public void placeInWorldChunk(IServerWorld p_237144_1_, BlockPos p_237144_2_, PlacementSettings p_237144_3_, Random p_237144_4_) { + p_237144_3_.updateBoundingBoxFromChunkPos(); + this.placeInWorld(p_237144_1_, p_237144_2_, p_237144_3_, p_237144_4_); @@ -215,7 +_,7 @@ int i1 = Integer.MIN_VALUE; int j1 = Integer.MIN_VALUE; -- for(Template.BlockInfo template$blockinfo : func_237145_a_(p_237146_1_, p_237146_2_, p_237146_3_, p_237146_4_, list)) { +- for(Template.BlockInfo template$blockinfo : processBlockInfos(p_237146_1_, p_237146_2_, p_237146_3_, p_237146_4_, list)) { + for(Template.BlockInfo template$blockinfo : processBlockInfos(p_237146_1_, p_237146_2_, p_237146_3_, p_237146_4_, list, this)) { - BlockPos blockpos = template$blockinfo.field_186242_a; - if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) { - FluidState fluidstate = p_237146_4_.func_204763_l() ? p_237146_1_.func_204610_c(blockpos) : null; + BlockPos blockpos = template$blockinfo.pos; + if (mutableboundingbox == null || mutableboundingbox.isInside(blockpos)) { + FluidState fluidstate = p_237146_4_.shouldKeepLiquids() ? p_237146_1_.getFluidState(blockpos) : null; @@ -330,7 +_,7 @@ } - if (!p_237146_4_.func_186221_e()) { -- this.func_237143_a_(p_237146_1_, p_237146_2_, p_237146_4_.func_186212_b(), p_237146_4_.func_186215_c(), p_237146_4_.func_207664_d(), mutableboundingbox, p_237146_4_.func_237134_m_()); + if (!p_237146_4_.isIgnoreEntities()) { +- this.placeEntities(p_237146_1_, p_237146_2_, p_237146_4_.getMirror(), p_237146_4_.getRotation(), p_237146_4_.getRotationPivot(), mutableboundingbox, p_237146_4_.shouldFinalizeEntities()); + this.addEntitiesToWorld(p_237146_1_, p_237146_2_, p_237146_4_); } @@ -34,7 +34,7 @@ } + @Deprecated //Use Forge version - public static List func_237145_a_(IWorld p_237145_0_, BlockPos p_237145_1_, BlockPos p_237145_2_, PlacementSettings p_237145_3_, List p_237145_4_) { + public static List processBlockInfos(IWorld p_237145_0_, BlockPos p_237145_1_, BlockPos p_237145_2_, PlacementSettings p_237145_3_, List p_237145_4_) { + return processBlockInfos(p_237145_0_, p_237145_1_, p_237145_2_, p_237145_3_, p_237145_4_, null); + } + @@ -42,11 +42,11 @@ List list = Lists.newArrayList(); for(Template.BlockInfo template$blockinfo : p_237145_4_) { - BlockPos blockpos = func_186266_a(p_237145_3_, template$blockinfo.field_186242_a).func_177971_a(p_237145_1_); - Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c != null ? template$blockinfo.field_186244_c.func_74737_b() : null); + BlockPos blockpos = calculateRelativePosition(p_237145_3_, template$blockinfo.pos).offset(p_237145_1_); + Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.state, template$blockinfo.nbt != null ? template$blockinfo.nbt.copy() : null); -- for(Iterator iterator = p_237145_3_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_230386_a_(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_)) { -+ for(Iterator iterator = p_237145_3_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_, template)) { +- for(Iterator iterator = p_237145_3_.getProcessors().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().processBlock(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_)) { ++ for(Iterator iterator = p_237145_3_.getProcessors().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_, template)) { } if (template$blockinfo1 != null) { @@ -54,17 +54,17 @@ return list; } -- private void func_237143_a_(IServerWorld p_237143_1_, BlockPos p_237143_2_, Mirror p_237143_3_, Rotation p_237143_4_, BlockPos p_237143_5_, @Nullable MutableBoundingBox p_237143_6_, boolean p_237143_7_) { -- for(Template.EntityInfo template$entityinfo : this.field_186271_b) { -- BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, p_237143_3_, p_237143_4_, p_237143_5_).func_177971_a(p_237143_2_); -- if (p_237143_6_ == null || p_237143_6_.func_175898_b(blockpos)) { +- private void placeEntities(IServerWorld p_237143_1_, BlockPos p_237143_2_, Mirror p_237143_3_, Rotation p_237143_4_, BlockPos p_237143_5_, @Nullable MutableBoundingBox p_237143_6_, boolean p_237143_7_) { +- for(Template.EntityInfo template$entityinfo : this.entityInfoList) { +- BlockPos blockpos = transform(template$entityinfo.blockPos, p_237143_3_, p_237143_4_, p_237143_5_).offset(p_237143_2_); +- if (p_237143_6_ == null || p_237143_6_.isInside(blockpos)) { + public static List processEntityInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List p_215387_3_) { + List list = Lists.newArrayList(); + for(Template.EntityInfo entityInfo : p_215387_3_) { -+ Vector3d pos = transformedVec3d(p_215387_2_, entityInfo.field_186247_a).func_178787_e(Vector3d.func_237491_b_(p_215387_1_)); -+ BlockPos blockpos = func_186266_a(p_215387_2_, entityInfo.field_186248_b).func_177971_a(p_215387_1_); -+ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c); -+ for (StructureProcessor proc : p_215387_2_.func_215221_j()) { ++ Vector3d pos = transformedVec3d(p_215387_2_, entityInfo.pos).add(Vector3d.atLowerCornerOf(p_215387_1_)); ++ BlockPos blockpos = calculateRelativePosition(p_215387_2_, entityInfo.blockPos).offset(p_215387_1_); ++ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.nbt); ++ for (StructureProcessor proc : p_215387_2_.getProcessors()) { + info = proc.processEntity(p_215387_0_, p_215387_1_, entityInfo, info, p_215387_2_, template); + if (info == null) + break; @@ -76,28 +76,28 @@ + } + + private void addEntitiesToWorld(IServerWorld p_237143_1_, BlockPos p_237143_2_, PlacementSettings placementIn) { -+ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_237143_1_, p_237143_2_, placementIn, this.field_186271_b)) { -+ BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d()).func_177971_a(p_237143_2_); -+ blockpos = template$entityinfo.field_186248_b; // FORGE: Position will have already been transformed by processEntityInfos -+ if (placementIn.func_186213_g() == null || placementIn.func_186213_g().func_175898_b(blockpos)) { - CompoundNBT compoundnbt = template$entityinfo.field_186249_c.func_74737_b(); -- Vector3d vector3d = func_207667_a(template$entityinfo.field_186247_a, p_237143_3_, p_237143_4_, p_237143_5_); -- Vector3d vector3d1 = vector3d.func_72441_c((double)p_237143_2_.func_177958_n(), (double)p_237143_2_.func_177956_o(), (double)p_237143_2_.func_177952_p()); -+ Vector3d vector3d1 = template$entityinfo.field_186247_a; // FORGE: Position will have already been transformed by processEntityInfos ++ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_237143_1_, p_237143_2_, placementIn, this.entityInfoList)) { ++ BlockPos blockpos = transform(template$entityinfo.blockPos, placementIn.getMirror(), placementIn.getRotation(), placementIn.getRotationPivot()).offset(p_237143_2_); ++ blockpos = template$entityinfo.blockPos; // FORGE: Position will have already been transformed by processEntityInfos ++ if (placementIn.getBoundingBox() == null || placementIn.getBoundingBox().isInside(blockpos)) { + CompoundNBT compoundnbt = template$entityinfo.nbt.copy(); +- Vector3d vector3d = transform(template$entityinfo.pos, p_237143_3_, p_237143_4_, p_237143_5_); +- Vector3d vector3d1 = vector3d.add((double)p_237143_2_.getX(), (double)p_237143_2_.getY(), (double)p_237143_2_.getZ()); ++ Vector3d vector3d1 = template$entityinfo.pos; // FORGE: Position will have already been transformed by processEntityInfos ListNBT listnbt = new ListNBT(); - listnbt.add(DoubleNBT.func_229684_a_(vector3d1.field_72450_a)); - listnbt.add(DoubleNBT.func_229684_a_(vector3d1.field_72448_b)); + listnbt.add(DoubleNBT.valueOf(vector3d1.x)); + listnbt.add(DoubleNBT.valueOf(vector3d1.y)); @@ -391,10 +_,10 @@ - compoundnbt.func_218657_a("Pos", listnbt); - compoundnbt.func_82580_o("UUID"); - func_215382_a(p_237143_1_, compoundnbt).ifPresent((p_242927_6_) -> { -- float f = p_242927_6_.func_184217_a(p_237143_3_); -- f = f + (p_242927_6_.field_70177_z - p_242927_6_.func_184229_a(p_237143_4_)); -+ float f = p_242927_6_.func_184217_a(placementIn.func_186212_b()); -+ f = f + (p_242927_6_.field_70177_z - p_242927_6_.func_184229_a(placementIn.func_186215_c())); - p_242927_6_.func_70012_b(vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, f, p_242927_6_.field_70125_A); + compoundnbt.put("Pos", listnbt); + compoundnbt.remove("UUID"); + createEntityIgnoreException(p_237143_1_, compoundnbt).ifPresent((p_242927_6_) -> { +- float f = p_242927_6_.mirror(p_237143_3_); +- f = f + (p_242927_6_.yRot - p_242927_6_.rotate(p_237143_4_)); ++ float f = p_242927_6_.mirror(placementIn.getMirror()); ++ f = f + (p_242927_6_.yRot - p_242927_6_.rotate(placementIn.getRotation())); + p_242927_6_.moveTo(vector3d1.x, vector3d1.y, vector3d1.z, f, p_242927_6_.xRot); - if (p_237143_7_ && p_242927_6_ instanceof MobEntity) { -+ if (placementIn.func_237134_m_() && p_242927_6_ instanceof MobEntity) { - ((MobEntity)p_242927_6_).func_213386_a(p_237143_1_, p_237143_1_.func_175649_E(new BlockPos(vector3d1)), SpawnReason.STRUCTURE, (ILivingEntityData)null, compoundnbt); ++ if (placementIn.shouldFinalizeEntities() && p_242927_6_ instanceof MobEntity) { + ((MobEntity)p_242927_6_).finalizeSpawn(p_237143_1_, p_237143_1_.getCurrentDifficultyAt(new BlockPos(vector3d1)), SpawnReason.STRUCTURE, (ILivingEntityData)null, compoundnbt); } diff --git a/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch index 302690bbc2..ac4c336fc1 100644 --- a/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch @@ -6,6 +6,6 @@ -public class FoliagePlacerType

{ +public class FoliagePlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final FoliagePlacerType field_227386_a_ = func_236773_a_("blob_foliage_placer", BlobFoliagePlacer.field_236738_a_); - public static final FoliagePlacerType field_227387_b_ = func_236773_a_("spruce_foliage_placer", SpruceFoliagePlacer.field_236790_a_); - public static final FoliagePlacerType field_227388_c_ = func_236773_a_("pine_foliage_placer", PineFoliagePlacer.field_236784_a_); + public static final FoliagePlacerType BLOB_FOLIAGE_PLACER = register("blob_foliage_placer", BlobFoliagePlacer.CODEC); + public static final FoliagePlacerType SPRUCE_FOLIAGE_PLACER = register("spruce_foliage_placer", SpruceFoliagePlacer.CODEC); + public static final FoliagePlacerType PINE_FOLIAGE_PLACER = register("pine_foliage_placer", PineFoliagePlacer.CODEC); diff --git a/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch index 83ef9affd9..470a003586 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/gen/layer/BiomeLayer.java +++ b/net/minecraft/world/gen/layer/BiomeLayer.java @@ -10,12 +_,13 @@ - private static final int[] field_202746_t = new int[]{4, 3, 5, 1}; - private static final int[] field_202747_u = new int[]{12, 12, 12, 30}; - private int[] field_151623_c = field_202744_r; + private static final int[] COLD_BIOMES = new int[]{4, 3, 5, 1}; + private static final int[] ICE_BIOMES = new int[]{12, 12, 12, 30}; + private int[] warmBiomes = WARM_BIOMES; + private final boolean legacyDesert; + private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; public BiomeLayer(boolean p_i232147_1_) { - if (p_i232147_1_) { -- this.field_151623_c = field_202743_q; +- this.warmBiomes = LEGACY_WARM_BIOMES; - } - + this.legacyDesert = p_i232147_1_; @@ -17,29 +17,29 @@ + biomes[type.ordinal()] = new java.util.ArrayList<>(net.minecraftforge.common.BiomeManager.getBiomes(type)); } - public int func_202726_a(INoiseRandom p_202726_1_, int p_202726_2_) { + public int apply(INoiseRandom p_202726_1_, int p_202726_2_) { @@ -28,26 +_,39 @@ - return p_202726_1_.func_202696_a(3) == 0 ? 39 : 38; + return p_202726_1_.nextRandom(3) == 0 ? 39 : 38; } -- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)]; +- return this.warmBiomes[p_202726_1_.nextRandom(this.warmBiomes.length)]; + return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_); case 2: if (i > 0) { return 21; } -- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)]; +- return MEDIUM_BIOMES[p_202726_1_.nextRandom(MEDIUM_BIOMES.length)]; + return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_); case 3: if (i > 0) { return 32; } -- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)]; +- return COLD_BIOMES[p_202726_1_.nextRandom(COLD_BIOMES.length)]; + return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_); case 4: -- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)]; +- return ICE_BIOMES[p_202726_1_.nextRandom(ICE_BIOMES.length)]; + return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_); default: return 14; @@ -50,15 +50,15 @@ + } + + private int getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) { -+ return net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_148757_b( -+ net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_230516_a_(getBiome(type, context))); ++ return net.minecraft.util.registry.WorldGenRegistries.BIOME.getId( ++ net.minecraft.util.registry.WorldGenRegistries.BIOME.get(getBiome(type, context))); + } + protected net.minecraft.util.RegistryKey getBiome(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) { + if (type == net.minecraftforge.common.BiomeManager.BiomeType.DESERT && this.legacyDesert) + type = net.minecraftforge.common.BiomeManager.BiomeType.DESERT_LEGACY; + java.util.List biomeList = biomes[type.ordinal()]; -+ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList); -+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type) ? context.func_202696_a(totalWeight) : context.func_202696_a(totalWeight / 10) * 10; -+ return net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight).getKey(); ++ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type) ? context.nextRandom(totalWeight) : context.nextRandom(totalWeight / 10) * 10; ++ return net.minecraft.util.WeightedRandom.getWeightedItem(biomeList, weight).getKey(); } } diff --git a/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch b/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch index f472be26be..f0be36c209 100644 --- a/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/placement/Placement.java.patch @@ -6,6 +6,6 @@ -public abstract class Placement { +public abstract class Placement extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final Placement field_215022_h = func_214999_a("nope", new Passthrough(NoPlacementConfig.field_236555_a_)); - public static final Placement field_242898_b = func_214999_a("chance", new ChancePlacement(ChanceConfig.field_236950_a_)); - public static final Placement field_242899_c = func_214999_a("count", new CountPlacement(FeatureSpreadConfig.field_242797_a)); + public static final Placement NOPE = register("nope", new Passthrough(NoPlacementConfig.CODEC)); + public static final Placement CHANCE = register("chance", new ChancePlacement(ChanceConfig.CODEC)); + public static final Placement COUNT = register("count", new CountPlacement(FeatureSpreadConfig.CODEC)); diff --git a/patches/minecraft/net/minecraft/world/gen/settings/DimensionGeneratorSettings.java.patch b/patches/minecraft/net/minecraft/world/gen/settings/DimensionGeneratorSettings.java.patch index 3912df8c9c..148351d2b5 100644 --- a/patches/minecraft/net/minecraft/world/gen/settings/DimensionGeneratorSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/settings/DimensionGeneratorSettings.java.patch @@ -10,11 +10,11 @@ long i = (new Random()).nextLong(); if (!s1.isEmpty()) { @@ -210,6 +_,8 @@ - Registry registry = p_242753_0_.func_243612_b(Registry.field_239720_u_); - Registry registry1 = p_242753_0_.func_243612_b(Registry.field_243549_ar); - SimpleRegistry simpleregistry = DimensionType.func_242718_a(registry2, registry, registry1, i); + Registry registry = p_242753_0_.registryOrThrow(Registry.BIOME_REGISTRY); + Registry registry1 = p_242753_0_.registryOrThrow(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY); + SimpleRegistry simpleregistry = DimensionType.defaultDimensions(registry2, registry, registry1, i); + net.minecraftforge.common.world.ForgeWorldType type = net.minecraftforge.registries.ForgeRegistries.WORLD_TYPES.getValue(new net.minecraft.util.ResourceLocation(s4)); + if (type != null) return type.createSettings(p_242753_0_, i, flag, false, s); switch(s4) { case "flat": - JsonObject jsonobject = !s.isEmpty() ? JSONUtils.func_212745_a(s) : new JsonObject(); + JsonObject jsonobject = !s.isEmpty() ? JSONUtils.parse(s) : new JsonObject(); diff --git a/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch b/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch index 4ad336ae6e..637d39978d 100644 --- a/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/surfacebuilders/SurfaceBuilder.java.patch @@ -6,6 +6,6 @@ -public abstract class SurfaceBuilder { +public abstract class SurfaceBuilder extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final BlockState field_215410_g = Blocks.field_150346_d.func_176223_P(); - private static final BlockState field_215411_h = Blocks.field_196658_i.func_176223_P(); - private static final BlockState field_215412_i = Blocks.field_196661_l.func_176223_P(); + private static final BlockState DIRT = Blocks.DIRT.defaultBlockState(); + private static final BlockState GRASS_BLOCK = Blocks.GRASS_BLOCK.defaultBlockState(); + private static final BlockState PODZOL = Blocks.PODZOL.defaultBlockState(); diff --git a/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch index 13d6687c1f..b572ebd1d9 100644 --- a/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch @@ -6,6 +6,6 @@ -public class TreeDecoratorType

{ +public class TreeDecoratorType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final TreeDecoratorType field_227425_a_ = func_236877_a_("trunk_vine", TrunkVineTreeDecorator.field_236878_a_); - public static final TreeDecoratorType field_227426_b_ = func_236877_a_("leave_vine", LeaveVineTreeDecorator.field_236870_a_); - public static final TreeDecoratorType field_227427_c_ = func_236877_a_("cocoa", CocoaTreeDecorator.field_236866_a_); + public static final TreeDecoratorType TRUNK_VINE = register("trunk_vine", TrunkVineTreeDecorator.CODEC); + public static final TreeDecoratorType LEAVE_VINE = register("leave_vine", LeaveVineTreeDecorator.CODEC); + public static final TreeDecoratorType COCOA = register("cocoa", CocoaTreeDecorator.CODEC); diff --git a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch index 4988318e4c..70ae9d1e0b 100644 --- a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/lighting/BlockLightEngine.java +++ b/net/minecraft/world/lighting/BlockLightEngine.java @@ -117,4 +_,9 @@ - this.field_215627_c.func_215532_c(); - this.func_215469_a(Long.MAX_VALUE, p_215623_1_.func_218275_a(), 15 - p_215623_2_, true); + this.storage.runAllUpdates(); + this.checkEdge(Long.MAX_VALUE, p_215623_1_.asLong(), 15 - p_215623_2_, true); } + + @Override + public int queuedUpdateSize() { -+ return field_215627_c.queuedUpdateSize(); ++ return storage.queuedUpdateSize(); + } } diff --git a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch index 0f89ba8110..846473c7c2 100644 --- a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/lighting/LevelBasedGraph.java +++ b/net/minecraft/world/lighting/LevelBasedGraph.java @@ -228,4 +_,8 @@ - protected abstract void func_215476_a(long p_215476_1_, int p_215476_3_); + protected abstract void setLevel(long p_215476_1_, int p_215476_3_); - protected abstract int func_215480_b(long p_215480_1_, long p_215480_3_, int p_215480_5_); + protected abstract int computeLevelFromNeighbor(long p_215480_1_, long p_215480_3_, int p_215480_5_); + + protected int queuedUpdateSize() { -+ return field_215488_c.size(); ++ return computedLevels.size(); + } } diff --git a/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch index b249d6afcf..ef90ec16dc 100644 --- a/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/LightEngine.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/lighting/LightEngine.java +++ b/net/minecraft/world/lighting/LightEngine.java @@ -215,4 +_,6 @@ - long i = SectionPos.func_218169_f(SectionPos.func_218166_b(p_223129_1_.field_77276_a, 0, p_223129_1_.field_77275_b)); - this.field_215627_c.func_223113_c(i, p_223129_2_); + long i = SectionPos.getZeroNode(SectionPos.asLong(p_223129_1_.x, 0, p_223129_1_.z)); + this.storage.retainData(i, p_223129_2_); } + + public abstract int queuedUpdateSize(); diff --git a/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch index aa204fb518..57e1ec601e 100644 --- a/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/SkyLightEngine.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/lighting/SkyLightEngine.java +++ b/net/minecraft/world/lighting/SkyLightEngine.java @@ -228,4 +_,9 @@ - public String func_215614_b(long p_215614_1_) { - return super.func_215614_b(p_215614_1_) + (this.field_215627_c.func_215549_m(p_215614_1_) ? "*" : ""); + public String getDebugData(long p_215614_1_) { + return super.getDebugData(p_215614_1_) + (this.storage.isAboveData(p_215614_1_) ? "*" : ""); } + + @Override diff --git a/patches/minecraft/net/minecraft/world/raid/Raid.java.patch b/patches/minecraft/net/minecraft/world/raid/Raid.java.patch index bb2fd3cfce..fe5392ca62 100644 --- a/patches/minecraft/net/minecraft/world/raid/Raid.java.patch +++ b/patches/minecraft/net/minecraft/world/raid/Raid.java.patch @@ -6,13 +6,13 @@ - static enum WaveMember { + public static enum WaveMember implements net.minecraftforge.common.IExtensibleEnum { - VINDICATOR(EntityType.field_200758_ax, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), - EVOKER(EntityType.field_200806_t, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), - PILLAGER(EntityType.field_220350_aJ, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), + 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}), @@ -783,6 +_,20 @@ private WaveMember(EntityType p_i50602_3_, int[] p_i50602_4_) { - this.field_221285_g = p_i50602_3_; - this.field_221286_h = p_i50602_4_; + this.entityType = p_i50602_3_; + this.spawnsPerWaveBeforeBonus = p_i50602_4_; + } + + /** @@ -26,7 +26,7 @@ + @Override + @Deprecated + public void init() { -+ field_221284_f = values(); ++ VALUES = values(); } } } diff --git a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch index b849ab774f..a3cd1eaacc 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkHolder.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/server/ChunkHolder.java +++ b/net/minecraft/world/server/ChunkHolder.java @@ -61,6 +_,7 @@ - private final ChunkHolder.IPlayerProvider field_219328_w; - private boolean field_219329_x; - private boolean field_244384_x; + private final ChunkHolder.IPlayerProvider playerProvider; + private boolean wasAccessibleSinceLastSave; + private boolean resendLight; + Chunk currentlyLoading; //Forge - Used to bypass future chain when loading chunks. public ChunkHolder(ChunkPos p_i50716_1_, int p_i50716_2_, WorldLightManager p_i50716_3_, ChunkHolder.IListener p_i50716_4_, ChunkHolder.IPlayerProvider p_i50716_5_) { - this.field_219319_n = p_i50716_1_; + this.pos = p_i50716_1_; @@ -204,7 +_,7 @@ } - private void func_244385_a(World p_244385_1_, BlockPos p_244385_2_, BlockState p_244385_3_) { -- if (p_244385_3_.func_177230_c().func_235695_q_()) { + private void broadcastBlockEntityIfNeeded(World p_244385_1_, BlockPos p_244385_2_, BlockState p_244385_3_) { +- if (p_244385_3_.getBlock().isEntityBlock()) { + if (p_244385_3_.hasTileEntity()) { - this.func_219305_a(p_244385_1_, p_244385_2_); + this.broadcastBlockEntity(p_244385_1_, p_244385_2_); } diff --git a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch index b1469b0a67..cdde2d2631 100644 --- a/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ChunkManager.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/server/ChunkManager.java +++ b/net/minecraft/world/server/ChunkManager.java @@ -400,6 +_,7 @@ - if (this.field_219253_g.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) { + if (this.pendingUnloads.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) { if (p_219185_5_ instanceof Chunk) { - ((Chunk)p_219185_5_).func_177417_c(false); + ((Chunk)p_219185_5_).setLoaded(false); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload((Chunk)p_219185_5_)); } - this.func_219229_a(p_219185_5_); + this.save(p_219185_5_); @@ -581,6 +_,8 @@ - chunk.func_217318_w(); - if (this.field_219254_h.add(chunkpos.func_201841_a())) { - chunk.func_177417_c(true); + chunk.runPostLoad(); + if (this.entitiesInLevel.add(chunkpos.toLong())) { + chunk.setLoaded(true); + try { + p_219200_1_.currentlyLoading = chunk; //Forge - bypass the future chain when getChunk is called, this prevents deadlocks. - this.field_219255_i.func_147448_a(chunk.func_177434_r().values()); + this.level.addAllPendingBlockEntities(chunk.getBlockEntities().values()); List list = null; - ClassInheritanceMultiMap[] aclassinheritancemultimap = chunk.func_177429_s(); + ClassInheritanceMultiMap[] aclassinheritancemultimap = chunk.getEntitySections(); @@ -601,6 +_,10 @@ if (list != null) { - list.forEach(chunk::func_76622_b); + list.forEach(chunk::removeEntity); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + } finally { @@ -30,26 +30,26 @@ return chunk; @@ -678,6 +_,7 @@ - this.field_219255_i.func_217381_Z().func_230035_c_("chunkSave"); - CompoundNBT compoundnbt = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_219229_1_, p_219229_1_.getWorldForge() != null ? p_219229_1_.getWorldForge() : this.field_219255_i, compoundnbt)); - this.func_219100_a(chunkpos, compoundnbt); - this.func_241088_a_(chunkpos, chunkstatus.func_202129_d()); + this.level.getProfiler().incrementCounter("chunkSave"); + CompoundNBT compoundnbt = ChunkSerializer.write(this.level, p_219229_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_219229_1_, p_219229_1_.getWorldForge() != null ? p_219229_1_.getWorldForge() : this.level, compoundnbt)); + this.write(chunkpos, compoundnbt); + this.markPosition(chunkpos, chunkstatus.getChunkType()); return true; @@ -734,6 +_,7 @@ - protected void func_219199_a(ServerPlayerEntity p_219199_1_, ChunkPos p_219199_2_, IPacket[] p_219199_3_, boolean p_219199_4_, boolean p_219199_5_) { - if (p_219199_1_.field_70170_p == this.field_219255_i) { -+ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_219199_4_, p_219199_5_, p_219199_1_, p_219199_2_, this.field_219255_i); + protected void updateChunkTracking(ServerPlayerEntity p_219199_1_, ChunkPos p_219199_2_, IPacket[] p_219199_3_, boolean p_219199_4_, boolean p_219199_5_) { + if (p_219199_1_.level == this.level) { ++ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_219199_4_, p_219199_5_, p_219199_1_, p_219199_2_, this.level); if (p_219199_5_ && !p_219199_4_) { - ChunkHolder chunkholder = this.func_219219_b(p_219199_2_.func_201841_a()); + ChunkHolder chunkholder = this.getVisibleChunkIfPresent(p_219199_2_.toLong()); if (chunkholder != null) { @@ -942,7 +_,7 @@ } - protected void func_219210_a(Entity p_219210_1_) { + protected void addEntity(Entity p_219210_1_) { - if (!(p_219210_1_ instanceof EnderDragonPartEntity)) { + if (!(p_219210_1_ instanceof net.minecraftforge.entity.PartEntity)) { - EntityType entitytype = p_219210_1_.func_200600_R(); - int i = entitytype.func_233602_m_() * 16; - int j = entitytype.func_220332_l(); + EntityType entitytype = p_219210_1_.getType(); + int i = entitytype.clientTrackingRange() * 16; + int j = entitytype.updateInterval(); diff --git a/patches/minecraft/net/minecraft/world/server/ServerChunkProvider.java.patch b/patches/minecraft/net/minecraft/world/server/ServerChunkProvider.java.patch index 454d9966ea..09397c66a1 100644 --- a/patches/minecraft/net/minecraft/world/server/ServerChunkProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerChunkProvider.java.patch @@ -4,35 +4,35 @@ } } -+ ChunkHolder chunkholder = this.func_217213_a(i); ++ ChunkHolder chunkholder = this.getVisibleChunkIfPresent(i); + if (chunkholder != null && chunkholder.currentlyLoading != null) { + return chunkholder.currentlyLoading; //Forge - If the requested chunk is loading, bypass the future chain to prevent a deadlock. + } + - iprofiler.func_230035_c_("getChunkCacheMiss"); - CompletableFuture> completablefuture = this.func_217233_c(p_212849_1_, p_212849_2_, p_212849_3_, p_212849_4_); - this.field_217243_i.func_213161_c(completablefuture::isDone); + iprofiler.incrementCounter("getChunkCacheMiss"); + CompletableFuture> completablefuture = this.getChunkFutureMainThread(p_212849_1_, p_212849_2_, p_212849_3_, p_212849_4_); + this.mainThreadProcessor.managedBlock(completablefuture::isDone); @@ -353,7 +_,7 @@ if (optional1.isPresent()) { Chunk chunk = optional1.get(); - ChunkPos chunkpos = p_241099_7_.func_219277_h(); -- if (!this.field_217237_a.func_219243_d(chunkpos)) { -+ if (!this.field_217237_a.func_219243_d(chunkpos) || field_217237_a.func_219246_e().shouldForceTicks(chunkpos.func_201841_a())) { - chunk.func_177415_c(chunk.func_177416_w() + j); - if (flag1 && (this.field_217246_l || this.field_217247_m) && this.field_73251_h.func_175723_af().func_177730_a(chunk.func_76632_l())) { - WorldEntitySpawner.func_234979_a_(this.field_73251_h, chunk, worldentityspawner$entitydensitymanager, this.field_217247_m, this.field_217246_l, flag2); + ChunkPos chunkpos = p_241099_7_.getPos(); +- if (!this.chunkMap.noPlayersCloseForSpawning(chunkpos)) { ++ if (!this.chunkMap.noPlayersCloseForSpawning(chunkpos) || chunkMap.getDistanceManager().shouldForceTicks(chunkpos.toLong())) { + chunk.setInhabitedTime(chunk.getInhabitedTime() + j); + if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos())) { + WorldEntitySpawner.spawnForChunk(this.level, chunk, worldentityspawner$entitydensitymanager, this.spawnFriendlies, this.spawnEnemies, flag2); @@ -427,6 +_,14 @@ - public void func_217222_b(TicketType p_217222_1_, ChunkPos p_217222_2_, int p_217222_3_, T p_217222_4_) { - this.field_217240_d.func_219362_d(p_217222_1_, p_217222_2_, p_217222_3_, p_217222_4_); + public void removeRegionTicket(TicketType p_217222_1_, ChunkPos p_217222_2_, int p_217222_3_, T p_217222_4_) { + this.distanceManager.removeRegionTicket(p_217222_1_, p_217222_2_, p_217222_3_, p_217222_4_); + } + + public void registerTickingTicket(TicketType type, ChunkPos pos, int distance, T value) { -+ this.field_217240_d.registerTicking(type, pos, distance, value); ++ this.distanceManager.registerTicking(type, pos, distance, value); + } + + public void releaseTickingTicket(TicketType type, ChunkPos pos, int distance, T value) { -+ this.field_217240_d.releaseTicking(type, pos, distance, value); ++ this.distanceManager.releaseTicking(type, pos, distance, value); } - public void func_217206_a(ChunkPos p_217206_1_, boolean p_217206_2_) { + public void updateChunkForced(ChunkPos p_217206_1_, boolean p_217206_2_) { diff --git a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch index 5f4edffc77..5528caaecf 100644 --- a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch @@ -6,139 +6,139 @@ -public class ServerWorld extends World implements ISeedReader { +public class ServerWorld extends World implements ISeedReader, net.minecraftforge.common.extensions.IForgeWorldServer { - public static final BlockPos field_241108_a_ = new BlockPos(100, 50, 0); - private static final Logger field_147491_a = LogManager.getLogger(); - private final Int2ObjectMap field_217498_x = new Int2ObjectLinkedOpenHashMap<>(); + public static final BlockPos END_SPAWN_POINT = new BlockPos(100, 50, 0); + private static final Logger LOGGER = LogManager.getLogger(); + private final Int2ObjectMap entitiesById = new Int2ObjectLinkedOpenHashMap<>(); @@ -173,6 +_,8 @@ - private final DragonFightManager field_241105_O_; - private final StructureManager field_241106_P_; - private final boolean field_241107_Q_; + private final DragonFightManager dragonFight; + private final StructureManager structureFeatureManager; + private final boolean tickTime; + private net.minecraftforge.common.util.WorldCapabilityData capabilityData; + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); public ServerWorld(MinecraftServer p_i241885_1_, Executor p_i241885_2_, SaveFormat.LevelSave p_i241885_3_, IServerWorldInfo p_i241885_4_, RegistryKey p_i241885_5_, DimensionType p_i241885_6_, IChunkStatusListener p_i241885_7_, ChunkGenerator p_i241885_8_, boolean p_i241885_9_, long p_i241885_10_, List p_i241885_12_, boolean p_i241885_13_) { - super(p_i241885_4_, p_i241885_5_, p_i241885_6_, p_i241885_1_::func_213185_aS, false, p_i241885_9_, p_i241885_10_); + super(p_i241885_4_, p_i241885_5_, p_i241885_6_, p_i241885_1_::getProfiler, false, p_i241885_9_, p_i241885_10_); @@ -200,7 +_,7 @@ } else { - this.field_241105_O_ = null; + this.dragonFight = null; } - + this.initCapabilities(); } - public void func_241113_a_(int p_241113_1_, int p_241113_2_, boolean p_241113_3_, boolean p_241113_4_) { + public void setWeatherParameters(int p_241113_1_, int p_241113_2_, boolean p_241113_3_, boolean p_241113_4_) { @@ -296,15 +_,19 @@ - this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q), this.func_234923_W_()); + this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.THUNDER_LEVEL_CHANGE, this.thunderLevel), this.dimension()); } + /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, + * rather than to all players on the server. This is what causes the client-side rain, as the + * client believes that it has started raining locally, rather than in another dimension. + */ - if (flag != this.func_72896_J()) { + if (flag != this.isRaining()) { if (flag) { -- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241766_c_, 0.0F)); -+ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241766_c_, 0.0F), this.func_234923_W_()); +- this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.STOP_RAINING, 0.0F)); ++ this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.STOP_RAINING, 0.0F), this.dimension()); } else { -- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241765_b_, 0.0F)); -+ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241765_b_, 0.0F), this.func_234923_W_()); +- this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.START_RAINING, 0.0F)); ++ this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.START_RAINING, 0.0F), this.dimension()); } -- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241771_h_, this.field_73004_o)); -- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q)); -+ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241771_h_, this.field_73004_o), this.func_234923_W_()); -+ this.field_73061_a.func_184103_al().func_232642_a_(new SChangeGameStatePacket(SChangeGameStatePacket.field_241772_i_, this.field_73017_q), this.func_234923_W_()); +- this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.RAIN_LEVEL_CHANGE, this.rainLevel)); +- this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.THUNDER_LEVEL_CHANGE, this.thunderLevel)); ++ this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension()); ++ this.server.getPlayerList().broadcastAll(new SChangeGameStatePacket(SChangeGameStatePacket.THUNDER_LEVEL_CHANGE, this.thunderLevel), this.dimension()); } - if (this.field_73068_P && this.field_217491_A.stream().noneMatch((p_241132_0_) -> { + if (this.allPlayersSleeping && this.players.stream().noneMatch((p_241132_0_) -> { @@ -312,8 +_,8 @@ })) { - this.field_73068_P = false; - if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) { -- long l = this.field_72986_A.func_76073_f() + 24000L; -- this.func_241114_a_(l - l % 24000L); -+ long l = this.func_72820_D() + 24000L; -+ this.func_241114_a_(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D())); + this.allPlayersSleeping = false; + if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { +- long l = this.levelData.getDayTime() + 24000L; +- this.setDayTime(l - l % 24000L); ++ long l = this.getDayTime() + 24000L; ++ this.setDayTime(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.getDayTime())); } - this.func_229856_ab_(); + this.wakeUpAllPlayers(); @@ -338,7 +_,7 @@ - this.func_147488_Z(); - this.field_211159_Q = false; - iprofiler.func_219895_b("entities"); -- boolean flag3 = !this.field_217491_A.isEmpty() || !this.func_217469_z().isEmpty(); -+ boolean flag3 = !this.field_217491_A.isEmpty() || net.minecraftforge.common.world.ForgeChunkManager.hasForcedChunks(this); //Forge: Replace vanilla's has forced chunk check with forge's that checks both the vanilla and forge added ones + this.runBlockEvents(); + this.handlingTick = false; + iprofiler.popPush("entities"); +- boolean flag3 = !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); ++ boolean flag3 = !this.players.isEmpty() || net.minecraftforge.common.world.ForgeChunkManager.hasForcedChunks(this); //Forge: Replace vanilla's has forced chunk check with forge's that checks both the vanilla and forge added ones if (flag3) { - this.func_82742_i(); + this.resetEmptyTime(); } @@ -395,7 +_,7 @@ } - iprofiler.func_76320_a("tick"); -- if (!entity1.field_70128_L && !(entity1 instanceof EnderDragonPartEntity)) { -+ if (!entity1.field_70128_L && !(entity1 instanceof net.minecraftforge.entity.PartEntity)) { - this.func_217390_a(this::func_217479_a, entity1); + iprofiler.push("tick"); +- if (!entity1.removed && !(entity1 instanceof EnderDragonPartEntity)) { ++ if (!entity1.removed && !(entity1 instanceof net.minecraftforge.entity.PartEntity)) { + this.guardEntityTick(this::tickNonPassenger, entity1); } @@ -404,7 +_,7 @@ - if (entity1.field_70128_L) { - this.func_217454_n(entity1); + if (entity1.removed) { + this.removeFromChunk(entity1); objectiterator.remove(); -- this.func_217484_g(entity1); +- this.onEntityRemoved(entity1); + this.removeEntityComplete(entity1, entity1 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly. } - iprofiler.func_76319_b(); + iprofiler.pop(); @@ -475,6 +_,7 @@ - BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15)); - BlockPos blockpos3 = blockpos2.func_177977_b(); - Biome biome = this.func_226691_t_(blockpos2); + BlockPos blockpos2 = this.getHeightmapPos(Heightmap.Type.MOTION_BLOCKING, this.getBlockRandomPos(i, 0, j, 15)); + BlockPos blockpos3 = blockpos2.below(); + Biome biome = this.getBiome(blockpos2); + if (this.isAreaLoaded(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks - if (biome.func_201848_a(this, blockpos3)) { - this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P()); + if (biome.shouldFreeze(this, blockpos3)) { + this.setBlockAndUpdate(blockpos3, Blocks.ICE.defaultBlockState()); } @@ -598,9 +_,10 @@ - ++p_217479_1_.field_70173_aa; - IProfiler iprofiler = this.func_217381_Z(); - iprofiler.func_194340_a(() -> { -- return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString(); -+ return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString(); + ++p_217479_1_.tickCount; + IProfiler iprofiler = this.getProfiler(); + iprofiler.push(() -> { +- return Registry.ENTITY_TYPE.getKey(p_217479_1_.getType()).toString(); ++ return p_217479_1_.getType().getRegistryName() == null ? p_217479_1_.getType().toString() : p_217479_1_.getType().getRegistryName().toString(); }); - iprofiler.func_230035_c_("tickNonPassenger"); + iprofiler.incrementCounter("tickNonPassenger"); + if (p_217479_1_.canUpdate()) - p_217479_1_.func_70071_h_(); - iprofiler.func_76319_b(); + p_217479_1_.tick(); + iprofiler.pop(); } @@ -687,6 +_,7 @@ - p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks")); + p_217445_1_.progressStage(new TranslationTextComponent("menu.savingChunks")); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - serverchunkprovider.func_217210_a(p_217445_2_); + serverchunkprovider.save(p_217445_2_); } } @@ -777,6 +_,7 @@ } - private void func_217448_f(ServerPlayerEntity p_217448_1_) { + private void addPlayer(ServerPlayerEntity p_217448_1_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217448_1_, this))) return; - Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au()); + Entity entity = this.entitiesByUuid.get(p_217448_1_.getUUID()); if (entity != null) { - field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString()); + LOGGER.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.getUUID().toString()); @@ -801,6 +_,7 @@ - } else if (this.func_217478_l(p_72838_1_)) { + } else if (this.isUUIDUsed(p_72838_1_)) { return false; } else { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this))) return false; - IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); + IChunk ichunk = this.getChunk(MathHelper.floor(p_72838_1_.getX() / 16.0D), MathHelper.floor(p_72838_1_.getZ() / 16.0D), ChunkStatus.FULL, p_72838_1_.forcedLoading); if (!(ichunk instanceof Chunk)) { return false; @@ -816,6 +_,7 @@ - if (this.func_217478_l(p_217440_1_)) { + if (this.isUUIDUsed(p_217440_1_)) { return false; } else { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217440_1_, this))) return false; - this.func_217465_m(p_217440_1_); + this.add(p_217440_1_); return true; } @@ -879,10 +_,15 @@ @@ -146,22 +146,22 @@ } + @Deprecated //Forge: Use removeEntityComplete(entity,boolean) - public void func_217484_g(Entity p_217484_1_) { + public void onEntityRemoved(Entity p_217484_1_) { - if (p_217484_1_ instanceof EnderDragonEntity) { -- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217484_1_).func_213404_dT()) { -- enderdragonpartentity.func_70106_y(); +- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217484_1_).getSubEntities()) { +- enderdragonpartentity.remove(); + removeEntityComplete(p_217484_1_, false); + } + public void removeEntityComplete(Entity p_217484_1_, boolean keepData) { + if (p_217484_1_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity enderdragonpartentity : p_217484_1_.getParts()) { + enderdragonpartentity.remove(keepData); -+ this.partEntities.remove(enderdragonpartentity.func_145782_y()); ++ this.partEntities.remove(enderdragonpartentity.getId()); } } @@ -898,6 +_,9 @@ - this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as()); + this.navigations.remove(((MobEntity)p_217484_1_).getNavigation()); } + p_217484_1_.onRemovedFromWorld(); @@ -169,17 +169,17 @@ + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_217484_1_, this)); } - private void func_217465_m(Entity p_217465_1_) { + private void add(Entity p_217465_1_) { @@ -905,9 +_,10 @@ - this.field_217499_z.add(p_217465_1_); + this.toAddAfterTick.add(p_217465_1_); } else { - this.field_217498_x.put(p_217465_1_.func_145782_y(), p_217465_1_); + this.entitiesById.put(p_217465_1_.getId(), p_217465_1_); - if (p_217465_1_ instanceof EnderDragonEntity) { -- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217465_1_).func_213404_dT()) { +- for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217465_1_).getSubEntities()) { + if (p_217465_1_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity enderdragonpartentity : p_217465_1_.getParts()) { - this.field_217498_x.put(enderdragonpartentity.func_145782_y(), enderdragonpartentity); -+ this.partEntities.put(enderdragonpartentity.func_145782_y(), enderdragonpartentity); + this.entitiesById.put(enderdragonpartentity.getId(), enderdragonpartentity); ++ this.partEntities.put(enderdragonpartentity.getId(), enderdragonpartentity); } } @@ -190,16 +190,16 @@ + p_217465_1_.onAddedToWorld(); } - public void func_217467_h(Entity p_217467_1_) { + public void despawn(Entity p_217467_1_) { + removeEntity(p_217467_1_, false); + } + public void removeEntity(Entity p_217467_1_, boolean keepData) { - if (this.field_217492_a) { - throw (IllegalStateException)Util.func_229757_c_(new IllegalStateException("Removing entity while ticking!")); + if (this.tickingEntities) { + throw (IllegalStateException)Util.pauseInIde(new IllegalStateException("Removing entity while ticking!")); } else { - this.func_217454_n(p_217467_1_); - this.field_217498_x.remove(p_217467_1_.func_145782_y()); -- this.func_217484_g(p_217467_1_); + this.removeFromChunk(p_217467_1_); + this.entitiesById.remove(p_217467_1_.getId()); +- this.onEntityRemoved(p_217467_1_); + this.removeEntityComplete(p_217467_1_, keepData); } } @@ -207,60 +207,60 @@ @@ -939,8 +_,11 @@ } - public void func_217434_e(ServerPlayerEntity p_217434_1_) { -- p_217434_1_.func_70106_y(); -- this.func_217467_h(p_217434_1_); + public void removePlayerImmediately(ServerPlayerEntity p_217434_1_) { +- p_217434_1_.remove(); +- this.despawn(p_217434_1_); + removePlayer(p_217434_1_, false); + } + public void removePlayer(ServerPlayerEntity p_217434_1_, boolean keepData) { + p_217434_1_.remove(keepData); + this.removeEntity(p_217434_1_, keepData); - this.func_72854_c(); + this.updateSleepingPlayerList(); } @@ -959,10 +_,20 @@ } - public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { + public void playSound(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); + if (event.isCanceled() || event.getSound() == null) return; + p_184148_8_ = event.getSound(); + p_184148_9_ = event.getCategory(); + p_184148_10_ = event.getVolume(); - this.field_73061_a.func_184103_al().func_148543_a(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_ > 1.0F ? (double)(16.0F * p_184148_10_) : 16.0D, this.func_234923_W_(), new SPlaySoundEffectPacket(p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_)); + this.server.getPlayerList().broadcast(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_ > 1.0F ? (double)(16.0F * p_184148_10_) : 16.0D, this.dimension(), new SPlaySoundEffectPacket(p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_)); } - public void func_217384_a(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) { + public void playSound(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_217384_1_, p_217384_3_, p_217384_4_, p_217384_5_, p_217384_6_); + if (event.isCanceled() || event.getSound() == null) return; + p_217384_3_ = event.getSound(); + p_217384_4_ = event.getCategory(); + p_217384_5_ = event.getVolume(); - this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.func_234923_W_(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); + this.server.getPlayerList().broadcast(p_217384_1_, p_217384_2_.getX(), p_217384_2_.getY(), p_217384_2_.getZ(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.dimension(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); } @@ -998,6 +_,7 @@ - public Explosion func_230546_a_(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable ExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { + public Explosion explode(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable ExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_) { Explosion explosion = new Explosion(this, p_230546_1_, p_230546_2_, p_230546_3_, p_230546_4_, p_230546_6_, p_230546_8_, p_230546_10_, p_230546_11_, p_230546_12_); + if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.func_77278_a(); - explosion.func_77279_a(false); + explosion.explode(); + explosion.finalizeExplosion(false); if (p_230546_12_ == Explosion.Mode.NONE) { @@ -1409,5 +_,20 @@ - BlockPos.func_191531_b(i - 2, j, k - 2, i + 2, j, k + 2).forEach((p_241122_1_) -> { - p_241121_0_.func_175656_a(p_241122_1_, Blocks.field_150343_Z.func_176223_P()); + BlockPos.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((p_241122_1_) -> { + p_241121_0_.setBlockAndUpdate(p_241122_1_, Blocks.OBSIDIAN.defaultBlockState()); }); + } + + protected void initCapabilities() { + this.gatherCapabilities(); -+ capabilityData = this.func_217481_x().func_215752_a(() -> new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()), net.minecraftforge.common.util.WorldCapabilityData.ID); ++ capabilityData = this.getDataStorage().computeIfAbsent(() -> new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()), net.minecraftforge.common.util.WorldCapabilityData.ID); + capabilityData.setCapabilities(getCapabilities()); + } + + public java.util.stream.Stream getEntities() { -+ return field_217498_x.values().stream(); ++ return entitiesById.values().stream(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/server/Ticket.java.patch b/patches/minecraft/net/minecraft/world/server/Ticket.java.patch index 0a00ce0f11..aecb957cc4 100644 --- a/patches/minecraft/net/minecraft/world/server/Ticket.java.patch +++ b/patches/minecraft/net/minecraft/world/server/Ticket.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/server/Ticket.java +++ b/net/minecraft/world/server/Ticket.java @@ -9,9 +_,14 @@ - private long field_219483_d; + private long createdTick; protected Ticket(TicketType p_i226095_1_, int p_i226095_2_, T p_i226095_3_) { + this(p_i226095_1_, p_i226095_2_, p_i226095_3_, false); + } + + public Ticket(TicketType p_i226095_1_, int p_i226095_2_, T p_i226095_3_, boolean forceTicks) { - this.field_219480_a = p_i226095_1_; - this.field_219481_b = p_i226095_2_; - this.field_219482_c = p_i226095_3_; + this.type = p_i226095_1_; + this.ticketLevel = p_i226095_2_; + this.key = p_i226095_3_; + this.forceTicks = forceTicks; } @@ -19,26 +19,26 @@ return false; } else { Ticket ticket = (Ticket)p_equals_1_; -- return this.field_219481_b == ticket.field_219481_b && Objects.equals(this.field_219480_a, ticket.field_219480_a) && Objects.equals(this.field_219482_c, ticket.field_219482_c); -+ return this.field_219481_b == ticket.field_219481_b && Objects.equals(this.field_219480_a, ticket.field_219480_a) && Objects.equals(this.field_219482_c, ticket.field_219482_c) && this.forceTicks == ticket.forceTicks; +- return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key); ++ return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key) && this.forceTicks == ticket.forceTicks; } } public int hashCode() { -- return Objects.hash(this.field_219480_a, this.field_219481_b, this.field_219482_c); -+ return Objects.hash(this.field_219480_a, this.field_219481_b, this.field_219482_c, forceTicks); +- return Objects.hash(this.type, this.ticketLevel, this.key); ++ return Objects.hash(this.type, this.ticketLevel, this.key, forceTicks); } public String toString() { -- return "Ticket[" + this.field_219480_a + " " + this.field_219481_b + " (" + this.field_219482_c + ")] at " + this.field_219483_d; -+ return "Ticket[" + this.field_219480_a + " " + this.field_219481_b + " (" + this.field_219482_c + ")] at " + this.field_219483_d + " force ticks " + forceTicks; +- return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick; ++ return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick + " force ticks " + forceTicks; } - public TicketType func_219479_a() { + public TicketType getType() { @@ -58,5 +_,12 @@ - protected boolean func_223182_a(long p_223182_1_) { - long i = this.field_219480_a.func_223184_b(); - return i != 0L && p_223182_1_ - this.field_219483_d > i; + protected boolean timedOut(long p_223182_1_) { + long i = this.type.timeout(); + return i != 0L && p_223182_1_ - this.createdTick > i; + } + + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/world/server/TicketManager.java.patch b/patches/minecraft/net/minecraft/world/server/TicketManager.java.patch index f786f99812..3409c01174 100644 --- a/patches/minecraft/net/minecraft/world/server/TicketManager.java.patch +++ b/patches/minecraft/net/minecraft/world/server/TicketManager.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/server/TicketManager.java +++ b/net/minecraft/world/server/TicketManager.java @@ -49,6 +_,8 @@ - private final Executor field_219388_p; - private long field_219389_q; + private final Executor mainThreadExecutor; + private long ticketTickCounter; + private final Long2ObjectOpenHashMap>> forcedTickets = new Long2ObjectOpenHashMap<>(); + protected TicketManager(Executor p_i50707_1_, Executor p_i50707_2_) { - ITaskExecutor itaskexecutor = ITaskExecutor.func_213140_a("player ticket throttler", p_i50707_2_::execute); + ITaskExecutor itaskexecutor = ITaskExecutor.of("player ticket throttler", p_i50707_2_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(itaskexecutor), p_i50707_1_, 4); @@ -143,6 +_,10 @@ - this.field_219378_f.func_215491_b(p_219347_1_, p_219347_3_.func_219477_b(), true); + this.ticketTracker.update(p_219347_1_, p_219347_3_.getTicketLevel(), true); } + if (p_219347_3_.isForceTicks()) { -+ SortedArraySet> tickets = forcedTickets.computeIfAbsent(p_219347_1_, e -> SortedArraySet.func_226172_a_(4)); -+ tickets.func_226175_a_(ticket); ++ SortedArraySet> tickets = forcedTickets.computeIfAbsent(p_219347_1_, e -> SortedArraySet.create(4)); ++ tickets.addOrGet(ticket); + } } - private void func_219349_b(long p_219349_1_, Ticket p_219349_3_) { + private void removeTicket(long p_219349_1_, Ticket p_219349_3_) { @@ -155,6 +_,13 @@ } - this.field_219378_f.func_215491_b(p_219349_1_, func_229844_a_(sortedarrayset), false); + this.ticketTracker.update(p_219349_1_, getTicketLevelAt(sortedarrayset), false); + + if (p_219349_3_.isForceTicks()) { + SortedArraySet> tickets = forcedTickets.get(p_219349_1_); @@ -33,26 +33,26 @@ + } } - public void func_219356_a(TicketType p_219356_1_, ChunkPos p_219356_2_, int p_219356_3_, T p_219356_4_) { + public void addTicket(TicketType p_219356_1_, ChunkPos p_219356_2_, int p_219356_3_, T p_219356_4_) { @@ -175,6 +_,14 @@ - this.func_219349_b(p_219362_2_.func_201841_a(), ticket); + this.removeTicket(p_219362_2_.toLong(), ticket); } + public void registerTicking(TicketType type, ChunkPos pos, int distance, T value) { -+ this.func_219347_a(pos.func_201841_a(), new Ticket<>(type, 33 - distance, value, true)); ++ this.addTicket(pos.toLong(), new Ticket<>(type, 33 - distance, value, true)); + } + + public void releaseTicking(TicketType type, ChunkPos pos, int distance, T value) { -+ this.func_219349_b(pos.func_201841_a(), new Ticket<>(type, 33 - distance, value, true)); ++ this.removeTicket(pos.toLong(), new Ticket<>(type, 33 - distance, value, true)); + } + - private SortedArraySet> func_229848_e_(long p_229848_1_) { - return this.field_219377_e.computeIfAbsent(p_229848_1_, (p_229851_0_) -> { - return SortedArraySet.func_226172_a_(4); + private SortedArraySet> getTickets(long p_229848_1_) { + return this.tickets.computeIfAbsent(p_229848_1_, (p_229851_0_) -> { + return SortedArraySet.create(4); @@ -240,6 +_,11 @@ - public String func_225412_c() { - return this.field_219384_l.func_225396_a(); + public String getDebugStatus() { + return this.ticketThrottler.getDebugStatus(); + } + + public boolean shouldForceTicks(long chunkPos) { diff --git a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch index c882fe4b23..812228ca9d 100644 --- a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/world/spawner/AbstractSpawner.java +++ b/net/minecraft/world/spawner/AbstractSpawner.java @@ -131,11 +_,12 @@ - entity.func_70012_b(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_(), world.field_73012_v.nextFloat() * 360.0F, 0.0F); + entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), world.random.nextFloat() * 360.0F, 0.0F); if (entity instanceof MobEntity) { MobEntity mobentity = (MobEntity)entity; -- if (!mobentity.func_213380_a(world, SpawnReason.SPAWNER) || !mobentity.func_205019_a(world)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this)) { +- if (!mobentity.checkSpawnRules(world, SpawnReason.SPAWNER) || !mobentity.checkSpawnObstruction(world)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mobentity, world, (float)entity.getX(), (float)entity.getY(), (float)entity.getZ(), this)) { continue; } - if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this, SpawnReason.SPAWNER)) - ((MobEntity)entity).func_213386_a(serverworld, world.func_175649_E(entity.func_233580_cy_()), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null); + if (this.nextSpawnData.getTag().size() == 1 && this.nextSpawnData.getTag().contains("id", 8)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, world, (float)entity.getX(), (float)entity.getY(), (float)entity.getZ(), this, SpawnReason.SPAWNER)) + ((MobEntity)entity).finalizeSpawn(serverworld, world.getCurrentDifficultyAt(entity.blockPosition()), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null); } } @@ -282,5 +_,10 @@ @OnlyIn(Dist.CLIENT) - public double func_177223_e() { - return this.field_98284_d; + public double getoSpin() { + return this.oSpin; + } + + @Nullable diff --git a/patches/minecraft/net/minecraft/world/spawner/CatSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/CatSpawner.java.patch index 7de34db9f9..d5711f3753 100644 --- a/patches/minecraft/net/minecraft/world/spawner/CatSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/CatSpawner.java.patch @@ -4,10 +4,10 @@ if (catentity == null) { return 0; } else { -+ catentity.func_174828_a(p_221122_1_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat -+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(catentity, p_221122_2_, p_221122_1_.func_177958_n(), p_221122_1_.func_177956_o(), p_221122_1_.func_177952_p(), null, SpawnReason.NATURAL) == -1) return 0; - catentity.func_213386_a(p_221122_2_, p_221122_2_.func_175649_E(p_221122_1_), SpawnReason.NATURAL, (ILivingEntityData)null, (CompoundNBT)null); -- catentity.func_174828_a(p_221122_1_, 0.0F, 0.0F); - p_221122_2_.func_242417_l(catentity); ++ catentity.moveTo(p_221122_1_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat ++ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(catentity, p_221122_2_, p_221122_1_.getX(), p_221122_1_.getY(), p_221122_1_.getZ(), null, SpawnReason.NATURAL) == -1) return 0; + catentity.finalizeSpawn(p_221122_2_, p_221122_2_.getCurrentDifficultyAt(p_221122_1_), SpawnReason.NATURAL, (ILivingEntityData)null, (CompoundNBT)null); +- catentity.moveTo(p_221122_1_, 0.0F, 0.0F); + p_221122_2_.addFreshEntityWithPassengers(catentity); return 1; } diff --git a/patches/minecraft/net/minecraft/world/spawner/PatrolSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/PatrolSpawner.java.patch index bef881318e..9ccecdbe8e 100644 --- a/patches/minecraft/net/minecraft/world/spawner/PatrolSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/PatrolSpawner.java.patch @@ -3,8 +3,8 @@ @@ -101,6 +_,7 @@ } - patrollerentity.func_70107_b((double)p_222695_2_.func_177958_n(), (double)p_222695_2_.func_177956_o(), (double)p_222695_2_.func_177952_p()); -+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollerentity, p_222695_1_, p_222695_2_.func_177958_n(), p_222695_2_.func_177956_o(), p_222695_2_.func_177952_p(), null, SpawnReason.PATROL) == -1) return false; - patrollerentity.func_213386_a(p_222695_1_, p_222695_1_.func_175649_E(p_222695_2_), SpawnReason.PATROL, (ILivingEntityData)null, (CompoundNBT)null); - p_222695_1_.func_242417_l(patrollerentity); + patrollerentity.setPos((double)p_222695_2_.getX(), (double)p_222695_2_.getY(), (double)p_222695_2_.getZ()); ++ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollerentity, p_222695_1_, p_222695_2_.getX(), p_222695_2_.getY(), p_222695_2_.getZ(), null, SpawnReason.PATROL) == -1) return false; + patrollerentity.finalizeSpawn(p_222695_1_, p_222695_1_.getCurrentDifficultyAt(p_222695_2_), SpawnReason.PATROL, (ILivingEntityData)null, (CompoundNBT)null); + p_222695_1_.addFreshEntityWithPassengers(patrollerentity); return true; diff --git a/patches/minecraft/net/minecraft/world/spawner/PhantomSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/PhantomSpawner.java.patch index a4bd2bb9bc..c48a67f516 100644 --- a/patches/minecraft/net/minecraft/world/spawner/PhantomSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/PhantomSpawner.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/world/spawner/PhantomSpawner.java @@ -58,6 +_,7 @@ for(int i1 = 0; i1 < l; ++i1) { - PhantomEntity phantomentity = EntityType.field_203097_aH.func_200721_a(p_230253_1_); - phantomentity.func_174828_a(blockpos1, 0.0F, 0.0F); -+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(phantomentity, p_230253_1_, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), null, SpawnReason.NATURAL) == -1) return 0; - ilivingentitydata = phantomentity.func_213386_a(p_230253_1_, difficultyinstance, SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); - p_230253_1_.func_242417_l(phantomentity); + PhantomEntity phantomentity = EntityType.PHANTOM.create(p_230253_1_); + phantomentity.moveTo(blockpos1, 0.0F, 0.0F); ++ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(phantomentity, p_230253_1_, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ(), null, SpawnReason.NATURAL) == -1) return 0; + ilivingentitydata = phantomentity.finalizeSpawn(p_230253_1_, difficultyinstance, SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); + p_230253_1_.addFreshEntityWithPassengers(phantomentity); } diff --git a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch index 0820c81fcb..d83f9d5cee 100644 --- a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/world/spawner/WorldEntitySpawner.java +++ b/net/minecraft/world/spawner/WorldEntitySpawner.java @@ -82,7 +_,7 @@ - } while(mobentity.func_104002_bU() || mobentity.func_213392_I()); + } while(mobentity.isPersistenceRequired() || mobentity.requiresCustomPersistence()); final Entity entity_f = entity; -- EntityClassification entityclassification = entity.func_200600_R().func_220339_d(); +- EntityClassification entityclassification = entity.getType().getCategory(); + EntityClassification entityclassification = entity.getClassification(true); if (entityclassification != EntityClassification.MISC) { - BlockPos blockpos = entity.func_233580_cy_(); - long i = ChunkPos.func_77272_a(blockpos.func_177958_n() >> 4, blockpos.func_177952_p() >> 4); + BlockPos blockpos = entity.blockPosition(); + long i = ChunkPos.asLong(blockpos.getX() >> 4, blockpos.getZ() >> 4); @@ -169,13 +_,15 @@ } - mobentity.func_70012_b(d0, (double)i, d1, p_234966_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if (func_234974_a_(p_234966_1_, mobentity, d2)) { + mobentity.moveTo(d0, (double)i, d1, p_234966_1_.random.nextFloat() * 360.0F, 0.0F); +- if (isValidPositionForMob(p_234966_1_, mobentity, d2)) { + int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_234966_1_, d0, i, d1, null, SpawnReason.NATURAL); -+ if (canSpawn != -1 && (canSpawn == 1 || func_234974_a_(p_234966_1_, mobentity, d2))) { ++ if (canSpawn != -1 && (canSpawn == 1 || isValidPositionForMob(p_234966_1_, mobentity, d2))) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_234966_1_, (float)d0, (float)i, (float)d1, null, SpawnReason.NATURAL)) - ilivingentitydata = mobentity.func_213386_a(p_234966_1_, p_234966_1_.func_175649_E(mobentity.func_233580_cy_()), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); + ilivingentitydata = mobentity.finalizeSpawn(p_234966_1_, p_234966_1_.getCurrentDifficultyAt(mobentity.blockPosition()), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); ++j; ++l1; - p_234966_1_.func_242417_l(mobentity); + p_234966_1_.addFreshEntityWithPassengers(mobentity); p_234966_5_.run(mobentity, p_234966_2_); -- if (j >= mobentity.func_70641_bl()) { +- if (j >= mobentity.getMaxSpawnClusterSize()) { + if (j >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) { return; } @@ -30,15 +30,15 @@ @@ -253,6 +_,7 @@ return null; } else { - List list = func_241463_a_(p_234977_0_, p_234977_1_, p_234977_2_, p_234977_3_, p_234977_5_, biome); + List list = mobsAt(p_234977_0_, p_234977_1_, p_234977_2_, p_234977_3_, p_234977_5_, biome); + list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(p_234977_0_, p_234977_3_, p_234977_5_, list); - return list.isEmpty() ? null : WeightedRandom.func_76271_a(p_234977_4_, list); + return list.isEmpty() ? null : WeightedRandom.getRandomItem(p_234977_4_, list); } } @@ -292,6 +_,13 @@ if (p_209382_0_ == EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS) { return true; - } else if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) { + } else if (p_209382_3_ != null && p_209382_1_.getWorldBorder().isWithinBounds(p_209382_2_)) { + return p_209382_0_.canSpawnAt(p_209382_1_, p_209382_2_, p_209382_3_); + } + return false; @@ -46,18 +46,18 @@ + + public static boolean canSpawnAtBody(EntitySpawnPlacementRegistry.PlacementType p_209382_0_, IWorldReader p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType p_209382_3_) { + { - BlockState blockstate = p_209382_1_.func_180495_p(p_209382_2_); - FluidState fluidstate = p_209382_1_.func_204610_c(p_209382_2_); - BlockPos blockpos = p_209382_2_.func_177984_a(); + BlockState blockstate = p_209382_1_.getBlockState(p_209382_2_); + FluidState fluidstate = p_209382_1_.getFluidState(p_209382_2_); + BlockPos blockpos = p_209382_2_.above(); @@ -304,14 +_,12 @@ case ON_GROUND: default: - BlockState blockstate1 = p_209382_1_.func_180495_p(blockpos1); -- if (!blockstate1.func_215688_a(p_209382_1_, blockpos1, p_209382_3_)) { + BlockState blockstate1 = p_209382_1_.getBlockState(blockpos1); +- if (!blockstate1.isValidSpawn(p_209382_1_, blockpos1, p_209382_3_)) { + if (!blockstate1.canCreatureSpawn(p_209382_1_, blockpos1, p_209382_0_, p_209382_3_)) { return false; } else { - return func_234968_a_(p_209382_1_, p_209382_2_, blockstate, fluidstate, p_209382_3_) && func_234968_a_(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos), p_209382_3_); + return isValidEmptySpawnBlock(p_209382_1_, p_209382_2_, blockstate, fluidstate, p_209382_3_) && isValidEmptySpawnBlock(p_209382_1_, blockpos, p_209382_1_.getBlockState(blockpos), p_209382_1_.getFluidState(blockpos), p_209382_3_); } } - } else { @@ -66,10 +66,10 @@ } @@ -355,6 +_,7 @@ - entity.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F); + entity.moveTo(d0, (double)blockpos.getY(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F); if (entity instanceof MobEntity) { MobEntity mobentity = (MobEntity)entity; -+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_77191_0_, d0, blockpos.func_177956_o(), d1, null, SpawnReason.CHUNK_GENERATION) == -1) continue; - if (mobentity.func_213380_a(p_77191_0_, SpawnReason.CHUNK_GENERATION) && mobentity.func_205019_a(p_77191_0_)) { - ilivingentitydata = mobentity.func_213386_a(p_77191_0_, p_77191_0_.func_175649_E(mobentity.func_233580_cy_()), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null); - p_77191_0_.func_242417_l(mobentity); ++ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_77191_0_, d0, blockpos.getY(), d1, null, SpawnReason.CHUNK_GENERATION) == -1) continue; + if (mobentity.checkSpawnRules(p_77191_0_, SpawnReason.CHUNK_GENERATION) && mobentity.checkSpawnObstruction(p_77191_0_)) { + ilivingentitydata = mobentity.finalizeSpawn(p_77191_0_, p_77191_0_.getCurrentDifficultyAt(mobentity.blockPosition()), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null); + p_77191_0_.addFreshEntityWithPassengers(mobentity); diff --git a/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch b/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch index a79f9cb2c7..74a0ebd298 100644 --- a/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/world/storage/DimensionSavedDataManager.java @@ -47,9 +_,13 @@ @Nullable - public T func_215753_b(Supplier p_215753_1_, String p_215753_2_) { - WorldSavedData worldsaveddata = this.field_212778_c.get(p_215753_2_); + public T get(Supplier p_215753_1_, String p_215753_2_) { + WorldSavedData worldsaveddata = this.cache.get(p_215753_2_); + if (worldsaveddata == net.minecraftforge.common.util.DummyWorldSaveData.DUMMY) return null; - if (worldsaveddata == null && !this.field_212778_c.containsKey(p_215753_2_)) { - worldsaveddata = this.func_223409_c(p_215753_1_, p_215753_2_); - this.field_212778_c.put(p_215753_2_, worldsaveddata); + if (worldsaveddata == null && !this.cache.containsKey(p_215753_2_)) { + worldsaveddata = this.readSavedData(p_215753_1_, p_215753_2_); + this.cache.put(p_215753_2_, worldsaveddata); + } else if (worldsaveddata == null) { -+ this.field_212778_c.put(p_215753_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY); ++ this.cache.put(p_215753_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY); + return null; } diff --git a/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch index 805b5e2e85..716bbbf4e4 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/storage/MapDecoration.java +++ b/net/minecraft/world/storage/MapDecoration.java @@ -82,6 +_,16 @@ - return 31 * i + Objects.hashCode(this.field_204310_e); + return 31 * i + Objects.hashCode(this.name); } + /** diff --git a/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch b/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch index 0aeba3aef9..b8b1819e2c 100644 --- a/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/PlayerData.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/storage/PlayerData.java +++ b/net/minecraft/world/storage/PlayerData.java @@ -31,6 +_,7 @@ - File file2 = new File(this.field_237333_c_, p_237335_1_.func_189512_bd() + ".dat"); - File file3 = new File(this.field_237333_c_, p_237335_1_.func_189512_bd() + ".dat_old"); - Util.func_240977_a_(file2, file1, file3); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_237335_1_, field_237333_c_, p_237335_1_.func_189512_bd()); + File file2 = new File(this.playerDir, p_237335_1_.getStringUUID() + ".dat"); + File file3 = new File(this.playerDir, p_237335_1_.getStringUUID() + ".dat_old"); + Util.safeReplaceFile(file2, file1, file3); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_237335_1_, playerDir, p_237335_1_.getStringUUID()); } catch (Exception exception) { - field_237332_b_.warn("Failed to save player data for {}", (Object)p_237335_1_.func_200200_C_().getString()); + LOGGER.warn("Failed to save player data for {}", (Object)p_237335_1_.getName().getString()); } @@ -54,6 +_,7 @@ - int i = compoundnbt.func_150297_b("DataVersion", 3) ? compoundnbt.func_74762_e("DataVersion") : -1; - p_237336_1_.func_70020_e(NBTUtil.func_210822_a(this.field_237331_a_, DefaultTypeReferences.PLAYER, compoundnbt, i)); + int i = compoundnbt.contains("DataVersion", 3) ? compoundnbt.getInt("DataVersion") : -1; + p_237336_1_.load(NBTUtil.update(this.fixerUpper, DefaultTypeReferences.PLAYER, compoundnbt, i)); } -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_237336_1_, field_237333_c_, p_237336_1_.func_189512_bd()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_237336_1_, playerDir, p_237336_1_.getStringUUID()); return compoundnbt; } @@ -23,6 +23,6 @@ + } + + public File getPlayerDataFolder() { -+ return field_237333_c_; ++ return playerDir; } } diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch index af35379fe2..94f51abc9e 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch @@ -4,60 +4,60 @@ } } -- Dynamic dynamic1 = p_237259_1_.update(TypeReferences.field_233375_y_, dynamic, p_237259_2_, SharedConstants.func_215069_a().getWorldVersion()); -+ Dynamic dynamic1 = net.minecraftforge.common.ForgeHooks.fixUpDimensionsData(p_237259_1_.update(TypeReferences.field_233375_y_, dynamic, p_237259_2_, SharedConstants.func_215069_a().getWorldVersion())); - DataResult dataresult = DimensionGeneratorSettings.field_236201_a_.parse(dynamic1); - return Pair.of(dataresult.resultOrPartial(Util.func_240982_a_("WorldGenSettings: ", field_215785_a::error)).orElseGet(() -> { - Registry registry = RegistryLookupCodec.func_244331_a(Registry.field_239698_ad_).codec().parse(dynamic1).resultOrPartial(Util.func_240982_a_("Dimension type registry: ", field_215785_a::error)).orElseThrow(() -> { +- Dynamic dynamic1 = p_237259_1_.update(TypeReferences.WORLD_GEN_SETTINGS, dynamic, p_237259_2_, SharedConstants.getCurrentVersion().getWorldVersion()); ++ Dynamic dynamic1 = net.minecraftforge.common.ForgeHooks.fixUpDimensionsData(p_237259_1_.update(TypeReferences.WORLD_GEN_SETTINGS, dynamic, p_237259_2_, SharedConstants.getCurrentVersion().getWorldVersion())); + DataResult dataresult = DimensionGeneratorSettings.CODEC.parse(dynamic1); + return Pair.of(dataresult.resultOrPartial(Util.prefix("WorldGenSettings: ", LOGGER::error)).orElseGet(() -> { + Registry registry = RegistryLookupCodec.create(Registry.DIMENSION_TYPE_REGISTRY).codec().parse(dynamic1).resultOrPartial(Util.prefix("Dimension type registry: ", LOGGER::error)).orElseThrow(() -> { @@ -182,6 +_,10 @@ } - private static BiFunction func_237270_b_(DynamicOps p_237270_0_, DatapackCodec p_237270_1_) { + private static BiFunction getLevelData(DynamicOps p_237270_0_, DatapackCodec p_237270_1_) { + return getReader(p_237270_0_, p_237270_1_, null); + } + + private static BiFunction getReader(DynamicOps p_237270_0_, DatapackCodec p_237270_1_, @Nullable LevelSave levelSave) { return (p_242976_2_, p_242976_3_) -> { try { - CompoundNBT compoundnbt = CompressedStreamTools.func_244263_a(p_242976_2_); + CompoundNBT compoundnbt = CompressedStreamTools.readCompressed(p_242976_2_); @@ -193,7 +_,10 @@ - Pair pair = func_237259_a_(dynamic, p_242976_3_, i); - VersionData versiondata = VersionData.func_237324_a_(dynamic); - WorldSettings worldsettings = WorldSettings.func_234951_a_(dynamic, p_237270_1_); -- return ServerWorldInfo.func_237369_a_(dynamic, p_242976_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); -+ ServerWorldInfo info = ServerWorldInfo.func_237369_a_(dynamic, p_242976_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); + Pair pair = readWorldGenSettings(dynamic, p_242976_3_, i); + VersionData versiondata = VersionData.parse(dynamic); + WorldSettings worldsettings = WorldSettings.parse(dynamic, p_237270_1_); +- return ServerWorldInfo.parse(dynamic, p_242976_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); ++ ServerWorldInfo info = ServerWorldInfo.parse(dynamic, p_242976_3_, i, compoundnbt2, worldsettings, versiondata, pair.getFirst(), pair.getSecond()); + if (levelSave != null) + net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad(levelSave, info, compoundnbt); + return info; } catch (Exception exception) { - field_215785_a.error("Exception reading {}", p_242976_2_, exception); + LOGGER.error("Exception reading {}", p_242976_2_, exception); return null; @@ -314,7 +_,7 @@ @Nullable - public IServerConfiguration func_237284_a_(DynamicOps p_237284_1_, DatapackCodec p_237284_2_) { - this.func_237301_i_(); -- return SaveFormat.this.func_237266_a_(this.field_237279_c_.toFile(), SaveFormat.func_237270_b_(p_237284_1_, p_237284_2_)); -+ return SaveFormat.this.func_237266_a_(this.field_237279_c_.toFile(), SaveFormat.getReader(p_237284_1_, p_237284_2_, this)); + public IServerConfiguration getDataTag(DynamicOps p_237284_1_, DatapackCodec p_237284_2_) { + this.checkLock(); +- return SaveFormat.this.readLevelData(this.levelPath.toFile(), SaveFormat.getLevelData(p_237284_1_, p_237284_2_)); ++ return SaveFormat.this.readLevelData(this.levelPath.toFile(), SaveFormat.getReader(p_237284_1_, p_237284_2_, this)); } @Nullable @@ -335,6 +_,8 @@ CompoundNBT compoundnbt1 = new CompoundNBT(); - compoundnbt1.func_218657_a("Data", compoundnbt); + compoundnbt1.put("Data", compoundnbt); + net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_237288_2_, compoundnbt1); + try { File file2 = File.createTempFile("level", ".dat", file1); - CompressedStreamTools.func_244264_a(compoundnbt1, file2); + CompressedStreamTools.writeCompressed(compoundnbt1, file2); @@ -350,6 +_,10 @@ - public File func_237298_f_() { - this.func_237301_i_(); - return this.field_237279_c_.resolve("icon.png").toFile(); + public File getIconFile() { + this.checkLock(); + return this.levelPath.resolve("icon.png").toFile(); + } + + public Path getWorldDir() { -+ return field_237279_c_; ++ return levelPath; } @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch index 310c440476..568611f6a4 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch @@ -6,22 +6,22 @@ -public abstract class WorldSavedData { +public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable { - private static final Logger field_215159_a = LogManager.getLogger(); - private final String field_76190_i; - private boolean field_76189_a; + private static final Logger LOGGER = LogManager.getLogger(); + private final String id; + private boolean dirty; @@ -51,5 +_,15 @@ - this.func_76186_a(false); + this.setDirty(false); } + } + + @Override + public void deserializeNBT(CompoundNBT nbt) { -+ func_76184_a(nbt); ++ load(nbt); + } + + @Override + public CompoundNBT serializeNBT() { -+ return func_189551_b(new CompoundNBT()); ++ return save(new CompoundNBT()); } } diff --git a/settings.gradle b/settings.gradle index b2a6c189c0..7e1a2532f6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,20 @@ pluginManagement { } } +buildscript { + dependencies { + classpath('com.google.code.gson:gson') { + version { + strictly '2.10.1' + } + } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + rootProject.name = 'Forge' include ':mcp' @@ -14,3 +28,4 @@ include ':forge' project(":mcp").projectDir = file("projects/mcp") project(":clean").projectDir = file("projects/clean") project(":forge").projectDir = file("projects/forge") + diff --git a/src/main/resources/coremods/add_bouncer_method.js b/src/main/resources/coremods/add_bouncer_method.js index 5fdc228665..d28ee2dd8c 100644 --- a/src/main/resources/coremods/add_bouncer_method.js +++ b/src/main/resources/coremods/add_bouncer_method.js @@ -8,6 +8,8 @@ var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode') function initializeCoreMod() { return { "getLanguage_bouncer": addBouncer("net.minecraft.network.play.client.CClientSettingsPacket", "func_149524_c", "getLanguage", "()Ljava/lang/String;"), + "compose_bouncer": addRedirect("net.minecraft.util.math.vector.TransformationMatrix", "func_227985_a_", "composeVanilla", "(Lnet/minecraft/util/math/vector/TransformationMatrix;)Lnet/minecraft/util/math/vector/TransformationMatrix;", 2), + "inverse_bouncer": addRedirect("net.minecraft.util.math.vector.TransformationMatrix", "func_227987_b_", "inverseVanilla", "()Lnet/minecraft/util/math/vector/TransformationMatrix;", 1), } } @@ -38,6 +40,37 @@ function addBouncer(className, conflictedName, expectedName, descriptor, signatu node.methods.add(method); + return node; + } + } +} + +// Generate a method with name oldName that redirects to expectedName. oldName is remapped, expectedName isn't. +function addRedirect(className, oldName, expectedName, descriptor, numArgs) { + return { + 'target': { + 'type': 'CLASS', + 'name': className + }, + 'transformer': function(node) { + var mappedName = ASMAPI.mapMethod(oldName); + + var method = new MethodNode( + /* access = */ Opcodes.ACC_PUBLIC, + /* name = */ mappedName, + /* descriptor = */ descriptor, + /* signature = */ descriptor, + /* exceptions = */ null + ); + + for(var i = 0; i < numArgs; i++) { + method.instructions.add(new VarInsnNode(Opcodes.ALOAD, i)); + } + method.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, className.replaceAll("\\.","/"), expectedName, descriptor)); + method.instructions.add(new InsnNode(Opcodes.ARETURN)); + + node.methods.add(method); + return node; } }